This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
f0edfb76953962e2000f76e19e3d8faa3b135cf3
[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/perl5-metaconfig/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 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_accept4=''
376 d_access=''
377 d_accessx=''
378 d_acosh=''
379 d_aintl=''
380 d_alarm=''
381 asctime_r_proto=''
382 d_asctime_r=''
383 d_asinh=''
384 d_atanh=''
385 d_attribute_always_inline=''
386 d_attribute_deprecated=''
387 d_attribute_format=''
388 d_attribute_malloc=''
389 d_attribute_nonnull=''
390 d_attribute_noreturn=''
391 d_attribute_pure=''
392 d_attribute_unused=''
393 d_attribute_warn_unused_result=''
394 d_printf_format_null=''
395 d_backtrace=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_builtin_add_overflow=''
399 d_builtin_mul_overflow=''
400 d_builtin_sub_overflow=''
401 d_c99_variadic_macros=''
402 d_casti32=''
403 castflags=''
404 d_castneg=''
405 d_cbrt=''
406 d_chown=''
407 d_chroot=''
408 d_chsize=''
409 d_class=''
410 d_clearenv=''
411 d_closedir=''
412 d_void_closedir=''
413 d_cmsghdr_s=''
414 d_copysign=''
415 d_copysignl=''
416 d_cplusplus=''
417 cryptlib=''
418 d_crypt=''
419 crypt_r_proto=''
420 d_crypt_r=''
421 d_csh=''
422 full_csh=''
423 d_ctermid=''
424 ctermid_r_proto=''
425 d_ctermid_r=''
426 ctime_r_proto=''
427 d_ctime_r=''
428 d_cuserid=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_dup3=''
444 d_eaccess=''
445 d_endgrent=''
446 d_endgrent_r=''
447 endgrent_r_proto=''
448 d_endhent=''
449 d_endhostent_r=''
450 endhostent_r_proto=''
451 d_endnent=''
452 d_endnetent_r=''
453 endnetent_r_proto=''
454 d_endpent=''
455 d_endprotoent_r=''
456 endprotoent_r_proto=''
457 d_endpwent=''
458 d_endpwent_r=''
459 endpwent_r_proto=''
460 d_endsent=''
461 d_endservent_r=''
462 endservent_r_proto=''
463 d_erf=''
464 d_erfc=''
465 d_exp2=''
466 d_expm1=''
467 d_faststdio=''
468 d_fchdir=''
469 d_fchmod=''
470 d_fchown=''
471 d_fcntl=''
472 d_fcntl_can_lock=''
473 d_fd_macros=''
474 d_fd_set=''
475 d_fds_bits=''
476 d_fdclose=''
477 d_fdim=''
478 d_fegetround=''
479 d_fgetpos=''
480 d_finite=''
481 d_finitel=''
482 d_flexfnam=''
483 d_flock=''
484 d_flockproto=''
485 d_fma=''
486 d_fmax=''
487 d_fmin=''
488 d_fork=''
489 d_fp_class=''
490 d_fp_classl=''
491 d_fpclass=''
492 d_fp_classify=''
493 d_fpclassify=''
494 d_fpclassl=''
495 d_fpgetround=''
496 d_fpos64_t=''
497 d_frexpl=''
498 d_fs_data_s=''
499 d_fchmodat=''
500 d_linkat=''
501 d_openat=''
502 d_renameat=''
503 d_unlinkat=''
504 d_fseeko=''
505 d_fsetpos=''
506 d_fstatfs=''
507 d_fsync=''
508 d_ftello=''
509 d_ftime=''
510 d_gettimeod=''
511 d_futimes=''
512 d_gai_strerror=''
513 d_Gconvert=''
514 d_getaddrinfo=''
515 d_getcwd=''
516 d_getespwnam=''
517 d_getfsstat=''
518 d_getgrent=''
519 d_getgrent_r=''
520 getgrent_r_proto=''
521 d_getgrgid_r=''
522 getgrgid_r_proto=''
523 d_getgrnam_r=''
524 getgrnam_r_proto=''
525 d_getgrps=''
526 d_gethbyaddr=''
527 d_gethbyname=''
528 d_gethent=''
529 aphostname=''
530 d_gethname=''
531 d_phostname=''
532 d_uname=''
533 d_gethostbyaddr_r=''
534 gethostbyaddr_r_proto=''
535 d_gethostbyname_r=''
536 gethostbyname_r_proto=''
537 d_gethostent_r=''
538 gethostent_r_proto=''
539 d_gethostprotos=''
540 d_getitimer=''
541 d_getlogin=''
542 d_getlogin_r=''
543 getlogin_r_proto=''
544 d_getmnt=''
545 d_getmntent=''
546 d_getnameinfo=''
547 d_getnbyaddr=''
548 d_getnbyname=''
549 d_getnent=''
550 d_getnetbyaddr_r=''
551 getnetbyaddr_r_proto=''
552 d_getnetbyname_r=''
553 getnetbyname_r_proto=''
554 d_getnetent_r=''
555 getnetent_r_proto=''
556 d_getnetprotos=''
557 d_getpagsz=''
558 d_getpent=''
559 d_getpgid=''
560 d_getpgrp2=''
561 d_bsdgetpgrp=''
562 d_getpgrp=''
563 d_getppid=''
564 d_getprior=''
565 d_getpbyname=''
566 d_getpbynumber=''
567 d_getprotobyname_r=''
568 getprotobyname_r_proto=''
569 d_getprotobynumber_r=''
570 getprotobynumber_r_proto=''
571 d_getprotoent_r=''
572 getprotoent_r_proto=''
573 d_getprotoprotos=''
574 d_getprpwnam=''
575 d_getpwent=''
576 d_getpwent_r=''
577 getpwent_r_proto=''
578 d_getpwnam_r=''
579 getpwnam_r_proto=''
580 d_getpwuid_r=''
581 getpwuid_r_proto=''
582 d_getsent=''
583 d_getservbyname_r=''
584 getservbyname_r_proto=''
585 d_getservbyport_r=''
586 getservbyport_r_proto=''
587 d_getservent_r=''
588 getservent_r_proto=''
589 d_getservprotos=''
590 d_getspnam=''
591 d_getspnam_r=''
592 getspnam_r_proto=''
593 d_getsbyname=''
594 d_getsbyport=''
595 d_gmtime_r=''
596 gmtime_r_proto=''
597 d_gnulibc=''
598 gnulibc_version=''
599 d_hasmntopt=''
600 d_htonl=''
601 d_hypot=''
602 d_ilogb=''
603 d_ilogbl=''
604 d_inetaton=''
605 d_inetntop=''
606 d_inetpton=''
607 d_int64_t=''
608 d_isascii=''
609 d_isblank=''
610 d_isfinite=''
611 d_isfinitel=''
612 d_isinf=''
613 d_isinfl=''
614 d_isless=''
615 d_isnan=''
616 d_isnanl=''
617 d_isnormal=''
618 d_j0=''
619 d_j0l=''
620 d_killpg=''
621 d_lc_monetary_2008=''
622 d_lchown=''
623 d_ldbl_dig=''
624 d_lgamma=''
625 d_lgamma_r=''
626 d_libm_lib_version=''
627 d_link=''
628 d_llrint=''
629 d_llrintl=''
630 d_llround=''
631 d_llroundl=''
632 d_localeconv_l=''
633 d_localtime_r=''
634 d_localtime_r_needs_tzset=''
635 localtime_r_proto=''
636 d_locconv=''
637 d_lockf=''
638 d_log1p=''
639 d_log2=''
640 d_logb=''
641 d_ldexpl=''
642 d_long_double_style_ieee=''
643 d_long_double_style_ieee_doubledouble=''
644 d_long_double_style_ieee_extended=''
645 d_long_double_style_ieee_std=''
646 d_long_double_style_vax=''
647 d_longdbl=''
648 longdblkind=''
649 longdblsize=''
650 d_longlong=''
651 longlongsize=''
652 d_lrint=''
653 d_lrintl=''
654 d_lround=''
655 d_lroundl=''
656 d_lseekproto=''
657 d_lstat=''
658 d_madvise=''
659 d_malloc_good_size=''
660 d_malloc_size=''
661 d_malloc_usable_size=''
662 d_mblen=''
663 d_mbrlen=''
664 d_mbrtowc=''
665 d_mbstowcs=''
666 d_mbtowc=''
667 d_memmem=''
668 d_memrchr=''
669 d_mkdir=''
670 d_mkdtemp=''
671 d_mkfifo=''
672 d_mkostemp=''
673 d_mkstemp=''
674 d_mkstemps=''
675 d_mktime=''
676 d_mmap=''
677 mmaptype=''
678 d_modfl=''
679 d_modflproto=''
680 d_mprotect=''
681 d_msg=''
682 d_msgctl=''
683 d_msgget=''
684 d_msghdr_s=''
685 d_msgrcv=''
686 d_msgsnd=''
687 d_msync=''
688 d_munmap=''
689 d_nan=''
690 d_nanosleep=''
691 d_nearbyint=''
692 d_duplocale=''
693 d_freelocale=''
694 d_newlocale=''
695 d_querylocale=''
696 d_uselocale=''
697 i_xlocale=''
698 d_nextafter=''
699 d_nexttoward=''
700 d_nice=''
701 d_nl_langinfo=''
702 d_thread_safe_nl_langinfo_l=''
703 d_off64_t=''
704 d_open3=''
705 d_fpathconf=''
706 d_pathconf=''
707 d_pause=''
708 d_pipe2=''
709 d_pipe=''
710 d_poll=''
711 d_portable=''
712 d_prctl=''
713 d_prctl_set_name=''
714 d_procselfexe=''
715 procselfexe=''
716 d_old_pthread_create_joinable=''
717 old_pthread_create_joinable=''
718 d_pthread_atfork=''
719 d_pthread_attr_setscope=''
720 d_pthread_yield=''
721 d_sched_yield=''
722 sched_yield=''
723 d_ptrdiff_t=''
724 d_qgcvt=''
725 d_random_r=''
726 random_r_proto=''
727 d_readdir64_r=''
728 readdir64_r_proto=''
729 d_readdir=''
730 d_rewinddir=''
731 d_seekdir=''
732 d_telldir=''
733 d_readdir_r=''
734 readdir_r_proto=''
735 d_readlink=''
736 d_readv=''
737 d_recvmsg=''
738 d_re_comp=''
739 d_regcmp=''
740 d_regcomp=''
741 d_remainder=''
742 d_remquo=''
743 d_rename=''
744 d_rint=''
745 d_rmdir=''
746 d_round=''
747 d_sbrkproto=''
748 d_scalbn=''
749 d_scalbnl=''
750 d_select=''
751 d_sem=''
752 d_semctl=''
753 d_semget=''
754 d_semop=''
755 d_sendmsg=''
756 d_setegid=''
757 d_seteuid=''
758 d_setgrent=''
759 d_setgrent_r=''
760 setgrent_r_proto=''
761 d_setgrps=''
762 d_sethent=''
763 d_sethostent_r=''
764 sethostent_r_proto=''
765 d_setitimer=''
766 d_setlinebuf=''
767 d_has_C_UTF8=''
768 d_setlocale=''
769 d_setlocale_accepts_any_locale_name=''
770 d_setlocale_r=''
771 setlocale_r_proto=''
772 d_setnent=''
773 d_setnetent_r=''
774 setnetent_r_proto=''
775 d_setpent=''
776 d_setpgid=''
777 d_setpgrp2=''
778 d_bsdsetpgrp=''
779 d_setpgrp=''
780 d_setprior=''
781 d_setproctitle=''
782 d_setprotoent_r=''
783 setprotoent_r_proto=''
784 d_setpwent=''
785 d_setpwent_r=''
786 setpwent_r_proto=''
787 d_setregid=''
788 d_setresgid=''
789 d_setresuid=''
790 d_setreuid=''
791 d_setrgid=''
792 d_setruid=''
793 d_setsent=''
794 d_setservent_r=''
795 setservent_r_proto=''
796 d_setsid=''
797 d_setvbuf=''
798 d_shm=''
799 d_shmat=''
800 d_shmatprototype=''
801 shmattype=''
802 d_shmctl=''
803 d_shmdt=''
804 d_shmget=''
805 d_sigaction=''
806 d_siginfo_si_addr=''
807 d_siginfo_si_band=''
808 d_siginfo_si_errno=''
809 d_siginfo_si_fd=''
810 d_siginfo_si_pid=''
811 d_siginfo_si_status=''
812 d_siginfo_si_uid=''
813 d_siginfo_si_value=''
814 d_signbit=''
815 d_sigprocmask=''
816 d_sigsetjmp=''
817 usesitecustomize=''
818 d_snprintf=''
819 d_vsnprintf=''
820 d_sockatmark=''
821 d_sockatmarkproto=''
822 d_ip_mreq=''
823 d_ip_mreq_source=''
824 d_ipv6_mreq=''
825 d_ipv6_mreq_source=''
826 d_msg_ctrunc=''
827 d_msg_dontroute=''
828 d_msg_oob=''
829 d_msg_peek=''
830 d_msg_proxy=''
831 d_oldsock=''
832 d_scm_rights=''
833 d_sin6_scope_id=''
834 d_sockaddr_in6=''
835 d_sockaddr_sa_len=''
836 d_sockaddr_storage=''
837 d_socket=''
838 d_sockpair=''
839 sockethdr=''
840 socketlib=''
841 d_socklen_t=''
842 d_socks5_init=''
843 d_sqrtl=''
844 d_srand48_r=''
845 srand48_r_proto=''
846 d_srandom_r=''
847 srandom_r_proto=''
848 d_sresgproto=''
849 d_sresuproto=''
850 d_stat=''
851 d_statblks=''
852 d_statfs_f_flags=''
853 d_statfs_s=''
854 d_static_inline=''
855 perl_static_inline=''
856 d_fstatvfs=''
857 d_statvfs=''
858 d_stdio_cnt_lval=''
859 d_stdio_ptr_lval=''
860 d_stdio_ptr_lval_nochange_cnt=''
861 d_stdio_ptr_lval_sets_cnt=''
862 d_stdiobase=''
863 d_stdstdio=''
864 stdio_base=''
865 stdio_bufsiz=''
866 stdio_cnt=''
867 stdio_filbuf=''
868 stdio_ptr=''
869 d_strcoll=''
870 d_sysernlst=''
871 d_syserrlst=''
872 d_strerror_l=''
873 d_strerror_r=''
874 strerror_r_proto=''
875 d_strftime=''
876 d_strlcat=''
877 d_strlcpy=''
878 d_strnlen=''
879 d_strtod=''
880 d_strtod_l=''
881 d_strtol=''
882 d_strtold=''
883 d_strtold_l=''
884 d_strtoll=''
885 d_strtoq=''
886 d_strtoul=''
887 d_strtoull=''
888 d_strtouq=''
889 d_strxfrm=''
890 d_symlink=''
891 d_syscall=''
892 d_syscallproto=''
893 d_sysconf=''
894 d_system=''
895 d_tcgetpgrp=''
896 d_tcsetpgrp=''
897 d_telldirproto=''
898 d_tgamma=''
899 d_time=''
900 timetype=''
901 d_asctime64=''
902 d_ctime64=''
903 d_difftime64=''
904 d_gmtime64=''
905 d_localtime64=''
906 d_mktime64=''
907 d_timegm=''
908 clocktype=''
909 d_times=''
910 d_tmpnam_r=''
911 tmpnam_r_proto=''
912 d_towlower=''
913 d_towupper=''
914 d_trunc=''
915 d_truncate=''
916 d_truncl=''
917 d_ttyname_r=''
918 ttyname_r_proto=''
919 d_tzname=''
920 d_u32align=''
921 d_ualarm=''
922 d_umask=''
923 d_semctl_semid_ds=''
924 d_semctl_semun=''
925 d_union_semun=''
926 d_unordered=''
927 d_unsetenv=''
928 d_usleep=''
929 d_usleepproto=''
930 d_ustat=''
931 d_pseudofork=''
932 d_vfork=''
933 usevfork=''
934 d_voidsig=''
935 signal_t=''
936 d_wait4=''
937 d_waitpid=''
938 d_wcrtomb=''
939 d_wcscmp=''
940 d_wcstombs=''
941 d_wcsxfrm=''
942 d_wctomb=''
943 d_writev=''
944 default_inc_excludes_dot=''
945 dlext=''
946 bin_ELF=''
947 cccdlflags=''
948 ccdlflags=''
949 dlsrc=''
950 ld=''
951 ld_can_script=''
952 lddlflags=''
953 usedl=''
954 doublesize=''
955 dtraceobject=''
956 dtracexnolibs=''
957 ebcdic=''
958 fflushNULL=''
959 fflushall=''
960 fpossize=''
961 fpostype=''
962 gccansipedantic=''
963 gccosandvers=''
964 gccversion=''
965 gidformat=''
966 gidsign=''
967 gidsize=''
968 gidtype=''
969 groupstype=''
970 h_fcntl=''
971 h_sysfile=''
972 html1dir=''
973 html1direxp=''
974 installhtml1dir=''
975 html3dir=''
976 html3direxp=''
977 installhtml3dir=''
978 i_arpainet=''
979 i_bfd=''
980 i_crypt=''
981 db_hashtype=''
982 db_prefixtype=''
983 db_version_major=''
984 db_version_minor=''
985 db_version_patch=''
986 i_db=''
987 i_dbm=''
988 i_rpcsvcdbm=''
989 d_dirnamlen=''
990 direntrytype=''
991 i_dirent=''
992 i_dlfcn=''
993 i_execinfo=''
994 i_fcntl=''
995 i_fenv=''
996 i_fp=''
997 i_fp_class=''
998 i_gdbm=''
999 d_grpasswd=''
1000 i_grp=''
1001 i_ieeefp=''
1002 i_inttypes=''
1003 i_langinfo=''
1004 i_libutil=''
1005 i_locale=''
1006 i_machcthr=''
1007 i_malloc=''
1008 i_mallocmalloc=''
1009 i_mntent=''
1010 d_gdbm_ndbm_h_uses_prototypes=''
1011 d_gdbmndbm_h_uses_prototypes=''
1012 d_ndbm=''
1013 d_ndbm_h_uses_prototypes=''
1014 i_gdbm_ndbm=''
1015 i_gdbmndbm=''
1016 i_ndbm=''
1017 i_netdb=''
1018 i_neterrno=''
1019 i_netinettcp=''
1020 i_niin=''
1021 i_sysin=''
1022 i_poll=''
1023 i_prot=''
1024 i_pthread=''
1025 d_pwage=''
1026 d_pwchange=''
1027 d_pwclass=''
1028 d_pwcomment=''
1029 d_pwexpire=''
1030 d_pwgecos=''
1031 d_pwpasswd=''
1032 d_pwquota=''
1033 i_pwd=''
1034 i_quadmath=''
1035 i_shadow=''
1036 i_socks=''
1037 i_stdbool=''
1038 i_stdint=''
1039 i_stdlib=''
1040 i_sunmath=''
1041 i_sysaccess=''
1042 i_sysdir=''
1043 i_sysfile=''
1044 d_voidtty=''
1045 i_bsdioctl=''
1046 i_sysfilio=''
1047 i_sysioctl=''
1048 i_syssockio=''
1049 i_syslog=''
1050 i_sysmman=''
1051 i_sysmode=''
1052 i_sysmount=''
1053 i_sysndir=''
1054 i_sysparam=''
1055 i_syspoll=''
1056 i_sysresrc=''
1057 i_syssecrt=''
1058 i_sysselct=''
1059 i_sysstat=''
1060 i_sysstatfs=''
1061 i_sysstatvfs=''
1062 i_systimes=''
1063 i_systypes=''
1064 i_sysuio=''
1065 i_sysun=''
1066 i_sysutsname=''
1067 i_sysvfs=''
1068 i_syswait=''
1069 i_sgtty=''
1070 i_termio=''
1071 i_termios=''
1072 d_tm_tm_gmtoff=''
1073 d_tm_tm_zone=''
1074 i_systime=''
1075 i_systimek=''
1076 i_time=''
1077 timeincl=''
1078 i_unistd=''
1079 i_ustat=''
1080 i_utime=''
1081 i_vfork=''
1082 i_wchar=''
1083 i_wctype=''
1084 d_inc_version_list=''
1085 inc_version_list=''
1086 inc_version_list_init=''
1087 doubleinfbytes=''
1088 doublenanbytes=''
1089 longdblinfbytes=''
1090 longdblnanbytes=''
1091 installprefix=''
1092 installprefixexp=''
1093 installstyle=''
1094 installusrbinperl=''
1095 intsize=''
1096 longsize=''
1097 shortsize=''
1098 issymlink=''
1099 libc=''
1100 ldlibpthname=''
1101 libperl=''
1102 shrpenv=''
1103 useshrplib=''
1104 glibpth=''
1105 incpth=''
1106 libpth=''
1107 loclibpth=''
1108 plibpth=''
1109 xlibpth=''
1110 ignore_versioned_solibs=''
1111 libs=''
1112 libsdirs=''
1113 libsfiles=''
1114 libsfound=''
1115 libspath=''
1116 lns=''
1117 d_PRIEUldbl=''
1118 d_PRIFUldbl=''
1119 d_PRIGUldbl=''
1120 d_PRIeldbl=''
1121 d_PRIfldbl=''
1122 d_PRIgldbl=''
1123 d_SCNfldbl=''
1124 d_double_has_inf=''
1125 d_double_has_nan=''
1126 d_double_has_negative_zero=''
1127 d_double_has_subnormals=''
1128 d_double_style_cray=''
1129 d_double_style_ibm=''
1130 d_double_style_ieee=''
1131 d_double_style_vax=''
1132 doublekind=''
1133 sPRIEUldbl=''
1134 sPRIFUldbl=''
1135 sPRIGUldbl=''
1136 sPRIeldbl=''
1137 sPRIfldbl=''
1138 sPRIgldbl=''
1139 sSCNfldbl=''
1140 lseeksize=''
1141 lseektype=''
1142 make_set_make=''
1143 d_mymalloc=''
1144 freetype=''
1145 mallocobj=''
1146 mallocsrc=''
1147 malloctype=''
1148 usemallocwrap=''
1149 usemymalloc=''
1150 installman1dir=''
1151 man1dir=''
1152 man1direxp=''
1153 man1ext=''
1154 installman3dir=''
1155 man3dir=''
1156 man3direxp=''
1157 man3ext=''
1158 doublemantbits=''
1159 longdblmantbits=''
1160 nvmantbits=''
1161 modetype=''
1162 multiarch=''
1163 mydomain=''
1164 myhostname=''
1165 phostname=''
1166 c=''
1167 n=''
1168 d_eofnblk=''
1169 eagain=''
1170 o_nonblock=''
1171 rd_nodata=''
1172 need_va_copy=''
1173 netdb_hlen_type=''
1174 netdb_host_type=''
1175 netdb_name_type=''
1176 netdb_net_type=''
1177 groupcat=''
1178 hostcat=''
1179 passcat=''
1180 orderlib=''
1181 ranlib=''
1182 d_perl_otherlibdirs=''
1183 otherlibdirs=''
1184 package=''
1185 spackage=''
1186 pager=''
1187 api_revision=''
1188 api_subversion=''
1189 api_version=''
1190 api_versionstring=''
1191 patchlevel=''
1192 perl_patchlevel=''
1193 revision=''
1194 subversion=''
1195 version=''
1196 version_patchlevel_string=''
1197 perl5=''
1198 perladmin=''
1199 perlpath=''
1200 d_nv_preserves_uv=''
1201 d_nv_zero_is_allbits_zero=''
1202 i16size=''
1203 i16type=''
1204 i32size=''
1205 i32type=''
1206 i64size=''
1207 i64type=''
1208 i8size=''
1209 i8type=''
1210 ivsize=''
1211 ivtype=''
1212 nv_overflows_integers_at=''
1213 nv_preserves_uv_bits=''
1214 nvsize=''
1215 nvtype=''
1216 u16size=''
1217 u16type=''
1218 u32size=''
1219 u32type=''
1220 u64size=''
1221 u64type=''
1222 u8size=''
1223 u8type=''
1224 uvsize=''
1225 uvtype=''
1226 ivdformat=''
1227 nvEUformat=''
1228 nvFUformat=''
1229 nvGUformat=''
1230 nveformat=''
1231 nvfformat=''
1232 nvgformat=''
1233 uvXUformat=''
1234 uvoformat=''
1235 uvuformat=''
1236 uvxformat=''
1237 pidtype=''
1238 prefix=''
1239 prefixexp=''
1240 installprivlib=''
1241 privlib=''
1242 privlibexp=''
1243 ptrsize=''
1244 d_PRIXU64=''
1245 d_PRId64=''
1246 d_PRIi64=''
1247 d_PRIo64=''
1248 d_PRIu64=''
1249 d_PRIx64=''
1250 sPRIXU64=''
1251 sPRId64=''
1252 sPRIi64=''
1253 sPRIo64=''
1254 sPRIu64=''
1255 sPRIx64=''
1256 d_quad=''
1257 quadkind=''
1258 quadtype=''
1259 uquadtype=''
1260 drand01=''
1261 randbits=''
1262 randfunc=''
1263 randseedtype=''
1264 seedfunc=''
1265 installscript=''
1266 scriptdir=''
1267 scriptdirexp=''
1268 selectminbits=''
1269 selecttype=''
1270 sh=''
1271 targetsh=''
1272 sig_count=''
1273 sig_name=''
1274 sig_name_init=''
1275 sig_num=''
1276 sig_num_init=''
1277 sig_size=''
1278 d_sitearch=''
1279 installsitearch=''
1280 sitearch=''
1281 sitearchexp=''
1282 installsitebin=''
1283 sitebin=''
1284 sitebinexp=''
1285 installsitehtml1dir=''
1286 sitehtml1dir=''
1287 sitehtml1direxp=''
1288 installsitehtml3dir=''
1289 sitehtml3dir=''
1290 sitehtml3direxp=''
1291 installsitelib=''
1292 sitelib=''
1293 sitelib_stem=''
1294 sitelibexp=''
1295 installsiteman1dir=''
1296 siteman1dir=''
1297 siteman1direxp=''
1298 installsiteman3dir=''
1299 siteman3dir=''
1300 siteman3direxp=''
1301 siteprefix=''
1302 siteprefixexp=''
1303 installsitescript=''
1304 sitescript=''
1305 sitescriptexp=''
1306 sizesize=''
1307 sizetype=''
1308 d_libname_unique=''
1309 so=''
1310 socksizetype=''
1311 sharpbang=''
1312 shsharp=''
1313 spitshell=''
1314 src=''
1315 ssizetype=''
1316 st_ino_sign=''
1317 st_ino_size=''
1318 startperl=''
1319 startsh=''
1320 stdchar=''
1321 d_stdio_stream_array=''
1322 stdio_stream_array=''
1323 sysman=''
1324 sGMTIME_max=''
1325 sGMTIME_min=''
1326 sLOCALTIME_max=''
1327 sLOCALTIME_min=''
1328 trnl=''
1329 uidformat=''
1330 uidsign=''
1331 uidsize=''
1332 uidtype=''
1333 archname64=''
1334 use64bitall=''
1335 use64bitint=''
1336 usecbacktrace=''
1337 dtrace=''
1338 usedtrace=''
1339 usefaststdio=''
1340 usekernprocpathname=''
1341 ccflags_uselargefiles=''
1342 ldflags_uselargefiles=''
1343 libswanted_uselargefiles=''
1344 uselargefiles=''
1345 uselongdouble=''
1346 usemorebits=''
1347 usemultiplicity=''
1348 nm_opt=''
1349 nm_so_opt=''
1350 runnm=''
1351 usenm=''
1352 usensgetexecutablepath=''
1353 useperlio=''
1354 usequadmath=''
1355 usesocks=''
1356 d_oldpthreads=''
1357 use5005threads=''
1358 useithreads=''
1359 usereentrant=''
1360 usethreads=''
1361 incpath=''
1362 mips_type=''
1363 usrinc=''
1364 d_vendorarch=''
1365 installvendorarch=''
1366 vendorarch=''
1367 vendorarchexp=''
1368 d_vendorbin=''
1369 installvendorbin=''
1370 vendorbin=''
1371 vendorbinexp=''
1372 installvendorhtml1dir=''
1373 vendorhtml1dir=''
1374 vendorhtml1direxp=''
1375 installvendorhtml3dir=''
1376 vendorhtml3dir=''
1377 vendorhtml3direxp=''
1378 d_vendorlib=''
1379 installvendorlib=''
1380 vendorlib=''
1381 vendorlib_stem=''
1382 vendorlibexp=''
1383 installvendorman1dir=''
1384 vendorman1dir=''
1385 vendorman1direxp=''
1386 installvendorman3dir=''
1387 vendorman3dir=''
1388 vendorman3direxp=''
1389 usevendorprefix=''
1390 vendorprefix=''
1391 vendorprefixexp=''
1392 d_vendorscript=''
1393 installvendorscript=''
1394 vendorscript=''
1395 vendorscriptexp=''
1396 versiononly=''
1397 yacc=''
1398 yaccflags=''
1399 CONFIG=''
1400
1401 : Detect odd OSs
1402 define='define'
1403 undef='undef'
1404 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1405 rmlist=''
1406
1407 : We must find out about Eunice early
1408 eunicefix=':'
1409 if test -f /etc/unixtovms; then
1410         eunicefix=/etc/unixtovms
1411 fi
1412 if test -f /etc/unixtovms.exe; then
1413         eunicefix=/etc/unixtovms.exe
1414 fi
1415
1416 : Set executable suffix now -- needed before hints available
1417 if test -f "/libs/version.library"; then
1418 : Amiga OS
1419     _exe=""
1420 elif test -f "/system/gnu_library/bin/ar.pm"; then
1421 : Stratus VOS
1422     _exe=".pm"
1423 elif test -n "$DJGPP"; then
1424 : DOS DJGPP
1425     _exe=".exe"
1426 elif test -f /kern/cookiejar; then
1427 : MiNT
1428     _exe=""
1429 elif test -d c:/. -o -n "$is_os2" ; then
1430 : OS/2 or cygwin
1431     _exe=".exe"
1432 fi
1433
1434 groupstype=''
1435 i_whoami=''
1436 : Possible local include directories to search.
1437 : Set locincpth to "" in a hint file to defeat local include searches.
1438 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1439 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1440 :
1441 : no include file wanted by default
1442 inclwanted=''
1443
1444 : Enable -DEBUGGING and -DDEBUGGING from the command line
1445 EBUGGING=''
1446 DEBUGGING=''
1447
1448 : Trailing extension.  Override this in a hint file, if needed.
1449 : Extra object files, if any, needed on this platform.
1450 archobjs=''
1451 libnames=''
1452 : change the next line if compiling for Xenix/286 on Xenix/386
1453 xlibpth='/usr/lib/386 /lib/386'
1454 : Possible local library directories to search.
1455 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1456 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1457
1458 : general looking path for locating libraries
1459 glibpth="/lib /usr/lib $xlibpth"
1460 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1461 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1462 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1463 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1464
1465 : Private path used by Configure to find libraries.  Its value
1466 : is prepended to libpth. This variable takes care of special
1467 : machines, like the mips.  Usually, it should be empty.
1468 plibpth=''
1469
1470 : default library list
1471 libswanted=''
1472 : some systems want to use only the non-versioned libso:s
1473 ignore_versioned_solibs=''
1474 ccname=''
1475 ccversion=''
1476 perllibs=''
1477 : set useposix=false in your hint file to disable the POSIX extension.
1478 useposix=true
1479 : set useopcode=false in your hint file to disable the Opcode extension.
1480 useopcode=true
1481 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1482 uselanginfo=true
1483 archname64=''
1484 ccflags_uselargefiles=''
1485 ldflags_uselargefiles=''
1486 libswanted_uselargefiles=''
1487 : set usemultiplicity on the Configure command line to enable multiplicity.
1488 : set usesocks on the Configure command line to enable socks.
1489 archname=''
1490 : set usethreads on the Configure command line to enable threads.
1491 usereentrant='undef'
1492 : List of libraries we want.
1493 : If anyone needs extra -lxxx, put those in a hint file.
1494 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1495 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1496 : We probably want to search /usr/shlib before most other libraries.
1497 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1498 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1499 glibpth="/usr/shlib $glibpth"
1500 : Do not use vfork unless overridden by a hint file.
1501 usevfork=false
1502
1503 : Find the basic shell for Bourne shell scripts
1504 case "$sh" in
1505 '')
1506         case "$SYSTYPE" in
1507         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1508         *) xxx='/bin/sh';;
1509         esac
1510         if test -f "$xxx"; then
1511                 sh="$xxx"
1512         else
1513                 : Build up a list and do a single loop so we can 'break' out.
1514                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1515                 for xxx in sh bash ksh pdksh ash; do
1516                         for p in $pth; do
1517                                 try="$try ${p}/${xxx}"
1518                         done
1519                 done
1520                 for xxx in $try; do
1521                         if test -f "$xxx"; then
1522                                 sh="$xxx";
1523                                 break
1524                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1525                                 sh="$xxx";
1526                                 break
1527                         elif test -f "$xxx.exe"; then
1528                                 sh="$xxx";
1529                                 break
1530                         fi
1531                 done
1532         fi
1533         ;;
1534 esac
1535
1536 case "$sh" in
1537 '')     cat >&2 <<EOM
1538 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1539
1540 Usually it's in /bin/sh.  How did you even get this far?
1541 Please report this issue at https://github.com/Perl/perl5/issues
1542 and we'll try to straighten this all out.
1543 EOM
1544         exit 1
1545         ;;
1546 esac
1547
1548 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1549 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1550 targetsh=$sh
1551
1552 : see if sh knows # comments
1553 if `$sh -c '#' >/dev/null 2>&1`; then
1554         shsharp=true
1555         spitshell=cat
1556         xcat=/bin/cat
1557         test -f $xcat$_exe || xcat=/usr/bin/cat
1558         if test ! -f $xcat$_exe; then
1559                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1560                         if test -f $p/cat$_exe; then
1561                                 xcat=$p/cat
1562                                 break
1563                         fi
1564                 done
1565                 if test ! -f $xcat$_exe; then
1566                         echo "Can't find cat anywhere!"
1567                         exit 1
1568                 fi
1569         fi
1570         echo "#!$xcat" >sharp
1571         $eunicefix sharp
1572         chmod +x sharp
1573         ./sharp > today 2>/dev/null
1574         if test -s today; then
1575                 sharpbang='#!'
1576         else
1577                 echo "#! $xcat" > sharp
1578                 $eunicefix sharp
1579                 chmod +x sharp
1580                 ./sharp > today 2>/dev/null
1581                 if test -s today; then
1582                         sharpbang='#! '
1583                 else
1584                         sharpbang=': use '
1585                 fi
1586         fi
1587 else
1588         echo " "
1589         echo "Your $sh doesn't grok # comments--I will strip them later on."
1590         shsharp=false
1591         cd ..
1592         echo "exec grep -v '^[  ]*#'" >spitshell
1593         chmod +x spitshell
1594         $eunicefix spitshell
1595         spitshell=`pwd`/spitshell
1596         cd UU
1597         echo "I presume that if # doesn't work, #! won't work either!"
1598         sharpbang=': use '
1599 fi
1600 rm -f sharp today
1601
1602 : figure out how to guarantee sh startup
1603 case "$startsh" in
1604 '') startsh=${sharpbang}${sh} ;;
1605 *)
1606 esac
1607 cat >sharp <<EOSS
1608 $startsh
1609 set abc
1610 test "$?abc" != 1
1611 EOSS
1612
1613 chmod +x sharp
1614 $eunicefix sharp
1615 if ./sharp; then
1616         : echo "Yup, it does."
1617 else
1618         echo "Hmm... '$startsh' does not guarantee sh startup..."
1619         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1620 fi
1621 rm -f sharp
1622
1623 : Save command line options in file UU/cmdline.opt for later use in
1624 : generating config.sh.
1625 cat > cmdline.opt <<EOSH
1626 : Configure command line arguments.
1627 config_arg0='$0'
1628 config_args='$*'
1629 config_argc=$#
1630 EOSH
1631 argn=1
1632 args_exp=''
1633 args_sep=''
1634 for arg in "$@"; do
1635         cat >>cmdline.opt <<EOSH
1636 config_arg$argn='$arg'
1637 EOSH
1638         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1639 $arg
1640 EOC
1641         arg_exp=`cat cmdl.opt`
1642         args_exp="$args_exp$args_sep'$arg_exp'"
1643         argn=`expr $argn + 1`
1644         args_sep=' '
1645 done
1646 rm -f cmdl.opt
1647
1648 : produce awk script to parse command line options
1649 cat >options.awk <<'EOF'
1650 BEGIN {
1651         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1652
1653         len = length(optstr);
1654         for (i = 1; i <= len; i++) {
1655                 c = substr(optstr, i, 1);
1656                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1657                 if (a == ":") {
1658                         arg[c] = 1;
1659                         i++;
1660                 }
1661                 opt[c] = 1;
1662         }
1663 }
1664 {
1665         expect = 0;
1666         str = $0;
1667         if (substr(str, 1, 1) != "-") {
1668                 printf("'%s'\n", str);
1669                 next;
1670         }
1671         len = length($0);
1672         for (i = 2; i <= len; i++) {
1673                 c = substr(str, i, 1);
1674                 if (!opt[c]) {
1675                         printf("-%s\n", substr(str, i));
1676                         next;
1677                 }
1678                 printf("-%s\n", c);
1679                 if (arg[c]) {
1680                         if (i < len)
1681                                 printf("'%s'\n", substr(str, i + 1));
1682                         else
1683                                 expect = 1;
1684                         next;
1685                 }
1686         }
1687 }
1688 END {
1689         if (expect)
1690                 print "?";
1691 }
1692 EOF
1693
1694 : process the command line options
1695 set X `for arg in "$@"; do echo "X$arg"; done |
1696         sed -e s/X// | awk -f options.awk`
1697 eval "set $*"
1698 shift
1699 rm -f options.awk
1700
1701 : set up default values
1702 fastread=''
1703 reuseval=false
1704 config_sh=''
1705 alldone=''
1706 error=''
1707 silent=''
1708 extractsh=''
1709 knowitall=''
1710 rm -f optdef.sh posthint.sh
1711 cat >optdef.sh <<EOS
1712 $startsh
1713 EOS
1714
1715
1716 : option parsing
1717 while test $# -gt 0; do
1718         case "$1" in
1719         -d) shift; fastread=yes;;
1720         -e) shift; alldone=cont;;
1721         -f)
1722                 shift
1723                 cd ..
1724                 if test -r "$1"; then
1725                         config_sh="$1"
1726                 else
1727                         echo "$me: cannot read config file $1." >&2
1728                         error=true
1729                 fi
1730                 cd UU
1731                 shift;;
1732         --help|\
1733         -h) shift; error=true;;
1734         -r) shift; reuseval=true;;
1735         -s) shift; silent=true; realsilent=true;;
1736         -E) shift; alldone=exit;;
1737         -K) shift; knowitall=true;;
1738         -O) shift;;
1739         -S) shift; silent=true; extractsh=true;;
1740         -D)
1741                 shift
1742                 case "$1" in
1743                 *=)
1744                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1745                         echo "$me: ignoring -D $1" >&2
1746                         ;;
1747                 *=*) echo "$1" | \
1748                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1749                 *) echo "$1='define'" >> optdef.sh;;
1750                 esac
1751                 shift
1752                 ;;
1753         -U)
1754                 shift
1755                 case "$1" in
1756                 *=) echo "$1" >> optdef.sh;;
1757                 *=*)
1758                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1759                         echo "$me: ignoring -U $1" >&2
1760                         ;;
1761                 *) echo "$1='undef'" >> optdef.sh;;
1762                 esac
1763                 shift
1764                 ;;
1765         -A)
1766             shift
1767             xxx=''
1768             yyy="$1"
1769             zzz=''
1770             uuu=undef
1771             case "$yyy" in
1772             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1773                  case "$zzz" in
1774                  *:*) zzz='' ;;
1775                  *)   xxx=append
1776                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                  esac
1779                  ;;
1780             esac
1781             case "$xxx" in
1782             '')  case "$yyy" in
1783                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1784                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1785                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1786                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1787                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1788                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1789                  esac
1790                  ;;
1791             esac
1792             case "$xxx" in
1793             append)
1794                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1795             clear)
1796                 echo "$yyy=''"                  >> posthint.sh ;;
1797             define)
1798                 case "$zzz" in
1799                 '') zzz=define ;;
1800                 esac
1801                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1802             eval)
1803                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1804             prepend)
1805                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1806             undef)
1807                 case "$zzz" in
1808                 '') zzz="$uuu" ;;
1809                 esac
1810                 echo "$yyy=$zzz"                >> posthint.sh ;;
1811             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1812             esac
1813             shift
1814             ;;
1815         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1816             exit 0;;
1817         --) break;;
1818         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1819         *) break;;
1820         esac
1821 done
1822
1823 case "$error" in
1824 true)
1825         cat >&2 <<EOM
1826 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1827                  [-U symbol] [-U symbol=] [-A command:symbol...]
1828   -d : use defaults for all answers.
1829   -e : go on without questioning past the production of config.sh.
1830   -f : specify an alternate default configuration file.
1831   -h : print this help message and exit (with an error status).
1832   -r : reuse C symbols value if possible (skips costly nm extraction).
1833   -s : silent mode, only echoes questions and essential information.
1834   -D : define symbol to have some value:
1835          -D symbol         symbol gets the value 'define'
1836          -D symbol=value   symbol gets the value 'value'
1837        common used examples (see INSTALL for more info):
1838          -Duse64bitint            use 64bit integers
1839          -Duse64bitall            use 64bit integers and pointers
1840          -Dusethreads             use thread support
1841          -Dinc_version_list=none  do not include older perl trees in @INC
1842          -DEBUGGING=none          DEBUGGING options
1843          -Dcc=gcc                 choose your compiler
1844          -Dprefix=/opt/perl5      choose your destination
1845   -E : stop at the end of questions, after having produced config.sh.
1846   -K : do not use unless you know what you are doing.
1847   -O : ignored for backward compatibility
1848   -S : perform variable substitutions on all .SH files (can mix with -f)
1849   -U : undefine symbol:
1850          -U symbol    symbol gets the value 'undef'
1851          -U symbol=   symbol gets completely empty
1852        e.g.:  -Uversiononly
1853   -A : manipulate symbol after the platform specific hints have been applied:
1854          -A append:symbol=value   append value to symbol
1855          -A symbol=value          like append:, but with a separating space
1856          -A define:symbol=value   define symbol to have value
1857          -A clear:symbol          define symbol to be ''
1858          -A define:symbol         define symbol to be 'define'
1859          -A eval:symbol=value     define symbol to be eval of value
1860          -A prepend:symbol=value  prepend value to symbol
1861          -A undef:symbol          define symbol to be 'undef'
1862          -A undef:symbol=         define symbol to be ''
1863        e.g.:  -A prepend:libswanted='cl pthread '
1864               -A ccflags=-DSOME_MACRO
1865   -V : print version number and exit (with a zero status).
1866 EOM
1867         exit 1
1868         ;;
1869 esac
1870
1871 : Sanity checks
1872 case "$fastread$alldone" in
1873 yescont|yesexit) ;;
1874 *)
1875         case "$extractsh" in
1876         true) ;;
1877         *)
1878                 if test ! -t 0; then
1879                         echo "Say 'sh Configure', not 'sh <Configure'"
1880                         exit 1
1881                 fi
1882                 ;;
1883         esac
1884         ;;
1885 esac
1886
1887 exec 4>&1
1888 case "$silent" in
1889 true) exec 1>/dev/null;;
1890 esac
1891
1892 : run the defines and the undefines, if any, but leave the file out there...
1893 touch optdef.sh
1894 grep '\\' optdef.sh >/dev/null 2>&1
1895 if test $? = 0; then
1896     echo "Configure does not support \\ in -D arguments"
1897     exit 1
1898 fi
1899 . ./optdef.sh
1900 : create the posthint manipulation script and leave the file out there...
1901 touch posthint.sh
1902
1903 : set package name
1904 package='perl5'
1905 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1906 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1907 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1908 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1909 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1910 esac
1911
1912 : Some greps do not return status, grrr.
1913 echo "grimblepritz" >grimble
1914 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1915         contains=contains
1916 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1917         contains=grep
1918 else
1919         contains=contains
1920 fi
1921 rm -f grimble
1922 : the following should work in any shell
1923 case "$contains" in
1924 contains*)
1925         echo " "
1926         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1927         cat >contains <<'EOSS'
1928 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1929 EOSS
1930 chmod +x contains
1931 esac
1932
1933 : Find the path to the source tree
1934 case "$src" in
1935 '') case "$0" in
1936     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1937          case "$src" in
1938          /*)    ;;
1939          .)     ;;
1940          *)     src=`cd ../$src && pwd` ;;
1941          esac
1942          ;;
1943     *)   src='.';;
1944     esac;;
1945 esac
1946 case "$src" in
1947 '')     src=/
1948         rsrc=/
1949         ;;
1950 /*)     rsrc="$src";;
1951 *)      rsrc="../$src";;
1952 esac
1953 if test -f $rsrc/Configure && \
1954         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1955 then
1956    : found it, so we are ok.
1957 else
1958         rsrc=''
1959         for src in . .. ../.. ../../.. ../../../..; do
1960                 if test -f ../$src/Configure && \
1961                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1962                 then
1963                         rsrc=../$src
1964                         break
1965                 fi
1966         done
1967 fi
1968 case "$rsrc" in
1969 '')
1970         cat <<EOM >&4
1971
1972 Sorry, I can't seem to locate the source dir for $package.  Please start
1973 Configure with an explicit path -- i.e. /some/path/Configure.
1974
1975 EOM
1976         exit 1
1977         ;;
1978 ../.)   rsrc='..';;
1979 *)
1980         echo " "
1981         echo "Sources for $package found in \"$src\"." >&4
1982         ;;
1983 esac
1984
1985 : script used to extract .SH files with variable substitutions
1986 cat >extract <<'EOS'
1987 PERL_CONFIG_SH=true
1988 echo "Doing variable substitutions on .SH files..."
1989 if test -f MANIFEST; then
1990         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1991 else
1992         echo "(Looking for .SH files under the source directory.)"
1993         set x `(cd "$src"; find . -name "*.SH" -print)`
1994 fi
1995 shift
1996 case $# in
1997 0) set x `(cd "$src"; echo *.SH)`; shift;;
1998 esac
1999 if test ! -f "$src/$1"; then
2000         shift
2001 fi
2002 mkdir_p='
2003 name=$1;
2004 create="";
2005 while test $name; do
2006         if test ! -d "$name"; then
2007                 create="$name $create";
2008                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2009                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2010         else
2011                 name="";
2012         fi;
2013 done;
2014 for file in $create; do
2015         mkdir $file;
2016 done
2017 '
2018 for file in $*; do
2019         case "$src" in
2020         ".")
2021                 case "$file" in
2022                 */*)
2023                         dir=`expr X$file : 'X\(.*\)/'`
2024                         file=`expr X$file : 'X.*/\(.*\)'`
2025                         (cd "$dir" && . ./$file)
2026                         ;;
2027                 *)
2028                         . ./$file
2029                         ;;
2030                 esac
2031                 ;;
2032         *)
2033                 case "$file" in
2034                 */*)
2035                         dir=`expr X$file : 'X\(.*\)/'`
2036                         file=`expr X$file : 'X.*/\(.*\)'`
2037                         (set x $dir; shift; eval $mkdir_p)
2038                         sh <"$src/$dir/$file"
2039                         ;;
2040                 *)
2041                         sh <"$src/$file"
2042                         ;;
2043                 esac
2044                 ;;
2045         esac
2046 done
2047 if test -f "$src/config_h.SH"; then
2048         if test ! -f config.h; then
2049         : oops, they left it out of MANIFEST, probably, so do it anyway.
2050         . "$src/config_h.SH"
2051         fi
2052 fi
2053 EOS
2054
2055 : extract files and exit if asked to do so
2056 case "$extractsh" in
2057 true)
2058         case "$realsilent" in
2059         true) ;;
2060         *) exec 1>&4;;
2061         esac
2062         case "$config_sh" in
2063         '') config_sh='config.sh';;
2064         esac
2065         echo " "
2066         echo "Fetching answers from $config_sh..."
2067         cd ..
2068         . $config_sh
2069         . UU/optdef.sh
2070         echo " "
2071         . UU/extract
2072         rm -rf UU
2073         echo "Extraction done."
2074         exit 0
2075         ;;
2076 esac
2077
2078 : Eunice requires " " instead of "", can you believe it
2079 echo " "
2080 : Here we go...
2081 echo "Beginning of configuration questions for $package."
2082
2083 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2084
2085 : first determine how to suppress newline on echo command
2086 echo " "
2087 echo "Checking echo to see how to suppress newlines..."
2088 (echo "hi there\c" ; echo " ") >.echotmp
2089 if $contains c .echotmp >/dev/null 2>&1 ; then
2090         echo "...using -n."
2091         n='-n'
2092         c=''
2093 else
2094         cat <<'EOM'
2095 ...using \c
2096 EOM
2097         n=''
2098         c='\c'
2099 fi
2100 echo $n "The star should be here-->$c"
2101 echo '*'
2102 rm -f .echotmp
2103
2104 : Now test for existence of everything in MANIFEST
2105 echo " "
2106 if test -f "$rsrc/MANIFEST"; then
2107         echo "First let's make sure your kit is complete.  Checking..." >&4
2108         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2109                 (split -l 50 2>/dev/null || split -50)
2110         rm -f missing
2111         tmppwd=`pwd`
2112         for filelist in x??; do
2113                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2114                         >/dev/null 2>>"$tmppwd/missing")
2115         done
2116         if test -s missing; then
2117                 cat missing >&4
2118                 cat >&4 <<'EOM'
2119
2120 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2121
2122 You have the option of continuing the configuration process, despite the
2123 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2124 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2125 and contact the author (https://github.com/Perl/perl5/issues).
2126
2127 EOM
2128                 echo $n "Continue? [n] $c" >&4
2129                 read ans
2130                 case "$ans" in
2131                 y*)
2132                         echo "Continuing..." >&4
2133                         rm -f missing
2134                         ;;
2135                 *)
2136                         echo "ABORTING..." >&4
2137                         kill $$
2138                         ;;
2139                 esac
2140         else
2141                 echo "Looks good..."
2142         fi
2143 else
2144         echo "There is no MANIFEST file.  I hope your kit is complete !"
2145 fi
2146 rm -f missing x??
2147
2148 : Find the appropriate value for a newline for tr
2149 if test -n "$DJGPP"; then
2150        trnl='\012'
2151 fi
2152 if test X"$trnl" = X; then
2153         case "`echo foo | tr '\n' x 2>/dev/null`" in
2154         foox) trnl='\n' ;;
2155         esac
2156 fi
2157 if test X"$trnl" = X; then
2158         case "`echo foo | tr '\012' x 2>/dev/null`" in
2159         foox) trnl='\012' ;;
2160         esac
2161 fi
2162 if test X"$trnl" = X; then
2163        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2164        fooxy) trnl='\n\r' ;;
2165        esac
2166 fi
2167 if test X"$trnl" = X; then
2168         cat <<EOM >&2
2169
2170 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2171
2172 EOM
2173         exit 1
2174 fi
2175
2176 : compute the number of columns on the terminal for proper question formatting
2177 case "$COLUMNS" in
2178 '') COLUMNS='80';;
2179 esac
2180
2181 : set up the echo used in my read
2182 myecho="case \"\$xxxm\" in
2183 '') echo $n \"\$rp $c\" >&4;;
2184 *) case \"\$rp\" in
2185         '') echo $n \"[\$xxxm] $c\";;
2186         *)
2187                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2188                         echo \"\$rp\" >&4
2189                         echo $n \"[\$xxxm] $c\" >&4
2190                 else
2191                         echo $n \"\$rp [\$xxxm] $c\" >&4
2192                 fi
2193                 ;;
2194         esac;;
2195 esac"
2196
2197 : now set up to do reads with possible shell escape and default assignment
2198 cat <<EOSC >myread
2199 $startsh
2200 xxxm=\$dflt
2201 $myecho
2202 ans='!'
2203 case "\$fastread" in
2204 yes) case "\$dflt" in
2205         '') ;;
2206         *) ans='';
2207                 case "\$silent-\$rp" in
2208                 true-) ;;
2209                 *) echo " " >&4;;
2210                 esac;;
2211         esac;;
2212 *) case "\$silent" in
2213         true) case "\$rp" in
2214                 '') ans='';;
2215                 esac;;
2216         esac;;
2217 esac
2218 while expr "X\$ans" : "X!" >/dev/null; do
2219         read answ
2220         set x \$xxxm
2221         shift
2222         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2223         case  "\$answ" in
2224         "!")
2225                 sh 1>&4
2226                 echo " "
2227                 $myecho
2228                 ;;
2229         !*)
2230                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2231                 shift
2232                 sh 1>&4 -c "\$*"
2233                 echo " "
2234                 $myecho
2235                 ;;
2236         "\$ans")
2237                 case "\$ans" in
2238                 \\&*)
2239                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2240                         shift
2241                         case "\$1" in
2242                         -d)
2243                                 fastread=yes
2244                                 echo "(OK, I'll run with -d after this question.)" >&4
2245                                 ;;
2246                         -*)
2247                                 echo "*** Sorry, \$1 not supported yet." >&4
2248                                 ;;
2249                         esac
2250                         $myecho
2251                         ans=!
2252                         ;;
2253                 esac;;
2254         *)
2255                 case "\$aok" in
2256                 y)
2257                         echo "*** Substitution done -- please confirm."
2258                         xxxm="\$ans"
2259                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2260                         xxxm="\$ans"
2261                         ans=!
2262                         ;;
2263                 *)
2264                         echo "*** Error -- try again."
2265                         ans=!
2266                         ;;
2267                 esac
2268                 $myecho
2269                 ;;
2270         esac
2271         case "\$ans\$xxxm\$nostick" in
2272         '')
2273                 ans=!
2274                 $myecho
2275                 ;;
2276         esac
2277 done
2278 case "\$ans" in
2279 '') ans="\$xxxm";;
2280 esac
2281 EOSC
2282
2283 : create .config dir to save info across Configure sessions
2284 test -d ../.config || mkdir ../.config
2285 cat >../.config/README <<EOF
2286 This directory created by Configure to save information that should
2287 persist across sessions for $package.
2288
2289 You may safely delete it if you wish.
2290 EOF
2291
2292 : See if we are using a devel version and want that
2293 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2294 case "$usedevel" in
2295 $define|true|[yY]*)
2296     usedevel="$define" ;;
2297 *) case "$xversion" in
2298    *[13579])
2299         cat >&4 <<EOH
2300 *** WHOA THERE!!! ***
2301
2302     This is an UNSTABLE DEVELOPMENT release.
2303     The version of this $package distribution is $xversion, that is, odd,
2304     (as opposed to even) and that signifies a development release.
2305     If you want a maintenance release, you want an even-numbered version.
2306
2307     Do ***NOT*** install this into production use.
2308     Data corruption and crashes are possible.
2309
2310     It is most seriously suggested that you do not continue any further
2311     unless you want to help in developing and debugging Perl.
2312
2313     If you *still* want to build perl, you can answer 'y' now,
2314     or pass -Dusedevel to Configure.
2315
2316 EOH
2317         rp='Do you really want to continue?'
2318         dflt='n'
2319         . ./myread
2320         case "$ans" in
2321         [yY]) echo >&4 "Okay, continuing."
2322               usedevel="$define" ;;
2323         *) echo >&4 "Okay, bye."
2324            exit 1
2325            ;;
2326         esac
2327         ;;
2328     esac
2329     usedevel="$undef"
2330     ;;
2331 esac
2332 case "$usedevel" in
2333 $define|true|[yY]*)
2334         case "$versiononly" in
2335         '') versiononly="$define" ;;
2336         esac
2337         case "$installusrbinperl" in
2338         '') installusrbinperl="$undef" ;;
2339         esac
2340         ;;
2341 esac
2342
2343 : general instructions
2344 needman=true
2345 firsttime=true
2346 user=`(logname) 2>/dev/null`
2347 case "$user" in
2348 '') user=`whoami 2>&1`;;
2349 esac
2350 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2351         firsttime=false
2352         echo " "
2353         rp='Would you like to see the instructions?'
2354         dflt=n
2355         . ./myread
2356         case "$ans" in
2357         [yY]*) ;;
2358         *) needman=false;;
2359         esac
2360 fi
2361 if $needman; then
2362         cat <<EOH
2363
2364 This installation shell script will examine your system and ask you questions
2365 to determine how the perl5 package should be installed. If you get
2366 stuck on a question, you may use a ! shell escape to start a subshell or
2367 execute a command.  Many of the questions will have default answers in square
2368 brackets; typing carriage return will give you the default.
2369
2370 On some of the questions which ask for file or directory names you are allowed
2371 to use the ~name construct to specify the login directory belonging to "name",
2372 even if you don't have a shell which knows about that.  Questions where this is
2373 allowed will be marked "(~name ok)".
2374
2375 EOH
2376         rp=''
2377         dflt='Type carriage return to continue'
2378         . ./myread
2379         cat <<'EOH'
2380
2381 The prompter used in this script allows you to use shell variables and
2382 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2383 in the default answer, as if the default line was a set of arguments given to a
2384 script shell.  This means you may also use $* to repeat the whole default line,
2385 so you do not have to re-type everything to add something to the default.
2386
2387 Every time there is a substitution, you will have to confirm.  If there is an
2388 error (e.g. an unmatched backtick), the default answer will remain unchanged
2389 and you will be prompted again.
2390
2391 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2392 the questions and use the computed defaults (or the previous answers if there
2393 was already a config.sh file). Type 'Configure -h' for a list of options.
2394 You may also start interactively and then answer '& -d' at any prompt to turn
2395 on the non-interactive behaviour for the remainder of the execution.
2396
2397 EOH
2398         . ./myread
2399         cat <<EOH
2400
2401 Much effort has been expended to ensure that this shell script will run on any
2402 Unix system.  If despite that it blows up on yours, your best bet is to edit
2403 Configure and run it again.  If you can't run Configure for some reason,
2404 you'll have to generate a config.sh file by hand.  Whatever problems you
2405 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2406
2407 This installation script affects things in two ways:
2408
2409 1) it may do direct variable substitutions on some of the files included
2410    in this kit.
2411 2) it builds a config.h file for inclusion in C programs.  You may edit
2412    any of these files as the need arises after running this script.
2413
2414 If you make a mistake on a question, there is no easy way to back up to it
2415 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2416 files.  Configure will offer to let you do this before it runs the SH files.
2417
2418 EOH
2419         dflt='Type carriage return to continue'
2420         . ./myread
2421         case "$firsttime" in
2422         true) echo $user >>../.config/instruct;;
2423         esac
2424 fi
2425
2426 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2427 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2428 if test "X$sysroot" = X; then
2429     sysroot=""
2430 else
2431     case "$cc" in
2432         *gcc*|*g++*)
2433             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2434             # _sysroot is used in places where we need --sysroot=foo
2435             # but using the rest of the flags could cause issues.
2436             _sysroot="--sysroot=$sysroot";
2437             case "$ccflags" in
2438                 *sysroot*) ;;
2439                 'undef'|*)
2440                 ccflags="$ccflags $_sysroot"
2441             esac
2442             case "$ldflags" in
2443                 *sysroot*) ;;
2444                 'undef'|*)
2445                 ldflags="$ldflags $_sysroot"
2446             esac
2447             case "$cppflags" in
2448                 *sysroot*) ;;
2449                 'undef'|*)
2450                 cppflags="$cppflags $_sysroot"
2451             esac
2452             # lddlflags updated below in lddlflags section;
2453             # same with cccdlflags
2454             ;;
2455     esac
2456
2457     # Adjust some defaults to also use $sysroot
2458     for var in xlibpth loclibpth locincpth glibpth; do
2459         eval xxx=\$$var
2460         eval $var=''
2461         for path in $xxx; do
2462             eval $var=\"\$$var $sysroot$path\"
2463         done
2464     done
2465
2466 fi
2467
2468 : find out where common programs are
2469 echo " "
2470 echo "Locating common programs..." >&4
2471 cat <<EOSC >loc
2472 $startsh
2473 case \$# in
2474 0) exit 1;;
2475 esac
2476 thing=\$1
2477 shift
2478 dflt=\$1
2479 shift
2480 for dir in \$*; do
2481         case "\$thing" in
2482         .)
2483         if test -d \$dir/\$thing; then
2484                 echo \$dir
2485                 exit 0
2486         fi
2487         ;;
2488         *)
2489         for thisthing in \$dir/\$thing; do
2490                 : just loop through to pick last item
2491         done
2492         if test -f \$thisthing; then
2493                 echo \$thisthing
2494                 exit 0
2495         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2496                 echo \$thisthing
2497                 exit 0
2498         elif test -f \$dir/\$thing.exe; then
2499                 if test -n "$DJGPP"; then
2500                         echo \$dir/\$thing.exe
2501                 elif test "$eunicefix" != ":"; then
2502                         : on Eunice apparently
2503                         echo \$dir/\$thing
2504                 fi
2505                 exit 0
2506         fi
2507         ;;
2508         esac
2509 done
2510 echo \$dflt
2511 exit 1
2512 EOSC
2513 chmod +x loc
2514 $eunicefix loc
2515 loclist="
2516 awk
2517 cat
2518 chmod
2519 comm
2520 cp
2521 echo
2522 expr
2523 grep
2524 ls
2525 mkdir
2526 rm
2527 sed
2528 sort
2529 touch
2530 tr
2531 uniq
2532 "
2533 trylist="
2534 ar
2535 bison
2536 byacc
2537 cpp
2538 csh
2539 date
2540 egrep
2541 gmake
2542 gzip
2543 less
2544 ln
2545 make
2546 more
2547 nm
2548 nroff
2549 perl
2550 pg
2551 test
2552 uname
2553 zip
2554 "
2555 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2556 pth="$pth $sysroot/lib $sysroot/usr/lib"
2557 for file in $loclist; do
2558         eval xxx=\$$file
2559         case "$xxx" in
2560         /*|?:[\\/]*)
2561                 if test -f "$xxx"; then
2562                         : ok
2563                 else
2564                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2565                         xxx=`./loc $file $file $pth`
2566                 fi
2567                 ;;
2568         '') xxx=`./loc $file $file $pth`;;
2569         *) xxx=`./loc $xxx $xxx $pth`;;
2570         esac
2571         eval $file=$xxx$_exe
2572         eval _$file=$xxx
2573         case "$xxx" in
2574         /*)
2575                 echo $file is in $xxx.
2576                 ;;
2577         ?:[\\/]*)
2578                 echo $file is in $xxx.
2579                 ;;
2580         *)
2581                 echo "I don't know where '$file' is, and my life depends on it." >&4
2582                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2583                 exit 1
2584                 ;;
2585         esac
2586 done
2587 echo " "
2588 echo "Don't worry if any of the following aren't found..."
2589 say=offhand
2590 for file in $trylist; do
2591         eval xxx=\$$file
2592         case "$xxx" in
2593         /*|?:[\\/]*)
2594                 if test -f "$xxx"; then
2595                         : ok
2596                 else
2597                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2598                         xxx=`./loc $file $file $pth`
2599                 fi
2600                 ;;
2601         '') xxx=`./loc $file $file $pth`;;
2602         *) xxx=`./loc $xxx $xxx $pth`;;
2603         esac
2604         eval $file=$xxx$_exe
2605         eval _$file=$xxx
2606         case "$xxx" in
2607         /*)
2608                 echo $file is in $xxx.
2609                 ;;
2610         ?:[\\/]*)
2611                 echo $file is in $xxx.
2612                 ;;
2613         *)
2614                 echo "I don't see $file out there, $say."
2615                 say=either
2616                 ;;
2617         esac
2618 done
2619 case "$egrep" in
2620 egrep)
2621         echo "Substituting grep for egrep."
2622         egrep=$grep
2623         _egrep=$grep
2624         ;;
2625 esac
2626 case "$less" in
2627 '')     ;;
2628 *)      if $less -R </dev/null >/dev/null 2>&1; then
2629                echo "Substituting less -R for less."
2630                less="$less -R"
2631                _less=$less
2632         fi
2633         ;;
2634 esac
2635 case "$ln" in
2636 ln)
2637         echo "Substituting cp for ln."
2638         ln=$cp
2639         _ln=$cp
2640         ;;
2641 esac
2642 case "$make" in
2643 make)
2644         case "$gmake" in
2645         gmake)
2646         echo "I can't find make or gmake, and my life depends on it." >&4
2647         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2648         exit 1
2649         ;;
2650         esac
2651         ;;
2652 esac
2653 case "$gmake" in
2654 gmake)  ;;
2655 *)      # We can't have osname yet.
2656         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2657                 # Assume that gmake, if found, is definitely GNU make
2658                 # and prefer it over the system make.
2659                 echo "Substituting gmake for make."
2660                 make=$gmake
2661                 _make=$gmake
2662         fi
2663         ;;
2664 esac
2665 case "$test" in
2666 test)
2667         echo "Hopefully test is built into your sh."
2668         ;;
2669 *)
2670         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2671                 echo "Using the test built into your sh."
2672                 test=test
2673                 _test=test
2674         fi
2675         ;;
2676 esac
2677 case "$echo" in
2678 echo)
2679         echo "Hopefully echo is built into your sh."
2680         ;;
2681 '') ;;
2682 *)
2683         echo " "
2684 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2685         $echo $n "hi there$c" >foo1
2686         echo $n "hi there$c" >foo2
2687         if cmp foo1 foo2 >/dev/null 2>&1; then
2688                 echo "They are compatible.  In fact, they may be identical."
2689         else
2690                 case "$n" in
2691                 '-n') n='' c='\c';;
2692                 *) n='-n' c='';;
2693                 esac
2694                 cat <<FOO
2695 They are not compatible!  You are probably running ksh on a non-USG system.
2696 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2697 have echo built in and we may have to run some Bourne shell scripts.  That
2698 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2699
2700 FOO
2701                 $echo $n "The star should be here-->$c"
2702                 $echo "*"
2703         fi
2704         $rm -f foo1 foo2
2705         ;;
2706 esac
2707
2708 # This question was auctioned at YAPC::Europe-2007 in Vienna
2709 # I never promised you could answer it. I only auctioned the question.
2710 cat <<FOO
2711 The following message is sponsored by
2712
2713   Dresden.pm<--The stars should be here.
2714
2715 Dear Perl user, system administrator or package
2716 maintainer, the Perl community sends greetings to
2717 you. Do you (emblematical) greet back [Y/n]? n
2718
2719 FOO
2720
2721 : Check what type of C compiler we use
2722 cat <<EOS >trygcc
2723 $startsh
2724 EOS
2725 cat <<'EOSC' >>trygcc
2726 case "$cc" in
2727 '') ;;
2728 *)  $rm -f try try.*
2729     $cat >try.c <<EOM
2730 int main(int argc, char *argv[]) {
2731   return 0;
2732 }
2733 EOM
2734     if $cc -o try $ccflags $ldflags try.c; then
2735        :
2736     else
2737         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2738         despair=yes
2739         trygcc=yes
2740         case "$cc" in
2741         *gcc*) trygcc=no ;;
2742         esac
2743         # Skip this test because it gives a false match on output like:
2744         #    ./trygcc: line 23: cc: command not found
2745         # case "`$cc -v -c try.c 2>&1`" in
2746         # *gcc*) trygcc=no ;;
2747         # esac
2748         if $test X"$trygcc" = Xyes; then
2749             if gcc -o try -c try.c; then
2750                 echo " "
2751                 echo "You seem to have a working gcc, though." >&4
2752                 # Switching compilers may undo the work of hints files.
2753                 # The most common problem is -D_REENTRANT for threads.
2754                 # This heuristic catches that case, but gets false positives
2755                 # if -Dusethreads was not actually specified.  Better to
2756                 # bail out here with a useful message than fail
2757                 # mysteriously later. Should we perhaps just try to
2758                 # re-invoke Configure -Dcc=gcc config_args ?
2759                 if $test -f usethreads.cbu; then
2760                         $cat >&4 <<EOM
2761
2762 *** However, any setting of the C compiler flags (e.g. for thread support)
2763 *** will be lost.  It may be necessary for you to restart Configure and
2764 *** add -Dcc=gcc to your Configure command line.
2765
2766 EOM
2767                         rp="Would you like to go ahead and try gcc anyway?"
2768                         dflt=n
2769                 else
2770                         rp="Would you like to use it?"
2771                         dflt=y
2772                 fi
2773                 if $test -f myread; then
2774                     . ./myread
2775                 else
2776                     if $test -f UU/myread; then
2777                         . ./UU/myread
2778                     else
2779                         echo "Cannot find myread, sorry.  Aborting." >&2
2780                         exit 1
2781                     fi
2782                 fi
2783                 case "$ans" in
2784                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2785                 esac
2786             fi
2787         fi
2788     fi
2789     $rm -f try try.*
2790     ;;
2791 esac
2792 EOSC
2793
2794 cat <<EOS >checkcc
2795 $startsh
2796 EOS
2797 cat <<'EOSC' >>checkcc
2798 case "$cc" in
2799 '') ;;
2800 *)  $rm -f try try.*
2801     $cat >try.c <<EOM
2802 int main(int argc, char *argv[]) {
2803   return 0;
2804 }
2805 EOM
2806     if $cc -o try $ccflags $ldflags try.c; then
2807        :
2808     else
2809         if $test X"$despair" = Xyes; then
2810            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2811         fi
2812         $cat >&4 <<EOM
2813 You need to find a working C compiler.
2814 Either (purchase and) install the C compiler supplied by your OS vendor,
2815 or for a free C compiler try http://gcc.gnu.org/
2816 I cannot continue any further, aborting.
2817 EOM
2818         exit 1
2819     fi
2820     $rm -f try try.*
2821     ;;
2822 esac
2823 EOSC
2824
2825 : determine whether symbolic links are supported
2826 echo " "
2827 $touch blurfl
2828 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2829         echo "Symbolic links are supported." >&4
2830         lns="$ln -s"
2831 else
2832         echo "Symbolic links are NOT supported." >&4
2833         lns="$ln"
2834 fi
2835 $rm -f blurfl sym
2836
2837 : determine whether symbolic links are supported
2838 echo " "
2839 case "$lns" in
2840 *"ln"*" -s")
2841         echo "Checking how to test for symbolic links..." >&4
2842         $lns blurfl sym
2843         if $test "X$issymlink" = X; then
2844                 case "$newsh" in
2845                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2846                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2847                 esac
2848                 if test $? = 0; then
2849                         issymlink="test -h"
2850                 else
2851                         echo "Your builtin 'test -h' may be broken." >&4
2852                         case "$test" in
2853                         /*)     ;;
2854                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2855                                 for p in $pth
2856                                 do
2857                                         if test -f "$p/$test"; then
2858                                                 test="$p/$test"
2859                                                 break
2860                                         fi
2861                                 done
2862                                 ;;
2863                         esac
2864                         case "$test" in
2865                         /*)
2866                                 echo "Trying external '$test -h'." >&4
2867                                 issymlink="$test -h"
2868                                 if $test ! -h sym >/dev/null 2>&1; then
2869                                         echo "External '$test -h' is broken, too." >&4
2870                                         issymlink=''
2871                                 fi
2872                                 ;;
2873                         *)      issymlink='' ;;
2874                         esac
2875                 fi
2876         fi
2877         if $test "X$issymlink" = X; then
2878                 if $test -L sym 2>/dev/null; then
2879                         issymlink="$test -L"
2880                         echo "The builtin '$test -L' worked." >&4
2881                 fi
2882         fi
2883         if $test "X$issymlink" != X; then
2884                 echo "You can test for symbolic links with '$issymlink'." >&4
2885         else
2886                 echo "I do not know how you can test for symbolic links." >&4
2887         fi
2888         $rm -f blurfl sym
2889         ;;
2890 *)      echo "No symbolic links, so not testing for their testing..." >&4
2891         ;;
2892 esac
2893
2894 : Make symlinks util
2895 case "$mksymlinks" in
2896 $define|true|[yY]*)
2897         case "$src" in
2898         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2899                 exit 1
2900                 ;;
2901         *)      case "$lns:$issymlink" in
2902                 *"ln"*" -s:"*"test -"?)
2903                         echo "Creating the symbolic links..." >&4
2904                         cd ..
2905                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2906                         awk 'NF == 1 {
2907                                 dir=".";
2908                                 file=$1 "";
2909                              }
2910                              NF == 2 {
2911                                 dir=$1 "";
2912                                 file=$2 "";
2913                              }
2914                              {
2915                                  print "# dir = ", dir, "file = ", file
2916                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2917                              } END {
2918                                  for (d in mf) {
2919                                      if (d != ".") { print("mkdir -p "d) }
2920                                      print("ln -sf "mf[d]" "d);
2921                                  }
2922                              }' source="$src" > UU/mksymlinks.$$
2923                         sh UU/mksymlinks.$$
2924                         rm UU/mksymlinks.$$
2925                         # Sanity check 1.
2926                         if test ! -d t/base; then
2927                                 echo "Failed to create the subdirectories.  Aborting." >&4
2928                                 exit 1
2929                         fi
2930                         # Sanity check 2.
2931                         if test ! -f t/base/lex.t; then
2932                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2933                                 exit 1
2934                         fi
2935                         if test ! -f win32/win32.c; then
2936                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2937                                 exit 1
2938                         fi
2939                         cd UU
2940                         ;;
2941                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2942                         ;;
2943                 esac
2944                 ;;
2945         esac
2946         ;;
2947 esac
2948
2949 : Check for Cross-Compilation
2950 if $test "X$targethost" = "X"; then
2951     targethost=""
2952 fi
2953 if $test "X$targetenv" = "X"; then
2954     targetenv=""
2955 fi
2956 case "$usecrosscompile" in
2957 $define|true|[yY]*)
2958         $echo "Cross-compiling..."
2959         croak=''
2960         case "$cc" in
2961         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2962             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2963             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2964             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2965             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2966             # leave out ld, choosing it is more complex
2967             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2968             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2969             # We are in a weird spot. Just before us, some values
2970             # were 'saved', to be restored after the hints are
2971             # run.  This means that the changes we made to ar,
2972             # nm and ranlib will get reverted.
2973             # To avoid that, we hijack the saving mechanism and
2974             # have it save our new values.
2975             for file in ar nm ranlib; do
2976                 eval xxx=\$$file
2977                 eval $file=$xxx$_exe
2978                 eval _$file=$xxx
2979             done
2980         ;;
2981         esac
2982         case "$targetarch" in
2983         '') echo "Targetarch not defined." >&4; croak=y ;;
2984         *)  echo "Using targetarch $targetarch." >&4 ;;
2985         esac
2986         case "$targethost" in
2987         '') echo "Targethost not defined." >&4; croak=n ;;
2988         *)  echo "Using targethost $targethost." >&4
2989         esac
2990         locincpth=' '
2991         loclibpth=' '
2992         case "$croak" in
2993         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2994         esac
2995     : compile a host miniperl and generate_uudmap, unless we got passed them
2996     if $test "X$hostperl" = X; then
2997       echo "Building host miniperl and generate_uudmap binaries" >&4
2998       before_host=`pwd`
2999       cd ..
3000       cd $src
3001       src=`pwd`
3002       rm -rf $src/host
3003       mkdir $src/host
3004       cd $src/host
3005       $src/Configure -des -Dusedevel -Dmksymlinks
3006       $make miniperl
3007       case "$hostgenerate" in
3008       '') $make generate_uudmap
3009           hostgenerate=$src/host/generate_uudmap
3010           ;;
3011        "$undef") hostgenerate=''
3012           ;;
3013       esac
3014       hostperl=$src/host/miniperl
3015       cd $before_host
3016     fi
3017     hostosname=`$hostperl -le 'print $^O'`
3018     ;;
3019 *)
3020     usecrosscompile="$undef"
3021     ;;
3022 esac
3023
3024 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3025 case "$targethost" in
3026     '') echo "Checking for cross-compile" >&4
3027     case "$usecrosscompile$multiarch" in
3028        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3029          if [ -f Makefile ]; then
3030            echo " "
3031            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3032          else
3033            echo "Configure done."
3034          fi
3035        exit 0
3036        ;;
3037      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3038         run=''
3039         to=:
3040         from=:
3041         ;;
3042     esac
3043     ;;
3044     *) echo "Using targethost $targethost." >&4
3045         case "$src" in
3046         /*) run=$src/Cross/run
3047             targetmkdir=$src/Cross/mkdir
3048             to=$src/Cross/to
3049             from=$src/Cross/from
3050             ;;
3051         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3052             run=$pwd/Cross/run
3053             targetmkdir=$pwd/Cross/mkdir
3054             to=$pwd/Cross/to
3055             from=$pwd/Cross/from
3056             ;;
3057         esac
3058         case "$targetrun" in
3059         '') targetrun=ssh ;;
3060         esac
3061         case "$targetto" in
3062         '') targetto=scp ;;
3063         esac
3064         case "$targetfrom" in
3065         '') targetfrom=scp ;;
3066         esac
3067         run=$run-$targetrun
3068         to=$to-$targetto
3069         from=$from-$targetfrom
3070         case "$targetdir" in
3071         '')  targetdir=/tmp
3072              echo "Guessing targetdir $targetdir." >&4
3073              ;;
3074         esac
3075         case "$targetuser" in
3076         '')  targetuser=root
3077              echo "Guessing targetuser $targetuser." >&4
3078              ;;
3079         esac
3080         case "$targetport" in
3081         '')  targetport=22
3082              echo "Guessing targetport $targetport." >&4
3083              ;;
3084         esac
3085         case "$targetfrom" in
3086         scp)    q=-q ;;
3087         *)      q='' ;;
3088         esac
3089         case "$targetrun" in
3090         ssh|rsh)
3091             cat >$run <<EOF
3092 #!/bin/sh
3093 env=''
3094 case "\$1" in
3095 -cwd)
3096   shift
3097   cwd=\$1
3098   shift
3099   ;;
3100 esac
3101 case "\$1" in
3102 -env)
3103   shift
3104   env=\$1
3105   shift
3106   ;;
3107 esac
3108 case "\$cwd" in
3109 '') cwd=$targetdir ;;
3110 esac
3111 exe=\$1
3112 shift
3113 $to \$exe
3114 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3115 EOF
3116             ;;
3117         adb)
3118             $touch $run
3119             ;;
3120         *)  echo "Unknown targetrun '$targetrun'" >&4
3121             exit 1
3122             ;;
3123         esac
3124         case "$targetmkdir" in
3125         */Cross/mkdir)
3126             cat >$targetmkdir <<EOF
3127 #!/bin/sh
3128 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3129 EOF
3130             $chmod a+rx $targetmkdir
3131             ;;
3132         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3133             exit 1
3134             ;;
3135         esac
3136         case "$targetto" in
3137         scp|rcp)
3138             cat >$to <<EOF
3139 #!/bin/sh
3140 for f in \$@
3141 do
3142   case "\$f" in
3143   /*)
3144     $targetmkdir \`dirname \$f\`
3145     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3146     ;;
3147   *)
3148     $targetmkdir $targetdir/\`dirname \$f\`
3149     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3150     ;;
3151   esac
3152 done
3153 exit 0
3154 EOF
3155             ;;
3156         cp) cat >$to <<EOF
3157 #!/bin/sh
3158 for f in \$@
3159 do
3160   case "\$f" in
3161   /*)
3162     $mkdir -p $targetdir/\`dirname \$f\`
3163     $cp \$f $targetdir/\$f || exit 1
3164     ;;
3165   *)
3166     $targetmkdir $targetdir/\`dirname \$f\`
3167     $cp \$f $targetdir/\$f || exit 1
3168     ;;
3169   esac
3170 done
3171 exit 0
3172 EOF
3173             ;;
3174         *)  echo "Unknown targetto '$targetto'" >&4
3175             exit 1
3176             ;;
3177         esac
3178         case "$targetfrom" in
3179         scp|rcp)
3180           cat >$from <<EOF
3181 #!/bin/sh
3182 for f in \$@
3183 do
3184   $rm -f \$f
3185   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3186 done
3187 exit 0
3188 EOF
3189             ;;
3190         cp) cat >$from <<EOF
3191 #!/bin/sh
3192 for f in \$@
3193 do
3194   $rm -f \$f
3195   cp $targetdir/\$f . || exit 1
3196 done
3197 exit 0
3198 EOF
3199             ;;
3200         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3201             exit 1
3202             ;;
3203         esac
3204         if $test ! -f $run; then
3205             echo "Target 'run' script '$run' not found." >&4
3206         else
3207             $chmod a+rx $run
3208         fi
3209         if $test ! -f $to; then
3210             echo "Target 'to' script '$to' not found." >&4
3211         else
3212             $chmod a+rx $to
3213         fi
3214         if $test ! -f $from; then
3215             echo "Target 'from' script '$from' not found." >&4
3216         else
3217             $chmod a+rx $from
3218         fi
3219         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3220             exit 1
3221         fi
3222         cat >&4 <<EOF
3223 Using '$run' for remote execution,
3224 and '$from' and '$to'
3225 for remote file transfer.
3226 EOF
3227         ;;
3228 *)      run=''
3229         to=:
3230         from=:
3231         usecrosscompile="$undef"
3232         targetarch=''
3233         ;;
3234 esac
3235
3236 : see whether [:lower:] and [:upper:] are supported character classes
3237 echo " "
3238 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3239 ABYZ-abyz)
3240         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3241         up='[:upper:]'
3242         low='[:lower:]'
3243         ;;
3244 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3245         # (0xd9 and 0xe2), therefore that is a nice testing point.
3246         if test "X$up" = X -o "X$low" = X; then
3247             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3248             rs) up='[A-Z]'
3249                 low='[a-z]'
3250                 ;;
3251             esac
3252         fi
3253         if test "X$up" = X -o "X$low" = X; then
3254             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3255             rs) up='A-Z'
3256                 low='a-z'
3257                 ;;
3258             esac
3259         fi
3260         if test "X$up" = X -o "X$low" = X; then
3261             case "`echo RS | od -x 2>/dev/null`" in
3262             *D9E2*|*d9e2*)
3263                 echo "Hey, this might be EBCDIC." >&4
3264                 if test "X$up" = X -o "X$low" = X; then
3265                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3266                     rs) up='[A-IJ-RS-Z]'
3267                         low='[a-ij-rs-z]'
3268                         ;;
3269                     esac
3270                 fi
3271                 if test "X$up" = X -o "X$low" = X; then
3272                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3273                     rs) up='A-IJ-RS-Z'
3274                         low='a-ij-rs-z'
3275                         ;;
3276                     esac
3277                 fi
3278                 ;;
3279             esac
3280         fi
3281 esac
3282 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3283 rs)
3284     echo "Using $up and $low to convert case." >&4
3285     ;;
3286 *)
3287     echo "I don't know how to translate letters from upper to lower case." >&4
3288     echo "Your tr is not acting any way I know of." >&4
3289     exit 1
3290     ;;
3291 esac
3292 : set up the translation script tr, must be called with ./tr of course
3293 cat >tr <<EOSC
3294 $startsh
3295 case "\$1\$2" in
3296 '[A-Z][a-z]') exec $tr '$up' '$low';;
3297 '[a-z][A-Z]') exec $tr '$low' '$up';;
3298 esac
3299 exec $tr "\$@"
3300 EOSC
3301 chmod +x tr
3302 $eunicefix tr
3303
3304 : Try to determine whether config.sh was made on this system
3305 case "$config_sh" in
3306 '')
3307 myuname=`$uname -a 2>/dev/null`
3308 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3309 # Downcase everything to avoid ambiguity.
3310 # Remove slashes and single quotes so we can use parts of this in
3311 # directory and file names.
3312 # Remove newlines so myuname is sane to use elsewhere.
3313 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3314 # because the A-Z/a-z are not consecutive.
3315 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3316         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3317 newmyuname="$myuname"
3318 dflt=n
3319 case "$knowitall" in
3320 '')
3321         if test -f ../config.sh; then
3322                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3323                         eval "`grep myuname= ../config.sh`"
3324                 fi
3325                 if test "X$myuname" = "X$newmyuname"; then
3326                         dflt=y
3327                 fi
3328         fi
3329         ;;
3330 *) dflt=y;;
3331 esac
3332
3333 : Get old answers from old config file if Configure was run on the
3334 : same system, otherwise use the hints.
3335 hint=default
3336 cd ..
3337 if test -f config.sh; then
3338         echo " "
3339         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3340         . UU/myread
3341         case "$ans" in
3342         n*|N*) echo "OK, I'll ignore it."
3343                 mv config.sh config.sh.old
3344                 myuname="$newmyuname"
3345                 ;;
3346         *)  echo "Fetching default answers from your old config.sh file..." >&4
3347                 tmp_n="$n"
3348                 tmp_c="$c"
3349                 tmp_sh="$sh"
3350                 . ./config.sh
3351                 cp config.sh UU
3352                 n="$tmp_n"
3353                 c="$tmp_c"
3354                 : Older versions did not always set $sh.  Catch re-use of such
3355                 : an old config.sh.
3356                 case "$sh" in
3357                 '') sh="$tmp_sh" ;;
3358                 esac
3359                 hint=previous
3360                 ;;
3361         esac
3362 fi
3363 . ./UU/checkcc
3364 if test ! -f config.sh; then
3365         $cat <<EOM
3366
3367 First time through, eh?  I have some defaults handy for some systems
3368 that need some extra help getting the Configure answers right:
3369
3370 EOM
3371         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3372         dflt=''
3373         : Half the following guesses are probably wrong... If you have better
3374         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3375         : The metaconfig authors would also appreciate a copy...
3376         $test -f /irix && osname=irix
3377         $test -f /xenix && osname=sco_xenix
3378         $test -f /dynix && osname=dynix
3379         $test -f /dnix && osname=dnix
3380         $test -f /lynx.os && osname=lynxos
3381         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3382         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3383         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3384         $test -f /bin/mips && /bin/mips && osname=mips
3385         $test -d /usr/apollo/bin && osname=apollo
3386         $test -f /etc/saf/_sactab && osname=svr4
3387         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3388         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3389         $test -f /sys/utilities/MultiView && osname=amigaos
3390         if $test -d /MachTen -o -d /MachTen_Folder; then
3391                 osname=machten
3392                 if $test -x /sbin/version; then
3393                         osvers=`/sbin/version | $awk '{print $2}' |
3394                         $sed -e 's/[A-Za-z]$//'`
3395                 elif $test -x /usr/etc/version; then
3396                         osvers=`/usr/etc/version | $awk '{print $2}' |
3397                         $sed -e 's/[A-Za-z]$//'`
3398                 else
3399                         osvers="$2.$3"
3400                 fi
3401         fi
3402
3403         $test -f /sys/posix.dll &&
3404                 $test -f /usr/bin/what &&
3405                 set X `/usr/bin/what /sys/posix.dll` &&
3406                 $test "$3" = UWIN &&
3407                 osname=uwin &&
3408                 osvers="$5"
3409
3410         if $test -f $uname; then
3411                 set X $myuname
3412                 shift
3413
3414                 case "$5" in
3415                 fps*) osname=fps ;;
3416                 mips*)
3417                         case "$4" in
3418                         umips) osname=umips ;;
3419                         *) osname=mips ;;
3420                         esac;;
3421                 [23]100) osname=mips ;;
3422                 i386*)
3423                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3424                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3425                                 osname='sco'
3426                                 osvers=$tmp
3427                         elif $test -f /etc/kconfig; then
3428                                 osname=isc
3429                                 if test "$lns" = "$ln -s"; then
3430                                         osvers=4
3431                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3432                                         osvers=3
3433                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3434                                         osvers=2
3435                                 fi
3436                         fi
3437                         tmp=''
3438                         ;;
3439                 pc*)
3440                         if test -n "$DJGPP"; then
3441                                 osname=dos
3442                                 osvers=djgpp
3443                         fi
3444                         ;;
3445                 esac
3446
3447                 case "$1" in
3448                 aix) osname=aix
3449                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3450                         case "$tmp" in
3451                         # oslevel can fail with:
3452                         # oslevel: Unable to acquire lock.
3453                         *not\ found) osvers="$4"."$3" ;;
3454                         '<3240'|'<>3240') osvers=3.2.0 ;;
3455                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3456                         '=3250'|'>3250') osvers=3.2.5 ;;
3457                         *) osvers=$tmp;;
3458                         esac
3459                         ;;
3460                 bitrig) osname=bitrig
3461                         osvers="$3"
3462                         ;;
3463                 bsd386) osname=bsd386
3464                         osvers=`$uname -r`
3465                         ;;
3466                 cygwin*) osname=cygwin
3467                         osvers="$3"
3468                         ;;
3469                 *dc.osx) osname=dcosx
3470                         osvers="$3"
3471                         ;;
3472                 dnix) osname=dnix
3473                         osvers="$3"
3474                         ;;
3475                 domainos) osname=apollo
3476                         osvers="$3"
3477                         ;;
3478                 dgux)   osname=dgux
3479                         osvers="$3"
3480                         ;;
3481                 dragonfly) osname=dragonfly
3482                         osvers="$3"
3483                         ;;
3484                 dynixptx*) osname=dynixptx
3485                         osvers=`echo "$4"|sed 's/^v//'`
3486                         ;;
3487                 freebsd) osname=freebsd
3488                         osvers="$3" ;;
3489                 genix)  osname=genix ;;
3490                 gnu)    osname=gnu
3491                         osvers="$3" ;;
3492                 hp*)    osname=hpux
3493                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3494                         ;;
3495                 irix*)  osname=irix
3496                         case "$3" in
3497                         4*) osvers=4 ;;
3498                         5*) osvers=5 ;;
3499                         *)      osvers="$3" ;;
3500                         esac
3501                         ;;
3502                 linux)  osname=linux
3503                         case "$3" in
3504                         *)      osvers="$3" ;;
3505                         esac
3506                         $test -f /system/lib/libandroid.so && osname=linux-android
3507                         ;;
3508                 MiNT)   osname=mint
3509                         ;;
3510                 minix)  osname=minix
3511                         osvers=`$uname -r`
3512                         ;;
3513                 netbsd*) osname=netbsd
3514                         osvers="$3"
3515                         ;;
3516                 news-os) osvers="$3"
3517                         case "$3" in
3518                         4*) osname=newsos4 ;;
3519                         *) osname=newsos ;;
3520                         esac
3521                         ;;
3522                 nonstop-ux) osname=nonstopux ;;
3523                 openbsd) osname=openbsd
3524                         osvers="$3"
3525                         ;;
3526                 os2)    osname=os2
3527                         osvers="$4"
3528                         ;;
3529                 POSIX-BC | posix-bc ) osname=posix-bc
3530                         osvers="$3"
3531                         ;;
3532                 powerux | power_ux | powermax_os | powermaxos | \
3533                 powerunix | power_unix) osname=powerux
3534                         osvers="$3"
3535                         ;;
3536                 qnx) osname=qnx
3537                         osvers="$4"
3538                         ;;
3539                 solaris) osname=solaris
3540                         case "$3" in
3541                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3542                         *)      osvers="$3" ;;
3543                         esac
3544                         ;;
3545                 sunos) osname=sunos
3546                         case "$3" in
3547                         5*) osname=solaris
3548                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3549                         *)      osvers="$3" ;;
3550                         esac
3551                         ;;
3552                 titanos) osname=titanos
3553                         case "$3" in
3554                         1*) osvers=1 ;;
3555                         2*) osvers=2 ;;
3556                         3*) osvers=3 ;;
3557                         4*) osvers=4 ;;
3558                         *)      osvers="$3" ;;
3559                         esac
3560                         ;;
3561                 ultrix) osname=ultrix
3562                         osvers="$3"
3563                         ;;
3564                 osf1|mls+)      case "$5" in
3565                                 alpha)
3566                                         osname=dec_osf
3567                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3568                                         case "$osvers" in
3569                                         [1-9].[0-9]*) ;;
3570                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3571                                         esac
3572                                         ;;
3573                         hp*)    osname=hp_osf1  ;;
3574                         mips)   osname=mips_osf1 ;;
3575                         esac
3576                         ;;
3577                 # UnixWare 7.1.2 is known as Open UNIX 8
3578                 openunix|unixware) osname=svr5
3579                         osvers="$4"
3580                         ;;
3581                 uts)    osname=uts
3582                         osvers="$3"
3583                         ;;
3584                 vos) osvers="$3"
3585                         ;;
3586                 $2) case "$osname" in
3587                         *isc*) ;;
3588                         *freebsd*) ;;
3589                         svr*)
3590                                 : svr4.x or possibly later
3591                                 case "svr$3" in
3592                                 ${osname}*)
3593                                         osname=svr$3
3594                                         osvers=$4
3595                                         ;;
3596                                 esac
3597                                 case "$osname" in
3598                                 svr4.0)
3599                                         : Check for ESIX
3600                                         if test -f /stand/boot ; then
3601                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3602                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3603                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3604                                                         if test -n "$isesix"; then
3605                                                                 osname=esix4
3606                                                         fi
3607                                                 fi
3608                                         fi
3609                                         ;;
3610                                 esac
3611                                 ;;
3612                         *)      if test -f /etc/systemid; then
3613                                         osname=sco
3614                                         set `echo $3 | $sed 's/\./ /g'` $4
3615                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3616                                                 osvers=$1.$2.$3
3617                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3618                                                 osvers=$1.$2
3619                                         elif $test -f $src/hints/sco_$1.sh; then
3620                                                 osvers=$1
3621                                         fi
3622                                 else
3623                                         case "$osname" in
3624                                         '') : Still unknown.  Probably a generic Sys V.
3625                                                 osname="sysv"
3626                                                 osvers="$3"
3627                                                 ;;
3628                                         esac
3629                                 fi
3630                                 ;;
3631                         esac
3632                         ;;
3633                 *)      case "$osname" in
3634                         '') : Still unknown.  Probably a generic BSD.
3635                                 osname="$1"
3636                                 osvers="$3"
3637                                 ;;
3638                         esac
3639                         ;;
3640                 esac
3641         else
3642                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3643                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3644                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3645                                 osname=news_os
3646                         fi
3647                         $rm -f UU/kernel.what
3648                 elif test -d c:/. -o -n "$is_os2" ; then
3649                         set X $myuname
3650                         osname=os2
3651                         osvers="$5"
3652                 fi
3653         fi
3654
3655         case "$targetarch" in
3656         '') ;;
3657         *)  hostarch=$osname
3658             case "$targetarch" in
3659                 nto*|*-nto-*)
3660                     # Will load qnx.sh, which should change osname to nto
3661                     osname=qnx
3662                     osvers=''
3663                     ;;
3664                 *linux-android*)
3665                     # Catch arm-linux-androideabi, mipsel-linux-android,
3666                     # and i686-linux-android
3667                     osname=linux-android
3668                     osvers=''
3669                     ;;
3670                 *linux*)
3671                     # Something like arm-linux-gnueabihf is really just
3672                     # plain linux.
3673                     osname=linux
3674                     osvers=''
3675                     ;;
3676                 *solaris*|*sunos*)
3677                     osname=solaris
3678                     # XXX perhaps we should just assume
3679                     # osvers to be 2, or maybe take the value
3680                     # from targetarch. Using $run before the
3681                     # hints are run is somewhat icky.
3682                     set X `$run $uname -a 2>/dev/null`
3683                     shift
3684                     case "$3" in
3685                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3686                         *)  osvers="$3" ;;
3687                     esac
3688                     ;;
3689                 *)
3690                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3691                     osvers=''
3692                 ;;
3693             esac
3694             ;;
3695         esac
3696
3697         : Now look for a hint file osname_osvers, unless one has been
3698         : specified already.
3699         case "$hintfile" in
3700         ''|' ')
3701                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3702                 : Also try without trailing minor version numbers.
3703                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3704                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3705                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3706                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3707                 case "$file" in
3708                 '') dflt=none ;;
3709                 *)  case "$osvers" in
3710                         '') dflt=$file
3711                                 ;;
3712                         *)  if $test -f $src/hints/$file.sh ; then
3713                                         dflt=$file
3714                                 elif $test -f $src/hints/$xfile.sh ; then
3715                                         dflt=$xfile
3716                                 elif $test -f $src/hints/$xxfile.sh ; then
3717                                         dflt=$xxfile
3718                                 elif $test -f $src/hints/$xxxfile.sh ; then
3719                                         dflt=$xxxfile
3720                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3721                                         dflt=$xxxxfile
3722                                 elif $test -f "$src/hints/${osname}.sh" ; then
3723                                         dflt="${osname}"
3724                                 else
3725                                         dflt=none
3726                                 fi
3727                                 ;;
3728                         esac
3729                         ;;
3730                 esac
3731                 if $test -f Policy.sh ; then
3732                         case "$dflt" in
3733                         *Policy*) ;;
3734                         none) dflt="Policy" ;;
3735                         *) dflt="Policy $dflt" ;;
3736                         esac
3737                 fi
3738                 ;;
3739         *)
3740                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3741                 ;;
3742         esac
3743
3744         if $test -f Policy.sh ; then
3745                 $cat <<EOM
3746
3747 There's also a Policy hint file available, which should make the
3748 site-specific (policy) questions easier to answer.
3749 EOM
3750
3751         fi
3752
3753         $cat <<EOM
3754
3755 You may give one or more space-separated answers, or "none" if appropriate.
3756 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3757 previous run of Configure, you may specify it as well as or instead of
3758 OS-specific hints.  If hints are provided for your OS, you should use them:
3759 although Perl can probably be built without hints on many platforms, using
3760 hints often improve performance and may enable features that Configure can't
3761 set up on its own. If there are no hints that match your OS, specify "none";
3762 DO NOT give a wrong version or a wrong OS.
3763
3764 EOM
3765
3766         rp="Which of these apply, if any?"
3767         . UU/myread
3768         tans=$ans
3769         for file in $tans; do
3770                 if $test X$file = XPolicy -a -f Policy.sh; then
3771                         . Policy.sh
3772                         $cat Policy.sh >> UU/config.sh
3773                 elif $test -f $src/hints/$file.sh; then
3774                         . $src/hints/$file.sh
3775                         $cat $src/hints/$file.sh >> UU/config.sh
3776                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3777                         : nothing
3778                 else
3779                         : Give one chance to correct a possible typo.
3780                         echo "$file.sh does not exist"
3781                         dflt=$file
3782                         rp="hint to use instead?"
3783                         . UU/myread
3784                         for file in $ans; do
3785                                 if $test -f "$src/hints/$file.sh"; then
3786                                         . $src/hints/$file.sh
3787                                         $cat $src/hints/$file.sh >> UU/config.sh
3788                                 elif $test X$ans = X -o X$ans = Xnone ; then
3789                                         : nothing
3790                                 else
3791                                         echo "$file.sh does not exist -- ignored."
3792                                 fi
3793                         done
3794                 fi
3795         done
3796
3797         hint=recommended
3798         : Remember our hint file for later.
3799         if $test -f "$src/hints/$file.sh" ; then
3800                 hintfile="$file"
3801         else
3802                 hintfile=''
3803         fi
3804 fi
3805 cd UU
3806 ;;
3807 *)
3808         echo " "
3809         echo "Fetching default answers from $config_sh..." >&4
3810         tmp_n="$n"
3811         tmp_c="$c"
3812         cd ..
3813         cp $config_sh config.sh 2>/dev/null
3814         chmod +w config.sh
3815         . ./config.sh
3816         cd UU
3817         cp ../config.sh .
3818         n="$tmp_n"
3819         c="$tmp_c"
3820         hint=previous
3821         ;;
3822 esac
3823 . ./optdef.sh
3824
3825 : Restore computed paths
3826 for file in $loclist $trylist; do
3827         eval $file="\$_$file"
3828 done
3829
3830 cat << EOM
3831
3832 Configure uses the operating system name and version to set some defaults.
3833 The default value is probably right if the name rings a bell. Otherwise,
3834 since spelling matters for me, either accept the default or answer "none"
3835 to leave it blank.
3836
3837 EOM
3838 case "$osname" in
3839         ''|' ')
3840                 case "$hintfile" in
3841                 ''|' '|none) dflt=none ;;
3842                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3843                 esac
3844                 ;;
3845         *) dflt="$osname" ;;
3846 esac
3847 rp="Operating system name?"
3848 . ./myread
3849 case "$ans" in
3850 none)  osname='' ;;
3851 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3852 esac
3853 echo " "
3854 case "$osvers" in
3855         ''|' ')
3856                 case "$hintfile" in
3857                 ''|' '|none) dflt=none ;;
3858                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3859                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3860                         case "$dflt" in
3861                         ''|' ') dflt=none ;;
3862                         esac
3863                         ;;
3864                 esac
3865                 ;;
3866         *) dflt="$osvers" ;;
3867 esac
3868 rp="Operating system version?"
3869 . ./myread
3870 case "$ans" in
3871 none)  osvers='' ;;
3872 *) osvers="$ans" ;;
3873 esac
3874
3875
3876 . ./posthint.sh
3877
3878 : who configured the system
3879 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3880 case "$cf_by" in
3881 "")
3882         cf_by=`(logname) 2>/dev/null`
3883         case "$cf_by" in
3884         "")
3885                 cf_by=`(whoami) 2>/dev/null`
3886                 case "$cf_by" in
3887                 "") cf_by=unknown ;;
3888                 esac ;;
3889         esac ;;
3890 esac
3891
3892 : decide how portable to be.  Allow command line overrides.
3893 case "$d_portable" in
3894 "$undef") ;;
3895 *)      d_portable="$define" ;;
3896 esac
3897
3898 : set up shell script to do ~ expansion
3899 cat >filexp <<EOSS
3900 $startsh
3901 : expand filename
3902 case "\$1" in
3903  \~/*|\~)
3904         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3905         ;;
3906  \~*)
3907         if $test -f /bin/csh; then
3908                 /bin/csh -f -c "glob \$1"
3909                 failed=\$?
3910                 echo ""
3911                 exit \$failed
3912         else
3913                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3914                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3915                 if $test ! -d "\$dir"; then
3916                         me=\`basename \$0\`
3917                         echo "\$me: can't locate home directory for: \$name" >&2
3918                         exit 1
3919                 fi
3920                 case "\$1" in
3921                 */*)
3922                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3923                         ;;
3924                 *)
3925                         echo \$dir
3926                         ;;
3927                 esac
3928         fi
3929         ;;
3930 *)
3931         echo \$1
3932         ;;
3933 esac
3934 EOSS
3935 chmod +x filexp
3936 $eunicefix filexp
3937
3938 : now set up to get a file name
3939 cat <<EOS >getfile
3940 $startsh
3941 EOS
3942 cat <<'EOSC' >>getfile
3943 tilde=''
3944 fullpath=''
3945 already=''
3946 skip=''
3947 none_ok=''
3948 exp_file=''
3949 nopath_ok=''
3950 orig_rp="$rp"
3951 orig_dflt="$dflt"
3952 case "$gfpth" in
3953 '') gfpth='.' ;;
3954 esac
3955
3956 case "$fn" in
3957 *\(*)
3958         : getfile will accept an answer from the comma-separated list
3959         : enclosed in parentheses even if it does not meet other criteria.
3960         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3961         fn=`echo $fn | sed 's/(.*)//'`
3962         ;;
3963 esac
3964
3965 case "$fn" in
3966 *:*)
3967         loc_file=`expr $fn : '.*:\(.*\)'`
3968         fn=`expr $fn : '\(.*\):.*'`
3969         ;;
3970 esac
3971
3972 case "$fn" in
3973 *~*) tilde=true;;
3974 esac
3975 case "$fn" in
3976 */*) fullpath=true;;
3977 esac
3978 case "$fn" in
3979 *+*) skip=true;;
3980 esac
3981 case "$fn" in
3982 *n*) none_ok=true;;
3983 esac
3984 case "$fn" in
3985 *e*) exp_file=true;;
3986 esac
3987 case "$fn" in
3988 *p*) nopath_ok=true;;
3989 esac
3990
3991 case "$fn" in
3992 *f*) type='File';;
3993 *d*) type='Directory';;
3994 *l*) type='Locate';;
3995 esac
3996
3997 what="$type"
3998 case "$what" in
3999 Locate) what='File';;
4000 esac
4001
4002 case "$exp_file" in
4003 '')
4004         case "$d_portable" in
4005         "$define") ;;
4006         *) exp_file=true;;
4007         esac
4008         ;;
4009 esac
4010
4011 cd ..
4012 while test "$type"; do
4013         redo=''
4014         rp="$orig_rp"
4015         dflt="$orig_dflt"
4016         case "$tilde" in
4017         true) rp="$rp (~name ok)";;
4018         esac
4019         . UU/myread
4020         if test -f UU/getfile.ok && \
4021                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4022         then
4023                 value="$ans"
4024                 ansexp="$ans"
4025                 break
4026         fi
4027         case "$ans" in
4028         none)
4029                 value=''
4030                 ansexp=''
4031                 case "$none_ok" in
4032                 true) type='';;
4033                 esac
4034                 ;;
4035         *)
4036                 case "$tilde" in
4037                 '') value="$ans"
4038                         ansexp="$ans";;
4039                 *)
4040                         value=`UU/filexp $ans`
4041                         case $? in
4042                         0)
4043                                 if test "$ans" != "$value"; then
4044                                         echo "(That expands to $value on this system.)"
4045                                 fi
4046                                 ;;
4047                         *) value="$ans";;
4048                         esac
4049                         ansexp="$value"
4050                         case "$exp_file" in
4051                         '') value="$ans";;
4052                         esac
4053                         ;;
4054                 esac
4055                 case "$fullpath" in
4056                 true)
4057                         case "$ansexp" in
4058                         /*) value="$ansexp" ;;
4059                         [a-zA-Z]:/*) value="$ansexp" ;;
4060                         *)
4061                                 redo=true
4062                                 case "$already" in
4063                                 true)
4064                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4065                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4066                                         ;;
4067                                 *)
4068                                 echo "Please give a full path name, starting with slash." >&4
4069                                         case "$tilde" in
4070                                         true)
4071                                 echo "Note that using ~name is ok provided it expands well." >&4
4072                                                 already=true
4073                                                 ;;
4074                                         esac
4075                                 esac
4076                                 ;;
4077                         esac
4078                         ;;
4079                 esac
4080                 case "$redo" in
4081                 '')
4082                         case "$type" in
4083                         File)
4084                                 for fp in $gfpth; do
4085                                         if test "X$fp" = X.; then
4086                                             pf="$ansexp"
4087                                         else    
4088                                             pf="$fp/$ansexp"
4089                                         fi
4090                                         if test -f "$pf"; then
4091                                                 type=''
4092                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4093                                         then
4094                                                 echo "($value is not a plain file, but that's ok.)"
4095                                                 type=''
4096                                         fi
4097                                         if test X"$type" = X; then
4098                                             value="$pf"
4099                                             break
4100                                         fi
4101                                 done
4102                                 ;;
4103                         Directory)
4104                                 for fp in $gfpth; do
4105                                         if test "X$fp" = X.; then
4106                                             dir="$ans"
4107                                             direxp="$ansexp"
4108                                         else    
4109                                             dir="$fp/$ansexp"
4110                                             direxp="$fp/$ansexp"
4111                                         fi
4112                                         if test -d "$direxp"; then
4113                                                 type=''
4114                                                 value="$dir"
4115                                                 break
4116                                         fi
4117                                 done
4118                                 ;;
4119                         Locate)
4120                                 if test -d "$ansexp"; then
4121                                         echo "(Looking for $loc_file in directory $value.)"
4122                                         value="$value/$loc_file"
4123                                         ansexp="$ansexp/$loc_file"
4124                                 fi
4125                                 if test -f "$ansexp"; then
4126                                         type=''
4127                                 fi
4128                                 case "$nopath_ok" in
4129                                 true)   case "$value" in
4130                                         */*) ;;
4131                                         *)      echo "Assuming $value will be in people's path."
4132                                                 type=''
4133                                                 ;;
4134                                         esac
4135                                         ;;
4136                                 esac
4137                                 ;;
4138                         esac
4139
4140                         case "$skip" in
4141                         true) type='';
4142                         esac
4143
4144                         case "$type" in
4145                         '') ;;
4146                         *)
4147                                 if test "$fastread" = yes; then
4148                                         dflt=y
4149                                 else
4150                                         dflt=n
4151                                 fi
4152                                 rp="$what $value doesn't exist.  Use that name anyway?"
4153                                 . UU/myread
4154                                 dflt=''
4155                                 case "$ans" in
4156                                 y*) type='';;
4157                                 *) echo " ";;
4158                                 esac
4159                                 ;;
4160                         esac
4161                         ;;
4162                 esac
4163                 ;;
4164         esac
4165 done
4166 cd UU
4167 ans="$value"
4168 rp="$orig_rp"
4169 dflt="$orig_dflt"
4170 rm -f getfile.ok
4171 test "X$gfpthkeep" != Xy && gfpth=""
4172 EOSC
4173
4174 : determine root of directory hierarchy where package will be installed.
4175 case "$prefix" in
4176 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4177         ;;
4178 *)      dflt="$prefix"
4179         ;;
4180 esac
4181 $cat <<EOM
4182
4183 By default, $package will be installed in $dflt/bin, manual pages
4184 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4185 installation directories. Typically this is something like /usr/local.
4186 If you wish to have binaries under /usr/bin but other parts of the
4187 installation under /usr/local, that's ok: you will be prompted
4188 separately for each of the installation directories, the prefix being
4189 only used to set the defaults.
4190
4191 EOM
4192 fn=d~
4193 rp='Installation prefix to use?'
4194 . ./getfile
4195 oldprefix=''
4196 case "$prefix" in
4197 '')     ;;
4198 *)      case "$ans" in
4199         "$prefix") ;;
4200         *) oldprefix="$prefix";;
4201         esac
4202         ;;
4203 esac
4204
4205 case "$ans" in
4206 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4207         ;;
4208 *)      prefix="$ans"
4209 esac
4210
4211 case "$ansexp" in
4212 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4213         ;;
4214 *)      prefixexp="$ansexp"
4215 esac
4216
4217 : allow them to override the AFS root
4218 case "$afsroot" in
4219 '')     afsroot=/afs ;;
4220 *)      afsroot=$afsroot ;;
4221 esac
4222
4223 : is AFS running?
4224 echo " "
4225 case "$afs" in
4226 $define|true)   afs=true ;;
4227 $undef|false)   afs=false ;;
4228 *)      if $test -d $afsroot; then
4229                 afs=true
4230         else
4231                 afs=false
4232         fi
4233         ;;
4234 esac
4235 if $afs; then
4236         echo "AFS may be running... I'll be extra cautious then..." >&4
4237 else
4238         echo "AFS does not seem to be running..." >&4
4239 fi
4240
4241 : determine installation prefix for where package is to be installed.
4242 if $afs; then
4243 $cat <<EOM
4244
4245 Since you are running AFS, I need to distinguish the directory in which
4246 files will reside from the directory in which they are installed (and from
4247 which they are presumably copied to the former directory by occult means).
4248
4249 EOM
4250         case "$installprefix" in
4251         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4252         *) dflt="$installprefix";;
4253         esac
4254 else
4255 $cat <<EOM
4256
4257 In some special cases, particularly when building $package for distribution,
4258 it is convenient to distinguish the directory in which files should be
4259 installed from the directory ($prefix) in which they will
4260 eventually reside.  For most users, these two directories are the same.
4261
4262 EOM
4263         case "$installprefix" in
4264         '') dflt=$prefix ;;
4265         *) dflt=$installprefix;;
4266         esac
4267 fi
4268 fn=d~
4269 rp='What installation prefix should I use for installing files?'
4270 . ./getfile
4271 installprefix="$ans"
4272 installprefixexp="$ansexp"
4273
4274 : Perform the prefixexp/installprefixexp correction if necessary
4275 cat <<EOS >installprefix
4276 $startsh
4277 EOS
4278 cat <<'EOSC' >>installprefix
4279 : Change installation prefix, if necessary.
4280 if $test X"$prefix" != X"$installprefix"; then
4281     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4282 else
4283     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4284 fi
4285 EOSC
4286 chmod +x installprefix
4287 $eunicefix installprefix
4288
4289 : Set variables such as privlib and privlibexp from the output of ./getfile
4290 : performing the prefixexp/installprefixexp correction if necessary.
4291 cat <<EOS >setprefixvar
4292 $startsh
4293 EOS
4294 cat <<'EOSC' >>setprefixvar
4295 eval "${prefixvar}=\"\$ans\""
4296 eval "${prefixvar}exp=\"\$ansexp\""
4297 . ./installprefix
4298 EOSC
4299 chmod +x setprefixvar
4300 $eunicefix setprefixvar
4301
4302 : set up the script used to warn in case of inconsistency
4303 cat <<EOS >whoa
4304 $startsh
4305 EOS
4306 cat <<'EOSC' >>whoa
4307 dflt=y
4308 case "$hint" in
4309     recommended)
4310         case "$hintfile" in
4311         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4312                 ;;
4313         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4314                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4315                 ;;
4316         esac
4317         ;;
4318     *)  echo " "
4319         echo "*** WHOA THERE!!! ***" >&4
4320         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4321         ;;
4322 esac
4323 rp="    Keep the $hint value?"
4324 . ./myread
4325 case "$ans" in
4326 y) td=$was; tu=$was;;
4327 esac
4328 EOSC
4329
4330 : function used to set '$1' to '$val'
4331 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4332 case "$val$was" in
4333 $define$undef) . ./whoa; eval "$var=\$td";;
4334 $undef$define) . ./whoa; eval "$var=\$tu";;
4335 *) eval "$var=$val";;
4336 esac'
4337
4338 : get the patchlevel
4339 echo " "
4340 echo "Getting the current patchlevel..." >&4
4341 if $test -r $rsrc/patchlevel.h;then
4342         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4343         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4344         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4345         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4346         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4347         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4348         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4349 else
4350         revision=0
4351         patchlevel=0
4352         subversion=0
4353         api_revision=0
4354         api_version=0
4355         api_subversion=0
4356         perl_patchlevel=0
4357         $echo "(You do not have patchlevel.h.  Eek.)"
4358 fi
4359 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4360 version_patchlevel_string="version $patchlevel subversion $subversion"
4361 case "$perl_patchlevel" in
4362 0|'') ;;
4363 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4364     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4365     ;;
4366 esac
4367
4368 $echo "(You have $package $version_patchlevel_string.)"
4369
4370 case "$osname" in
4371 dos|vms)
4372         : XXX Should be a Configure test for double-dots in filenames.
4373         version=`echo $revision $patchlevel $subversion | \
4374                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4375         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4376                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4377         ;;
4378 *)
4379         version=`echo $revision $patchlevel $subversion | \
4380                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4381         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4382                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4383         ;;
4384 esac
4385 : Special case the 5.005_xx maintenance series, which used 5.005
4386 : without any subversion label as a subdirectory in $sitelib
4387 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4388         api_versionstring='5.005'
4389 fi
4390
4391 : Do we want threads support and if so, what type
4392 case "$usethreads" in
4393 $define|true|[yY]*)     dflt='y';;
4394 *)     # Catch case where user specified ithreads or 5005threads but
4395        # forgot -Dusethreads (A.D. 4/2002)
4396        case "$useithreads$use5005threads" in
4397        *$define*)       dflt='y';;
4398        *)               dflt='n';;
4399        esac
4400        ;;
4401 esac
4402 cat <<EOM
4403
4404 Perl can be built to offer a form of threading support on some systems
4405 To do so, Configure can be run with -Dusethreads.
4406
4407 Note that Perl built with threading support runs slightly slower
4408 and uses slightly more memory than plain Perl.
4409
4410 If this doesn't make any sense to you, just accept the default '$dflt'.
4411 EOM
4412 rp='Build a threading Perl?'
4413 . ./myread
4414 case "$ans" in
4415 y|Y)    val="$define" ;;
4416 *)      val="$undef" ;;
4417 esac
4418 set usethreads
4419 eval $setvar
4420
4421 if $test $patchlevel -lt 9; then
4422     case "$usethreads" in
4423     $define)
4424         : Default to ithreads unless overridden on command line or with
4425         : old config.sh
4426         dflt='y'
4427         case "$use5005threads" in
4428                 $define|true|[yY]*)
4429                         echo "5.005 threads are no longer supported"
4430                         exit 1
4431                 ;;
4432         esac
4433         case "$useithreads" in
4434                 $undef|false|[nN]*) dflt='n';;
4435         esac
4436         rp='Use the newer interpreter-based ithreads?'
4437         . ./myread
4438         case "$ans" in
4439         y|Y)    val="$define" ;;
4440         *)      val="$undef" ;;
4441         esac
4442         set useithreads
4443         eval $setvar
4444         : Now set use5005threads to the opposite value.
4445         case "$useithreads" in
4446         $define) val="$undef" ;;
4447         *) val="$define" ;;
4448         esac
4449         set use5005threads
4450         eval $setvar
4451         ;;
4452     *)
4453         useithreads="$undef"
4454         use5005threads="$undef"
4455         ;;
4456     esac
4457
4458     case "$useithreads$use5005threads" in
4459     "$define$define")
4460         $cat >&4 <<EOM
4461
4462 You cannot have both the ithreads and the 5.005 threads enabled
4463 at the same time.  Disabling the 5.005 threads since they are
4464 much less stable than the ithreads.
4465
4466 EOM
4467         use5005threads="$undef"
4468         ;;
4469     esac
4470
4471 else
4472 : perl-5.9.x and later
4473
4474     if test X"$usethreads" = "X$define"; then
4475         case "$use5005threads" in
4476             $define|true|[yY]*)
4477                 $cat >&4 <<EOM
4478
4479 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4480
4481 EOM
4482             ;;
4483         esac
4484     fi
4485
4486     use5005threads="$undef"
4487     useithreads="$usethreads"
4488 fi
4489
4490 case "$d_oldpthreads" in
4491 '')     : Configure tests would be welcome here.  For now, assume undef.
4492         val="$undef" ;;
4493 *)      val="$d_oldpthreads" ;;
4494 esac
4495 set d_oldpthreads
4496 eval $setvar
4497
4498
4499 : Look for a hint-file generated 'call-back-unit'.  If the
4500 : user has specified that a threading perl is to be built,
4501 : we may need to set or change some other defaults.
4502 if $test -f usethreads.cbu; then
4503     echo "Your platform has some specific hints regarding threaded builds, using them..."
4504     . ./usethreads.cbu
4505 else
4506     case "$usethreads" in
4507         "$define"|true|[yY]*)
4508                 $cat <<EOM
4509 (Your platform does not have any specific hints for threaded builds.
4510  Assuming POSIX threads, then.)
4511 EOM
4512         ;;
4513     esac
4514 fi
4515
4516 : Check if multiplicity is required
4517 cat <<EOM
4518
4519 Perl can be built so that multiple Perl interpreters can coexist
4520 within the same Perl executable.
4521 EOM
4522
4523 case "$useithreads" in
4524 $define)
4525         cat <<EOM
4526 This multiple interpreter support is required for interpreter-based threads.
4527 EOM
4528         val="$define"
4529         ;;
4530 *)      case "$usemultiplicity" in
4531         $define|true|[yY]*)     dflt='y';;
4532         *) dflt='n';;
4533         esac
4534         echo " "
4535         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4536         rp='Build Perl for multiplicity?'
4537         . ./myread
4538         case "$ans" in
4539         y|Y)    val="$define" ;;
4540         *)      val="$undef" ;;
4541         esac
4542         ;;
4543 esac
4544 set usemultiplicity
4545 eval $setvar
4546
4547 : Check if morebits is requested
4548 case "$usemorebits" in
4549 "$define"|true|[yY]*)
4550         use64bitint="$define"
4551         uselongdouble="$define"
4552         usemorebits="$define"
4553         ;;
4554 *)      usemorebits="$undef"
4555         ;;
4556 esac
4557
4558 : Determine the C compiler to be used
4559 echo " "
4560 case "$cc" in
4561 '') dflt=cc;;
4562 *) dflt="$cc";;
4563 esac
4564 rp="Use which C compiler?"
4565 . ./myread
4566 cc="$ans"
4567
4568 : See whether they have no cc but they do have gcc
4569 . ./trygcc
4570 if $test -f cc.cbu; then
4571     . ./cc.cbu
4572 fi
4573 . ./checkcc
4574
4575 : make some quick guesses about what we are up against
4576 echo " "
4577 $echo $n "Hmm...  $c"
4578 echo exit 1 >bsd
4579 echo exit 1 >usg
4580 echo exit 1 >v7
4581 echo exit 1 >osf1
4582 echo exit 1 >eunice
4583 echo exit 1 >xenix
4584 echo exit 1 >venix
4585 echo exit 1 >os2
4586 d_bsd="$undef"
4587 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4588 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4589 then
4590         echo "Looks kind of like an OSF/1 system, but we'll see..."
4591         echo exit 0 >osf1
4592 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4593         xxx=`./loc addbib blurfl $pth`
4594         if $test -f $xxx; then
4595         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4596                 echo exit 0 >bsd
4597                 echo exit 0 >usg
4598         else
4599                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4600                         echo "Looks kind of like an extended USG system, but we'll see..."
4601                 else
4602                         echo "Looks kind of like a USG system, but we'll see..."
4603                 fi
4604                 echo exit 0 >usg
4605         fi
4606 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4607         echo "Looks kind of like a BSD system, but we'll see..."
4608         d_bsd="$define"
4609         echo exit 0 >bsd
4610 else
4611         echo "Looks kind of like a Version 7 system, but we'll see..."
4612         echo exit 0 >v7
4613 fi
4614 case "$eunicefix" in
4615 *unixtovms*)
4616         $cat <<'EOI'
4617 There is, however, a strange, musty smell in the air that reminds me of
4618 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4619 EOI
4620         echo exit 0 >eunice
4621         d_eunice="$define"
4622 : it so happens the Eunice I know will not run shell scripts in Unix format
4623         ;;
4624 *)
4625         echo " "
4626         echo "Congratulations.  You aren't running Eunice."
4627         d_eunice="$undef"
4628         ;;
4629 esac
4630 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4631 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4632 : semicolon as a patch separator
4633 case "$p_" in
4634 :) ;;
4635 *)
4636         $cat <<'EOI'
4637 I have the feeling something is not exactly right, however...don't tell me...
4638 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4639 (Or you may be running DOS with DJGPP.)
4640 EOI
4641         echo exit 0 >os2
4642         ;;
4643 esac
4644 if test -f /xenix; then
4645         echo "Actually, this looks more like a XENIX system..."
4646         echo exit 0 >xenix
4647         d_xenix="$define"
4648 else
4649         echo " "
4650         echo "It's not Xenix..."
4651         d_xenix="$undef"
4652 fi
4653 chmod +x xenix
4654 $eunicefix xenix
4655 if test -f /venix; then
4656         echo "Actually, this looks more like a VENIX system..."
4657         echo exit 0 >venix
4658 else
4659         echo " "
4660         if ./xenix; then
4661                 : null
4662         else
4663                 echo "Nor is it Venix..."
4664         fi
4665 fi
4666 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4667 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4668 $rm -f foo
4669
4670 : Check if we are using GNU gcc and what its version is
4671 echo " "
4672 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4673 $cat >try.c <<EOM
4674 #include <stdio.h>
4675 int main() {
4676 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4677 #ifdef __VERSION__
4678         printf("%s\n", __VERSION__);
4679 #else
4680         printf("%s\n", "1");
4681 #endif
4682 #endif
4683         return(0);
4684 }
4685 EOM
4686 if $cc -o try $ccflags $ldflags try.c; then
4687         gccversion=`$run ./try`
4688         case "$gccversion" in
4689         '') echo "You are not using GNU cc." ;;
4690         *)  echo "You are using GNU cc $gccversion."
4691             ccname=gcc
4692             ;;
4693         esac
4694 else
4695         echo " "
4696         echo "*** WHOA THERE!!! ***" >&4
4697         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4698         case "$knowitall" in
4699         '')
4700         echo "    You'd better start hunting for one and let me know about it." >&4
4701                 exit 1
4702                 ;;
4703         esac
4704 fi
4705 $rm -f try try.*
4706 case "$gccversion" in
4707 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4708 esac
4709 case "$gccversion" in
4710 '') gccosandvers='' ;;
4711 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4712    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4713    gccshortvers=''
4714    case "$gccosandvers" in
4715    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4716    $osname$osvers) ;; # looking good
4717    $osname*) cat <<EOM >&4
4718
4719 *** WHOA THERE!!! ***
4720
4721     Your gcc has not been compiled for the exact release of
4722     your operating system ($gccosandvers versus $osname$osvers).
4723
4724     In general it is a good idea to keep gcc synchronized with
4725     the operating system because otherwise serious problems
4726     may ensue when trying to compile software, like Perl.
4727
4728     I'm trying to be optimistic here, though, and will continue.
4729     If later during the configuration and build icky compilation
4730     problems appear (headerfile conflicts being the most common
4731     manifestation), I suggest reinstalling the gcc to match
4732     your operating system release.
4733
4734 EOM
4735       ;;
4736    *) gccosandvers='' ;; # failed to parse, better be silent
4737    esac
4738    ;;
4739 esac
4740 case "$ccname" in
4741 '') ccname="$cc" ;;
4742 esac
4743
4744 # gcc 3.* complain about adding -Idirectories that they already know about,
4745 # so we will take those off from locincpth.
4746 case "$gccversion" in
4747 3.*)
4748     echo "main(){}">try.c
4749     for incdir in $locincpth; do
4750        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4751              grep '^c[cp]p*[01]: warning: changing search order '`
4752        if test "X$warn" != X; then
4753            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4754        fi
4755     done
4756     $rm -f try try.*
4757 esac
4758
4759 # gcc 4.9 by default does some optimizations that break perl.
4760 # see ticket 121505.
4761 #
4762 # The -fwrapv disables those optimizations (and probably others,) so
4763 # for gcc 4.9 (and later, since the optimizations probably won't go
4764 # away), add -fwrapv unless the user requests -fno-wrapv, which
4765 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4766 # which turns the overflows -fwrapv ignores into runtime errors.
4767 case "$gccversion" in
4768 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4769     case "$ccflags" in
4770     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4771     *) ccflags="$ccflags -fwrapv" ;;
4772     esac
4773 esac
4774
4775 : What should the include directory be ?
4776 : Use sysroot if set, so findhdr looks in the right place.
4777 echo " "
4778 $echo $n "Hmm...  $c"
4779 dflt="$sysroot/usr/include"
4780 incpath=''
4781 mips_type=''
4782 if $test -f /bin/mips && /bin/mips; then
4783         echo "Looks like a MIPS system..."
4784         $cat >usr.c <<'EOCP'
4785 #ifdef SYSTYPE_BSD43
4786 /bsd43
4787 #endif
4788 EOCP
4789         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4790                 dflt='/bsd43/usr/include'
4791                 incpath='/bsd43'
4792                 mips_type='BSD 4.3'
4793         else
4794                 mips_type='System V'
4795         fi
4796         $rm -f usr.c usr.out
4797         echo "and you're compiling with the $mips_type compiler and libraries."
4798         xxx_prompt=y
4799         echo "exit 0" >mips
4800 else
4801         echo "Doesn't look like a MIPS system."
4802         xxx_prompt=n
4803         echo "exit 1" >mips
4804 fi
4805 chmod +x mips
4806 $eunicefix mips
4807 case "$usrinc" in
4808 '') ;;
4809 *) dflt="$usrinc";;
4810 esac
4811 case "$xxx_prompt" in
4812 y)      fn=d/
4813         echo " "
4814         rp='Where are the include files you want to use?'
4815         . ./getfile
4816         usrinc="$ans"
4817         ;;
4818 *)      usrinc="$dflt"
4819         ;;
4820 esac
4821
4822 : see how we invoke the C preprocessor
4823 echo " "
4824 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4825 cat <<'EOT' >testcpp.c
4826 #define ABC abc
4827 #define XYZ xyz
4828 ABC.XYZ
4829 EOT
4830 cd ..
4831 if test ! -f cppstdin; then
4832         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4833                 # AIX cc -E doesn't show the absolute headerfile
4834                 # locations but we'll cheat by using the -M flag.
4835                 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
4836         else
4837                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4838         fi
4839 else
4840         echo "Keeping your $hint cppstdin wrapper."
4841 fi
4842 chmod 755 cppstdin
4843 wrapper=`pwd`/cppstdin
4844 ok='false'
4845 cd UU
4846
4847 if $test "X$cppstdin" != "X" && \
4848         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4850 then
4851         echo "You used to use $cppstdin $cppminus so we'll use that again."
4852         case "$cpprun" in
4853         '') echo "But let's see if we can live without a wrapper..." ;;
4854         *)
4855                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4856                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4857                 then
4858                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4859                         ok='true'
4860                 else
4861                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4862                 fi
4863                 ;;
4864         esac
4865 else
4866         case "$cppstdin" in
4867         '') ;;
4868         *)
4869                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4870                 ;;
4871         esac
4872 fi
4873
4874 if $ok; then
4875         : nothing
4876 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4877         $cc -E <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "Yup, it does."
4880         x_cpp="$cc $cppflags -E"
4881         x_minus='';
4882 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4883         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4884         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4885         echo "Yup, it does."
4886         x_cpp="$cc $cppflags -E"
4887         x_minus='-';
4888 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4889         $cc -P <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         echo "Yipee, that works!"
4892         x_cpp="$cc $cppflags -P"
4893         x_minus='';
4894 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4895         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4896         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4897         echo "At long last!"
4898         x_cpp="$cc $cppflags -P"
4899         x_minus='-';
4900 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4901         $cpp <testcpp.c >testcpp.out 2>&1; \
4902         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903         echo "It works!"
4904         x_cpp="$cpp $cppflags"
4905         x_minus='';
4906 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4907         $cpp - <testcpp.c >testcpp.out 2>&1; \
4908         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4909         echo "Hooray, it works!  I was beginning to wonder."
4910         x_cpp="$cpp $cppflags"
4911         x_minus='-';
4912 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4913         $wrapper <testcpp.c >testcpp.out 2>&1; \
4914         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4915         x_cpp="$wrapper"
4916         x_minus=''
4917         echo "Eureka!"
4918 else
4919         dflt=''
4920         rp="No dice.  I can't find a C preprocessor.  Name one:"
4921         . ./myread
4922         x_cpp="$ans"
4923         x_minus=''
4924         $x_cpp <testcpp.c >testcpp.out 2>&1
4925         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4926                 echo "OK, that will do." >&4
4927         else
4928 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4929                 exit 1
4930         fi
4931 fi
4932
4933 case "$ok" in
4934 false)
4935         cppstdin="$x_cpp"
4936         cppminus="$x_minus"
4937         cpprun="$x_cpp"
4938         cpplast="$x_minus"
4939         set X $x_cpp
4940         shift
4941         case "$1" in
4942         "$cpp")
4943                 echo "Perhaps can we force $cc -E using a wrapper..."
4944                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4945                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4946                 then
4947                         echo "Yup, we can."
4948                         cppstdin="$wrapper"
4949                         cppminus='';
4950                 else
4951                         echo "Nope, we'll have to live without it..."
4952                 fi
4953                 ;;
4954         esac
4955         case "$cpprun" in
4956         "$wrapper")
4957                 cpprun=''
4958                 cpplast=''
4959                 ;;
4960         esac
4961         ;;
4962 esac
4963
4964 case "$cppstdin" in
4965 "$wrapper"|'cppstdin') ;;
4966 *) $rm -f $wrapper;;
4967 esac
4968 $rm -f testcpp.c testcpp.out
4969
4970 : Adjust cppfilter for path component separator
4971 case "$osname" in
4972 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4973 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4974 *)   cppfilter='' ;;
4975 esac
4976
4977 : Use gcc to determine libpth and incpth
4978 # If using gcc or clang, we can get better values for libpth, incpth
4979 # and usrinc directly from the compiler.
4980 # Note that ccname for clang is also gcc.
4981 case "$ccname" in
4982     gcc)
4983         $echo 'extern int foo;' > try.c
4984         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4985         shift
4986         if $test $# -gt 0; then
4987             incpth="$incpth $*"
4988             incpth="`$echo $incpth|$sed 's/^ //'`"
4989             for i in $*; do
4990                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4991                 if $test -d $j; then
4992                     libpth="$libpth $j"
4993                 fi
4994             done
4995             libpth="`$echo $libpth|$sed 's/^ //'`"
4996             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4997                 if $test -d $xxx; then
4998                     case " $libpth " in
4999                     *" $xxx "*) ;;
5000                     *) libpth="$libpth $xxx";;
5001                     esac
5002                 fi
5003             done
5004         fi
5005         $rm -f try.c
5006         case "$usrinc" in
5007         '') for i in $incpth; do
5008                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5009                     usrinc="$i"
5010                     break
5011                 fi
5012             done
5013             ;;
5014         esac
5015
5016         case "$usecrosscompile" in
5017         $define|true|[yY]*)
5018             case "$incpth" in
5019                 '') echo "Incpth not defined." >&4; croak=y ;;
5020                 *)  echo "Using incpth '$incpth'." >&4 ;;
5021             esac
5022             case "$libpth" in
5023                 '') echo "Libpth not defined." >&4; croak=y ;;
5024                 *)  echo "Using libpth '$libpth'." >&4 ;;
5025             esac
5026             case "$usrinc" in
5027                 '') echo "Usrinc not defined." >&4; croak=y ;;
5028                 *)  echo "Using usrinc $usrinc." >&4 ;;
5029             esac
5030             case "$croak" in
5031                 y)
5032                 if test "X$sysroot" = X; then
5033                     echo "Cannot continue, aborting." >&4; exit 1
5034                 else
5035                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5036                 fi
5037                 ;;
5038             esac
5039             ;;
5040         esac
5041     ;;
5042 esac
5043
5044 : Default value for incpth is just usrinc
5045 case "$incpth" in
5046 '') incpth="$usrinc";;
5047 esac
5048
5049 : Set private lib path
5050 case "$plibpth" in
5051 '') if ./mips; then
5052         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5053     fi;;
5054 esac
5055 case "$libpth" in
5056 ' ') dlist='';;
5057 '') dlist="$loclibpth $plibpth $glibpth";;
5058 *) dlist="$libpth";;
5059 esac
5060
5061 : Now check and see which directories actually exist, avoiding duplicates
5062 for xxx in $dlist
5063 do
5064     if $test -d $xxx; then
5065                 case " $libpth " in
5066                 *" $xxx "*) ;;
5067                 *) libpth="$libpth $xxx";;
5068                 esac
5069     fi
5070 done
5071 $cat <<'EOM'
5072
5073 Some systems have incompatible or broken versions of libraries.  Among
5074 the directories listed in the question below, please remove any you
5075 know not to be holding relevant libraries, and add any that are needed.
5076 Say "none" for none.
5077
5078 EOM
5079
5080 if test "X$sysroot" != X; then
5081     $cat <<EOM
5082 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5083
5084 EOM
5085 fi
5086
5087 case "$libpth" in
5088 '') dflt='none';;
5089 *)
5090         set X $libpth
5091         shift
5092         dflt=${1+"$@"}
5093         ;;
5094 esac
5095 rp="Directories to use for library searches?"
5096 . ./myread
5097 case "$ans" in
5098 none) libpth=' ';;
5099 *) libpth="$ans";;
5100 esac
5101
5102 : compute shared library extension
5103 case "$so" in
5104 '')
5105         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5106                 dflt='sl'
5107         else
5108                 dflt='so'
5109         fi
5110         ;;
5111 *) dflt="$so";;
5112 esac
5113 $cat <<EOM
5114
5115 On some systems, shared libraries may be available.  Answer 'none' if
5116 you want to suppress searching of shared libraries for the remainder
5117 of this configuration.
5118
5119 EOM
5120 rp='What is the file extension used for shared libraries?'
5121 . ./myread
5122 so="$ans"
5123
5124 : Does target system insist that shared library basenames are unique
5125 $cat << EOM
5126
5127 Some dynamic loaders assume that the *basename* of shared library filenames
5128 are globally unique.  We'll default this to undef as we assume your system
5129 is not this weird. Set to defined if you're on one of them.
5130
5131 EOM
5132
5133 dflt='n'
5134 rp='Make shared library basenames unique?'
5135 . ./myread
5136 case "$ans" in
5137 y|Y) val="$define" ;;
5138 *)   val="$undef"  ;;
5139 esac
5140 set d_libname_unique
5141 eval $setvar
5142
5143 : Define several unixisms.
5144 : Hints files or command line option can be used to override them.
5145 : The convoluted testing is in case hints files set either the old
5146 : or the new name.
5147 case "$_exe" in
5148 '')     case "$exe_ext" in
5149         '')     ;;
5150         *)      _exe="$exe_ext" ;;
5151         esac
5152         ;;
5153 esac
5154 case "$_a" in
5155 '')     case "$lib_ext" in
5156     '') _a='.a';;
5157         *)      _a="$lib_ext" ;;
5158         esac
5159         ;;
5160 esac
5161 case "$_o" in
5162 '') case "$obj_ext" in
5163         '')     _o='.o';;
5164         *)      _o="$obj_ext";;
5165         esac
5166         ;;
5167 esac
5168 case "$p_" in
5169 '') case "$path_sep" in
5170         '')     p_=':';;
5171         *)      p_="$path_sep";;
5172         esac
5173         ;;
5174 esac
5175 exe_ext=$_exe
5176 lib_ext=$_a
5177 obj_ext=$_o
5178 path_sep=$p_
5179
5180 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5181
5182 : Which makefile gets called first.  This is used by make depend.
5183 case "$firstmakefile" in
5184 '') firstmakefile='makefile';;
5185 esac
5186
5187 : Check is we will use socks
5188 case "$usesocks" in
5189 $define|true|[yY]*)     dflt='y';;
5190 *) dflt='n';;
5191 esac
5192 cat <<EOM
5193
5194 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5195 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5196 to use the PerlIO abstraction layer, this will be implicitly selected.
5197
5198 If this doesn't make any sense to you, just accept the default '$dflt'.
5199 EOM
5200 rp='Build Perl for SOCKS?'
5201 . ./myread
5202 case "$ans" in
5203 y|Y)    val="$define" ;;
5204 *)      val="$undef" ;;
5205 esac
5206 set usesocks
5207 eval $setvar
5208
5209 : Check for uselongdouble support
5210 case "$ccflags" in
5211 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5212 esac
5213
5214 case "$uselongdouble" in
5215 $define|true|[yY]*)     dflt='y';;
5216 *) dflt='n';;
5217 esac
5218 cat <<EOM
5219
5220 Perl can be built to take advantage of long doubles which
5221 (if available) may give more accuracy and range for floating point numbers.
5222
5223 If this doesn't make any sense to you, just accept the default '$dflt'.
5224 EOM
5225 rp='Try to use long doubles if available?'
5226 . ./myread
5227 case "$ans" in
5228 y|Y)    val="$define"   ;;
5229 *)      val="$undef"    ;;
5230 esac
5231 set uselongdouble
5232 eval $setvar
5233
5234 case "$uselongdouble" in
5235 true|[yY]*) uselongdouble="$define" ;;
5236 esac
5237
5238 : Look for a hint-file generated 'call-back-unit'.  If the
5239 : user has specified that long doubles should be used,
5240 : we may need to set or change some other defaults.
5241 if $test -f uselongdouble.cbu; then
5242     echo "Your platform has some specific hints regarding long doubles, using them..."
5243     . ./uselongdouble.cbu
5244 else
5245     case "$uselongdouble" in
5246         $define)
5247                 $cat <<EOM
5248 (Your platform does not have any specific hints for long doubles.)
5249 EOM
5250         ;;
5251     esac
5252 fi
5253
5254 : Check if quadmath is requested
5255 case "$usequadmath" in
5256 "$define"|true|[yY]*) usequadmath="$define" ;;
5257 *)                    usequadmath="$undef"  ;;
5258 esac
5259
5260 : Fail if both uselongdouble and usequadmath are requested
5261 case "$usequadmath:$uselongdouble" in
5262 define:define)
5263         $cat <<EOM >&4
5264
5265 *** You requested the use of the quadmath library and use
5266 *** of long doubles.
5267 ***
5268 *** Please select one or the other.
5269 EOM
5270         exit 1
5271         ;;
5272 esac
5273
5274 : Looking for optional libraries
5275 echo " "
5276 echo "Checking for optional libraries..." >&4
5277 case "$libs" in
5278 ' '|'') dflt='';;
5279 *) dflt="$libs";;
5280 esac
5281 case "$libswanted" in
5282 '') libswanted='c_s';;
5283 esac
5284 case "$usesocks" in
5285 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5286 esac
5287 case "$usecbacktrace" in
5288 "$define") libswanted="$libswanted bfd" ;;
5289 esac
5290 case "$usequadmath" in
5291 "$define") libswanted="$libswanted quadmath" ;;
5292 esac
5293 libsfound=''
5294 libsfiles=''
5295 libsdirs=''
5296 libspath=''
5297 for thisdir in $libpth $xlibpth; do
5298   test -d $thisdir && libspath="$libspath $thisdir"
5299 done
5300 for thislib in $libswanted; do
5301         for thisdir in $libspath; do
5302             xxx=''
5303             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5304                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=shared
5307                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=shared
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/lib$thislib.$so
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=shared
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/lib$thislib$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320             fi
5321             if test ! -f "$xxx"; then
5322                 xxx=$thisdir/$thislib$_a
5323                 $test -f "$xxx" && eval $libscheck
5324                 $test -f "$xxx" && libstyle=static
5325             fi
5326             if test ! -f "$xxx"; then
5327                 xxx=$thisdir/lib${thislib}_s$_a
5328                 $test -f "$xxx" && eval $libscheck
5329                 $test -f "$xxx" && libstyle=static
5330                 $test -f "$xxx" && thislib=${thislib}_s
5331             fi
5332             if test ! -f "$xxx"; then
5333                 xxx=$thisdir/Slib$thislib$_a
5334                 $test -f "$xxx" && eval $libscheck
5335                 $test -f "$xxx" && libstyle=static
5336             fi
5337             if $test -f "$xxx"; then
5338                 case "$libstyle" in
5339                 shared) echo "Found -l$thislib (shared)." ;;
5340                 static) echo "Found -l$thislib." ;;
5341                 *)      echo "Found -l$thislib ($libstyle)." ;;
5342                 esac
5343                 case " $dflt " in
5344                 *"-l$thislib "*);;
5345                 *) dflt="$dflt -l$thislib"
5346                    libsfound="$libsfound $xxx"
5347                    yyy=`basename $xxx`
5348                    libsfiles="$libsfiles $yyy"
5349                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5350                    case " $libsdirs " in
5351                    *" $yyy "*) ;;
5352                    *) libsdirs="$libsdirs $yyy" ;;
5353                    esac
5354                    ;;
5355                 esac
5356                 break
5357             fi
5358         done
5359         if $test ! -f "$xxx"; then
5360             echo "No -l$thislib."
5361         fi
5362 done
5363 set X $dflt
5364 shift
5365 dflt="$*"
5366 case "$libs" in
5367 '') dflt="$dflt";;
5368 *) dflt="$libs";;
5369 esac
5370 case "$dflt" in
5371 ' '|'') dflt='none';;
5372 esac
5373
5374 $cat <<EOM
5375
5376 In order to compile $package on your machine, a number of libraries
5377 are usually needed.  Include any other special libraries here as well.
5378 Say "none" for none.  The default list is almost always right.
5379 EOM
5380
5381 echo " "
5382 rp="What libraries to use?"
5383 . ./myread
5384 case "$ans" in
5385 none) libs=' ';;
5386 *) libs="$ans";;
5387 esac
5388
5389 : determine optimization, if desired, or use for debug flag also
5390 case "$optimize" in
5391 ' '|$undef) dflt='none';;
5392 '') dflt='-O';;
5393 *) dflt="$optimize";;
5394 esac
5395 $cat <<EOH
5396
5397 By default, $package compiles with the -O flag to use the optimizer.
5398 Alternately, you might want to use the symbolic debugger, which uses
5399 the -g flag (on traditional Unix systems).  Either flag can be
5400 specified here.  To use neither flag, specify the word "none".
5401
5402 EOH
5403 rp="What optimizer/debugger flag should be used?"
5404 . ./myread
5405 optimize="$ans"
5406 case "$optimize" in
5407 'none') optimize=" ";;
5408 esac
5409
5410 : Check what DEBUGGING is required from the command line
5411 : -DEBUGGING      or -DDEBUGGING or
5412 : -DEBUGGING=both                       = -g + -DDEBUGGING
5413 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5414 : -DEBUGGING=none or -UDEBUGGING        =
5415 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5416 case "$EBUGGING" in
5417 '')     ;;
5418 *)      DEBUGGING=$EBUGGING ;;
5419 esac
5420
5421 case "$DEBUGGING" in
5422 -g|both|$define)
5423     case "$optimize" in
5424         *-g*) ;;
5425         *)    optimize="$optimize -g" ;;
5426     esac ;;
5427 none|$undef)
5428     case "$optimize" in
5429         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5430                 shift
5431                 optimize="$*"
5432                 ;;
5433     esac ;;
5434 esac
5435
5436 dflt=''
5437 case "$DEBUGGING" in
5438 both|$define) dflt='-DDEBUGGING'
5439 esac
5440
5441 : argument order is deliberate, as the flag will start with - which set could
5442 : think is an option
5443 checkccflag='check=$1; flag=$2; callback=$3;
5444 echo " ";
5445 echo "Checking if your compiler accepts $flag" 2>&1;
5446 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5447 echo "int main(void) { return 0; }" > gcctest.c;
5448 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5449     echo "Yes, it does." 2>&1;
5450     if $test -s gcctest.out ; then
5451         echo "But your platform does not like it:";
5452         cat gcctest.out;
5453     else
5454         case "$ccflags" in
5455         *$check*)
5456             echo "Leaving current flags $ccflags alone." 2>&1
5457             ;;
5458         *) dflt="$dflt $flag";
5459             eval $callback
5460             ;;
5461         esac
5462     fi
5463 else
5464     echo "Nope, it does not, but that is ok." 2>&1;
5465 fi
5466 '
5467
5468 : We will not override a previous value, but we might want to
5469 : augment a hint file
5470 case "$hint" in
5471 default|recommended)
5472         case "$gccversion" in
5473         1.*) dflt="$dflt -fpcc-struct-return" ;;
5474         esac
5475         case "$optimize:$DEBUGGING" in
5476         *-g*:old) dflt="$dflt -DDEBUGGING";;
5477         esac
5478         case "$gccversion" in
5479         2.*) if $test -d /etc/conf/kconfig.d &&
5480                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5481                 then
5482                         # Interactive Systems (ISC) POSIX mode.
5483                         dflt="$dflt -posix"
5484                 fi
5485                 ;;
5486         esac
5487         case "$gccversion" in
5488         1.*) ;;
5489         2.[0-8]*) ;;
5490         ?*)     set strict-aliasing -fno-strict-aliasing
5491                 eval $checkccflag
5492                 ;;
5493         esac
5494         # For gcc, adding -pipe speeds up compilations for some, but apparently
5495         # some assemblers can't read from stdin.  (It also slows down compilations
5496         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5497         case "$gccversion" in
5498         ?*)     set pipe -pipe
5499                 eval $checkccflag
5500                 ;;
5501         esac
5502
5503         # on x86_64 (at least) we require an extra library (libssp) in the
5504         # link command line. This library is not named, so I infer that it is
5505         # an implementation detail that may change. Hence the safest approach
5506         # is to add the flag to the flags passed to the compiler at link time,
5507         # as that way the compiler can do the right implementation dependant
5508         # thing. (NWC)
5509         case "$osname" in
5510         amigaos) ;; # -fstack-protector builds but doesn't work
5511         *)      case "$gccversion" in
5512                 ?*)     set stack-protector-strong -fstack-protector-strong
5513                         eval $checkccflag
5514                         case "$dflt" in
5515                         *-fstack-protector-strong*) ;; # It got added.
5516                         *) # Try the plain/older -fstack-protector.
5517                            set stack-protector -fstack-protector
5518                            eval $checkccflag
5519                            ;;
5520                         esac
5521                         ;;
5522                 esac
5523                 ;;
5524         esac
5525         ;;
5526 esac
5527
5528 case "$mips_type" in
5529 *BSD*|'') inclwanted="$locincpth $usrinc";;
5530 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5531 esac
5532 for thisincl in $inclwanted; do
5533         if $test -d $thisincl; then
5534                 if $test x$thisincl != x$usrinc; then
5535                         case "$dflt" in
5536                         *" -I$thisincl "*);;
5537                         *) dflt="$dflt -I$thisincl ";;
5538                         esac
5539                 fi
5540         fi
5541 done
5542
5543 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5544         xxx=true;
5545 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5546         xxx=true;
5547 else
5548         xxx=false;
5549 fi;
5550 if $xxx; then
5551         case "$dflt" in
5552         *$2*);;
5553         *) dflt="$dflt -D$2";;
5554         esac;
5555 fi'
5556
5557 set signal.h LANGUAGE_C; eval $inctest
5558
5559 case "$usesocks" in
5560 $define)
5561         ccflags="$ccflags -DSOCKS"
5562         ;;
5563 esac
5564
5565 case "$hint" in
5566 default|recommended) dflt="$ccflags $dflt" ;;
5567 *) dflt="$ccflags";;
5568 esac
5569
5570 case "$dflt" in
5571 ''|' ') dflt=none;;
5572 esac
5573
5574 $cat <<EOH
5575
5576 Your C compiler may want other flags.  For this question you should include
5577 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5578 but you should NOT include libraries or ld flags like -lwhatever.  If you
5579 want $package to honor its debug switch, you should include -DDEBUGGING here.
5580 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5581
5582 To use no flags, specify the word "none".
5583
5584 EOH
5585 set X $dflt
5586 shift
5587 dflt=${1+"$@"}
5588 rp="Any additional cc flags?"
5589 . ./myread
5590 case "$ans" in
5591 none) ccflags='';;
5592 *) ccflags="$ans";;
5593 esac
5594
5595 : the following weeds options from ccflags that are of no interest to cpp
5596 case "$cppflags" in
5597 '') cppflags="$ccflags" ;;
5598 *)  set X $ccflags; shift
5599     case " $cppflags " in
5600     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5601     *) cppflags="$cppflags $ccflags" ;;
5602     esac
5603     ;;
5604 esac
5605 case "$gccversion" in
5606 1.*) cppflags="$cppflags -D__GNUC__"
5607 esac
5608 case "$mips_type" in
5609 '');;
5610 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5611 esac
5612 case "$cppflags" in
5613 '');;
5614 *)
5615         echo " "
5616         echo "Let me guess what the preprocessor flags are..." >&4
5617         set X $cppflags
5618         shift
5619         cppflags=''
5620         $cat >cpp.c <<'EOM'
5621 #define BLURFL foo
5622
5623 BLURFL xx LFRULB
5624 EOM
5625         previous=''
5626         for flag in $*
5627         do
5628                 case "$flag" in
5629                 -*) ftry="$flag";;
5630                 *) ftry="$previous $flag";;
5631                 esac
5632                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5633                         >cpp1.out 2>/dev/null && \
5634                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5635                         >cpp2.out 2>/dev/null && \
5636                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5637                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5638                 then
5639                         cppflags="$cppflags $ftry"
5640                         previous=''
5641                 else
5642                         previous="$flag"
5643                 fi
5644         done
5645         set X $cppflags
5646         shift
5647         cppflags=${1+"$@"}
5648         case "$cppflags" in
5649         *-*)  echo "They appear to be: $cppflags";;
5650         esac
5651         $rm -f cpp.c cpp?.out
5652         ;;
5653 esac
5654
5655 : flags used in final linking phase
5656 case "$ldflags" in
5657 '') if ./venix; then
5658                 dflt='-i -z'
5659         else
5660                 dflt=''
5661         fi
5662         case "$ccflags" in
5663         *-posix*) dflt="$dflt -posix" ;;
5664         esac
5665         ;;
5666 *) dflt="$ldflags";;
5667 esac
5668 # See note above about -fstack-protector
5669 case "$ccflags" in
5670 *-fstack-protector-strong*)
5671         case "$dflt" in
5672         *-fstack-protector-strong*) ;; # Don't add it again
5673         *) dflt="$dflt -fstack-protector-strong" ;;
5674         esac
5675         ;;
5676 *-fstack-protector*)
5677         case "$dflt" in
5678         *-fstack-protector*) ;; # Don't add it again
5679         *) dflt="$dflt -fstack-protector" ;;
5680         esac
5681         ;;
5682 esac
5683
5684 : Try to guess additional flags to pick up local libraries.
5685 for thislibdir in $libpth; do
5686         case " $loclibpth " in
5687         *" $thislibdir "*)
5688                 case "$dflt " in
5689                 *"-L$thislibdir "*) ;;
5690                 *)  dflt="$dflt -L$thislibdir" ;;
5691                 esac
5692                 ;;
5693         esac
5694 done
5695
5696 case "$dflt" in
5697 '') dflt='none' ;;
5698 esac
5699
5700 $cat <<EOH
5701
5702 Your C linker may need flags.  For this question you should
5703 include -L/whatever and any other flags used by the C linker, but you
5704 should NOT include libraries like -lwhatever.
5705
5706 Make sure you include the appropriate -L/path flags if your C linker
5707 does not normally search all of the directories you specified above,
5708 namely
5709         $libpth
5710 To use no flags, specify the word "none".
5711
5712 EOH
5713
5714 rp="Any additional ld flags (NOT including libraries)?"
5715 . ./myread
5716 case "$ans" in
5717 none) ldflags='';;
5718 *) ldflags="$ans";;
5719 esac
5720 rmlist="$rmlist pdp11"
5721
5722 : coherency check
5723 echo " "
5724 echo "Checking your choice of C compiler and flags for coherency..." >&4
5725 $cat > try.c <<'EOF'
5726 #include <stdio.h>
5727 int main() { printf("Ok\n"); return(0); }
5728 EOF
5729 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5730 shift
5731 $cat >try.msg <<'EOM'
5732 I've tried to compile and run the following simple program:
5733
5734 EOM
5735 $cat try.c >> try.msg
5736
5737 $cat >> try.msg <<EOM
5738
5739 I used the command:
5740
5741         $*
5742         $run ./try
5743
5744 and I got the following output:
5745
5746 EOM
5747 dflt=y
5748 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5749         if $sh -c "$run ./try " >>try.msg 2>&1; then
5750                 xxx=`$run ./try`
5751                 case "$xxx" in
5752                 "Ok") dflt=n ;;
5753                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5754                 esac
5755         else
5756                 echo "The program compiled OK, but exited with status $?." >>try.msg
5757                 rp="You have a problem.  Shall I abort Configure"
5758                 dflt=y
5759         fi
5760 else
5761         echo "I can't compile the test program." >>try.msg
5762         rp="You have a BIG problem.  Shall I abort Configure"
5763         dflt=y
5764 fi
5765 case "$dflt" in
5766 y)
5767         $cat try.msg >&4
5768         case "$knowitall" in
5769         '')
5770                 echo "(The supplied flags or libraries might be incorrect.)"
5771                 ;;
5772         *) dflt=n;;
5773         esac
5774         echo " "
5775         . ./myread
5776         case "$ans" in
5777         n*|N*) ;;
5778         *)      echo "Ok.  Stopping Configure." >&4
5779                 exit 1
5780                 ;;
5781         esac
5782         ;;
5783 n) echo "OK, that should do.";;
5784 esac
5785 $rm_try gcctest gcctest.out
5786
5787 : define a shorthand compile call
5788 compile='
5789 mc_file=$1;
5790 shift;
5791 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5792 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5793 exit 1;
5794 fi;
5795 esac;
5796 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5797 : define a shorthand compile call for compilations that should be ok.
5798 compile_ok='
5799 mc_file=$1;
5800 shift;
5801 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5802
5803 : stub, used only to satisfy other units
5804 i_stdlib='define'
5805
5806 : check for lengths of integral types
5807 echo " "
5808 case "$intsize" in
5809 '')
5810         echo "Checking to see how big your integers are..." >&4
5811         $cat >try.c <<EOCP
5812 #include <stdio.h>
5813 #$i_stdlib I_STDLIB
5814 #ifdef I_STDLIB
5815 #include <stdlib.h>
5816 #endif
5817 int main()
5818 {
5819         printf("intsize=%d;\n", (int)sizeof(int));
5820         printf("longsize=%d;\n", (int)sizeof(long));
5821         printf("shortsize=%d;\n", (int)sizeof(short));
5822         exit(0);
5823 }
5824 EOCP
5825         set try
5826         if eval $compile_ok && $run ./try > /dev/null; then
5827                 eval `$run ./try`
5828                 echo "Your integers are $intsize bytes long."
5829                 echo "Your long integers are $longsize bytes long."
5830                 echo "Your short integers are $shortsize bytes long."
5831         else
5832                 $cat >&4 <<EOM
5833 !
5834 Help! I can't compile and run the intsize test program: please enlighten me!
5835 (This is probably a misconfiguration in your system or libraries, and
5836 you really ought to fix it.  Still, I'll try anyway.)
5837 !
5838 EOM
5839                 dflt=4
5840                 rp="What is the size of an integer (in bytes)?"
5841                 . ./myread
5842                 intsize="$ans"
5843                 dflt=$intsize
5844                 rp="What is the size of a long integer (in bytes)?"
5845                 . ./myread
5846                 longsize="$ans"
5847                 dflt=2
5848                 rp="What is the size of a short integer (in bytes)?"
5849                 . ./myread
5850                 shortsize="$ans"
5851         fi
5852         ;;
5853 esac
5854 $rm_try
5855
5856 : check for long long
5857 echo " "
5858 echo "Checking to see if you have long long..." >&4
5859 echo 'int main() { long long x = 7; return 0; }' > try.c
5860 set try
5861 if eval $compile; then
5862         val="$define"
5863         echo "You have long long."
5864 else
5865         val="$undef"
5866         echo "You do not have long long."
5867 fi
5868 $rm_try
5869 set d_longlong
5870 eval $setvar
5871
5872 : check for length of long long
5873 case "${d_longlong}${longlongsize}" in
5874 $define)
5875         echo " "
5876         echo "Checking to see how big your long longs are..." >&4
5877         $cat >try.c <<'EOCP'
5878 #include <stdio.h>
5879 int main()
5880 {
5881     printf("%d\n", (int)sizeof(long long));
5882     return(0);
5883 }
5884 EOCP
5885         set try
5886         if eval $compile_ok; then
5887                 longlongsize=`$run ./try`
5888                 echo "Your long longs are $longlongsize bytes long."
5889         else
5890                 dflt='8'
5891                 echo " "
5892                 echo "(I can't seem to compile the test program.  Guessing...)"
5893                 rp="What is the size of a long long (in bytes)?"
5894                 . ./myread
5895                 longlongsize="$ans"
5896         fi
5897         if $test "X$longsize" = "X$longlongsize"; then
5898                 echo "(That isn't any different from an ordinary long.)"
5899         fi
5900         ;;
5901 esac
5902 $rm_try
5903
5904 : determine filename position in cpp output
5905 echo " "
5906 echo "Computing filename position in cpp output for #include directives..." >&4
5907 case "$osname" in
5908 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5909 esac
5910 case "$fieldn" in
5911 '')
5912 case "$osname" in
5913 vos) testaccess=-e ;;
5914 *)   testaccess=-r ;;
5915 esac
5916 echo '#include <stdio.h>' > foo.c
5917 $cat >fieldn <<EOF
5918 $startsh
5919 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5920 $grep '^[       ]*#.*stdio\.h' | \
5921 while read cline; do
5922         pos=1
5923         set \$cline
5924         while $test \$# -gt 0; do
5925                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5926                         echo "\$pos"
5927                         exit 0
5928                 fi
5929                 shift
5930                 pos=\`expr \$pos + 1\`
5931         done
5932 done
5933 EOF
5934 chmod +x fieldn
5935 fieldn=`./fieldn`
5936 $rm -f foo.c fieldn
5937 ;;
5938 esac
5939 case $fieldn in
5940 '') pos='???';;
5941 1) pos=first;;
5942 2) pos=second;;
5943 3) pos=third;;
5944 *) pos="${fieldn}th";;
5945 esac
5946 echo "Your cpp writes the filename in the $pos field of the line."
5947
5948 : locate header file
5949 $cat >findhdr <<EOF
5950 $startsh
5951 wanted=\$1
5952 name=''
5953 for usrincdir in $incpth
5954 do
5955         if test -f \$usrincdir/\$wanted; then
5956                 echo "\$usrincdir/\$wanted"
5957                 exit 0
5958         fi
5959 done
5960 awkprg='{ print \$$fieldn }'
5961 echo "#include <\$wanted>" > foo\$\$.c
5962 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5963 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5964 while read cline; do
5965         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5966         case "\$name" in
5967         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5968         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5969         *) exit 2;;
5970         esac;
5971 done;
5972 #
5973 # status = 0: grep returned 0 lines, case statement not executed
5974 # status = 1: headerfile found
5975 # status = 2: while loop executed, no headerfile found
5976 #
5977 status=\$?
5978 $rm -f foo\$\$.c;
5979 if test \$status -eq 1; then
5980         exit 0;
5981 fi
5982 exit 1
5983 EOF
5984 chmod +x findhdr
5985
5986 : define an alternate in-header-list? function
5987 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5988 cont=true; xxf="echo \"<\$1> found.\" >&4";
5989 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5990 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5991 esac;
5992 case $# in 4) instead=instead;; *) instead="at last";; esac;
5993 while $test "$cont"; do
5994         xxx=`./findhdr $1`
5995         var=$2; eval "was=\$$2";
5996         if $test "$xxx" && $test -r "$xxx";
5997         then eval $xxf;
5998         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5999                 cont="";
6000         else eval $xxnf;
6001         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6002         set $yyy; shift; shift; yyy=$@;
6003         case $# in 0) cont="";;
6004         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6005                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6006         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6007                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6008         esac;
6009 done;
6010 while $test "$yyy";
6011 do set $yyy; var=$2; eval "was=\$$2";
6012         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6013         set $yyy; shift; shift; yyy=$@;
6014 done'
6015
6016 : see if inttypes.h is available
6017 : we want a real compile instead of Inhdr because some systems
6018 : have an inttypes.h which includes non-existent headers
6019 echo " "
6020 $cat >try.c <<EOCP
6021 #include <inttypes.h>
6022 int main() {
6023         static int32_t foo32 = 0x12345678;
6024 }
6025 EOCP
6026 set try
6027 if eval $compile; then
6028         echo "<inttypes.h> found." >&4
6029         val="$define"
6030 else
6031         echo "<inttypes.h> NOT found." >&4
6032         val="$undef"
6033 fi
6034 $rm_try
6035 set i_inttypes
6036 eval $setvar
6037
6038 : check for int64_t
6039 echo " "
6040 echo "Checking to see if you have int64_t..." >&4
6041 $cat >try.c <<EOCP
6042 #include <sys/types.h>
6043 #$i_inttypes I_INTTYPES
6044 #ifdef I_INTTYPES
6045 #include <inttypes.h>
6046 #endif
6047 int main() { int64_t x = 7; }
6048 EOCP
6049 set try
6050 if eval $compile; then
6051         val="$define"
6052         echo "You have int64_t."
6053 else
6054         val="$undef"
6055         echo "You do not have int64_t."
6056 fi
6057 $rm_try
6058 set d_int64_t
6059 eval $setvar
6060
6061 : Check if 64bit ints have a quad type
6062 echo " "
6063 echo "Checking which 64-bit integer type we could use..." >&4
6064
6065 case "$intsize" in
6066 8) val=int
6067    set quadtype
6068    eval $setvar
6069    val='"unsigned int"'
6070    set uquadtype
6071    eval $setvar
6072    quadkind=1
6073    ;;
6074 *) case "$longsize" in
6075    8) val=long
6076       set quadtype
6077       eval $setvar
6078       val='"unsigned long"'
6079       set uquadtype
6080       eval $setvar
6081       quadkind=2
6082       ;;
6083    *) case "$d_longlong:$longlongsize" in
6084       define:8)
6085         val='"long long"'
6086         set quadtype
6087         eval $setvar
6088         val='"unsigned long long"'
6089         set uquadtype
6090         eval $setvar
6091         quadkind=3
6092         ;;
6093       *) case "$d_int64_t" in
6094          define)
6095            val=int64_t
6096            set quadtype
6097            eval $setvar
6098            val=uint64_t
6099            set uquadtype
6100            eval $setvar
6101            quadkind=4
6102            ;;
6103          esac
6104          ;;
6105       esac
6106       ;;
6107    esac
6108    ;;
6109 esac
6110
6111 case "$quadtype" in
6112 '')     echo "Alas, no 64-bit integer types in sight." >&4
6113         d_quad="$undef"
6114         ;;
6115 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6116         d_quad="$define"
6117         ;;
6118 esac
6119
6120 : Do we want 64bit support
6121 case "$uselonglong" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6126 EOM
6127         use64bitint="$define"
6128         ;;
6129 esac
6130 case "$use64bits" in
6131 "$define"|true|[yY]*)
6132         cat <<EOM >&4
6133
6134 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6135 EOM
6136         use64bitint="$define"
6137         ;;
6138 esac
6139 case "$use64bitints" in
6140 "$define"|true|[yY]*)
6141         cat <<EOM >&4
6142
6143 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6144 EOM
6145         use64bitint="$define"
6146         ;;
6147 esac
6148 case "$use64bitsint" in
6149 "$define"|true|[yY]*)
6150         cat <<EOM >&4
6151
6152 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6153 EOM
6154         use64bitint="$define"
6155         ;;
6156 esac
6157 case "$uselonglongs" in
6158 "$define"|true|[yY]*)
6159         cat <<EOM >&4
6160
6161 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6162 EOM
6163         use64bitint="$define"
6164         ;;
6165 esac
6166 case "$use64bitsall" in
6167 "$define"|true|[yY]*)
6168         cat <<EOM >&4
6169
6170 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6171 EOM
6172         use64bitall="$define"
6173         ;;
6174 esac
6175
6176 case "$ccflags" in
6177 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6178 esac
6179 case "$use64bitall" in
6180 "$define"|true|[yY]*) use64bitint="$define" ;;
6181 esac
6182
6183 case "$longsize" in
6184 8) cat <<EOM
6185
6186 You have natively 64-bit long integers.
6187 EOM
6188    val="$define"
6189    ;;
6190 *) case "$use64bitint" in
6191    "$define"|true|[yY]*) dflt='y';;
6192    *) dflt='n';;
6193    esac
6194    case "$d_quad" in
6195    "$define") ;;
6196    *) dflt='n' ;;
6197    esac
6198    cat <<EOM
6199
6200 Perl can be built to take advantage of 64-bit integer types
6201 on some systems.  To do so, Configure can be run with -Duse64bitint.
6202 Choosing this option will most probably introduce binary incompatibilities.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 (The default has been chosen based on your configuration.)
6206 EOM
6207    rp='Try to use 64-bit integers, if available?'
6208    . ./myread
6209    case "$ans" in
6210    [yY]*) val="$define" ;;
6211    *)     val="$undef"  ;;
6212    esac
6213    ;;
6214 esac
6215 set use64bitint
6216 eval $setvar
6217
6218 case "$use64bitall" in
6219 "$define"|true|[yY]*) dflt='y' ;;
6220 *) case "$longsize" in
6221    8) dflt='y' ;;
6222    *) dflt='n' ;;
6223    esac
6224    ;;
6225 esac
6226 cat <<EOM
6227
6228 You may also choose to try maximal 64-bitness.  It means using as much
6229 64-bitness as possible on the platform.  This in turn means even more
6230 binary incompatibilities.  On the other hand, your platform may not
6231 have any more 64-bitness available than what you already have chosen.
6232
6233 If this doesn't make any sense to you, just accept the default '$dflt'.
6234 (The default has been chosen based on your configuration.)
6235 EOM
6236 rp='Try to use maximal 64-bit support, if available?'
6237 . ./myread
6238 case "$ans" in
6239 [yY]*) val="$define" ;;
6240 *)     val="$undef"  ;;
6241 esac
6242 set use64bitall
6243 eval $setvar
6244 case "$use64bitall" in
6245 "$define")
6246         case "$use64bitint" in
6247         "$undef")
6248                 cat <<EOM
6249
6250 Since you have chosen a maximally 64-bit build, I'm also turning on
6251 the use of 64-bit integers.
6252 EOM
6253                 use64bitint="$define" ;;
6254         esac
6255         ;;
6256 esac
6257
6258 : Look for a hint-file generated 'call-back-unit'.  If the
6259 : user has specified that a 64-bit perl is to be built,
6260 : we may need to set or change some other defaults.
6261 if $test -f use64bitint.cbu; then
6262         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6263         . ./use64bitint.cbu
6264 fi
6265 case "$use64bitint" in
6266 "$define"|true|[yY]*)
6267         : This test was common to all the OpenBSD forks, and seems harmless for
6268         : other platforms:
6269         echo " "
6270         echo "Checking if your C library has broken 64-bit functions..." >&4
6271         cat >try.c <<EOCP
6272 #include <stdio.h>
6273 typedef $uquadtype myULL;
6274 int main (void)
6275 {
6276     struct {
6277         double d;
6278         myULL  u;
6279     } *p, test[] = {
6280         {4294967303.15, 4294967303ULL},
6281         {4294967294.2,  4294967294ULL},
6282         {4294967295.7,  4294967295ULL},
6283         {0.0, 0ULL}
6284     };
6285     for (p = test; p->u; p++) {
6286         myULL x = (myULL)p->d;
6287         if (x != p->u) {
6288             printf("buggy\n");
6289             return 0;
6290         }
6291     }
6292     printf("ok\n");
6293     return 0;
6294 }
6295 EOCP
6296         set try
6297         if eval $compile_ok; then
6298             libcquad=`$run ./try`
6299             echo "Your C library's 64-bit functions are $libcquad."
6300         else
6301             echo "(I can't seem to compile the test program.)"
6302             echo "Assuming that your C library's 64-bit functions are ok."
6303             libcquad="ok"
6304         fi
6305         $rm_try
6306
6307         case "$libcquad" in
6308             buggy*)
6309                 cat >&4 <<EOM
6310
6311 *** You have a C library with broken 64-bit functions.
6312 *** 64-bit support does not work reliably in this configuration.
6313 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6314 *** Cannot continue, aborting.
6315
6316 EOM
6317                 exit 1
6318                 ;;
6319         esac
6320         case "$longsize" in
6321         4) case "$archname64" in
6322            '') archname64=64int ;;
6323            esac
6324            ;;
6325         esac
6326         ;;
6327 esac
6328
6329 : Look for a hint-file generated 'call-back-unit'.  If the
6330 : user has specified that a maximally 64-bit perl is to be built,
6331 : we may need to set or change some other defaults.
6332 if $test -f use64bitall.cbu; then
6333         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6334         . ./use64bitall.cbu
6335 fi
6336 case "$use64bitall" in
6337 "$define"|true|[yY]*)
6338         case "$longsize" in
6339         4) case "$archname64" in
6340            ''|64int) archname64=64all ;;
6341            esac
6342            ;;
6343         esac
6344         ;;
6345 esac
6346
6347 case "$d_quad:$use64bitint" in
6348 $undef:$define)
6349         cat >&4 <<EOF
6350
6351 *** You have chosen to use 64-bit integers,
6352 *** but none can be found.
6353 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6354 *** Cannot continue, aborting.
6355
6356 EOF
6357         exit 1
6358         ;;
6359 esac
6360
6361 : Check if we are using the GNU C library
6362 echo " "
6363 echo "Checking for GNU C Library..." >&4
6364 cat >try.c <<'EOCP'
6365 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6366    alone are insufficient to distinguish different versions, such as
6367    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6368    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6369 */
6370 #include <stdio.h>
6371 int main(void)
6372 {
6373 #ifdef __GLIBC__
6374 #   ifdef __GLIBC_MINOR__
6375 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6376 #           include <gnu/libc-version.h>
6377             printf("%s\n",  gnu_get_libc_version());
6378 #       else
6379             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6380 #       endif
6381 #   else
6382         printf("%d\n",  __GLIBC__);
6383 #   endif
6384     return 0;
6385 #else
6386     return 1;
6387 #endif
6388 }
6389 EOCP
6390 set try
6391 if eval $compile_ok && $run ./try > glibc.ver; then
6392         val="$define"
6393         gnulibc_version=`$cat glibc.ver`
6394         echo "You are using the GNU C Library version $gnulibc_version"
6395 else
6396         val="$undef"
6397         gnulibc_version=''
6398         echo "You are not using the GNU C Library"
6399 fi
6400 $rm_try glibc.ver
6401 set d_gnulibc
6402 eval $setvar
6403
6404 : see if nm is to be used to determine whether a symbol is defined or not
6405 case "$usenm" in
6406 '')
6407         dflt=''
6408         case "$d_gnulibc" in
6409         "$define")
6410                 echo " "
6411                 echo "nm probably won't work on the GNU C Library." >&4
6412                 dflt=n
6413                 ;;
6414         esac
6415         case "$dflt" in
6416         '')
6417                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6418                         echo " "
6419                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6420                         echo "'nm' won't be sufficient on this system." >&4
6421                         dflt=n
6422                 fi
6423                 ;;
6424         esac
6425         case "$dflt" in
6426         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6427                 if $test $dflt -gt 20; then
6428                         dflt=y
6429                 else
6430                         dflt=n
6431                 fi
6432                 ;;
6433         esac
6434         ;;
6435 *)
6436         case "$usenm" in
6437         true|$define) dflt=y;;
6438         *) dflt=n;;
6439         esac
6440         ;;
6441 esac
6442 $cat <<EOM
6443
6444 I can use $nm to extract the symbols from your C libraries. This
6445 is a time consuming task which may generate huge output on the disk (up
6446 to 3 megabytes) but that should make the symbols extraction faster. The
6447 alternative is to skip the 'nm' extraction part and to compile a small
6448 test program instead to determine whether each symbol is present. If
6449 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6450 this may be the best solution.
6451
6452 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6453
6454 EOM
6455 rp="Shall I use $nm to extract C symbols from the libraries?"
6456 . ./myread
6457 case "$ans" in
6458 [Nn]*) usenm=false;;
6459 *) usenm=true;;
6460 esac
6461
6462 runnm=$usenm
6463 case "$reuseval" in
6464 true) runnm=false;;
6465 esac
6466
6467 : nm options which may be necessary
6468 case "$nm_opt" in
6469 '') if $test -f /mach_boot; then
6470                 nm_opt=''       # Mach
6471         elif $test -d /usr/ccs/lib; then
6472                 nm_opt='-p'     # Solaris (and SunOS?)
6473         elif $test -f /dgux; then
6474                 nm_opt='-p'     # DG-UX
6475         elif $test -f /lib64/rld; then
6476                 nm_opt='-p'     # 64-bit Irix
6477         else
6478                 nm_opt=''
6479         fi;;
6480 esac
6481
6482 : nm options which may be necessary for shared libraries but illegal
6483 : for archive libraries.  Thank you, Linux.
6484 case "$nm_so_opt" in
6485 '')     case "$myuname" in
6486         *linux*|gnu*)
6487                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6488                         nm_so_opt='--dynamic'
6489                 fi
6490                 ;;
6491         esac
6492         ;;
6493 esac
6494
6495 : Figure out where the libc is located
6496 case "$runnm" in
6497 true)
6498 : get list of predefined functions in a handy place
6499 echo " "
6500 case "$libc" in
6501 '') libc=unknown
6502         case "$libs" in
6503         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6504         esac
6505         ;;
6506 esac
6507 case "$libs" in
6508 '') ;;
6509 *)  for thislib in $libs; do
6510         case "$thislib" in
6511         -lc|-lc_s)
6512                 : Handle C library specially below.
6513                 ;;
6514         -l*)
6515                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6516                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6519                         :
6520                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6521                         :
6522                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6523                         :
6524                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6525                         :
6526                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6527                         :
6528                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6529                         :
6530                 else
6531                         try=''
6532                 fi
6533                 libnames="$libnames $try"
6534                 ;;
6535         *) libnames="$libnames $thislib" ;;
6536         esac
6537         done
6538         ;;
6539 esac
6540 xxx=normal
6541 case "$libc" in
6542 unknown)
6543         set /lib/libc.$so
6544         for xxx in $libpth; do
6545                 $test -r $1 || set $xxx/libc.$so
6546                 : The messy sed command sorts on library version numbers.
6547                 $test -r $1 || \
6548                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6549                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6550                                 h
6551                                 s/[0-9][0-9]*/0000&/g
6552                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6553                                 G
6554                                 s/\n/ /' | \
6555                          $sort | $sed -e 's/^.* //'`
6556                 eval set \$$#
6557         done
6558         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6559         $test -r $1 || set $sysroot/lib/libsys_s$_a
6560         ;;
6561 *)
6562         set blurfl
6563         ;;
6564 esac
6565 if $test -r "$1"; then
6566         echo "Your (shared) C library seems to be in $1."
6567         libc="$1"
6568 elif $test -r /lib/libc && $test -r /lib/clib; then
6569         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6570         xxx=apollo
6571         libc='/lib/clib /lib/libc'
6572         if $test -r /lib/syslib; then
6573                 echo "(Your math library is in /lib/syslib.)"
6574                 libc="$libc /lib/syslib"
6575         fi
6576 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6577         echo "Your C library seems to be in $libc, as you said before."
6578 elif $test -r $incpath/usr/lib/libc$_a; then
6579         libc=$incpath/usr/lib/libc$_a;
6580         echo "Your C library seems to be in $libc.  That's fine."
6581 elif $test -r /lib/libc$_a; then
6582         libc=/lib/libc$_a;
6583         echo "Your C library seems to be in $libc.  You're normal."
6584 else
6585         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6586                 :
6587         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6588                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6589         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6590                 :
6591         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6592                 :
6593         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6594                 :
6595         else
6596                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6597         fi
6598         if $test -r "$tans"; then
6599                 echo "Your C library seems to be in $tans, of all places."
6600                 libc=$tans
6601         else
6602                 libc='blurfl'
6603         fi
6604 fi
6605 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6606         dflt="$libc"
6607         cat <<EOM
6608
6609 If the guess above is wrong (which it might be if you're using a strange
6610 compiler, or your machine supports multiple models), you can override it here.
6611
6612 EOM
6613 else
6614         dflt=''
6615         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6616         cat >&4 <<EOM
6617 I can't seem to find your C library.  I've looked in the following places:
6618
6619 EOM
6620         $sed 's/^/      /' libpath
6621         cat <<EOM
6622
6623 None of these seems to contain your C library. I need to get its name...
6624
6625 EOM
6626 fi
6627 fn=f
6628 rp='Where is your C library?'
6629 . ./getfile
6630 libc="$ans"
6631
6632 echo " "
6633 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6634 set X `cat libnames`
6635 shift
6636 xxx=files
6637 case $# in 1) xxx=file; esac
6638 echo "Extracting names from the following $xxx for later perusal:" >&4
6639 echo " "
6640 $sed 's/^/      /' libnames >&4
6641 echo " "
6642 $echo $n "This may take a while...$c" >&4
6643
6644 for file in $*; do
6645         case $file in
6646         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6647         *) $nm $nm_opt $file 2>/dev/null;;
6648         esac
6649 done >libc.tmp
6650
6651 $echo $n ".$c"
6652 $grep fprintf libc.tmp > libc.ptf
6653 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6654 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6655 xxx='[ADTSIWi]'
6656 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6681                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6698         eval $xscan;\
6699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6700                 eval $xrun
6701 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6702         eval $xscan;\
6703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6704                 eval $xrun
6705 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6706         eval $xscan;\
6707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6708                 eval $xrun
6709 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6710         eval $xscan;\
6711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6712                 eval $xrun
6713 else
6714         $nm -p $* 2>/dev/null >libc.tmp
6715         $grep fprintf libc.tmp > libc.ptf
6716         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6717                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6718         then
6719                 nm_opt='-p'
6720                 eval $xrun
6721         else
6722                 echo " "
6723                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6724                 com=''
6725                 if $ar t $libc > libc.tmp && \
6726                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6727                 then
6728                         for thisname in $libnames $libc; do
6729                                 $ar t $thisname >>libc.tmp
6730                         done
6731                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6732                         echo "Ok." >&4
6733                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6734                         for thisname in $libnames $libc; do
6735                                 $ar tv $thisname >>libc.tmp
6736                                 emximp -o tmp.imp $thisname \
6737                                     2>/dev/null && \
6738                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6739                                     < tmp.imp >>libc.tmp
6740                                 $rm -f tmp.imp
6741                         done
6742                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6743                         echo "Ok." >&4
6744                 else
6745                         echo "$ar didn't seem to work right." >&4
6746                         echo "Maybe this is a Cray...trying bld instead..." >&4
6747                         if  bld t $libc | \
6748                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6749                                 $test -s libc.list
6750                         then
6751                                 for thisname in $libnames; do
6752                                         bld t $libnames | \
6753                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6754                                         $ar t $thisname >>libc.tmp
6755                                 done
6756                                 echo "Ok." >&4
6757                         else
6758                                 echo "That didn't work either.  Giving up." >&4
6759                                 exit 1
6760                         fi
6761                 fi
6762         fi
6763 fi
6764 nm_extract="$com"
6765 case "$PASE" in
6766 define)
6767     echo " "
6768     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6769     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6770     ;;
6771 *)  if $test -f /lib/syscalls.exp; then
6772         echo " "
6773         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6774         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6775                 /lib/syscalls.exp >>libc.list
6776     fi
6777     ;;
6778 esac
6779 ;;
6780 esac
6781 $rm -f libnames libpath
6782
6783 : Check if we are using C++
6784 echo " "
6785 echo "Checking for C++..." >&4
6786 $cat >try.c <<'EOCP'
6787 #include <stdio.h>
6788 int main(void)
6789 {
6790 #ifdef __cplusplus
6791     return 0;
6792 #else
6793     return 1;
6794 #endif
6795 }
6796 EOCP
6797 set try
6798 if eval $compile_ok && $run ./try; then
6799         val="$define"
6800         echo "You are using a C++ compiler."
6801 else
6802         val="$undef"
6803         echo "You are not using a C++ compiler."
6804 fi
6805 $rm_try cplusplus$$
6806 set d_cplusplus
6807 eval $setvar
6808
6809 : is a C symbol defined?
6810 csym='tlook=$1;
6811 case "$3" in
6812 -v) tf=libc.tmp; tdc="";;
6813 -a) tf=libc.tmp; tdc="[]";;
6814 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6815 esac;
6816 case "$d_cplusplus" in
6817     $define)    extern_C="extern \"C\"" ;;
6818     *)          extern_C="extern"       ;;
6819 esac;
6820 tx=yes;
6821 case "$reuseval-$4" in
6822 true-) ;;
6823 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6824 esac;
6825 case "$tx" in
6826 yes)
6827         tval=false;
6828         if $test "$runnm" = true; then
6829                 if $contains $tlook $tf >/dev/null 2>&1; then
6830                         tval=true;
6831                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6832                         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;
6833                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6834                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6835                         $rm_try;
6836                 fi;
6837         else
6838                 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;
6839                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6840                 $rm_try;
6841         fi;
6842         ;;
6843 *)
6844         case "$tval" in
6845         $define) tval=true;;
6846         *) tval=false;;
6847         esac;
6848         ;;
6849 esac;
6850 eval "$2=$tval"'
6851
6852 : define an is-in-libc? function
6853 inlibc='echo " "; td=$define; tu=$undef;
6854 sym=$1; var=$2; eval "was=\$$2";
6855 tx=yes;
6856 case "$reuseval$was" in
6857 true) ;;
6858 true*) tx=no;;
6859 esac;
6860 case "$tx" in
6861 yes)
6862         set $sym tres -f;
6863         eval $csym;
6864         case "$tres" in
6865         true)
6866                 echo "$sym() found." >&4;
6867                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6868         *)
6869                 echo "$sym() NOT found." >&4;
6870                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6871         esac;;
6872 *)
6873         case "$was" in
6874         $define) echo "$sym() found." >&4;;
6875         *) echo "$sym() NOT found." >&4;;
6876         esac;;
6877 esac'
6878
6879 : check for length of double
6880 echo " "
6881 case "$doublesize" in
6882 '')
6883         echo "Checking to see how big your double precision numbers are..." >&4
6884         $cat >try.c <<EOCP
6885 #include <stdio.h>
6886 #$i_stdlib I_STDLIB
6887 #ifdef I_STDLIB
6888 #include <stdlib.h>
6889 #endif
6890 int main()
6891 {
6892     printf("%d\n", (int)sizeof(double));
6893     exit(0);
6894 }
6895 EOCP
6896         set try
6897         if eval $compile_ok; then
6898                 doublesize=`$run ./try`
6899                 echo "Your double is $doublesize bytes long."
6900         else
6901                 dflt='8'
6902                 echo "(I can't seem to compile the test program.  Guessing...)"
6903                 rp="What is the size of a double precision number (in bytes)?"
6904                 . ./myread
6905                 doublesize="$ans"
6906         fi
6907         ;;
6908 esac
6909 $rm_try
6910
6911 : check for long doubles
6912 echo " "
6913 echo "Checking to see if you have long double..." >&4
6914 echo 'int main() { long double x = 7.0; }' > try.c
6915 set try
6916 if eval $compile; then
6917         val="$define"
6918         echo "You have long double."
6919 else
6920         val="$undef"
6921         echo "You do not have long double."
6922 fi
6923 $rm_try
6924 set d_longdbl
6925 eval $setvar
6926
6927 : see if ldexpl exists
6928 set ldexpl d_ldexpl
6929 eval $inlibc
6930
6931 : check for length of long double
6932 case "${d_longdbl}${longdblsize}" in
6933 $define)
6934         echo " "
6935         echo "Checking to see how big your long doubles are..." >&4
6936         $cat >try.c <<'EOCP'
6937 #include <stdio.h>
6938 int main()
6939 {
6940         printf("%d\n", sizeof(long double));
6941 }
6942 EOCP
6943         set try
6944         set try
6945         if eval $compile; then
6946                 longdblsize=`$run ./try`
6947                 echo "Your long doubles are $longdblsize bytes long."
6948         else
6949                 dflt='8'
6950                 echo " "
6951                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6952                 rp="What is the size of a long double (in bytes)?"
6953                 . ./myread
6954                 longdblsize="$ans"
6955         fi
6956         if $test "X$doublesize" = "X$longdblsize"; then
6957                 echo "That isn't any different from an ordinary double."
6958                 echo "I'll keep your setting anyway, but you may see some"
6959                 echo "harmless compilation warnings."
6960         fi
6961         ;;
6962 esac
6963 $rm_try
6964
6965 $echo "Checking the kind of long doubles you have..." >&4
6966 case "$d_longdbl" in
6967 define)
6968 $cat <<EOP >try.c
6969 #$i_stdlib I_STDLIB
6970 #define LONGDBLSIZE $longdblsize
6971 #define DOUBLESIZE $doublesize
6972 #include <float.h>
6973 #ifdef I_STDLIB
6974 #include <stdlib.h>
6975 #endif
6976 #include <stdio.h>
6977 static const long double d = -0.1L;
6978 int main() {
6979   unsigned const char* b = (unsigned const char*)(&d);
6980 #if DOUBLESIZE == LONGDBLSIZE
6981   printf("0\n"); /* if it floats like double */
6982   exit(0);
6983 #endif
6984 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6985   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6986     /* IEEE 754 128-bit little-endian */
6987     printf("1\n");
6988     exit(0);
6989   }
6990   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6991     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6992     printf("2\n");
6993     exit(0);
6994   }
6995 #endif
6996 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6997  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6998  * cannot be trusted. */
6999 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7000   if (b[0] == 0xCD && b[9] == 0xBF) {
7001     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7002      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7003      * Also known as "extended precision". */
7004     printf("3\n");
7005     exit(0);
7006   }
7007   if (b[0] == 0xBF && b[9] == 0xCD) {
7008     /* Is there ever big-endian 80-bit, really?
7009      *
7010      * The Motorola 68881 had another "extended precision" format:
7011      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7012      * for total of 96 bits of bytes.  The zero bits were unused.
7013      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7014      * If it ever becomes relevant, this format should be allocated
7015      * a new doublekind code since it's quite different from the Intel x87.
7016      */
7017     printf("4\n");
7018     exit(0);
7019   }
7020 #endif
7021 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7022   /* software "double double", the 106 is 53+53.
7023    * but irix thinks it is 107. */
7024   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7025     /* double double 128-bit fully little-endian,
7026      * little-endian doubles in little-endian order,
7027      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7028     printf("5\n");
7029     exit(0);
7030   }
7031   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7032     /* double double 128-bit fully big-endian,
7033      * big-endian doubles in big-endian order,
7034      * e.g. PPC/Power and MIPS:
7035      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7036     printf("6\n");
7037     exit(0);
7038   }
7039   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7040     /* double double 128-bit mixed endian.
7041      * little-endian doubles in big-endian order,
7042      * e.g. ppc64el,
7043      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7044     printf("7\n");
7045     exit(0);
7046   }
7047   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7048     /* double double 128-bit mixed endian,
7049      * big-endian doubles in little-endian order,
7050      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7051     printf("8\n");
7052     exit(0);
7053   }
7054 #endif
7055 /* We are largely making this up because it may well be
7056  * that the VAX format H was never made available to C,
7057  * only to Fortran. */
7058 #if LONGDBLSIZE == 16 && defined(__vax__)
7059   if (b[0] == 0xFD && b[15] == 0x99) {
7060     /* VAX format H, PDP-11 mixed endian. */
7061     printf("9\n");
7062     exit(0);
7063   }
7064 #endif
7065   printf("-1\n"); /* unknown */
7066   exit(0);
7067 }
7068 EOP
7069 set try
7070 if eval $compile; then
7071     longdblkind=`$run ./try`
7072 else
7073     longdblkind=-1
7074 fi
7075 ;;
7076 *) longdblkind=0 ;;
7077 esac
7078 case "$longdblkind" in
7079 0) echo "Your long doubles are doubles." >&4 ;;
7080 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7081 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7082 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7083 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7084 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7085 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7086 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7087 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7088 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7089 *) echo "Cannot figure out your long double." >&4 ;;
7090 esac
7091 d_long_double_style_ieee=$undef
7092 d_long_double_style_ieee_std=$undef
7093 d_long_double_style_ieee_extended=$undef
7094 d_long_double_style_ieee_doubledouble=$undef
7095 d_long_double_style_vax=$undef
7096 case "$longdblkind" in
7097 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7098 esac
7099 case "$longdblkind" in
7100 1|2) d_long_double_style_ieee_std=$define ;;
7101 esac
7102 case "$longdblkind" in
7103 3|4) d_long_double_style_ieee_extended=$define ;;
7104 esac
7105 case "$longdblkind" in
7106 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7107 esac
7108 case "$longdblkind" in
7109 9) d_long_double_style_vax=$define ;;
7110 esac
7111 $rm_try
7112
7113 : determine the architecture name
7114 echo " "
7115 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7116         tarch=`arch`"-$osname"
7117 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7118         if uname -m > tmparch 2>&1 ; then
7119                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7120                         -e 's/$/'"-$osname/" tmparch`
7121         else
7122                 tarch="$osname"
7123         fi
7124         $rm -f tmparch
7125 else
7126         tarch="$osname"
7127 fi
7128 case "$myarchname" in
7129 ''|"$tarch") ;;
7130 *)
7131         echo "(Your architecture name used to be $myarchname.)"
7132         archname=''
7133         ;;
7134 esac
7135 case "$targetarch" in
7136 '') ;;
7137 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7138 esac
7139 myarchname="$tarch"
7140 case "$archname" in
7141 '') dflt="$tarch";;
7142 *) dflt="$archname";;
7143 esac
7144 rp='What is your architecture name'
7145 . ./myread
7146 archname="$ans"
7147
7148 : optionally add API version to the architecture for versioned archlibs
7149 case "$useversionedarchname" in
7150 $define|true|[yY]*) dflt='y';;
7151 *)                  dflt='n';;
7152 esac
7153 rp='Add the Perl API version to your archname?'
7154 . ./myread
7155 case "$ans" in
7156 y|Y)    useversionedarchname="$define" ;;
7157 *)      useversionedarchname="$undef" ;;
7158 esac
7159 case "$useversionedarchname" in
7160 $define)
7161         case "$archname" in
7162         *-$api_versionstring)
7163                 echo "...and architecture name already has -$api_versionstring" >&4
7164                 ;;
7165         *)
7166                 archname="$archname-$api_versionstring"
7167                 echo "...setting architecture name to $archname." >&4
7168                 ;;
7169         esac
7170         ;;
7171 esac
7172
7173 case "$usethreads" in
7174 $define)
7175         echo "Threads selected." >&4
7176         case "$archname" in
7177         *-thread*) echo "...and architecture name already has -thread." >&4
7178                 ;;
7179         *)      archname="$archname-thread"
7180                 echo "...setting architecture name to $archname." >&4
7181                 ;;
7182         esac
7183         ;;
7184 esac
7185 case "$usemultiplicity" in
7186 $define)
7187         echo "Multiplicity selected." >&4
7188         case "$archname" in
7189         *-multi*) echo "...and architecture name already has -multi." >&4
7190                 ;;
7191         *)      archname="$archname-multi"
7192                 echo "...setting architecture name to $archname." >&4
7193                 ;;
7194         esac
7195         ;;
7196 esac
7197 case "$use64bitint$use64bitall" in
7198 *"$define"*)
7199         case "$archname64" in
7200         '')
7201                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7202                 ;;
7203         *)
7204                 case "$use64bitint" in
7205                 "$define") echo "64 bit integers selected." >&4 ;;
7206                 esac
7207                 case "$use64bitall" in
7208                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7209                 esac
7210                 case "$archname" in
7211                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7212                         ;;
7213                 *)      archname="$archname-$archname64"
7214                         echo "...setting architecture name to $archname." >&4
7215                         ;;
7216                 esac
7217                 ;;
7218         esac
7219 esac
7220 case "$uselongdouble" in
7221 $define)
7222         echo "Long doubles selected." >&4
7223         case "$longdblsize" in
7224         $doublesize)
7225                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7226                 ;;
7227         *)
7228                 case "$archname" in
7229                 *-ld*) echo "...and architecture name already has -ld." >&4
7230                         ;;
7231                 *)      archname="$archname-ld"
7232                         echo "...setting architecture name to $archname." >&4
7233                         ;;
7234                 esac
7235                 ;;
7236         esac
7237         ;;
7238 esac
7239 case "$usequadmath" in
7240 $define)
7241         echo "quadmath selected." >&4
7242         case "$archname" in
7243         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7244                 ;;
7245         *)      archname="$archname-quadmath"
7246                 echo "...setting architecture name to $archname." >&4
7247                 ;;
7248         esac
7249         ;;
7250 esac
7251 if $test -f archname.cbu; then
7252         echo "Your platform has some specific hints for architecture name, using them..."
7253         . ./archname.cbu
7254 fi
7255
7256 : set the prefixit variable, to compute a suitable default value
7257 prefixit='case "$3" in
7258 ""|none)
7259         case "$oldprefix" in
7260         "") eval "$1=\"\$$2\"";;
7261         *)
7262                 case "$3" in
7263                 "") eval "$1=";;
7264                 none)
7265                         eval "tp=\"\$$2\"";
7266                         case "$tp" in
7267                         ""|" "|none) eval "$1=\"\$$2\"";;
7268                         *) eval "$1=";;
7269                         esac;;
7270                 esac;;
7271         esac;;
7272 *)
7273         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7274         case "$tp" in
7275         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7276         /*-$oldprefix/*|\~*-$oldprefix/*)
7277                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7278         *) eval "$1=\"\$$2\"";;
7279         esac;;
7280 esac'
7281
7282 : determine installation style
7283 : For now, try to deduce it from prefix unless it is already set.
7284 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7285 case "$installstyle" in
7286 '')     case "$prefix" in
7287                 *perl*) dflt='lib';;
7288                 *) dflt='lib/perl5' ;;
7289         esac
7290         ;;
7291 *)      dflt="$installstyle" ;;
7292 esac
7293 : Probably not worth prompting for this since we prompt for all
7294 : the directories individually, and the prompt would be too long and
7295 : confusing anyway.
7296 installstyle=$dflt
7297
7298 : determine where public executables go
7299 echo " "
7300 set dflt bin bin
7301 eval $prefixit
7302 fn=d~
7303 rp='Pathname where the public executables will reside?'
7304 . ./getfile
7305 if $test "X$ansexp" != "X$binexp"; then
7306         installbin=''
7307 fi
7308 prefixvar=bin
7309 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7310 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7311 :     this via initialinstalllocation
7312 . ./setprefixvar
7313
7314 case "$userelocatableinc" in
7315 $define|true|[yY]*)     dflt='y' ;;
7316 *)                      dflt='n' ;;
7317 esac
7318 cat <<EOM
7319
7320 Would you like to build Perl so that the installation is relocatable, so that
7321 library paths in @INC are determined relative to the path of the perl binary?
7322 This is not advised for system Perl installs, or if you need to run setid
7323 scripts or scripts under taint mode.
7324
7325 If this doesn't make any sense to you, just accept the default '$dflt'.
7326 EOM
7327 rp='Use relocatable @INC?'
7328 . ./myread
7329 case "$ans" in
7330 y|Y)    val="$define" ;;
7331 *)      val="$undef"  ;;
7332 esac
7333 set userelocatableinc
7334 eval $setvar
7335
7336 initialinstalllocation="$binexp"
7337 : Default prefix is now "up one level from where the binaries are"
7338 case "$userelocatableinc" in
7339 $define|true|[yY]*)
7340     bin=".../"
7341     binexp=".../"
7342     prefix=".../.."
7343     prefixexp=".../.."
7344     installprefixexp=".../.."
7345     ;;
7346 esac
7347
7348 : determine where private library files go
7349 : Usual default is /usr/local/lib/perl5/$version.
7350 : Also allow things like /opt/perl/lib/$version, since
7351 : /opt/perl/lib/perl5... would be redundant.
7352 : The default "style" setting is made in installstyle.U
7353 case "$installstyle" in
7354 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7355 *)       set dflt privlib lib/$version ;;
7356 esac
7357 eval $prefixit
7358 $cat <<EOM
7359
7360 There are some auxiliary files for $package that need to be put into a
7361 private library directory that is accessible by everyone.
7362
7363 EOM
7364 fn=$binexp
7365 fn=d~+
7366 rp='Pathname where the private library files will reside?'
7367 . ./getfile
7368 prefixvar=privlib
7369 . ./setprefixvar
7370
7371 : set the prefixup variable, to restore leading tilda escape
7372 prefixup='case "$prefixexp" in
7373 "$prefix") ;;
7374 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7375 esac'
7376
7377 : determine where public architecture dependent libraries go
7378 set archlib archlib
7379 eval $prefixit
7380 : privlib default is /usr/local/lib/$package/$version
7381 : archlib default is /usr/local/lib/$package/$version/$archname
7382 : privlib may have an optional trailing /share.
7383 tdflt=`echo $privlib | $sed 's,/share$,,'`
7384 tdflt=$tdflt/$archname
7385 case "$archlib" in
7386 '')     dflt=$tdflt
7387         ;;
7388 *)      dflt="$archlib"
7389     ;;
7390 esac
7391 $cat <<EOM
7392
7393 $spackage contains architecture-dependent library files.  If you are
7394 sharing libraries in a heterogeneous environment, you might store
7395 these files in a separate location.  Otherwise, you can just include
7396 them with the rest of the public library files.
7397
7398 EOM
7399 fn=$binexp
7400 fn=d+~
7401 rp='Where do you want to put the public architecture-dependent libraries?'
7402 . ./getfile
7403 prefixvar=archlib
7404 . ./setprefixvar
7405 if $test X"$archlib" = X"$privlib"; then
7406         d_archlib="$undef"
7407 else
7408         d_archlib="$define"
7409 fi
7410
7411 : see if setuid scripts can be secure
7412 $cat <<EOM
7413
7414 Some kernels have a bug that prevents setuid #! scripts from being
7415 secure.  Some sites have disabled setuid #! scripts because of this.
7416
7417 First let's decide if your kernel supports secure setuid #! scripts.
7418 (If setuid #! scripts would be secure but have been disabled anyway,
7419 don't say that they are secure if asked.)
7420
7421 EOM
7422
7423 val="$undef"
7424 if $test -d /dev/fd; then
7425         echo "#!$ls" >reflect
7426         chmod +x,u+s reflect
7427         ./reflect >flect 2>&1
7428         if $contains "/dev/fd" flect >/dev/null; then
7429                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7430                 val="$define"
7431         else
7432                 $cat <<EOM
7433 If you are not sure if they are secure, I can check but I'll need a
7434 username and password different from the one you are using right now.
7435 If you don't have such a username or don't want me to test, simply
7436 enter 'none'.
7437
7438 EOM
7439                 rp='Other username to test security of setuid scripts with?'
7440                 dflt='none'
7441                 . ./myread
7442                 case "$ans" in
7443                 n|none)
7444                         case "$d_suidsafe" in
7445                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7446                                 dflt=n;;
7447                         "$undef")
7448                                 echo "Well, the $hint value is *not* secure." >&4
7449                                 dflt=n;;
7450                         *)      echo "Well, the $hint value *is* secure." >&4
7451                                 dflt=y;;
7452                         esac
7453                         ;;
7454                 *)
7455                         $rm -f reflect flect
7456                         echo "#!$ls" >reflect
7457                         chmod +x,u+s reflect
7458                         echo >flect
7459                         chmod a+w flect
7460                         echo '"su" will (probably) prompt you for '"$ans's password."
7461                         su $ans -c './reflect >flect'
7462                         if $contains "/dev/fd" flect >/dev/null; then
7463                                 echo "Okay, it looks like setuid scripts are secure." >&4
7464                                 dflt=y
7465                         else
7466                                 echo "I don't think setuid scripts are secure." >&4
7467                                 dflt=n
7468                         fi
7469                         ;;
7470                 esac
7471                 rp='Does your kernel have *secure* setuid scripts?'
7472                 . ./myread
7473                 case "$ans" in
7474                 [yY]*)  val="$define";;
7475                 *)      val="$undef";;
7476                 esac
7477         fi
7478 else
7479         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7480         echo "(That's for file descriptors, not floppy disks.)"
7481         val="$undef"
7482 fi
7483 set d_suidsafe
7484 eval $setvar
7485
7486 $rm -f reflect flect
7487
7488 : now see if they want to do setuid emulation
7489 if $test $patchlevel -lt 11; then
7490 echo " "
7491 val="$undef"
7492 case "$d_suidsafe" in
7493 "$define")
7494         val="$undef"
7495         echo "No need to emulate SUID scripts since they are secure here." >&4
7496         ;;
7497 *)
7498         $cat <<EOM
7499 Some systems have disabled setuid scripts, especially systems where
7500 setuid scripts cannot be secure.  On systems where setuid scripts have
7501 been disabled, the setuid/setgid bits on scripts are currently
7502 useless.  It is possible for $package to detect those bits and emulate
7503 setuid/setgid in a secure fashion.  This emulation will only work if
7504 setuid scripts have been disabled in your kernel.
7505
7506 EOM
7507         case "$d_dosuid" in
7508         "$define") dflt=y ;;
7509         *) dflt=n ;;
7510         esac
7511         rp="Do you want to do setuid/setgid emulation?"
7512         . ./myread
7513         case "$ans" in
7514         [yY]*)  val="$define";;
7515         *)      val="$undef";;
7516         esac
7517         ;;
7518 esac
7519 set d_dosuid
7520 eval $setvar
7521 else
7522     case "$d_dosuid" in
7523         "$define")
7524         cat >&4 <<EOH
7525
7526 SUID emulation has been removed for 5.12
7527 Please re-run Configure without -Dd_dosuid
7528
7529 EOH
7530         exit 1;
7531         ;;
7532     esac
7533     d_dosuid=undef
7534 fi
7535
7536 : Find perl5.005 or later.
7537 echo "Looking for a previously installed perl5.005 or later... "
7538 case "$perl5" in
7539 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7540                 : Check if this perl is recent and can load a simple module
7541                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7542                         perl5=$tdir/perl
7543                         break;
7544                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7545                         perl5=$tdir/perl5
7546                         break;
7547                 fi
7548         done
7549         ;;
7550 *)      perl5="$perl5"
7551         ;;
7552 esac
7553 case "$perl5" in
7554 '')     echo "None found.  That's ok.";;
7555 *)      echo "Using $perl5." ;;
7556 esac
7557
7558 : Set the siteprefix variables
7559 $cat <<EOM
7560
7561 After $package is installed, you may wish to install various
7562 add-on modules and utilities.  Typically, these add-ons will
7563 be installed under $prefix with the rest
7564 of this package.  However, you may wish to install such add-ons
7565 elsewhere under a different prefix.
7566
7567 If you do not wish to put everything under a single prefix, that's
7568 ok.  You will be prompted for the individual locations; this siteprefix
7569 is only used to suggest the defaults.
7570
7571 The default should be fine for most people.
7572
7573 EOM
7574 fn=d~+
7575 rp='Installation prefix to use for add-on modules and utilities?'
7576 : XXX Here might be another good place for an installstyle setting.
7577 case "$siteprefix" in
7578 '') dflt=$prefix ;;
7579 *)  dflt=$siteprefix ;;
7580 esac
7581 . ./getfile
7582 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7583 oldsiteprefix=''
7584 case "$siteprefix" in
7585 '') ;;
7586 *)      case "$ans" in
7587         "$prefix") ;;
7588         *) oldsiteprefix="$prefix";;
7589         esac
7590         ;;
7591 esac
7592 siteprefix="$ans"
7593 siteprefixexp="$ansexp"
7594
7595 : determine where site specific libraries go.
7596 : Usual default is /usr/local/lib/perl5/site_perl/$version
7597 : The default "style" setting is made in installstyle.U
7598 : XXX No longer works with Prefixit stuff.
7599 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7600 case "$sitelib" in
7601 '') case "$installstyle" in
7602         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7603         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7604         esac
7605         ;;
7606 *)      dflt="$sitelib"
7607         ;;
7608 esac
7609 $cat <<EOM
7610
7611 The installation process will create a directory for
7612 site-specific extensions and modules.  Most users find it convenient
7613 to place all site-specific files in this directory rather than in the
7614 main distribution directory.
7615
7616 EOM
7617 fn=d~+
7618 rp='Pathname for the site-specific library files?'
7619 . ./getfile
7620 prefixvar=sitelib
7621 . ./setprefixvar
7622 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7623
7624 : Determine list of previous versions to include in @INC
7625 $cat > getverlist <<EOPL
7626 #!$perl5 -w
7627 use File::Basename;
7628 \$api_versionstring = "$api_versionstring";
7629 \$version = "$version";
7630 \$stem = "$sitelib_stem";
7631 \$archname = "$archname";
7632 EOPL
7633         $cat >> getverlist <<'EOPL'
7634 # The list found is store twice for each entry: the original name, and
7635 # the binary broken down version as pack "sss", so sorting is easy and
7636 # unambiguous. This will work for all versions that have a maximum of
7637 # three digit groups, separate by '.'s or '_'s. Names are extended with
7638 # ".0.0" to ensure at least three elements for the pack.
7639 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7640
7641 # Can't have leading @ because metaconfig interprets it as a command!
7642 ;@inc_version_list=();
7643 # XXX Redo to do opendir/readdir?
7644 if (-d $stem) {
7645     chdir($stem);
7646     ;@candidates = map {
7647         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7648     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7649 }
7650 else {
7651     ;@candidates = ();
7652 }
7653
7654 ($pversion, $aversion, $vsn5005) = map {
7655     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7656 foreach $d (@candidates) {
7657     if ($d->[1] lt $pversion) {
7658         if ($d->[1] ge $aversion) {
7659             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7660         }
7661         elsif ($d->[1] ge $vsn5005) {
7662             unshift(@inc_version_list, grep { -d } $d->[0]);
7663         }
7664     }
7665     else {
7666         # Skip newer version.  I.e. don't look in
7667         # 5.7.0 if we're installing 5.6.1.
7668     }
7669 }
7670
7671 if (@inc_version_list) {
7672     print join(' ', @inc_version_list);
7673 }
7674 else {
7675     # Blank space to preserve value for next Configure run.
7676     print " ";
7677 }
7678 EOPL
7679 chmod +x getverlist
7680 case "$inc_version_list" in
7681 '')     if test -x "$perl5$exe_ext"; then
7682                 dflt=`$perl5 getverlist`
7683         else
7684                 dflt='none'
7685         fi
7686         ;;
7687 $undef) dflt='none' ;;
7688 *)  eval dflt=\"$inc_version_list\" ;;
7689 esac
7690 case "$dflt" in
7691 ''|' ') dflt=none ;;
7692 esac
7693 case "$dflt" in
7694 5.005) dflt=none ;;
7695 esac
7696 $cat <<EOM
7697
7698 In order to ease the process of upgrading, this version of perl
7699 can be configured to use modules built and installed with earlier
7700 versions of perl that were installed under $prefix.  Specify here
7701 the list of earlier versions that this version of perl should check.
7702 If Configure detected no earlier versions of perl installed under
7703 $prefix, then the list will be empty.  Answer 'none' to tell perl
7704 to not search earlier versions.
7705
7706 The default should almost always be sensible, so if you're not sure,
7707 just accept the default.
7708 EOM
7709
7710 rp='List of earlier versions to include in @INC?'
7711 . ./myread
7712 case "$ans" in
7713 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7714 *) inc_version_list="$ans" ;;
7715 esac
7716 case "$inc_version_list" in
7717 ''|' ')
7718         inc_version_list_init='0'
7719         d_inc_version_list="$undef"
7720         ;;
7721 *)      inc_version_list_init=`echo $inc_version_list |
7722                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7723         d_inc_version_list="$define"
7724         ;;
7725 esac
7726 $rm -f getverlist
7727
7728 : see if malloc/malloc.h has to be included
7729 set malloc/malloc.h i_mallocmalloc
7730 eval $inhdr
7731
7732 : see if this is a malloc.h system
7733 : we want a real compile instead of Inhdr because some systems have a
7734 : malloc.h that just gives a compile error saying to use stdlib.h instead
7735 echo " "
7736 $cat >try.c <<EOCP
7737 #include <stdlib.h>
7738 #include <malloc.h>
7739 #$i_mallocmalloc I_MALLOCMALLOC
7740 #ifdef I_MALLOCMALLOC
7741 # include <malloc/malloc.h>
7742 #endif
7743
7744 int main () { return 0; }
7745 EOCP
7746 set try
7747 if eval $compile; then
7748     echo "<malloc.h> found." >&4
7749     val="$define"
7750 else
7751     echo "<malloc.h> NOT found." >&4
7752     val="$undef"
7753 fi
7754 $rm_try
7755 set i_malloc
7756 eval $setvar
7757
7758 : check for length of pointer
7759 echo " "
7760 case "$ptrsize" in
7761 '')
7762         echo "Checking to see how big your pointers are..." >&4
7763         $cat >try.c <<EOCP
7764 #include <stdio.h>
7765 #$i_stdlib I_STDLIB
7766 #ifdef I_STDLIB
7767 #include <stdlib.h>
7768 #endif
7769 int main()
7770 {
7771     printf("%d\n", (int)sizeof(void *));
7772     exit(0);
7773 }
7774 EOCP
7775         set try
7776         if eval $compile_ok; then
7777                 ptrsize=`$run ./try`
7778                 echo "Your pointers are $ptrsize bytes long."
7779         else
7780                 dflt='4'
7781                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7782                 rp="What is the size of a pointer (in bytes)?"
7783                 . ./myread
7784                 ptrsize="$ans"
7785         fi
7786         ;;
7787 esac
7788 $rm_try
7789 case "$use64bitall" in
7790 "$define"|true|[yY]*)
7791         case "$ptrsize" in
7792         4)      cat <<EOM >&4
7793
7794 *** You have chosen a maximally 64-bit build,
7795 *** but your pointers are only 4 bytes wide.
7796 *** Please rerun Configure without -Duse64bitall.
7797 EOM
7798                 case "$d_quad" in
7799                 define)
7800                         cat <<EOM >&4
7801 *** Since you have quads, you could possibly try with -Duse64bitint.
7802 EOM
7803                         ;;
7804                 esac
7805                 cat <<EOM >&4
7806 *** Cannot continue, aborting.
7807
7808 EOM
7809
7810                 exit 1
7811                 ;;
7812         esac
7813         ;;
7814 esac
7815
7816 : determine whether to use malloc wrapping
7817 echo " "
7818 case "$usemallocwrap" in
7819 [yY]*|true|$define)     dflt='y' ;;
7820 [nN]*|false|$undef)     dflt='n' ;;
7821 *)      case "$usedevel" in
7822         [yY]*|true|$define)     dflt='y' ;;
7823         *) dflt='n' ;;
7824         esac
7825         ;;
7826 esac
7827 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7828 . ./myread
7829 usemallocwrap="$ans"
7830 case "$ans" in
7831 y*|true)
7832         usemallocwrap="$define" ;;
7833 *)
7834         usemallocwrap="$undef" ;;
7835 esac
7836
7837 : determine which malloc to compile in
7838 echo " "
7839 case "$usemymalloc" in
7840 [yY]*|true|$define)     dflt='y' ;;
7841 [nN]*|false|$undef)     dflt='n' ;;
7842 *)      case "$ptrsize" in
7843         4) dflt='y' ;;
7844         *) dflt='n' ;;
7845         esac
7846         if test "$useithreads" = "$define"; then dflt='n'; fi
7847         ;;
7848 esac
7849 rp="Do you wish to attempt to use the malloc that comes with $package?"
7850 . ./myread
7851 usemymalloc="$ans"
7852 case "$ans" in
7853 y*|true)
7854         usemymalloc='y'
7855         mallocsrc='malloc.c'
7856         mallocobj="malloc$_o"
7857         d_mymalloc="$define"
7858         case "$libs" in
7859         *-lmalloc*)
7860                 : Remove malloc from list of libraries to use
7861                 echo "Removing unneeded -lmalloc from library list" >&4
7862                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7863                 shift
7864                 libs="$*"
7865                 echo "libs = $libs" >&4
7866                 ;;
7867         esac
7868         ;;
7869 *)
7870         usemymalloc='n'
7871         mallocsrc=''
7872         mallocobj=''
7873         d_mymalloc="$undef"
7874         ;;
7875 esac
7876
7877 : compute the return types of malloc and free
7878 echo " "
7879 $cat >malloc.c <<END
7880 #$i_malloc I_MALLOC
7881 #$i_stdlib I_STDLIB
7882 #include <stdio.h>
7883 #include <sys/types.h>
7884 #ifdef I_MALLOC
7885 #include <malloc.h>
7886 #endif
7887 #ifdef I_STDLIB
7888 #include <stdlib.h>
7889 #endif
7890 #ifdef TRY_MALLOC
7891 void *malloc();
7892 #endif
7893 #ifdef TRY_FREE
7894 void free();
7895 #endif
7896 END
7897 case "$malloctype" in
7898 '')
7899         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7900                 malloctype='void *'
7901         else
7902                 malloctype='char *'
7903         fi
7904         ;;
7905 esac
7906 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7907
7908 case "$freetype" in
7909 '')
7910         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7911                 freetype='void'
7912         else
7913                 freetype='int'
7914         fi
7915         ;;
7916 esac
7917 echo "Your system uses $freetype free(), it would seem." >&4
7918 $rm -f malloc.[co]
7919 : determine where site specific architecture-dependent libraries go.
7920 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7921 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7922 : sitelib may have an optional trailing /share.
7923 case "$sitearch" in
7924 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7925         dflt="$dflt/$archname"
7926         ;;
7927 *)      dflt="$sitearch"
7928         ;;
7929 esac
7930 set sitearch sitearch none
7931 eval $prefixit
7932 $cat <<EOM
7933
7934 The installation process will also create a directory for
7935 architecture-dependent site-specific extensions and modules.
7936
7937 EOM
7938 fn=d~+
7939 rp='Pathname for the site-specific architecture-dependent library files?'
7940 . ./getfile
7941 prefixvar=sitearch
7942 . ./setprefixvar
7943 if $test X"$sitearch" = X"$sitelib"; then
7944         d_sitearch="$undef"
7945 else
7946         d_sitearch="$define"
7947 fi
7948
7949 : Set the vendorprefix variables
7950 $cat <<EOM
7951
7952 The installation process will also create a directory for
7953 vendor-supplied add-ons.  Vendors who supply perl with their system
7954 may find it convenient to place all vendor-supplied files in this
7955 directory rather than in the main distribution directory.  This will
7956 ease upgrades between binary-compatible maintenance versions of perl.
7957
7958 Of course you may also use these directories in whatever way you see
7959 fit.  For example, you might use them to access modules shared over a
7960 company-wide network.
7961
7962 The default answer should be fine for most people.
7963 This causes further questions about vendor add-ons to be skipped
7964 and no vendor-specific directories will be configured for perl.
7965
7966 EOM
7967 rp='Do you want to configure vendor-specific add-on directories?'
7968 case "$usevendorprefix" in
7969 define|true|[yY]*) dflt=y ;;
7970 *)      : User may have set vendorprefix directly on Configure command line.
7971         case "$vendorprefix" in
7972         ''|' ') dflt=n ;;
7973         *)      dflt=y ;;
7974         esac
7975         ;;
7976 esac
7977 . ./myread
7978 case "$ans" in
7979 [yY]*)  fn=d~+
7980         rp='Installation prefix to use for vendor-supplied add-ons?'
7981         case "$vendorprefix" in
7982         '') dflt="$prefix" ;;
7983         *)  dflt=$vendorprefix ;;
7984         esac
7985         . ./getfile
7986         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7987         oldvendorprefix=''
7988         case "$vendorprefix" in
7989         '') ;;
7990         *)      case "$ans" in
7991                 "$prefix") ;;
7992                 *) oldvendorprefix="$prefix";;
7993                 esac
7994                 ;;
7995         esac
7996         usevendorprefix="$define"
7997         vendorprefix="$ans"
7998         vendorprefixexp="$ansexp"
7999         ;;
8000 *)      usevendorprefix="$undef"
8001         vendorprefix=''
8002         vendorprefixexp=''
8003         ;;
8004 esac
8005
8006 : Set the vendorlib variables
8007 case "$vendorprefix" in
8008 '')     d_vendorlib="$undef"
8009         vendorlib=''
8010         vendorlibexp=''
8011         ;;
8012 *)      d_vendorlib="$define"
8013         : determine where vendor-supplied modules go.
8014         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8015         case "$vendorlib" in
8016         '')
8017                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8018                 case "$installstyle" in
8019                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8020                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8021                 esac
8022                 ;;
8023         *)      dflt="$vendorlib"
8024                 ;;
8025         esac
8026         fn=d~+
8027         rp='Pathname for the vendor-supplied library files?'
8028         . ./getfile
8029         vendorlib="$ans"
8030         vendorlibexp="$ansexp"
8031         ;;
8032 esac
8033 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8034 prefixvar=vendorlib
8035 . ./installprefix
8036
8037 : Set the vendorarch variables
8038 case "$vendorprefix" in
8039 '')     d_vendorarch="$undef"
8040         vendorarch=''
8041         vendorarchexp=''
8042         ;;
8043 *)      d_vendorarch="$define"
8044         : determine where vendor-supplied architecture-dependent libraries go.
8045         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8046         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8047         : vendorlib may have an optional trailing /share.
8048         case "$vendorarch" in
8049         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8050                 dflt="$dflt/$archname"
8051                 ;;
8052         *)      dflt="$vendorarch" ;;
8053         esac
8054         fn=d~+
8055         rp='Pathname for vendor-supplied architecture-dependent files?'
8056         . ./getfile
8057         vendorarch="$ans"
8058         vendorarchexp="$ansexp"
8059         ;;
8060 esac
8061 prefixvar=vendorarch
8062 . ./installprefix
8063 if $test X"$vendorarch" = X"$vendorlib"; then
8064         d_vendorarch="$undef"
8065 else
8066         d_vendorarch="$define"
8067 fi
8068
8069 : Final catch-all directories to search
8070 $cat <<EOM
8071
8072 Lastly, you can have perl look in other directories for extensions and
8073 modules in addition to those already specified.
8074 These directories will be searched after
8075         $sitearch
8076         $sitelib
8077 EOM
8078 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8079 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8080 echo ' '
8081 case "$otherlibdirs" in
8082 ''|' ') dflt='none' ;;
8083 *)      dflt="$otherlibdirs" ;;
8084 esac
8085 $cat <<EOM
8086 Enter a colon-separated set of extra paths to include in perl's @INC
8087 search path, or enter 'none' for no extra paths.
8088
8089 EOM
8090
8091 rp='Colon-separated list of additional directories for perl to search?'
8092 . ./myread
8093 case "$ans" in
8094 ' '|''|none)    otherlibdirs=' ' ;;
8095 *)      otherlibdirs="$ans" ;;
8096 esac
8097 case "$otherlibdirs" in
8098 ' ') val=$undef ;;
8099 *)      val=$define ;;
8100 esac
8101 set d_perl_otherlibdirs
8102 eval $setvar
8103
8104 : DTrace support
8105 dflt_dtrace='/usr/sbin/dtrace'
8106 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8107
8108 cat <<EOM
8109
8110 Perl can be built to support DTrace on platforms that support it.
8111 DTrace is a diagnosis and performance analysis tool from Sun.
8112
8113 If this doesn't make any sense to you, just accept the default.
8114 EOM
8115
8116 while $test 1 ; do
8117         case "$usedtrace" in
8118         $define|true|[yY]*)
8119                 dflt='y'
8120                 ;;
8121         $undef|false|[nN]*)
8122                 dflt='n'
8123                 dflt_dtrace=""
8124                 ;;
8125         ?*)
8126                 dflt='y'
8127                 dflt_dtrace=$usedtrace
8128                 ;;
8129         *)
8130                 dflt='n'
8131                 ;;
8132         esac
8133
8134         rp='Support DTrace if available?'
8135         . ./myread
8136         case "$ans" in
8137         y|Y)    val="$define" ;;
8138         *)      val="$undef" ;;
8139         esac
8140         set usedtrace
8141         eval $setvar
8142
8143         test "X$usedtrace" != "X$define" && break
8144
8145         echo " "
8146         rp='Where is the dtrace executable?'
8147         dflt=$dflt_dtrace
8148         . ./getfile
8149         val="$ans"
8150         set dtrace
8151         eval $setvar
8152
8153         if $test -f $dtrace
8154         then
8155                 if $dtrace -h -s ../perldtrace.d \
8156                         -o perldtrace.tmp >/dev/null 2>&1 \
8157                         && rm -f perldtrace.tmp
8158                 then
8159                         echo " "
8160                         echo "Good: your $dtrace knows about the -h flag."
8161                 else
8162                         cat >&2 <<EOM
8163
8164 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8165 ***
8166 *** Your installed dtrace doesn't support the -h switch to compile a D
8167 *** program into a C header. Can't continue.
8168
8169 EOM
8170                         exit 1
8171                 fi
8172                 break;
8173         fi
8174
8175         case "$fastread" in
8176         yes)
8177                 cat >&2 <<EOM
8178
8179 *** $me:  Fatal Error:  $dtrace not found.
8180 *** Can't continue.
8181
8182 EOM
8183                 exit 1
8184                 ;;
8185         *)
8186                 echo "*** $dtrace was not found."
8187                 echo " "
8188                 ;;
8189         esac
8190 done
8191
8192 : See if we want extra modules installed
8193 echo " "
8194 case "$extras" in
8195 '') dflt='n';;
8196 *) dflt='y';;
8197 esac
8198 cat <<EOM
8199 Perl can be built with extra modules or bundles of modules which
8200 will be fetched from the CPAN and installed alongside Perl.
8201
8202 Notice that you will need access to the CPAN; either via the Internet,
8203 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8204 be asked later to configure the CPAN.pm module which will in turn do
8205 the installation of the rest of the extra modules or bundles.)
8206
8207 Notice also that if the modules require any external software such as
8208 libraries and headers (the libz library and the zlib.h header for the
8209 Compress::Zlib module, for example) you MUST have any such software
8210 already installed, this configuration process will NOT install such
8211 things for you.
8212
8213 If this doesn't make any sense to you, just accept the default '$dflt'.
8214 EOM
8215 rp='Install any extra modules (y or n)?'
8216 . ./myread
8217 case "$ans" in
8218 y|Y)
8219         cat <<EOM
8220
8221 Please list any extra modules or bundles to be installed from CPAN,
8222 with spaces between the names.  The names can be in any format the
8223 'install' command of CPAN.pm will understand.  (Answer 'none',
8224 without the quotes, to install no extra modules or bundles.)
8225 EOM
8226         rp='Extras?'
8227         dflt="$extras"
8228         . ./myread
8229         extras="$ans"
8230 esac
8231 case "$extras" in
8232 ''|'none')
8233         val=''
8234         $rm -f ../extras.lst
8235         ;;
8236 *)      echo "(Saving the list of extras for later...)"
8237         echo "$extras" > ../extras.lst
8238         val="'$extras'"
8239         ;;
8240 esac
8241 set extras
8242 eval $setvar
8243 echo " "
8244
8245 : determine where html pages for programs go
8246 set html1dir html1dir none
8247 eval $prefixit
8248 $cat <<EOM
8249
8250 If you wish to install html files for programs in $spackage, indicate
8251 the appropriate directory here.  To skip installing html files,
8252 answer "none".
8253 EOM
8254 case "$html1dir" in
8255 ''|none|$undef|' ') dflt=none ;;
8256 *) dflt=$html1dir ;;
8257 esac
8258 fn=dn+~
8259 rp="Directory for the main $spackage html pages?"
8260 . ./getfile
8261 prefixvar=html1dir
8262 . ./setprefixvar
8263 : Use ' ' for none so value is preserved next time through Configure
8264 $test X"$html1dir" = "X" && html1dir=' '
8265
8266 : determine where html pages for libraries and modules go
8267 set html3dir html3dir none
8268 eval $prefixit
8269 $cat <<EOM
8270
8271 If you wish to install html files for modules associated with $spackage,
8272 indicate the appropriate directory here.  To skip installing html files,
8273 answer "none".
8274 EOM
8275 : There is no obvious default.  If they have specified html1dir, then
8276 : try to key off that, possibly changing .../html1 into .../html3.
8277 case "$html3dir" in
8278 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8279 *) dflt=$html3dir ;;
8280 esac
8281 fn=dn+~
8282 rp="Directory for the $spackage module html pages?"
8283 . ./getfile
8284 prefixvar=html3dir
8285 . ./setprefixvar
8286 : Use ' ' for none so value is preserved next time through Configure
8287 $test X"$html3dir" = "X" && html3dir=' '
8288
8289 : determine whether to install perl also as /usr/bin/perl
8290
8291 echo " "
8292 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8293         $cat <<EOM
8294 Many scripts expect perl to be installed as /usr/bin/perl.
8295
8296 If you want to, I can install the perl you are about to compile
8297 as /usr/bin/perl (in addition to $bin/perl).
8298 EOM
8299         if test -f /usr/bin/perl; then
8300             $cat <<EOM
8301
8302 However, please note that because you already have a /usr/bin/perl,
8303 overwriting that with a new Perl would very probably cause problems.
8304 Therefore I'm assuming you don't want to do that (unless you insist).
8305
8306 EOM
8307             case "$installusrbinperl" in
8308             "$define"|[yY]*)    dflt='y';;
8309             *)                  dflt='n';;
8310             esac
8311         else
8312             $cat <<EOM
8313
8314 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8315
8316 EOM
8317             case "$installusrbinperl" in
8318             "$undef"|[nN]*)     dflt='n';;
8319             *)                  dflt='y';;
8320             esac
8321         fi
8322         rp="Do you want to install perl as /usr/bin/perl?"
8323         . ./myread
8324         case "$ans" in
8325         [yY]*)  val="$define";;
8326         *)      val="$undef" ;;
8327         esac
8328 else
8329         val="$undef"
8330 fi
8331 set installusrbinperl
8332 eval $setvar
8333
8334 : see if dlopen exists
8335 xxx_runnm="$runnm"
8336 xxx_ccflags="$ccflags"
8337 runnm=false
8338 : with g++ one needs -shared to get is-in-libc to work for dlopen
8339 case "$gccversion" in
8340 '')     ;;
8341 *Clang*)        ;;
8342 *)      case "$d_cplusplus" in
8343         "$define") ccflags="$ccflags -shared" ;;
8344         esac
8345         ;;
8346 esac
8347 set dlopen d_dlopen
8348 eval $inlibc
8349 runnm="$xxx_runnm"
8350 ccflags="$xxx_ccflags"
8351
8352 : see if this is a unistd.h system
8353 set unistd.h i_unistd
8354 eval $inhdr
8355
8356 : determine which dynamic loading, if any, to compile in
8357 echo " "
8358 dldir="ext/DynaLoader"
8359 case "$usedl" in
8360     $define|y|true)
8361         dflt='y'
8362         usedl="$define"
8363         ;;
8364     $undef|n|false)
8365         dflt='n'
8366         usedl="$undef"
8367         ;;
8368     *)
8369         dflt='n'
8370         case "$d_dlopen" in
8371             $define) dflt='y' ;;
8372         esac
8373         : Does a dl_xxx.xs file exist for this operating system
8374         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8375         ;;
8376 esac
8377 rp="Do you wish to use dynamic loading?"
8378 . ./myread
8379 usedl="$ans"
8380 bin_ELF="$undef"
8381 case "$ans" in
8382     y*) usedl="$define"
8383         case "$dlsrc" in
8384             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8385                     dflt="$dldir/dl_${osname}.xs"
8386                 elif $test "$d_dlopen" = "$define" ; then
8387                     dflt="$dldir/dl_dlopen.xs"
8388                 else
8389                     dflt=''
8390                 fi
8391                 ;;
8392             *)  dflt="$dldir/$dlsrc"
8393                 ;;
8394         esac
8395         echo "The following dynamic loading files are available:"
8396         : Can not go over to $dldir because getfile has path hard-coded in.
8397         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8398         rp="Source file to use for dynamic loading"
8399         fn="fne"
8400         gfpth="$src"
8401         . ./getfile
8402         usedl="$define"
8403         : emulate basename
8404         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8405
8406         $cat << EOM
8407
8408 Some systems may require passing special flags to $cc -c to
8409 compile modules that will be used to create a shared library.
8410 To use no flags, say "none".
8411
8412 EOM
8413         case "$cccdlflags" in
8414             '') case "$gccversion" in
8415                 '') case "$osname" in
8416                         hpux)   dflt='+z' ;;
8417                         irix*)  dflt='-KPIC' ;;
8418                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8419                         sunos)  dflt='-pic' ;;
8420                         *)      dflt='none' ;;
8421                     esac
8422                     ;;
8423                 *)  case "$osname" in
8424                         darwin) dflt='none' ;;
8425                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8426                         *)      dflt='-fpic' ;;
8427                     esac ;;
8428                 esac ;;
8429             ' ') dflt='none' ;;
8430             *)   dflt="$cccdlflags" ;;
8431         esac
8432
8433         case "$dflt" in
8434             none) dflt='' ;;
8435         esac
8436
8437         # If -Dsysroot was specified, now's the time to add it
8438         # to cccdlflags
8439         if test "X$sysroot" != X; then
8440             case "$gccversion" in
8441                 '') ;;
8442                 *)  case "$dflt" in
8443                         *sysroot*) ;;
8444                         'undef'|*)
8445                             dflt="$dflt --sysroot=$sysroot" ;;
8446                     esac
8447                     ;;
8448             esac
8449         fi
8450
8451         case "$dflt" in
8452             '') dflt='none';;
8453         esac
8454
8455         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8456         . ./myread
8457         case "$ans" in
8458             none) cccdlflags=' ' ;;
8459             *)    cccdlflags="$ans" ;;
8460         esac
8461
8462         cat << EOM
8463
8464 Some systems use ld to create libraries that can be dynamically loaded,
8465 while other systems (such as those using ELF) use $cc.
8466
8467 EOM
8468
8469 : Determine if this is ELF
8470         $cat >try.c <<EOM
8471 /* Test for whether ELF binaries are produced */
8472 #include <fcntl.h>
8473 #$i_stdlib I_STDLIB
8474 #ifdef I_STDLIB
8475 #include <stdlib.h>
8476 #endif
8477 #$i_unistd I_UNISTD
8478 #ifdef I_UNISTD
8479 #include <unistd.h>
8480 #endif
8481 int main() {
8482     char b[4];
8483     int i = open("a.out",O_RDONLY);
8484     if(i == -1)
8485         exit(1); /* fail */
8486     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8487         exit(0); /* succeed (yes, it is ELF) */
8488     exit(1); /* fail */
8489 }
8490 EOM
8491         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8492             bin_ELF="$define"
8493         fi
8494         $rm_try
8495
8496         case "$ld" in
8497             '') if $test $bin_ELF = "$define"; then
8498                     cat <<EOM
8499 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8500 EOM
8501                     dflt="$cc"
8502                 else
8503                     echo "I'll use ld to build dynamic libraries."
8504                     dflt='ld'
8505                 fi
8506                 ;;
8507             *)  dflt="$ld"
8508                 ;;
8509         esac
8510
8511         rp="What command should be used to create dynamic libraries?"
8512         . ./myread
8513         ld="$ans"
8514
8515         cat << EOM
8516
8517 Some systems may require passing special flags to $ld to create a
8518 library that can be dynamically loaded.  If your ld flags include
8519 -L/other/path options to locate libraries outside your loader's normal
8520 search path, you may need to specify those -L options here as well.  To
8521 use no flags, say "none".
8522
8523 EOM
8524         case "$lddlflags" in
8525             '') case "$osname" in
8526                     haiku) dflt='-shared' ;;
8527                     hpux) dflt='-b';
8528                           case "$gccversion" in
8529                               '') dflt="$dflt +vnocompatwarnings" ;;
8530                           esac
8531                           ;;
8532                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8533                     solaris) # See [perl #66604].
8534                             # On Solaris 11, gcc -m64 on amd64
8535                             # appears not to understand -G.  gcc versions at
8536                             # least as old as 3.4.3 support -shared, so just
8537                             # use that with Solaris 11 and later, but keep
8538                             # the old behavior for older Solaris versions.
8539                             case "$gccversion" in
8540                                 '') dflt='-G' ;;
8541                                 *)  case "$osvers" in
8542                                         2.?|2.10) dflt='-G' ;;
8543                                         *) dflt='-shared' ;;
8544                                     esac
8545                                     ;;
8546                             esac
8547                             ;;
8548                     sunos) dflt='-assert nodefinitions' ;;
8549                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8550                     *)     dflt='none' ;;
8551                 esac
8552                 ;;
8553             *) dflt="$lddlflags" ;;
8554         esac
8555
8556         : Only do this for gcc, since, for example, qcc has no concept
8557         : of --sysroot.
8558         if $test "X$sysroot" != X; then
8559             case "$gccversion" in
8560                 '') ;;
8561                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8562             esac
8563         fi
8564
8565         : Try to guess additional flags to pick up local libraries.
8566         : Be careful not to append to a plain 'none'
8567         case "$dflt" in
8568             none) dflt='' ;;
8569         esac
8570         for thisflag in $ldflags; do
8571             case "$thisflag" in
8572                 -L*|-R*|-Wl,-R*)
8573                     case " $dflt " in
8574                         *" $thisflag "*) ;;
8575                         *) dflt="$dflt $thisflag" ;;
8576                     esac
8577                     ;;
8578             esac
8579         done
8580
8581         case "$dflt" in
8582             ''|' ') dflt='none' ;;
8583         esac
8584
8585         case "$ldflags" in
8586             *-fstack-protector-strong*)
8587                 case "$dflt" in
8588                     *-fstack-protector-strong*) ;; # Don't add it again
8589                     *) dflt="$dflt -fstack-protector-strong" ;;
8590                 esac
8591                 ;;
8592             *-fstack-protector*)
8593                 case "$dflt" in
8594                     *-fstack-protector*) ;; # Don't add it again
8595                     *) dflt="$dflt -fstack-protector" ;;
8596                 esac
8597                 ;;
8598         esac
8599
8600         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8601         . ./myread
8602         case "$ans" in
8603             none) lddlflags=' ' ;;
8604             *) lddlflags="$ans" ;;
8605         esac
8606
8607         cat <<EOM
8608
8609 Some systems may require passing special flags to $cc to indicate that
8610 the resulting executable will use dynamic linking.  To use no flags,
8611 say "none".
8612
8613 EOM
8614         case "$ccdlflags" in
8615             '') case "$osname" in
8616                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8617                     sunos)             dflt='none'   ;;
8618                     *)                 dflt='none'   ;;
8619                 esac ;;
8620             ' ') dflt='none' ;;
8621             *)   dflt="$ccdlflags" ;;
8622         esac
8623         rp="Any special flags to pass to $cc to use dynamic linking?"
8624         . ./myread
8625         case "$ans" in
8626             none) ccdlflags=' ' ;;
8627             *)    ccdlflags="$ans" ;;
8628         esac
8629         ;;
8630
8631     *)  usedl="$undef"
8632         ld='ld'
8633         dlsrc='dl_none.xs'
8634         lddlflags=''
8635         ccdlflags=''
8636         ;;
8637 esac
8638
8639 ld_can_script="$undef"
8640 case "$bin_ELF$usedl" in
8641     $define$define)
8642         # Abuse try.h and a.out names for neat cleanup
8643         $cat >try.c <<EOM
8644 void foo() {}
8645 void bar() {}
8646 EOM
8647         $cat >try.h <<EOM
8648 LIBTEST_42 {
8649  global:
8650   foo;
8651  local: *;
8652  };
8653 EOM
8654         if $cc $cccdlflags $ccdlflags $ccflags \
8655                $ldflags $lddlflags -o a.out try.c \
8656                -Wl,--version-script=try.h >/dev/null 2>&1 \
8657            &&  $test -s a.out ; then
8658             echo "ld supports scripting" >&4
8659             ld_can_script="$define"
8660         else
8661             echo "ld does not support scripting" >&4
8662         fi
8663         $rm_try
8664         ;;
8665 esac
8666
8667 : Do we want a shared libperl?
8668 also=''
8669 case "$usedl" in
8670 $undef)
8671         # No dynamic loading being used, so don't bother even to prompt.
8672         useshrplib='false'
8673         ;;
8674 *)      case "$useshrplib" in
8675         '')     case "$osname" in
8676                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8677                         dflt=y
8678                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8679                         ;;
8680                 *)      dflt=n
8681                         ;;
8682                 esac
8683                 ;;
8684         $define|true|[Yy]*)
8685                 dflt=y
8686                 ;;
8687         *)      dflt=n
8688                 ;;
8689         esac
8690         $cat << EOM
8691
8692 The perl executable is normally obtained by linking perlmain.c with
8693 libperl${_a}, any static extensions (usually just DynaLoader), and
8694 any other libraries needed on this system (such as -lm, etc.).  Since
8695 your system supports dynamic loading, it is probably possible to build
8696 a shared libperl.$so.  If you will have more than one executable linked
8697 to libperl.$so, this will significantly reduce the size of each
8698 executable, but it may have a noticeable effect on performance.  The
8699 default is probably sensible for your system.
8700 $also
8701
8702 EOM
8703         rp="Build a shared libperl.$so (y/n)"
8704         . ./myread
8705         case "$ans" in
8706         true|$define|[Yy]*)
8707                 useshrplib='true'  ;;
8708         *)      useshrplib='false' ;;
8709         esac
8710         ;;
8711 esac
8712
8713 case "$useshrplib" in
8714 true)
8715         case "$userelocatableinc" in
8716         true|define)
8717                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8718                 echo "See INSTALL for an explanation why that won't work." >&4
8719                 exit 4
8720                 ;;
8721         esac
8722         case "$libperl" in
8723         '')
8724                 # Figure out a good name for libperl.so.  Since it gets stored in
8725                 # a version-specific architecture-dependent library, the version
8726                 # number isn't really that important, except for making cc/ld happy.
8727                 #
8728                 # A name such as libperl.so.10.1
8729                 majmin="libperl.$so.$patchlevel.$subversion"
8730                 # A name such as libperl.so.100
8731                 majonly=`echo $patchlevel $subversion |
8732                         $awk '{printf "%d%02d", $1, $2}'`
8733                 majonly=libperl.$so.$majonly
8734                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8735                 # rely on figuring it out from the naming of libc.
8736                 case "${osname}${osvers}" in
8737                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8738                         dflt=libperl.$so
8739                         ;;
8740                 cygwin*) # ld links now against the dll directly
8741                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8742                         majonly=`echo $patchlevel $subversion |
8743                                 $awk '{printf "%03d%03d", $1, $2}'`
8744                         majonly=cygperl5.$majonly.$so
8745                         dflt=$majmin
8746                         ;;
8747                 *)      # Try to guess based on whether libc has major.minor.
8748                         case "$libc" in
8749                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8750                         *libc.$so.[0-9]*) dflt=$majonly ;;
8751                         *)      dflt=libperl.$so ;;
8752                         esac
8753                         ;;
8754                 esac
8755                 ;;
8756         *)      dflt=$libperl
8757                 ;;
8758         esac
8759         cat << EOM
8760
8761 I need to select a good name for the shared libperl.  If your system uses
8762 library names with major and minor numbers, then you might want something
8763 like $majmin.  Alternatively, if your system uses a single version
8764 number for shared libraries, then you might want to use $majonly.
8765 Or, your system might be quite happy with a simple libperl.$so.
8766
8767 Since the shared libperl will get installed into a version-specific
8768 architecture-dependent directory, the version number of the shared perl
8769 library probably isn't important, so the default should be o.k.
8770
8771 EOM
8772         rp='What name do you want to give to the shared libperl?'
8773         . ./myread
8774         libperl=$ans
8775         echo "Ok, I'll use $libperl"
8776         ;;
8777 *)
8778         libperl="libperl${_a}"
8779         ;;
8780 esac
8781
8782 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8783 case "$shrpdir" in
8784 '') ;;
8785 *)      $cat >&4 <<EOM
8786 WARNING:  Use of the shrpdir variable for the installation location of
8787 the shared $libperl is not supported.  It was never documented and
8788 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8789 know of any problems this may cause.
8790
8791 EOM
8792         case "$shrpdir" in
8793         "$archlibexp/CORE")
8794                 $cat >&4 <<EOM
8795 But your current setting of $shrpdir is
8796 the default anyway, so it's harmless.
8797 EOM
8798                 ;;
8799         *)
8800                 $cat >&4 <<EOM
8801 Further, your current attempted setting of $shrpdir
8802 conflicts with the value of $archlibexp/CORE
8803 that installperl will use.
8804 EOM
8805                 ;;
8806         esac
8807         ;;
8808 esac
8809
8810 # How will the perl executable find the installed shared $libperl?
8811 # Add $xxx to ccdlflags.
8812 # If we can't figure out a command-line option, use $shrpenv to
8813 # set env LD_RUN_PATH.  The main perl makefile uses this.
8814 shrpdir=$archlibexp/CORE
8815 xxx=''
8816 tmp_shrpenv=''
8817 if "$useshrplib"; then
8818     case "$osname" in
8819         aix)
8820                 # We'll set it in Makefile.SH...
8821                 ;;
8822         solaris)
8823                 xxx="-R $shrpdir"
8824                 ;;
8825         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8826                 xxx="-Wl,-R$shrpdir"
8827                 ;;
8828         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8829                 xxx="-Wl,-rpath,$shrpdir"
8830                 ;;
8831         hpux*)
8832                 # hpux doesn't like the default, either.
8833                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8834                 ;;
8835         cygwin)
8836                 # cygwin needs only ldlibpth
8837                 ;;
8838         *)
8839                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8840                 ;;
8841         esac
8842         case "$xxx" in
8843         '') ;;
8844         *)
8845                 # Only add $xxx if it isn't already in ccdlflags.
8846                 case " $ccdlflags " in
8847                 *" $xxx "*)     ;;
8848                 *)      ccdlflags="$ccdlflags $xxx"
8849                         cat <<EOM >&4
8850
8851 Adding $xxx to the flags
8852 passed to $ld so that the perl executable will find the
8853 installed shared $libperl.
8854
8855 EOM
8856                         ;;
8857                 esac
8858                 ;;
8859         esac
8860 fi
8861 # Fix ccdlflags in AIX for building external extensions.
8862 # (For building Perl itself bare -bE:perl.exp is needed,
8863 #  Makefile.SH takes care of this.)
8864 case "$osname" in
8865 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8866 esac
8867 # Respect a hint or command-line value.
8868 case "$shrpenv" in
8869 '') shrpenv="$tmp_shrpenv" ;;
8870 esac
8871 case "$ldlibpthname" in
8872 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8873 none)   ldlibpthname='' ;;
8874 esac
8875
8876 : determine where manual pages are on this system
8877 echo " "
8878 case "$sysman" in
8879 '')
8880         syspath='/usr/share/man/man1 /usr/man/man1'
8881         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8882         syspath="$syspath /usr/man/u_man/man1"
8883         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8884         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8885         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8886         sysman=`./loc . /usr/man/man1 $syspath`
8887         ;;
8888 esac
8889 if $test -d "$sysman"; then
8890         echo "System manual is in $sysman." >&4
8891 else
8892         echo "Could not find manual pages in source form." >&4
8893 fi
8894
8895 : determine where manual pages go
8896 set man1dir man1dir none
8897 eval $prefixit
8898 $cat <<EOM
8899
8900 $spackage has manual pages available in source form.
8901 EOM
8902 case "$nroff" in
8903 nroff)
8904         echo "However, you don't have nroff, so they're probably useless to you."
8905         case "$man1dir" in
8906         '') man1dir="none";;
8907         esac;;
8908 esac
8909 echo "If you don't want the manual sources installed, answer 'none'."
8910 case "$man1dir" in
8911 ' ') dflt=none
8912         ;;
8913 '')
8914         lookpath="$prefixexp/share/man/man1"
8915         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8916         lookpath="$lookpath $prefixexp/man/p_man/man1"
8917         lookpath="$lookpath $prefixexp/man/u_man/man1"
8918         lookpath="$lookpath $prefixexp/man/man.1"
8919         case "$sysman" in
8920         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8921         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8922         esac
8923         set dflt
8924         eval $prefixup
8925         ;;
8926 *)  dflt="$man1dir"
8927         ;;
8928 esac
8929 echo " "
8930 fn=dn+~
8931 rp="Where do the main $spackage manual pages (source) go?"
8932 . ./getfile
8933 if $test "X$man1direxp" != "X$ansexp"; then
8934         installman1dir=''
8935 fi
8936 prefixvar=man1dir
8937 . ./setprefixvar
8938
8939 case "$man1dir" in
8940 '')     man1dir=' '
8941         installman1dir='';;
8942 esac
8943
8944 : What suffix to use on installed man pages
8945
8946 case "$man1dir" in
8947 ' ')
8948         man1ext='0'
8949         ;;
8950 *)
8951         rp="What suffix should be used for the main $spackage man pages?"
8952         case "$man1ext" in
8953         '')     case "$man1dir" in
8954                 *1)  dflt=1 ;;
8955                 *1p) dflt=1p ;;
8956                 *1pm) dflt=1pm ;;
8957                 *l) dflt=l;;
8958                 *n) dflt=n;;
8959                 *o) dflt=o;;
8960                 *p) dflt=p;;
8961                 *C) dflt=C;;
8962                 *L) dflt=L;;
8963                 *L1) dflt=L1;;
8964                 *) dflt=1;;
8965                 esac
8966                 ;;
8967         *)      dflt="$man1ext";;
8968         esac
8969         . ./myread
8970         man1ext="$ans"
8971         ;;
8972 esac
8973
8974 : see if we can have long filenames
8975 echo " "
8976 first=123456789abcdef
8977 $rm -f $first
8978 if (echo hi >$first) 2>/dev/null; then
8979         if $test -f 123456789abcde; then
8980                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8981                 val="$undef"
8982         else
8983                 echo 'You can have filenames longer than 14 characters.'>&4
8984                 val="$define"
8985         fi
8986 else
8987         $cat <<'EOM'
8988 You can't have filenames longer than 14 chars.
8989 You can't even think about them!
8990 EOM
8991         val="$undef"
8992 fi
8993 set d_flexfnam
8994 eval $setvar
8995 $rm -rf 123456789abcde*
8996
8997 : determine where library module manual pages go
8998 set man3dir man3dir none
8999 eval $prefixit
9000 $cat <<EOM
9001
9002 $spackage has manual pages for many of the library modules.
9003 EOM
9004
9005 case "$nroff" in
9006 nroff)
9007         $cat <<'EOM'
9008 However, you don't have nroff, so they're probably useless to you.
9009 EOM
9010         case "$man3dir" in
9011         '') man3dir="none";;
9012         esac;;
9013 esac
9014
9015 case "$d_flexfnam" in
9016 undef)
9017         $cat <<'EOM'
9018 However, your system can't handle the long file names like File::Basename.3.
9019 EOM
9020         case "$man3dir" in
9021         '') man3dir="none";;
9022         esac;;
9023 esac
9024
9025 echo "If you don't want the manual sources installed, answer 'none'."
9026 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9027 case "$man3dir" in
9028 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9029         if $test -d "$privlib/man/man3"; then
9030                 cat <<EOM >&4
9031
9032 WARNING:  Previous versions of perl installed man3 pages into
9033 $privlib/man/man3.  This version will suggest a
9034 new default of $dflt.
9035 EOM
9036                 tdflt=$dflt
9037                 dflt='n'
9038                 rp='Do you wish to preserve the old behavior?(y/n)'
9039                 . ./myread
9040                 case "$ans" in
9041                 y*) dflt="$privlib/man/man3" ;;
9042                 *)  dflt=$tdflt ;;
9043                 esac
9044     fi
9045         ;;
9046 *)      dflt="$man3dir" ;;
9047 esac
9048 case "$dflt" in
9049 ' ') dflt=none ;;
9050 esac
9051 echo " "
9052 fn=dn+~
9053 rp="Where do the $package library man pages (source) go?"
9054 . ./getfile
9055 prefixvar=man3dir
9056 . ./setprefixvar
9057
9058 case "$man3dir" in
9059 '')     man3dir=' '
9060         installman3dir='';;
9061 esac
9062
9063 : What suffix to use on installed man pages
9064 case "$man3dir" in
9065 ' ')
9066         man3ext='0'
9067         ;;
9068 *)
9069         rp="What suffix should be used for the $package library man pages?"
9070         case "$man3ext" in
9071         '')     case "$man3dir" in
9072                 *3)  dflt=3 ;;
9073                 *3p) dflt=3p ;;
9074                 *3pm) dflt=3pm ;;
9075                 *l) dflt=l;;
9076                 *n) dflt=n;;
9077                 *o) dflt=o;;
9078                 *p) dflt=p;;
9079                 *C) dflt=C;;
9080                 *L) dflt=L;;
9081                 *L3) dflt=L3;;
9082                 *) dflt=3;;
9083                 esac
9084                 ;;
9085         *)      dflt="$man3ext";;
9086         esac
9087         . ./myread
9088         man3ext="$ans"
9089         ;;
9090 esac
9091
9092 : see if we have to deal with yellow pages, now NIS.
9093 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9094         case "$hostcat" in
9095         nidump*) ;;
9096         *)
9097                 case "$hostcat" in
9098                 *ypcat*) dflt=y;;
9099                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9100                                 dflt=y
9101                         else
9102                                 dflt=n
9103                         fi;;
9104                 *) dflt=n;;
9105                 esac
9106                 echo " "
9107                 rp='Are you getting the hosts file via yellow pages?'
9108                 . ./myread
9109                 case "$ans" in
9110                 y*) hostcat='ypcat hosts';;
9111                 *) hostcat='cat /etc/hosts';;
9112                 esac
9113                 ;;
9114         esac
9115 fi
9116 case "$hostcat" in
9117 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9118 esac
9119 case "$groupcat" in
9120 '') test -f /etc/group && groupcat='cat /etc/group';;
9121 esac
9122 case "$passcat" in
9123 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9124 esac
9125
9126 : now get the host name
9127 echo " "
9128 echo "Figuring out host name..." >&4
9129 case "$myhostname" in
9130 '') cont=true
9131         echo 'Maybe "hostname" will work...'
9132         if tans=`sh -c hostname 2>&1` ; then
9133                 myhostname=$tans
9134                 phostname=hostname
9135                 cont=''
9136         fi
9137         ;;
9138 *) cont='';;
9139 esac
9140 if $test "$cont"; then
9141         if ./xenix; then
9142                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9143                 if tans=`cat /etc/systemid 2>&1` ; then
9144                         myhostname=$tans
9145                         phostname='cat /etc/systemid'
9146                         echo "Whadyaknow.  Xenix always was a bit strange..."
9147                         cont=''
9148                 fi
9149         elif $test -r /etc/systemid; then
9150                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9151         fi
9152 fi
9153 if $test "$cont"; then
9154         echo 'No, maybe "uuname -l" will work...'
9155         if tans=`sh -c 'uuname -l' 2>&1` ; then
9156                 myhostname=$tans
9157                 phostname='uuname -l'
9158         else
9159                 echo 'Strange.  Maybe "uname -n" will work...'
9160                 if tans=`sh -c 'uname -n' 2>&1` ; then
9161                         myhostname=$tans
9162                         phostname='uname -n'
9163                 else
9164                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9165                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9166                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9167                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9168                         else
9169                                 case "$myhostname" in
9170                                 '') echo "Does this machine have an identity crisis or something?"
9171                                         phostname='';;
9172                                 *)
9173                                         echo "Well, you said $myhostname before..."
9174                                         phostname='echo $myhostname';;
9175                                 esac
9176                         fi
9177                 fi
9178         fi
9179 fi
9180 case "$myhostname" in
9181 '') myhostname=noname ;;
9182 esac
9183 : you do not want to know about this
9184 set $myhostname
9185 myhostname=$1
9186
9187 : verify guess
9188 if $test "$myhostname" ; then
9189         dflt=y
9190         rp='Your host name appears to be "'$myhostname'".'" Right?"
9191         . ./myread
9192         case "$ans" in
9193         y*) ;;
9194         *) myhostname='';;
9195         esac
9196 fi
9197
9198 : bad guess or no guess
9199 while $test "X$myhostname" = X ; do
9200         dflt=''
9201         rp="Please type the (one word) name of your host:"
9202         . ./myread
9203         myhostname="$ans"
9204 done
9205
9206 : translate upper to lower if necessary
9207 case "$myhostname" in
9208 *[A-Z]*)
9209         echo "(Normalizing case in your host name)"
9210         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9211         ;;
9212 esac
9213
9214 case "$myhostname" in
9215 *.*)
9216         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9217         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9218         echo "(Trimming domain name from host name--host name is now $myhostname)"
9219         ;;
9220 *) case "$mydomain" in
9221         '')
9222                 {
9223                         test "X$hostcat" = "Xypcat hosts" &&
9224                         ypmatch "$myhostname" hosts 2>/dev/null |\
9225                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9226                         $test -s hosts
9227                 } || {
9228                         test "X$hostcat" != "X" &&
9229                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9230                                         /[       ]$myhostname[  . ]/p" > hosts
9231                 }
9232                 tmp_re="[       . ]"
9233                 if $test -f hosts; then
9234                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9235                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9236                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9237                                 hosts | $sort | $uniq | \
9238                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9239                         case `$echo X$dflt` in
9240                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9241                                 dflt=.
9242                                 ;;
9243                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9244                                 ;;
9245                         esac
9246                 else
9247                         echo "(I cannot locate a hosts database anywhere)"
9248                         dflt=.
9249                 fi
9250                 case "$dflt" in
9251                 .)
9252                         tans=`./loc resolv.conf X /etc /usr/etc`
9253                         if $test -f "$tans"; then
9254                                 echo "(Attempting domain name extraction from $tans)"
9255                                 dflt=.`$sed -n -e 's/   / /g' \
9256                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9257                                   -e 1q 2>/dev/null`
9258                                 case "$dflt" in
9259                                 .) dflt=.`$sed -n -e 's/        / /g' \
9260                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9261                                      -e 1q 2>/dev/null`
9262                                         ;;
9263                                 esac
9264                         fi
9265                         ;;
9266                 esac
9267                 case "$dflt" in
9268                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9269                         dflt=.`sh -c domainname 2>/dev/null`
9270                         case "$dflt" in
9271                         '') dflt='.';;
9272                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9273                         esac
9274                         ;;
9275                 esac
9276                 case "$dflt$osname" in
9277                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9278                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9279                         ;;
9280                 esac
9281                 case "$dflt" in
9282                 .) echo "(Lost all hope -- silly guess then)"
9283                         dflt='.nonet'
9284                         ;;
9285                 esac
9286                 $rm -f hosts
9287                 ;;
9288         *) dflt="$mydomain";;
9289         esac;;
9290 esac
9291 echo " "
9292 rp="What is your domain name?"
9293 . ./myread
9294 tans="$ans"
9295 case "$ans" in
9296 '') ;;
9297 .*) ;;
9298 *) tans=".$tans";;
9299 esac
9300 mydomain="$tans"
9301
9302 : translate upper to lower if necessary
9303 case "$mydomain" in
9304 *[A-Z]*)
9305         echo "(Normalizing case in your domain name)"
9306         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9307         ;;
9308 esac
9309
9310 : a little sanity check here
9311 case "$phostname" in
9312 '') ;;
9313 *)
9314         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9315         $myhostname$mydomain|$myhostname) ;;
9316         *)
9317                 case "$phostname" in
9318                 sed*)
9319                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9320                         ;;
9321                 *)
9322                         echo "(That doesn't agree with your $phostname command, by the way.)"
9323                         ;;
9324                 esac
9325         ;;
9326         esac
9327         ;;
9328 esac
9329
9330 : determine the e-mail address of the user who is running us
9331 $cat <<EOM
9332
9333 I need to get your e-mail address in Internet format if possible, i.e.
9334 something like user@host.domain. Please answer accurately since I have
9335 no easy means to double check it. The default value provided below
9336 is most probably close to reality but may not be valid from outside
9337 your organization...
9338
9339 EOM
9340 cont=x
9341 while test "$cont"; do
9342         case "$MAILDOMAIN" in
9343         '')
9344                 if $test -s /etc/mailname; then
9345                         maildomain=`$cat /etc/mailname`
9346                 else
9347                         maildomain="$myhostname$mydomain"
9348                 fi
9349                 ;;
9350         *)  maildomain="$MAILDOMAIN";;
9351         esac
9352         case "$cf_email" in
9353         '') dflt="$cf_by@$maildomain";;
9354         *)  dflt="$cf_email";;
9355         esac
9356         rp='What is your e-mail address?'
9357         . ./myread
9358         cf_email="$ans"
9359         case "$cf_email" in
9360         *@*.*) cont='' ;;
9361         *)
9362                 rp='Address does not look like an Internet one.  Use it anyway?'
9363                 case "$fastread" in
9364                 yes) dflt=y ;;
9365                 *) dflt=n ;;
9366                 esac
9367                 . ./myread
9368                 case "$ans" in
9369                 y*) cont='' ;;
9370                 *) echo " " ;;
9371                 esac
9372                 ;;
9373         esac
9374 done
9375
9376 : Ask e-mail of administrator
9377 $cat <<EOM
9378
9379 If you or somebody else will be maintaining perl at your site, please
9380 fill in the correct e-mail address here so that they may be contacted
9381 if necessary. Currently, the "perlbug" program included with perl
9382 will send mail to this address in addition to perlbug@perl.org. You may
9383 enter "none" for no administrator.
9384
9385 EOM
9386 case "$perladmin" in
9387 '') dflt="$cf_email";;
9388 *) dflt="$perladmin";;
9389 esac
9390 rp='Perl administrator e-mail address'
9391 . ./myread
9392 perladmin="$ans"
9393
9394 : determine whether to use a version number suffix for installed binaries
9395 echo " "
9396 $cat <<EOM
9397 Do you want to use a version number suffix for installed binaries? This
9398 will install 'perl$version' instead of 'perl', and likewise for other
9399 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9400 to be installed side-by-side. Unless you are a developer, you probably
9401 do *not* want to do this.
9402 EOM
9403 case "$versiononly" in
9404 "$define"|[Yy]*|true) dflt='y' ;;
9405 *) dflt='n';
9406 esac
9407 rp="Do you want to use a version number suffix for installed binaries?"
9408 . ./myread
9409 case "$ans" in
9410 [yY]*)  val="$define";;
9411 *)      val="$undef" ;;
9412 esac
9413 set versiononly
9414 eval $setvar
9415
9416 case "$versiononly" in
9417 "$define") inc_version_list=''
9418            inc_version_list_init=0
9419            ;;
9420 esac
9421
9422 : figure out how to guarantee perl startup
9423 : XXX Note that this currently takes advantage of the bug that binexp ignores
9424 :     the Configure -Dinstallprefix setting, which in turn means that under
9425 :     relocatable @INC, initialinstalllocation is what binexp started as.
9426 case "$startperl" in
9427 '')
9428         case "$sharpbang" in
9429         *!)
9430                 $cat <<EOH
9431
9432 I can use the #! construct to start perl on your system. This will
9433 make startup of perl scripts faster, but may cause problems if you
9434 want to share those scripts and perl is not in a standard place
9435 ($initialinstalllocation/perl) on all your platforms. The alternative
9436 is to force a shell by starting the script with a single ':' character.
9437
9438 EOH
9439                 case "$versiononly" in
9440                 "$define")      dflt="$initialinstalllocation/perl$version";;
9441                 *)              dflt="$initialinstalllocation/perl";;
9442                 esac
9443                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9444                 . ./myread
9445                 case "$ans" in
9446                 none)   startperl=": # use perl";;
9447                 *)      startperl="#!$ans"
9448                         if $test 30 -lt `echo "$ans" | wc -c`; then
9449                                 $cat >&4 <<EOM
9450
9451 WARNING:  Some systems limit the #! command to 32 characters.
9452 If you experience difficulty running Perl scripts with #!, try
9453 installing Perl in a directory with a shorter pathname.
9454
9455 EOM
9456                         fi ;;
9457                 esac
9458                 ;;
9459         *) startperl=": # use perl"
9460                 ;;
9461         esac
9462         ;;
9463 esac
9464 echo "I'll use $startperl to start perl scripts."
9465
9466 : figure best path for perl in scripts
9467 case "$perlpath" in
9468 '')
9469         case "$versiononly" in
9470         "$define")      perlpath="$initialinstalllocation/perl$version";;
9471         *)              perlpath="$initialinstalllocation/perl";;
9472         esac
9473         case "$startperl" in
9474         *!*) ;;
9475         *)
9476                 $cat <<EOH
9477
9478 I will use the "eval 'exec'" idiom to start Perl on your system.
9479 I can use the full path of your Perl binary for this purpose, but
9480 doing so may cause problems if you want to share those scripts and
9481 Perl is not always in a standard place ($initialinstalllocation/perl).
9482
9483 EOH
9484                 dflt="$initialinstalllocation/perl"
9485                 rp="What path shall I use in \"eval 'exec'\"?"
9486                 . ./myread
9487                 perlpath="$ans"
9488                 ;;
9489         esac
9490         ;;
9491 esac
9492 case "$startperl" in
9493 *!*)    ;;
9494 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9495 esac
9496
9497 : determine where public executable scripts go
9498 set scriptdir scriptdir
9499 eval $prefixit
9500 case "$scriptdir" in
9501 '')
9502         dflt="$bin"
9503         : guess some guesses
9504         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9505         $test -d /usr/share/bin     && dflt=/usr/share/bin
9506         $test -d /usr/local/script  && dflt=/usr/local/script
9507         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9508         $test -d $prefixexp/script  && dflt=$prefixexp/script
9509         set dflt
9510         eval $prefixup
9511         ;;
9512 *)  dflt="$scriptdir"
9513         ;;
9514 esac
9515 $cat <<EOM
9516
9517 Some installations have a separate directory just for executable scripts so
9518 that they can mount it across multiple architectures but keep the scripts in
9519 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9520 Or you might just lump your scripts in with all your other executables.
9521
9522 EOM
9523 fn=d~
9524 rp='Where do you keep publicly executable scripts?'
9525 . ./getfile
9526 if $test "X$ansexp" != "X$scriptdirexp"; then
9527         installscript=''
9528 fi
9529 installscriptdir=''
9530 prefixvar=scriptdir
9531 . ./setprefixvar
9532 : A little fix up for an irregularly named variable.
9533 installscript="$installscriptdir"
9534
9535 : determine where add-on public executables go
9536 case "$sitebin" in
9537 '')     dflt=$siteprefix/bin ;;
9538 *)      dflt=$sitebin ;;
9539 esac
9540 fn=d~
9541 rp='Pathname where the add-on public executables should be installed?'
9542 . ./getfile
9543 prefixvar=sitebin
9544 . ./setprefixvar
9545
9546 : determine where add-on html pages go
9547 : There is no standard location, so try to copy the previously-selected
9548 : directory structure for the core html pages.
9549 case "$sitehtml1dir" in
9550 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9551 *)     dflt=$sitehtml1dir ;;
9552 esac
9553 case "$dflt" in
9554 ''|' ') dflt=none ;;
9555 esac
9556 fn=dn+~
9557 rp='Pathname where the site-specific html pages should be installed?'
9558 . ./getfile
9559 prefixvar=sitehtml1dir
9560 . ./setprefixvar
9561
9562 : determine where add-on library html pages go
9563 : There is no standard location, so try to copy the previously-selected
9564 : directory structure for the core html pages.
9565 case "$sitehtml3dir" in
9566 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)     dflt=$sitehtml3dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific library html pages should be installed?'
9574 . ./getfile
9575 prefixvar=sitehtml3dir
9576 . ./setprefixvar
9577
9578 : determine where add-on manual pages go
9579 case "$siteman1dir" in
9580 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9581 *)      dflt=$siteman1dir ;;
9582 esac
9583 case "$dflt" in
9584 ''|' ') dflt=none ;;
9585 esac
9586 fn=dn+~
9587 rp='Pathname where the site-specific manual pages should be installed?'
9588 . ./getfile
9589 prefixvar=siteman1dir
9590 . ./setprefixvar
9591
9592 : determine where add-on library man pages go
9593 case "$siteman3dir" in
9594 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9595 *)      dflt=$siteman3dir ;;
9596 esac
9597 case "$dflt" in
9598 ''|' ') dflt=none ;;
9599 esac
9600 fn=dn+~
9601 rp='Pathname where the site-specific library manual pages should be installed?'
9602 . ./getfile
9603 prefixvar=siteman3dir
9604 . ./setprefixvar
9605
9606 : determine where add-on public executable scripts go
9607 case "$sitescript" in
9608 '')     dflt=$siteprefix/script
9609         $test -d $dflt || dflt=$sitebin ;;
9610 *)  dflt="$sitescript" ;;
9611 esac
9612 fn=d~+
9613 rp='Pathname where add-on public executable scripts should be installed?'
9614 . ./getfile
9615 prefixvar=sitescript
9616 . ./setprefixvar
9617
9618 : see if backtrace exists
9619 set backtrace d_backtrace
9620 eval $inlibc
9621
9622 : Check if C backtrace is actually supported.
9623 case "$usecbacktrace" in
9624   "") usecbacktrace=$undef ;;
9625   [yY]*|true|$define)
9626     case "$d_backtrace" in
9627       [yY]*|true|$define)
9628         ;;
9629       *)
9630         echo "This system does not support backtrace" >&4
9631         usecbacktrace=$undef
9632         ;;
9633       esac
9634     ;;
9635   esac
9636
9637 : Check if faststdio is requested and available
9638 case "$usefaststdio" in
9639 $define|true|[yY]*|'')
9640         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9641         case "$xversion" in
9642         [68])   dflt='y' ;;
9643         *)      dflt='n' ;;
9644         esac
9645         ;;
9646 *) dflt='n';;
9647 esac
9648 cat <<EOM
9649
9650 Perl can be built to use 'fast stdio', which means using the stdio
9651 library but also directly manipulating the stdio buffers to enable
9652 faster I/O.  Using stdio is better for backward compatibility (especially
9653 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9654 interface has been preferred instead of stdio.
9655
9656 If this doesn't make any sense to you, just accept the default '$dflt'.
9657 EOM
9658 rp='Use the "fast stdio" if available?'
9659 . ./myread
9660 case "$ans" in
9661 y|Y)    val="$define" ;;
9662 *)      val="$undef" ;;
9663 esac
9664 set usefaststdio
9665 eval $setvar
9666
9667 : define an is-a-typedef? function
9668 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9669 case "$inclist" in
9670 "") inclist="sys/types.h";;
9671 esac;
9672 eval "varval=\$$var";
9673 case "$varval" in
9674 "")
9675         $rm -f temp.c;
9676         for inc in $inclist; do
9677                 echo "#include <$inc>" >>temp.c;
9678         done;
9679         echo "#ifdef $type" >> temp.c;
9680         echo "printf(\"We have $type\");" >> temp.c;
9681         echo "#endif" >> temp.c;
9682         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9683         if $contains $type temp.E >/dev/null 2>&1; then
9684                 eval "$var=\$type";
9685         else
9686                 eval "$var=\$def";
9687         fi;
9688         $rm -f temp.?;;
9689 *) eval "$var=\$varval";;
9690 esac'
9691
9692 : define an is-a-typedef? function that prompts if the type is not available.
9693 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9694 case "$inclist" in
9695 "") inclist="sys/types.h";;
9696 esac;
9697 eval "varval=\$$var";
9698 case "$varval" in
9699 "")
9700         $rm -f temp.c;
9701         for inc in $inclist; do
9702                 echo "#include <$inc>" >>temp.c;
9703         done;
9704         echo "#ifdef $type" >> temp.c;
9705         echo "printf(\"We have $type\");" >> temp.c;
9706         echo "#endif" >> temp.c;
9707         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9708         echo " " ;
9709         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9710         if $contains $type temp.E >/dev/null 2>&1; then
9711                 echo "$type found." >&4;
9712                 eval "$var=\$type";
9713         else
9714                 echo "$type NOT found." >&4;
9715                 dflt="$def";
9716                 . ./myread ;
9717                 eval "$var=\$ans";
9718         fi;
9719         $rm -f temp.?;;
9720 *) eval "$var=\$varval";;
9721 esac'
9722
9723 : see what type lseek is declared as in the kernel
9724 rp="What is the type used for lseek's offset on this system?"
9725 set off_t lseektype long stdio.h sys/types.h
9726 eval $typedef_ask
9727
9728 echo " "
9729 echo "Checking to see how big your file offsets are..." >&4
9730 $cat >try.c <<EOCP
9731 #include <sys/types.h>
9732 #include <stdio.h>
9733 int main()
9734 {
9735     printf("%d\n", (int)sizeof($lseektype));
9736     return(0);
9737 }
9738 EOCP
9739 set try
9740 if eval $compile_ok; then
9741         lseeksize=`$run ./try`
9742         echo "Your file offsets are $lseeksize bytes long."
9743 else
9744         dflt=$longsize
9745         echo " "
9746         echo "(I can't seem to compile the test program.  Guessing...)"
9747         rp="What is the size of your file offsets (in bytes)?"
9748         . ./myread
9749         lseeksize="$ans"
9750 fi
9751 $rm_try
9752
9753 : see what type file positions are declared as in the library
9754 rp="What is the type for file position used by fsetpos()?"
9755 set fpos_t fpostype long stdio.h sys/types.h
9756 eval $typedef_ask
9757
9758 : Check size for Fpos_t
9759 echo " "
9760 case "$fpostype" in
9761 *_t) zzz="$fpostype"    ;;
9762 *)   zzz="fpos_t"       ;;
9763 esac
9764 echo "Checking the size of $zzz..." >&4
9765 cat > try.c <<EOCP
9766 #include <sys/types.h>
9767 #include <stdio.h>
9768 #$i_stdlib I_STDLIB
9769 #ifdef I_STDLIB
9770 #include <stdlib.h>
9771 #endif
9772 int main() {
9773     printf("%d\n", (int)sizeof($fpostype));
9774     exit(0);
9775 }
9776 EOCP
9777 set try
9778 if eval $compile_ok; then
9779         yyy=`$run ./try`
9780         case "$yyy" in
9781         '')     fpossize=4
9782                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9783                 ;;
9784         *)      fpossize=$yyy
9785                 echo "Your $zzz is $fpossize bytes long."
9786                 ;;
9787         esac
9788 else
9789         dflt="$longsize"
9790         echo " " >&4
9791         echo "(I can't compile the test program.  Guessing...)" >&4
9792         rp="What is the size of your file positions (in bytes)?"
9793         . ./myread
9794         fpossize="$ans"
9795 fi
9796
9797 : Check for large file support
9798 # Backward compatibility (uselfs is deprecated).
9799 case "$uselfs" in
9800 "$define"|true|[yY]*)
9801         cat <<EOM >&4
9802
9803 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9804 EOM
9805         uselargefiles="$define"
9806         ;;
9807 esac
9808
9809 case "$lseeksize:$fpossize" in
9810 8:8) cat <<EOM
9811
9812 You can have files larger than 2 gigabytes.
9813 EOM
9814    val="$define" ;;
9815 *)    case "$uselargefiles" in
9816    "$undef"|false|[nN]*) dflt='n' ;;
9817    *)   dflt='y' ;;
9818    esac
9819    cat <<EOM
9820
9821 Perl can be built to understand large files (files larger than 2 gigabytes)
9822 on some systems.  To do so, Configure can be run with -Duselargefiles.
9823
9824 If this doesn't make any sense to you, just accept the default '$dflt'.
9825 EOM
9826    rp='Try to understand large files, if available?'
9827    . ./myread
9828    case "$ans" in
9829    y|Y) val="$define" ;;
9830    *)   val="$undef"  ;;
9831    esac
9832    ;;
9833 esac
9834 set uselargefiles
9835 eval $setvar
9836 : Look for a hint-file generated 'call-back-unit'.  If the
9837 : user has specified that a large files perl is to be built,
9838 : we may need to set or change some other defaults.
9839 if $test -f uselargefiles.cbu; then
9840         echo "Your platform has some specific hints regarding large file builds, using them..."
9841         . ./uselargefiles.cbu
9842 fi
9843 case "$uselargefiles" in
9844 "$define")
9845         if $test -f uselargefiles.cbu; then
9846                 echo " "
9847                 echo "Rechecking to see how big your file offsets are..." >&4
9848                 $cat >try.c <<EOCP
9849 #include <sys/types.h>
9850 #include <stdio.h>
9851 int main()
9852 {
9853     printf("%d\n", (int)sizeof($lseektype));
9854     return(0);
9855 }
9856 EOCP
9857                 set try
9858                 if eval $compile_ok; then
9859                         lseeksize=`$run ./try`
9860                         $echo "Your file offsets are now $lseeksize bytes long."
9861                 else
9862                         dflt="$lseeksize"
9863                         echo " "
9864                         echo "(I can't seem to compile the test program.  Guessing...)"
9865                         rp="What is the size of your file offsets (in bytes)?"
9866                         . ./myread
9867                         lseeksize="$ans"
9868                 fi
9869                 case "$fpostype" in
9870                 *_t) zzz="$fpostype"    ;;
9871                 *)   zzz="fpos_t"       ;;
9872                 esac
9873                 $echo $n "Rechecking the size of $zzz...$c" >&4
9874                 $cat > try.c <<EOCP
9875 #include <sys/types.h>
9876 #include <stdio.h>
9877 #$i_stdlib I_STDLIB
9878 #ifdef I_STDLIB
9879 #include <stdlib.h>
9880 #endif
9881 int main() {
9882     printf("%d\n", (int)sizeof($fpostype));
9883     return(0);
9884 }
9885 EOCP
9886                 set try
9887                 if eval $compile_ok; then
9888                         yyy=`$run ./try`
9889                         dflt="$lseeksize"
9890                         case "$yyy" in
9891                         '')     echo " "
9892                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9893                                 ;;
9894                         *)      fpossize=$yyy
9895                                 echo " $fpossize bytes." >&4
9896                                 ;;
9897                         esac
9898                 else
9899                         dflt="$fpossize"
9900                         echo " "
9901                         echo "(I can't compile the test program.  Guessing...)" >&4
9902                         rp="What is the size of your file positions (in bytes)?"
9903                         . ./myread
9904                         fpossize="$ans"
9905                 fi
9906                 $rm_try
9907         fi
9908         ;;
9909 esac
9910
9911 : Check if we want perlio
9912 useperlio="$define"
9913
9914 : Set the vendorbin variables
9915 case "$vendorprefix" in
9916 '')     d_vendorbin="$undef"
9917         vendorbin=''
9918         vendorbinexp=''
9919         ;;
9920 *)      d_vendorbin="$define"
9921         : determine where vendor-supplied executables go.
9922         case "$vendorbin" in
9923         '') dflt=$vendorprefix/bin ;;
9924         *)      dflt="$vendorbin" ;;
9925         esac
9926         fn=d~+
9927         rp='Pathname for the vendor-supplied executables directory?'
9928         . ./getfile
9929         vendorbin="$ans"
9930         vendorbinexp="$ansexp"
9931         ;;
9932 esac
9933 prefixvar=vendorbin
9934 . ./installprefix
9935
9936 : Set the vendorhtml1dir variables
9937 case "$vendorprefix" in
9938 '')     vendorhtml1dir=''
9939         vendorhtml1direxp=''
9940         ;;
9941 *)      : determine where vendor-supplied html pages go.
9942         : There is no standard location, so try to copy the previously-selected
9943         : directory structure for the core html pages.
9944         : XXX Better default suggestions would be welcome.
9945         case "$vendorhtml1dir" in
9946         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9947         *)      dflt=$vendorhtml1dir ;;
9948         esac
9949         case "$dflt" in
9950         ''|' ') dflt=none ;;
9951         esac
9952         fn=dn+~
9953         rp='Pathname for the vendor-supplied html pages?'
9954         . ./getfile
9955         vendorhtml1dir="$ans"
9956         vendorhtml1direxp="$ansexp"
9957         ;;
9958 esac
9959 : Use ' ' for none so value is preserved next time through Configure
9960 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9961 prefixvar=vendorhtml1dir
9962 . ./installprefix
9963
9964 : Set the vendorhtml3dir variables
9965 case "$vendorprefix" in
9966 '')     vendorhtml3dir=''
9967         vendorhtml3direxp=''
9968         ;;
9969 *)      : determine where vendor-supplied module html pages go.
9970         : There is no standard location, so try to copy the previously-selected
9971         : directory structure for the core html pages.
9972         : XXX Better default suggestions would be welcome.
9973         case "$vendorhtml3dir" in
9974         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9975         *)      dflt=$vendorhtml3dir ;;
9976         esac
9977         case "$dflt" in
9978         ''|' ') dflt=none ;;
9979         esac
9980         fn=dn+~
9981         rp='Pathname for the vendor-supplied html pages?'
9982         . ./getfile
9983         vendorhtml3dir="$ans"
9984         vendorhtml3direxp="$ansexp"
9985         ;;
9986 esac
9987 : Use ' ' for none so value is preserved next time through Configure
9988 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9989 prefixvar=vendorhtml3dir
9990 . ./installprefix
9991
9992 : Set the vendorman1dir variables
9993 case "$vendorprefix" in
9994 '')     vendorman1dir=''
9995         vendorman1direxp=''
9996         ;;
9997 *)      : determine where vendor-supplied manual pages go.
9998         case "$vendorman1dir" in
9999         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10000         *)      dflt=$vendorman1dir ;;
10001         esac
10002         case "$dflt" in
10003         ''|' ') dflt=none ;;
10004         esac
10005         fn=nd~+
10006         rp='Pathname for the vendor-supplied manual section 1 pages?'
10007         . ./getfile
10008         vendorman1dir="$ans"
10009         vendorman1direxp="$ansexp"
10010         ;;
10011 esac
10012 : Use ' ' for none so value is preserved next time through Configure
10013 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10014 prefixvar=vendorman1dir
10015 . ./installprefix
10016
10017 : Set the vendorman3dir variables
10018 case "$vendorprefix" in
10019 '')     vendorman3dir=''
10020         vendorman3direxp=''
10021         ;;
10022 *)      : determine where vendor-supplied module manual pages go.
10023         case "$vendorman3dir" in
10024         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10025         *)      dflt=$vendorman3dir ;;
10026         esac
10027         case "$dflt" in
10028         ''|' ') dflt=none ;;
10029         esac
10030         fn=nd~+
10031         rp='Pathname for the vendor-supplied manual section 3 pages?'
10032         . ./getfile
10033         vendorman3dir="$ans"
10034         vendorman3direxp="$ansexp"
10035         ;;
10036 esac
10037 : Use ' ' for none so value is preserved next time through Configure
10038 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10039 prefixvar=vendorman3dir
10040 . ./installprefix
10041
10042 : Set the vendorscript variables
10043 case "$vendorprefix" in
10044 '')     d_vendorscript="$undef"
10045         vendorscript=''
10046         vendorscriptexp=''
10047         ;;
10048 *)      d_vendorscript="$define"
10049         : determine where vendor-supplied scripts go.
10050         case "$vendorscript" in
10051         '')     dflt=$vendorprefix/script
10052                 $test -d $dflt || dflt=$vendorbin ;;
10053         *)  dflt="$vendorscript" ;;
10054         esac
10055         $cat <<EOM
10056
10057 The installation process will create a directory for
10058 vendor-supplied scripts.
10059
10060 EOM
10061         fn=d~+
10062         rp='Pathname for the vendor-supplied scripts directory?'
10063         . ./getfile
10064         vendorscript="$ans"
10065         vendorscriptexp="$ansexp"
10066         ;;
10067 esac
10068 prefixvar=vendorscript
10069 . ./installprefix
10070
10071 : see if qgcvt exists
10072 set qgcvt d_qgcvt
10073 eval $inlibc
10074
10075 : Check what kind of doubles your system has
10076 $echo "Checking the kind of doubles you have..." >&4
10077 $cat >try.c <<EOP
10078 #$i_stdlib I_STDLIB
10079 #define DOUBLESIZE $doublesize
10080 #ifdef I_STDLIB
10081 #include <stdlib.h>
10082 #endif
10083 #include <stdio.h>
10084 static const double d = -0.1;
10085 int main() {
10086   unsigned const char* b = (unsigned const char*)(&d);
10087 #if DOUBLESIZE == 4
10088   if (b[0] == 0xCD && b[3] == 0xBD) {
10089     /* IEEE 754 32-bit little-endian */
10090     printf("1\n");
10091     exit(0);
10092   }
10093   if (b[0] == 0xBD && b[3] == 0xCD) {
10094     /* IEEE 754 32-bit big-endian */
10095     printf("2\n");
10096     exit(0);
10097   }
10098   if (b[0] == 0xCC && b[3] == 0xCC) {
10099     /* VAX format F, 32-bit PDP-style mixed endian. */
10100     printf("9\n");
10101     exit(0);
10102   }
10103   if (b[0] == 0xC0 && b[3] == 0x9A) {
10104     /* IBM single 32-bit */
10105     printf("12\n");
10106     exit(0);
10107   }
10108 #endif
10109 #if DOUBLESIZE == 8
10110   if (b[0] == 0x9A && b[7] == 0xBF) {
10111     /* IEEE 754 64-bit little-endian */
10112     printf("3\n");
10113     exit(0);
10114   }
10115   if (b[0] == 0xBF && b[7] == 0x9A) {
10116     /* IEEE 754 64-bit big-endian */
10117     printf("4\n");
10118     exit(0);
10119   }
10120   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10121    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10122     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10123     * 99 99 b9 bf 9a 99 99 99 */
10124     printf("7\n");
10125     exit(0);
10126   }
10127   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10128    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10129     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10130     * 99 99 99 9a bf b9 99 99 */
10131     printf("8\n");
10132     exit(0);
10133   }
10134   if (b[0] == 0xCC && b[7] == 0xCC) {
10135    /* VAX format D, 64-bit PDP-style mixed endian. */
10136     printf("10\n");
10137     exit(0);
10138   }
10139   if (b[0] == 0xD9 && b[7] == 0x99) {
10140    /* VAX format G, 64-bit PDP-style mixed endian. */
10141     printf("11\n");
10142     exit(0);
10143   }
10144   if (b[0] == 0xC0 && b[7] == 0x9A) {
10145     /* IBM double 64-bit */
10146     printf("13\n");
10147     exit(0);
10148   }
10149   if (b[0] == 0xBF && b[7] == 0xCD) {
10150     /* CRAY single 64-bit */
10151     printf("14\n");
10152     exit(0);
10153   }
10154 #endif
10155 #if DOUBLESIZE == 16
10156   if (b[0] == 0x9A && b[15] == 0xBF) {
10157     /* IEEE 754 128-bit little-endian */
10158     printf("5\n");
10159     exit(0);
10160   }
10161   if (b[0] == 0xBF && b[15] == 0x9A) {
10162     /* IEEE 754 128-bit big-endian */
10163     printf("6\n");
10164     exit(0);
10165   }
10166 #endif
10167   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10168    * Whether those environments can still build Perl is debatable. */
10169   printf("-1\n"); /* unknown */
10170   exit(0);
10171 }
10172 EOP
10173 set try
10174 if eval $compile; then
10175     doublekind=`$run ./try`
10176 else
10177     doublekind=-1
10178 fi
10179 case "$doublekind" in
10180 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10181 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10182 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10183 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10184 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10185 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10186 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10187 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10188 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10189 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10190 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10191 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10192 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10193 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10194 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10195 esac
10196 d_double_style_ieee=$undef
10197 d_double_style_vax=$undef
10198 d_double_style_ibm=$undef
10199 d_double_style_cray=$undef
10200 case "$doublekind" in
10201 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10202 9|10|11) d_double_style_vax=$define ;;
10203 12|13) d_double_style_ibm=$define ;;
10204 14) d_double_style_cray=$define ;;
10205 esac
10206 case "$d_double_style_ieee" in
10207 $define)
10208     d_double_has_inf=$define
10209     d_double_has_nan=$define
10210     d_double_has_negative_zero=$define
10211     d_double_has_subnormals=$define
10212     ;;
10213 *)
10214     d_double_has_inf=$undef
10215     d_double_has_nan=$undef
10216     d_double_has_negative_zero=$undef
10217     d_double_has_subnormals=$undef
10218     ;;
10219 esac
10220 $rm_try
10221
10222 : Check print/scan long double stuff
10223 echo " "
10224
10225 if $test X"$d_longdbl" = X"$define"; then
10226
10227 echo "Checking how to print long doubles..." >&4
10228
10229 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10230         $cat >try.c <<'EOCP'
10231 #include <sys/types.h>
10232 #include <stdio.h>
10233 int main() {
10234   double d = 123.456;
10235   printf("%.3f\n", d);
10236 }
10237 EOCP
10238         set try
10239         if eval $compile; then
10240                 yyy=`$run ./try`
10241                 case "$yyy" in
10242                 123.456)
10243                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10244                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10245                         echo "We will use %f."
10246                         ;;
10247                 esac
10248         fi
10249 fi
10250
10251 if $test X"$sPRIfldbl" = X; then
10252         $cat >try.c <<'EOCP'
10253 #include <sys/types.h>
10254 #include <stdio.h>
10255 int main() {
10256   long double d = 123.456;
10257   printf("%.3Lf\n", d);
10258 }
10259 EOCP
10260         set try
10261         if eval $compile; then
10262                 yyy=`$run ./try`
10263                 case "$yyy" in
10264                 123.456)
10265                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10266                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10267                         echo "We will use %Lf."
10268                         ;;
10269                 esac
10270         fi
10271 fi
10272
10273 if $test X"$sPRIfldbl" = X; then
10274         $cat >try.c <<'EOCP'
10275 #include <sys/types.h>
10276 #include <stdio.h>
10277 int main() {
10278   long double d = 123.456;
10279   printf("%.3llf\n", d);
10280 }
10281 EOCP
10282         set try
10283         if eval $compile; then
10284                 yyy=`$run ./try`
10285                 case "$yyy" in
10286                 123.456)
10287                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10288                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10289                         echo "We will use %llf."
10290                         ;;
10291                 esac
10292         fi
10293 fi
10294
10295 if $test X"$sPRIfldbl" = X; then
10296         $cat >try.c <<'EOCP'
10297 #include <sys/types.h>
10298 #include <stdio.h>
10299 int main() {
10300   long double d = 123.456;
10301   printf("%.3lf\n", d);
10302 }
10303 EOCP
10304         set try
10305         if eval $compile; then
10306                 yyy=`$run ./try`
10307                 case "$yyy" in
10308                 123.456)
10309                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10310                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10311                         echo "We will use %lf."
10312                         ;;
10313                 esac
10314         fi
10315 fi
10316
10317 if $test X"$sPRIfldbl" = X; then
10318         echo "Cannot figure out how to print long doubles." >&4
10319 else
10320         sSCNfldbl=$sPRIfldbl    # expect consistency
10321 fi
10322
10323 $rm_try
10324
10325 fi # d_longdbl
10326
10327 case "$sPRIfldbl" in
10328 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10329         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10330         d_SCNfldbl="$undef";
10331         ;;
10332 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10333         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10334         d_SCNfldbl="$define";
10335         ;;
10336 esac
10337
10338 : Before committing on uselongdouble, see whether that looks sane.
10339 if $test "$uselongdouble" = "$define"; then
10340     message=""
10341     echo " "
10342     echo "Checking if your long double math functions work right..." >&4
10343     $cat > try.c <<EOF
10344 #include <math.h>
10345 #include <stdio.h>
10346 int main() {
10347   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10348 }
10349 EOF
10350     case "$osname:$gccversion" in
10351     aix:)       saveccflags="$ccflags"
10352                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10353     esac
10354     set try
10355     if eval $compile_ok; then
10356       yyy=`$run ./try`
10357     fi
10358     case "$yyy" in
10359     3) echo "Your long double math functions are working correctly." >&4 ;;
10360     *) echo "Your long double math functions are broken, not using long doubles." >&4
10361        uselongdouble=$undef
10362        ;;
10363     esac
10364     $rm_try
10365     case "$osname:$gccversion" in
10366     aix:)       ccflags="$saveccflags" ;; # restore
10367     esac
10368 fi
10369
10370 : Check how to convert floats to strings.
10371
10372 if test "X$d_Gconvert" = X; then
10373
10374 echo " "
10375 echo "Checking for an efficient way to convert floats to strings."
10376 echo " " > try.c
10377 case "$uselongdouble" in
10378 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10379 esac
10380 case "$d_longdbl" in
10381 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10382 esac
10383 case "$d_PRIgldbl" in
10384 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10385 esac
10386 $cat >>try.c <<EOP
10387 #ifdef TRY_gconvert
10388 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10389 const char *myname = "gconvert";
10390 #endif
10391 #ifdef TRY_gcvt
10392 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10393 const char *myname = "gcvt";
10394 #endif
10395 #ifdef TRY_qgcvt
10396 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10397 const char *myname = "qgcvt";
10398 #define DOUBLETYPE long double
10399 #endif
10400 #ifdef TRY_sprintf
10401 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10402 #ifdef HAS_PRIgldbl
10403 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10404 #else
10405 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10406 #endif
10407 #else
10408 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10409 #endif
10410 const char *myname = "sprintf";
10411 #endif
10412
10413 #ifndef DOUBLETYPE
10414 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10415 #define DOUBLETYPE long double
10416 #else
10417 #define DOUBLETYPE double
10418 #endif
10419 #endif
10420
10421 #include <stdio.h>
10422
10423 #$i_stdlib I_STDLIB
10424 #ifdef I_STDLIB
10425 #include <stdlib.h>
10426 #endif
10427 #include <string.h>
10428
10429 void checkit(const char *expect, char *got)
10430 {
10431     if (strcmp(expect, got)) {
10432                 printf("%s oddity:  Expected %s, got %s\n",
10433                         myname, expect, got);
10434                 exit(1);
10435         }
10436 }
10437
10438 int main()
10439 {
10440         char buf[64];
10441         buf[63] = '\0';
10442
10443         /* This must be 1st test on (which?) platform */
10444         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10445         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10446         checkit("0.1", buf);
10447
10448         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10449         checkit("0.01", buf);
10450
10451         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10452         checkit("0.001", buf);
10453
10454         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10455         checkit("0.0001", buf);
10456
10457         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10458         if (strlen(buf) > 5)
10459             checkit("9e-005", buf); /* for Microsoft ?? */
10460         else
10461             checkit("9e-05", buf);
10462
10463         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10464         checkit("1", buf);
10465
10466         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10467         checkit("1.1", buf);
10468
10469         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10470         checkit("1.01", buf);
10471
10472         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10473         checkit("1.001", buf);
10474
10475         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10476         checkit("1.0001", buf);
10477
10478         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10479         checkit("1.00001", buf);
10480
10481         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10482         checkit("1.000001", buf);
10483
10484         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10485         checkit("0", buf);
10486
10487         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10488         checkit("-1", buf);
10489
10490         /* Some Linux gcvt's give 1.e+5 here. */
10491         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10492         checkit("100000", buf);
10493
10494         /* Some Linux gcvt's give -1.e+5 here. */
10495         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10496         checkit("-100000", buf);
10497
10498         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10499         checkit("123.456", buf);
10500
10501         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10502         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10503         /* 34 should be enough to scare even long double
10504          * places into using the e notation. */
10505         if (strlen(buf) > 5)
10506             checkit("1e+034", buf); /* for Microsoft */
10507         else
10508             checkit("1e+34", buf);
10509
10510         /* For Perl, if you add additional tests here, also add them to
10511          * t/base/num.t for benefit of platforms not using Configure or
10512          * overriding d_Gconvert */
10513
10514         exit(0);
10515 }
10516 EOP
10517 : first add preferred functions to our list
10518 xxx_list=""
10519 for xxx_convert in $gconvert_preference; do
10520     case $xxx_convert in
10521     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10522     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10523     esac
10524 done
10525 : then add any others
10526 for xxx_convert in gconvert gcvt sprintf; do
10527     case "$xxx_list" in
10528     *$xxx_convert*) ;;
10529     *) xxx_list="$xxx_list $xxx_convert" ;;
10530     esac
10531 done
10532
10533 case "$d_longdbl$uselongdouble" in
10534 "$define$define")
10535     : again, add preferred functions to our list first
10536     xxx_ld_list=""
10537     for xxx_convert in $gconvert_ld_preference; do
10538         case $xxx_convert in
10539         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10540         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10541         esac
10542     done
10543     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10544     for xxx_convert in qgcvt sprintf $xxx_list; do
10545         case "$xxx_ld_list" in
10546         $xxx_convert*|*" $xxx_convert"*) ;;
10547         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10548         esac
10549     done
10550     : if sprintf cannot do long doubles, move it to the end
10551     if test "$d_PRIgldbl" != "$define"; then
10552         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10553     fi
10554     : if no qgcvt, remove it
10555     if test "$d_qgcvt" != "$define"; then
10556         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10557     fi
10558     : use the ld_list
10559     xxx_list="$xxx_ld_list"
10560     ;;
10561 esac
10562
10563 for xxx_convert in $xxx_list; do
10564         echo "Trying $xxx_convert..."
10565         $rm -f try try$_o core
10566         set try -DTRY_$xxx_convert
10567         if eval $compile; then
10568                 echo "$xxx_convert() found." >&4
10569                 if $run ./try; then
10570                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10571                         break;
10572                 else
10573                         echo "...But $xxx_convert didn't work as I expected."
10574                         xxx_convert=''
10575                 fi
10576         else
10577                 echo "$xxx_convert NOT found." >&4
10578                 xxx_convert=''
10579         fi
10580 done
10581
10582 if test X$xxx_convert = X; then
10583     echo "*** WHOA THERE!!! ***" >&4
10584     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10585     xxx_convert=sprintf
10586 fi
10587
10588 case "$xxx_convert" in
10589 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10590 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10591 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10592 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10593    "$define$define$define")
10594       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10595    "$define$define$undef")
10596       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10597    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10598    esac
10599    ;;
10600 esac
10601
10602 fi
10603 $rm_try
10604
10605 : see if _fwalk exists
10606 set fwalk d__fwalk
10607 eval $inlibc
10608
10609 : see if accept4 exists
10610 set accept4 d_accept4
10611 eval $inlibc
10612
10613 : Initialize h_fcntl
10614 h_fcntl=false
10615
10616 : Initialize h_sysfile
10617 h_sysfile=false
10618
10619 : access call always available on UNIX
10620 set access d_access
10621 eval $inlibc
10622
10623 : locate the flags for 'access()'
10624 case "$d_access" in
10625 "$define")
10626         echo " "
10627         $cat >access.c <<EOCP
10628 #include <sys/types.h>
10629 #ifdef I_FCNTL
10630 #include <fcntl.h>
10631 #endif
10632 #ifdef I_SYS_FILE
10633 #include <sys/file.h>
10634 #endif
10635 #ifdef I_UNISTD
10636 #include <unistd.h>
10637 #endif
10638 #$i_stdlib I_STDLIB
10639 #ifdef I_STDLIB
10640 #include <stdlib.h>
10641 #endif
10642 int main() {
10643         exit(R_OK);
10644 }
10645 EOCP
10646         : check sys/file.h first, no particular reason here
10647         if $test `./findhdr sys/file.h` && \
10648                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10649                 h_sysfile=true;
10650                 echo "<sys/file.h> defines the *_OK access constants." >&4
10651         elif $test `./findhdr fcntl.h` && \
10652                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10653                 h_fcntl=true;
10654                 echo "<fcntl.h> defines the *_OK access constants." >&4
10655         elif $test `./findhdr unistd.h` && \
10656                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10657                 echo "<unistd.h> defines the *_OK access constants." >&4
10658         else
10659                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10660         fi
10661         ;;
10662 esac
10663 $rm -f access*
10664
10665 : see if accessx exists
10666 set accessx d_accessx
10667 eval $inlibc
10668
10669 : see if acosh exists
10670 set acosh d_acosh
10671 eval $inlibc
10672
10673 : see if aintl exists
10674 set aintl d_aintl
10675 eval $inlibc
10676
10677 : see if alarm exists
10678 set alarm d_alarm
10679 eval $inlibc
10680
10681 : see if 64bit time functions exists
10682
10683 set ctime64 d_ctime64
10684 eval $inlibc
10685
10686 set localtime64 d_localtime64
10687 eval $inlibc
10688
10689 set gmtime64 d_gmtime64
10690 eval $inlibc
10691
10692 set mktime64 d_mktime64
10693 eval $inlibc
10694
10695 set difftime64 d_difftime64
10696 eval $inlibc
10697
10698 set asctime64 d_asctime64
10699 eval $inlibc
10700
10701 : see if POSIX threads are available
10702 set pthread.h i_pthread
10703 eval $inhdr
10704
10705 : define a function to check prototypes
10706 $cat > protochk <<EOSH
10707 $startsh
10708 cc="$cc"
10709 optimize="$optimize"
10710 ccflags="$ccflags"
10711 define="$define"
10712 rm_try="$rm_try"
10713 usethreads=$usethreads
10714 i_pthread=$i_pthread
10715 pthread_h_first=$pthread_h_first
10716 EOSH
10717
10718 $cat >> protochk <<'EOSH'
10719
10720 $rm_try
10721 foo="$1"
10722 shift
10723 while test $# -ge 2; do
10724         case "$1" in
10725                 $define) echo "#include <$2>" >> try.c ;;
10726                 literal) echo "$2" >> try.c ;;
10727         esac
10728     # Extra magic for the benefit of systems that need pthread.h
10729     # to be included early to correctly detect threadsafe functions.
10730     # Such functions must guarantee themselves, though, that the usethreads
10731     # and i_pthread have been defined, before calling protochk.
10732     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10733         echo "#include <pthread.h>" >> try.c
10734         pthread_h_done=yes
10735     fi
10736     shift 2
10737 done
10738 cat >> try.c <<'EOCP'
10739 #define _(args) args
10740 EOCP
10741 echo "$foo" >> try.c
10742 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10743 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10744 status=$?
10745 $rm_try
10746 exit $status
10747 EOSH
10748 chmod +x protochk
10749 $eunicefix protochk
10750
10751 : Define hasproto macro for Configure internal use
10752 hasproto='varname=$1; func=$2; shift; shift;
10753 while $test $# -ge 2; do
10754         case "$1" in
10755         $define) echo "#include <$2>";;
10756         literal) echo "$2" ;;
10757         esac ;
10758     shift 2;
10759 done > try.c;
10760 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10761 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10762         echo "$func() prototype found.";
10763         val="$define";
10764 else
10765         echo "$func() prototype NOT found.";
10766         val="$undef";
10767 fi;
10768 set $varname;
10769 eval $setvar;
10770 $rm_try tryout.c'
10771
10772 : see if sys/types.h has to be included
10773 set sys/types.h i_systypes
10774 eval $inhdr
10775
10776 : see if sys/select.h has to be included
10777 set sys/select.h i_sysselct
10778 eval $inhdr
10779
10780 : Define hasfield macro for Configure internal use
10781 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10782 while $test $# -ge 2; do
10783         case "$1" in
10784         $define) echo "#include <$2>";;
10785         esac ;
10786     shift 2;
10787 done > try.c;
10788 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10789 set try;
10790 if eval $compile; then
10791         val="$define";
10792 else
10793         val="$undef";
10794 fi;
10795 set $varname;
10796 eval $setvar;
10797 $rm_try'
10798
10799 : see if we should include sys/time.h
10800 echo " "
10801 i_time='define'
10802 if test "X$timeincl" = X; then
10803         echo "Testing to see if we should include <sys/time.h>." >&4
10804         $echo $n "I'm now running the test program...$c"
10805         $cat >try.c <<EOCP
10806 #include <sys/types.h>
10807 #include <time.h>
10808 #ifdef I_SYSTIME
10809 #ifdef SYSTIMEKERNEL
10810 #define KERNEL
10811 #endif
10812 #include <sys/time.h>
10813 #endif
10814 #ifdef I_SYSSELECT
10815 #include <sys/select.h>
10816 #endif
10817 #$i_stdlib I_STDLIB
10818 #ifdef I_STDLIB
10819 #include <stdlib.h>
10820 #endif
10821 int main()
10822 {
10823         struct tm foo;
10824 #ifdef S_TIMEVAL
10825         struct timeval bar;
10826 #endif
10827 #ifdef S_TIMEZONE
10828         struct timezone tzp;
10829 #endif
10830         if (foo.tm_sec == foo.tm_sec)
10831                 exit(0);
10832 #ifdef S_TIMEVAL
10833         if (bar.tv_sec == bar.tv_sec)
10834                 exit(0);
10835 #endif
10836         exit(1);
10837 }
10838 EOCP
10839         flags=''
10840         for s_timezone in '-DS_TIMEZONE' ''; do
10841         sysselect=''
10842         for s_timeval in '-DS_TIMEVAL' ''; do
10843         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10844         for i_systime in '-DI_SYSTIME' ''; do
10845                 case "$flags" in
10846                 '') $echo $n ".$c"
10847                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10848                         if eval $compile; then
10849                                 set X $i_systime $i_systimek $sysselect $s_timeval
10850                                 shift
10851                                 flags="$*"
10852                                 echo " "
10853                                 $echo $n "Succeeded with $flags$c"
10854                         fi
10855                         ;;
10856                 esac
10857         done
10858         done
10859         done
10860         done
10861         timeincl=''
10862         echo " "
10863         case "$flags" in
10864         *SYSTIMEKERNEL*) i_systimek="$define"
10865                 timeincl=`./findhdr sys/time.h`
10866                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10867         *) i_systimek="$undef";;
10868         esac
10869         case "$flags" in
10870         *I_SYSTIME*) i_systime="$define"
10871                 timeincl=`./findhdr sys/time.h`" $timeincl"
10872                 echo "We'll include <sys/time.h>." >&4;;
10873         *) i_systime="$undef";;
10874         esac
10875         $rm_try
10876 fi
10877 : see if struct tm knows about tm_zone
10878 case "$i_systime$i_time" in
10879 *$define*)
10880         echo " "
10881         echo "Checking to see if your struct tm has tm_zone field..." >&4
10882         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10883         eval $hasfield
10884         ;;
10885 *)      val="$undef"
10886         set d_tm_tm_zone
10887         eval $setvar
10888         ;;
10889 esac
10890 case "$d_tm_tm_zone" in
10891 "$define")      echo "Yes, it does."   ;;
10892 *)              echo "No, it doesn't." ;;
10893 esac
10894 : see if struct tm knows about tm_gmtoff
10895 case "$i_systime$i_time" in
10896 *$define*)
10897         echo " "
10898         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10899         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10900         eval $hasfield
10901         ;;
10902 *)      val="$undef"
10903         set d_tm_tm_gmtoff
10904         eval $setvar
10905         ;;
10906 esac
10907 case "$d_tm_tm_gmtoff" in
10908 "$define")      echo "Yes, it does."   ;;
10909 *)              echo "No, it doesn't." ;;
10910 esac
10911
10912 : see if asctime_r exists
10913 set asctime_r d_asctime_r
10914 eval $inlibc
10915 case "$d_asctime_r" in
10916 "$define")
10917         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10918         case "$d_asctime_r_proto:$usethreads" in
10919         ":define")      d_asctime_r_proto=define
10920                 set d_asctime_r_proto asctime_r $hdrs
10921                 eval $hasproto ;;
10922         *)      ;;
10923         esac
10924         case "$d_asctime_r_proto" in
10925         define)
10926         case "$asctime_r_proto" in
10927         ''|0) try='char* asctime_r(const struct tm*, char*);'
10928         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10929         esac
10930         case "$asctime_r_proto" in
10931         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10932         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10933         esac
10934         case "$asctime_r_proto" in
10935         ''|0) try='int asctime_r(const struct tm*, char*);'
10936         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10937         esac
10938         case "$asctime_r_proto" in
10939         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10940         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10941         esac
10942         case "$asctime_r_proto" in
10943         ''|0)   d_asctime_r=undef
10944                 asctime_r_proto=0
10945                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10946         * )     case "$asctime_r_proto" in
10947                 REENTRANT_PROTO*) ;;
10948                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10949                 esac
10950                 echo "Prototype: $try" ;;
10951         esac
10952         ;;
10953         *)      case "$usethreads" in
10954                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10955                 esac
10956                 d_asctime_r=undef
10957                 asctime_r_proto=0
10958                 ;;
10959         esac
10960         ;;
10961 *)      asctime_r_proto=0
10962         ;;
10963 esac
10964
10965 : see if asinh exists
10966 set asinh d_asinh
10967 eval $inlibc
10968
10969 : see if atanh exists
10970 set atanh d_atanh
10971 eval $inlibc
10972
10973 : see if atolf exists
10974 set atolf d_atolf
10975 eval $inlibc
10976
10977 : see if atoll exists
10978 set atoll d_atoll
10979 eval $inlibc
10980
10981 : Look for GCC-style attribute format
10982 case "$d_attribute_format" in
10983 '')
10984 echo " "
10985 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10986 $cat >attrib.c <<'EOCP'
10987 #include <stdio.h>
10988 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10989 EOCP
10990 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10991         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10992                 echo "Your C compiler doesn't support __attribute__((format))."
10993                 val="$undef"
10994         else
10995                 echo "Your C compiler supports __attribute__((format))."
10996                 val="$define"
10997         fi
10998 else
10999         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11000         val="$undef"
11001 fi
11002 ;;
11003 *) val="$d_attribute_format" ;;
11004 esac
11005 set d_attribute_format
11006 eval $setvar
11007 $rm -f attrib*
11008
11009 : Look for GCC-style attribute format with null format allowed
11010 case "$d_printf_format_null" in
11011 '') case "$d_attribute_format" in
11012     $define)
11013         echo " "
11014         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11015 $cat >attrib.c <<EOCP
11016 #include <stdio.h>
11017 #$i_stdlib I_STDLIB
11018 #ifdef I_STDLIB
11019 #include <stdlib.h>
11020 #endif
11021 #$i_inttypes I_INTTYPES
11022 #ifdef I_INTTYPES
11023 #include <inttypes.h>
11024 #endif
11025 #ifndef INTPTR_MAX
11026 #define intptr_t int
11027 #endif
11028 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11029 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11030 int main () { exit(null_printf(NULL)); }
11031 EOCP
11032         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11033             : run the executable in case it produces a run-time warning
11034             if $run ./attrib >>attrib.out 2>&1; then
11035                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11036                     echo "Your C compiler doesn't allow __printf__ format to be null."
11037                     val="$undef"
11038                 else
11039                     echo "Your C compiler allows __printf__ format to be null."
11040                     val="$define"
11041                 fi
11042             else
11043             echo "Your C compiler executable failed with __printf__ format null."
11044             val="$undef"
11045         fi
11046     else
11047         echo "Your C compiler fails with __printf__ format null."
11048         val="$undef"
11049     fi
11050     ;;
11051     *)  val="$undef" ;;
11052     esac
11053 ;;
11054 *)  val="$d_printf_format_null" ;;
11055 esac
11056 set d_printf_format_null
11057 eval $setvar
11058 $rm -f attrib*
11059
11060 : Look for GCC-style attribute malloc
11061 case "$d_attribute_malloc" in
11062 '')
11063 echo " "
11064 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11065 $cat >attrib.c <<'EOCP'
11066 #include <stdio.h>
11067 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11068 EOCP
11069 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11070         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11071                 echo "Your C compiler doesn't support __attribute__((malloc))."
11072                 val="$undef"
11073         else
11074                 echo "Your C compiler supports __attribute__((malloc))."
11075                 val="$define"
11076         fi
11077 else
11078         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11079         val="$undef"
11080 fi
11081 ;;
11082 *) val="$d_attribute_malloc" ;;
11083 esac
11084 set d_attribute_malloc
11085 eval $setvar
11086 $rm -f attrib*
11087
11088 : Look for GCC-style attribute nonnull
11089 case "$d_attribute_nonnull" in
11090 '')
11091 echo " "
11092 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11093 $cat >attrib.c <<'EOCP'
11094 #include <stdio.h>
11095 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11096 EOCP
11097 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11098         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11099                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11100                 val="$undef"
11101         else
11102                 echo "Your C compiler supports __attribute__((nonnull))."
11103                 val="$define"
11104         fi
11105 else
11106         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11107         val="$undef"
11108 fi
11109 ;;
11110 *) val="$d_attribute_nonnull" ;;
11111 esac
11112 set d_attribute_nonnull
11113 eval $setvar
11114 $rm -f attrib*
11115
11116 : Look for GCC-style attribute noreturn
11117 case "$d_attribute_noreturn" in
11118 '')
11119 echo " "
11120 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11121 $cat >attrib.c <<'EOCP'
11122 #include <stdio.h>
11123 void fall_over_dead( void ) __attribute__((noreturn));
11124 EOCP
11125 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11126         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11127                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11128                 val="$undef"
11129         else
11130                 echo "Your C compiler supports __attribute__((noreturn))."
11131                 val="$define"
11132         fi
11133 else
11134         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11135         val="$undef"
11136 fi
11137 ;;
11138 *) val="$d_attribute_noreturn" ;;
11139 esac
11140 set d_attribute_noreturn
11141 eval $setvar
11142 $rm -f attrib*
11143
11144 : Look for GCC-style attribute pure
11145 case "$d_attribute_pure" in
11146 '')
11147 echo " "
11148 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11149 $cat >attrib.c <<'EOCP'
11150 #include <stdio.h>
11151 int square( int n ) __attribute__((pure));
11152 EOCP
11153 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11154         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11155                 echo "Your C compiler doesn't support __attribute__((pure))."
11156                 val="$undef"
11157         else
11158                 echo "Your C compiler supports __attribute__((pure))."
11159                 val="$define"
11160         fi
11161 else
11162         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11163         val="$undef"
11164 fi
11165 ;;
11166 *) val="$d_attribute_pure" ;;
11167 esac
11168 set d_attribute_pure
11169 eval $setvar
11170 $rm -f attrib*
11171
11172 : Look for GCC-style attribute unused
11173 case "$d_attribute_unused" in
11174 '')
11175 echo " "
11176 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11177 $cat >attrib.c <<'EOCP'
11178 #include <stdio.h>
11179 int do_something( int dummy __attribute__((unused)), int n );
11180 EOCP
11181 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11182         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11183                 echo "Your C compiler doesn't support __attribute__((unused))."
11184                 val="$undef"
11185         else
11186                 echo "Your C compiler supports __attribute__((unused))."
11187                 val="$define"
11188         fi
11189 else
11190         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11191         val="$undef"
11192 fi
11193 ;;
11194 *) val="$d_attribute_unused" ;;
11195 esac
11196 set d_attribute_unused
11197 eval $setvar
11198 $rm -f attrib*
11199
11200 : Look for GCC-style attribute deprecated
11201 case "$d_attribute_deprecated" in
11202 '')
11203 echo " "
11204 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11205 $cat >attrib.c <<'EOCP'
11206 #include <stdio.h>
11207 int I_am_deprecated(void) __attribute__((deprecated));
11208 EOCP
11209 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11210         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11211                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11212                 val="$undef"
11213         else
11214                 echo "Your C compiler supports __attribute__((deprecated))."
11215                 val="$define"
11216         fi
11217 else
11218         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11219         val="$undef"
11220 fi
11221 ;;
11222 *) val="$d_attribute_deprecated" ;;
11223 esac
11224 set d_attribute_deprecated
11225 eval $setvar
11226 $rm -f attrib*
11227
11228 : Look for GCC-style attribute warn_unused_result
11229 case "$d_attribute_warn_unused_result" in
11230 '')
11231 echo " "
11232 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11233 $cat >attrib.c <<'EOCP'
11234 #include <stdio.h>
11235 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11236 EOCP
11237 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11238         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11239                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11240                 val="$undef"
11241         else
11242                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11243                 val="$define"
11244         fi
11245 else
11246         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11247         val="$undef"
11248 fi
11249 ;;
11250 *) val="$d_attribute_warn_unused_result" ;;
11251 esac
11252 set d_attribute_warn_unused_result
11253 eval $setvar
11254 $rm -f attrib*
11255
11256 : Look for GCC-style attribute always_inline
11257 case "$d_attribute_always_inline" in
11258 '')
11259 echo " "
11260 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11261 $cat >attrib.c <<'EOCP'
11262 #include <stdio.h>
11263 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11264 EOCP
11265 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11266         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11267                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11268                 val="$undef"
11269         else
11270                 echo "Your C compiler supports __attribute__((always_inline))."
11271                 val="$define"
11272         fi
11273 else
11274         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11275         val="$undef"
11276 fi
11277 ;;
11278 *) val="$d_attribute_always_inline" ;;
11279 esac
11280 set d_attribute_always_inline
11281 eval $setvar
11282 $rm -f attrib*
11283
11284 : see if getpgrp exists
11285 set getpgrp d_getpgrp
11286 eval $inlibc
11287
11288 case "$d_getpgrp" in
11289 "$define")
11290         echo " "
11291         echo "Checking to see which flavor of getpgrp is in use..."
11292         $cat >try.c <<EOP
11293 #include <stdio.h>
11294 #$i_unistd I_UNISTD
11295 #include <sys/types.h>
11296 #ifdef I_UNISTD
11297 #  include <unistd.h>
11298 #endif
11299 #$i_stdlib I_STDLIB
11300 #ifdef I_STDLIB
11301 #include <stdlib.h>
11302 #endif
11303 int main()
11304 {
11305         if (getuid() == 0) {
11306                 printf("(I see you are running Configure as super-user...)\n");
11307                 setuid(1);
11308         }
11309 #ifdef TRY_BSD_PGRP
11310         if (getpgrp(1) == 0)
11311                 exit(0);
11312 #else
11313         if (getpgrp() > 0)
11314                 exit(0);
11315 #endif
11316         exit(1);
11317 }
11318 EOP
11319         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11320                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11321                 val="$define"
11322         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11323                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11324                 val="$undef"
11325         else
11326                 echo "I can't seem to compile and run the test program."
11327                 if ./usg; then
11328                         xxx="a USG one, i.e. you use getpgrp()."
11329                 else
11330                         # SVR4 systems can appear rather BSD-ish.
11331                         case "$i_unistd" in
11332                         $undef)
11333                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11334                                 val="$define"
11335                                 ;;
11336                         $define)
11337                                 xxx="probably a USG one, i.e. you use getpgrp()."
11338                                 val="$undef"
11339                                 ;;
11340                         esac
11341                 fi
11342                 echo "Assuming your getpgrp is $xxx" >&4
11343         fi
11344         ;;
11345 *) val="$undef";;
11346 esac
11347 set d_bsdgetpgrp
11348 eval $setvar
11349 $rm_try
11350
11351 : see if setpgrp exists
11352 set setpgrp d_setpgrp
11353 eval $inlibc
11354
11355 case "$d_setpgrp" in
11356 "$define")
11357         echo " "
11358         echo "Checking to see which flavor of setpgrp is in use..."
11359         $cat >try.c <<EOP
11360 #include <stdio.h>
11361 #$i_unistd I_UNISTD
11362 #include <sys/types.h>
11363 #ifdef I_UNISTD
11364 #  include <unistd.h>
11365 #endif
11366 #$i_stdlib I_STDLIB
11367 #ifdef I_STDLIB
11368 #include <stdlib.h>
11369 #endif
11370 int main()
11371 {
11372         if (getuid() == 0) {
11373                 printf("(I see you are running Configure as super-user...)\n");
11374                 setuid(1);
11375         }
11376 #ifdef TRY_BSD_PGRP
11377         if (-1 == setpgrp(1, 1))
11378                 exit(0);
11379 #else
11380         if (setpgrp() != -1)
11381                 exit(0);
11382 #endif
11383         exit(1);
11384 }
11385 EOP
11386         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11387                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11388                 val="$define"
11389         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11390                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11391                 val="$undef"
11392         else
11393                 echo "(I can't seem to compile and run the test program.)"
11394                 if ./usg; then
11395                         xxx="a USG one, i.e. you use setpgrp()."
11396                 else
11397                         # SVR4 systems can appear rather BSD-ish.
11398                         case "$i_unistd" in
11399                         $undef)
11400                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11401                                 val="$define"
11402                                 ;;
11403                         $define)
11404                                 xxx="probably a USG one, i.e. you use setpgrp()."
11405                                 val="$undef"
11406                                 ;;
11407                         esac
11408                 fi
11409                 echo "Assuming your setpgrp is $xxx" >&4
11410         fi
11411         ;;
11412 *) val="$undef";;
11413 esac
11414 set d_bsdsetpgrp
11415 eval $setvar
11416 $rm_try
11417
11418 : Look for GCC-style __builtin_add_overflow
11419 case "$d_builtin_add_overflow" in
11420 '')
11421     echo " "
11422     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11423     $cat >try.c <<'EOCP'
11424 int main(void) {
11425     const unsigned int uint_max = ~0u;
11426     int target_int = 0;
11427     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11428         return 1;
11429     }
11430     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11431         return 1;
11432     }
11433     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11434         return 1;
11435     }
11436     return 0;
11437 }
11438 EOCP
11439     set try
11440     if eval $compile && $run ./try; then
11441         echo "Your C compiler supports __builtin_add_overflow."
11442         val="$define"
11443     else
11444         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11445         val="$undef"
11446     fi
11447     ;;
11448 *) val="$d_builtin_add_overflow" ;;
11449 esac
11450
11451 set d_builtin_add_overflow
11452 eval $setvar
11453 $rm_try
11454
11455 : Look for GCC-style __builtin_sub_overflow
11456 case "$d_builtin_sub_overflow" in
11457 '')
11458     echo " "
11459     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11460     $cat >try.c <<'EOCP'
11461 int main(void) {
11462     const unsigned int uint_max = ~0u;
11463     int target_int = 0;
11464     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11465         return 1;
11466     }
11467     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11468         return 1;
11469     }
11470     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11471         return 1;
11472     }
11473     return 0;
11474 }
11475 EOCP
11476     set try
11477     if eval $compile && $run ./try; then
11478         echo "Your C compiler supports __builtin_sub_overflow."
11479         val="$define"
11480     else
11481         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11482         val="$undef"
11483     fi
11484     ;;
11485 *) val="$d_builtin_sub_overflow" ;;
11486 esac
11487
11488 set d_builtin_sub_overflow
11489 eval $setvar
11490 $rm_try
11491
11492 : Look for GCC-style __builtin_mul_overflow
11493 case "$d_builtin_mul_overflow" in
11494 '')
11495     echo " "
11496     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11497     $cat >try.c <<'EOCP'
11498 int main(void) {
11499     const unsigned int uint_max = ~0u;
11500     int target_int = 0;
11501     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11502         return 1;
11503     }
11504     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11505         return 1;
11506     }
11507     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11508         return 1;
11509     }
11510     return 0;
11511 }
11512 EOCP
11513     set try
11514     if eval $compile && $run ./try; then
11515         echo "Your C compiler supports __builtin_mul_overflow."
11516         val="$define"
11517     else
11518         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11519         val="$undef"
11520     fi
11521     ;;
11522 *) val="$d_builtin_mul_overflow" ;;
11523 esac
11524
11525 set d_builtin_mul_overflow
11526 eval $setvar
11527 $rm_try
11528
11529 : Look for GCC-style __builtin_choose_expr
11530 case "$d_builtin_choose_expr" in
11531 '')
11532     echo " "
11533     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11534     $cat >try.c <<'EOCP'
11535 #include <assert.h>
11536 #include <stdlib.h>
11537 #include <stdio.h>
11538
11539 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11540
11541 int main(void) {
11542     assert( SYRINX(1) == 2112 );
11543     assert( SYRINX(1) != 5150 );
11544     assert( SYRINX(0) == 5150 );
11545     assert( SYRINX(0) != 2112 );
11546     puts( "All good!" );
11547     exit(0);
11548 }
11549
11550 EOCP
11551     set try
11552     if eval $compile && $run ./try; then
11553         echo "Your C compiler supports __builtin_choose_expr."
11554         val="$define"
11555     else
11556         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11557         val="$undef"
11558     fi
11559 ;;
11560 *) val="$d_builtin_choose_expr" ;;
11561 esac
11562
11563 set d_builtin_choose_expr
11564 eval $setvar
11565 $rm_try
11566
11567 : Look for GCC-style __builtin_expect
11568 case "$d_builtin_expect" in
11569 '')
11570     echo " "
11571     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11572     $cat >try.c <<'EOCP'
11573 int main(void) {
11574     int n = 50;
11575     if ( __builtin_expect(n, 0) ) n = 1;
11576     /* Remember shell exit code truth is 0, C truth is non-zero */
11577     return !(n == 1);
11578 }
11579 EOCP
11580     set try
11581     if eval $compile && $run ./try; then
11582         echo "Your C compiler supports __builtin_expect."
11583         val="$define"
11584     else
11585         echo "Your C compiler doesn't seem to understand __builtin_expect."
11586         val="$undef"
11587     fi
11588     ;;
11589 *) val="$d_builtin_expect" ;;
11590 esac
11591
11592 set d_builtin_expect
11593 eval $setvar
11594 $rm_try
11595
11596 : see if the Compiler supports C99 variadic macros
11597 echo "Checking for C99 variadic macros." >&4
11598 $cat >try.c <<EOCP
11599 #include <stdio.h>
11600 #include <stdarg.h>
11601
11602 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11603
11604 int main() {
11605   char buf[20];
11606   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11607   puts(buf);
11608   return 0;
11609 }
11610 EOCP
11611 set try
11612 if eval $compile && $run ./try 2>&1 >/dev/null; then
11613     case "`$run ./try`" in
11614         "123 456 789")
11615         echo "You have C99 variadic macros." >&4
11616         d_c99_variadic_macros="$define"
11617         ;;
11618         *)
11619         echo "You don't have functional C99 variadic macros." >&4
11620         d_c99_variadic_macros="$undef"
11621         ;;
11622     esac
11623 else
11624     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11625     d_c99_variadic_macros="$undef"
11626 fi
11627 $rm_try
11628
11629 : see if signal is declared as pointer to function returning int or void
11630 echo " "
11631 xxx=`./findhdr signal.h`
11632 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11633 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11634         echo "You have int (*signal())() instead of void." >&4
11635         val="$undef"
11636 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11637         echo "You have void (*signal())()." >&4
11638         val="$define"
11639 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11640         echo "You have int (*signal())() instead of void." >&4
11641         val="$undef"
11642 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11643         echo "You have void (*signal())()." >&4
11644         val="$define"
11645 else
11646         case "$d_voidsig" in
11647         '')
11648         echo "I can't determine whether signal handler returns void or int..." >&4
11649                 dflt=void
11650                 rp="What type does your signal handler return?"
11651                 . ./myread
11652                 case "$ans" in
11653                 v*) val="$define";;
11654                 *) val="$undef";;
11655                 esac;;
11656         "$define")
11657                 echo "As you already told me, signal handler returns void." >&4
11658                 val="$define"
11659                 ;;
11660         *)      echo "As you already told me, signal handler returns int." >&4
11661                 val="$undef"
11662                 ;;
11663         esac
11664 fi
11665 set d_voidsig
11666 eval $setvar
11667 case "$d_voidsig" in
11668 "$define") signal_t="void";;
11669 *) signal_t="int";;
11670 esac
11671 $rm -f $$.tmp
11672
11673 : check for ability to cast large floats to 32-bit ints.
11674 echo " "
11675 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11676 if $test "$intsize" -ge 4; then
11677         xxx=int
11678 else
11679         xxx=long
11680 fi
11681 $cat >try.c <<EOCP
11682 #include <stdio.h>
11683 #$i_stdlib I_STDLIB
11684 #ifdef I_STDLIB
11685 #include <stdlib.h>
11686 #endif
11687 #include <sys/types.h>
11688 #include <signal.h>
11689 $signal_t blech(int s) { exit(3); }
11690 int main()
11691 {
11692         $xxx i32;
11693         double f, g;
11694         int result = 0;
11695         char str[16];
11696         signal(SIGFPE, blech);
11697
11698         /* Don't let compiler optimize the test away.  Store the number
11699            in a writable string for gcc to pass to sscanf under HP-UX.
11700         */
11701         sprintf(str, "2147483647");
11702         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11703         g = 10 * f;
11704         i32  = ($xxx) g;
11705
11706         /* x86 processors will probably give 0x8000 0000, which is a
11707            sign change.  We don't want that.  We want to mimic SPARC
11708            behavior here, which is to preserve the sign and give
11709            back 0x7fff ffff.
11710         */
11711         if (i32 != ($xxx) f)
11712                 result |= 1;
11713         exit(result);
11714 }
11715 EOCP
11716 set try
11717 if eval $compile_ok; then
11718         $run ./try 2>/dev/null
11719         yyy=$?
11720 else
11721         echo "(I can't seem to compile the test program--assuming it can't)"
11722         yyy=1
11723 fi
11724 case "$yyy" in
11725 0)      val="$define"
11726         echo "Yup, it can."
11727         ;;
11728 *)      val="$undef"
11729         echo "Nope, it can't."
11730         ;;
11731 esac
11732 set d_casti32
11733 eval $setvar
11734 $rm_try
11735
11736 : check for ability to cast negative floats to unsigned
11737 echo " "
11738 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11739 $cat >try.c <<EOCP
11740 #include <stdio.h>
11741 #$i_stdlib I_STDLIB
11742 #ifdef I_STDLIB
11743 #include <stdlib.h>
11744 #endif
11745 #include <sys/types.h>
11746 #include <signal.h>
11747 $signal_t blech(int s) { exit(7); }
11748 $signal_t blech_in_list(int s) { exit(4); }
11749 unsigned long dummy_long(unsigned long p) { return p; }
11750 unsigned int dummy_int(unsigned int p) { return p; }
11751 unsigned short dummy_short(unsigned short p) { return p; }
11752 int main()
11753 {
11754         double f;
11755         unsigned long along;
11756         unsigned int aint;
11757         unsigned short ashort;
11758         int result = 0;
11759         char str[16];
11760
11761         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11762            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11763            optimized the whole file away
11764         */
11765         /* Store the number in a writable string for gcc to pass to
11766            sscanf under HP-UX.
11767         */
11768         sprintf(str, "-123");
11769         sscanf(str, "%lf", &f);  /* f = -123.; */
11770
11771         signal(SIGFPE, blech);
11772         along = (unsigned long)f;
11773         aint = (unsigned int)f;
11774         ashort = (unsigned short)f;
11775         if (along != (unsigned long)-123)
11776                 result |= 1;
11777         if (aint != (unsigned int)-123)
11778                 result |= 1;
11779         if (ashort != (unsigned short)-123)
11780                 result |= 1;
11781         sprintf(str, "1073741824.");
11782         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11783         f = f + f;
11784         along = 0;
11785         along = (unsigned long)f;
11786         if (along != 0x80000000)
11787                 result |= 2;
11788         f -= 1.;
11789         along = 0;
11790         along = (unsigned long)f;
11791         if (along != 0x7fffffff)
11792                 result |= 1;
11793         f += 2.;
11794         along = 0;
11795         along = (unsigned long)f;
11796         if (along != 0x80000001)
11797                 result |= 2;
11798         if (result)
11799                 exit(result);
11800         signal(SIGFPE, blech_in_list);
11801         sprintf(str, "123.");
11802         sscanf(str, "%lf", &f);  /* f = 123.; */
11803         along = dummy_long((unsigned long)f);
11804         aint = dummy_int((unsigned int)f);
11805         ashort = dummy_short((unsigned short)f);
11806         if (along != (unsigned long)123)
11807                 result |= 4;
11808         if (aint != (unsigned int)123)
11809                 result |= 4;
11810         if (ashort != (unsigned short)123)
11811                 result |= 4;
11812         exit(result);
11813
11814 }
11815 EOCP
11816 set try
11817 if eval $compile_ok; then
11818         $run ./try 2>/dev/null
11819         castflags=$?
11820 else
11821         echo "(I can't seem to compile the test program--assuming it can't)"
11822         castflags=7
11823 fi
11824 case "$castflags" in
11825 0)      val="$define"
11826         echo "Yup, it can."
11827         ;;
11828 *)      val="$undef"
11829         echo "Nope, it can't."
11830         ;;
11831 esac
11832 set d_castneg
11833 eval $setvar
11834 $rm_try
11835
11836 : see if cbrt exists
11837 set cbrt d_cbrt
11838 eval $inlibc
11839
11840 : see if chown exists
11841 set chown d_chown
11842 eval $inlibc
11843
11844 : see if chroot exists
11845 set chroot d_chroot
11846 eval $inlibc
11847
11848 : see if chsize exists
11849 set chsize d_chsize
11850 eval $inlibc
11851
11852 : see if class exists
11853 set class d_class
11854 eval $inlibc
11855
11856 : see if clearenv exists
11857 set clearenv d_clearenv
11858 eval $inlibc
11859
11860 : Define hasstruct macro for Configure internal use
11861 hasstruct='varname=$1; struct=$2; shift; shift;
11862 while $test $# -ge 2; do
11863         case "$1" in
11864         $define) echo "#include <$2>";;
11865         esac ;
11866     shift 2;
11867 done > try.c;
11868 echo "int main () { struct $struct foo; }" >> try.c;
11869 set try;
11870 if eval $compile; then
11871         val="$define";
11872 else
11873         val="$undef";
11874 fi;
11875 set $varname;
11876 eval $setvar;
11877 $rm_try'
11878
11879 : see whether socket exists
11880 socketlib=''
11881 sockethdr=''
11882 echo " "
11883 $echo $n "Hmm... $c" >&4
11884 if set socket val -f d_socket; eval $csym; $val; then
11885     echo "Looks like you have Berkeley networking support." >&4
11886     d_socket="$define"
11887     if set setsockopt val -f; eval $csym; $val; then
11888         d_oldsock="$undef"
11889     else
11890         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11891         d_oldsock="$define"
11892     fi
11893 else
11894     if $contains socklib libc.list >/dev/null 2>&1; then
11895         echo "Looks like you have Berkeley networking support." >&4
11896         d_socket="$define"
11897         : we will have to assume that it supports the 4.2 BSD interface
11898         d_oldsock="$undef"
11899     else
11900         echo "You don't have Berkeley networking in libc$_a..." >&4
11901         if test "X$d_socket" = "X$define"; then
11902             echo "...but you seem to believe that you have sockets." >&4
11903         else
11904             for net in net socket
11905             do
11906                 if test -f $sysroot/usr/lib/lib$net$_a; then
11907                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11908                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11909                     if $contains socket libc.list >/dev/null 2>&1; then
11910                         d_socket="$define"
11911                         socketlib="-l$net"
11912                         case "$net" in
11913                         net)
11914                             echo "...but the Wollongong group seems to have hacked it in." >&4
11915                             sockethdr="-I$sysroot/usr/netinclude"
11916                             ;;
11917                         esac
11918                         echo "Found Berkeley sockets interface in lib$net." >&4
11919                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11920                             d_oldsock="$undef"
11921                         else
11922                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11923                             d_oldsock="$define"
11924                         fi
11925                         break
11926                     fi
11927                 fi
11928             done
11929             if test "X$d_socket" != "X$define"; then
11930                echo "or anywhere else I see." >&4
11931                d_socket="$undef"
11932                d_oldsock="$undef"
11933             fi
11934         fi
11935     fi
11936 fi
11937
11938 : see if socketpair exists
11939 set socketpair d_sockpair
11940 eval $inlibc
11941
11942
11943 echo " "
11944 echo "Checking the availability sa_len in the sock struct ..." >&4
11945 $cat >try.c <<EOF
11946 #include <sys/types.h>
11947 #include <sys/socket.h>
11948 int main() {
11949 struct sockaddr sa;
11950 return (sa.sa_len);
11951 }
11952 EOF
11953 val="$undef"
11954 set try; if eval $compile; then
11955     val="$define"
11956 fi
11957 set d_sockaddr_sa_len; eval $setvar
11958 $rm_try
11959
11960 echo " "
11961 echo "Checking the availability struct sockaddr_in6 ..." >&4
11962 $cat >try.c <<EOF
11963 #include <sys/types.h>
11964 #include <sys/socket.h>
11965 #include <netinet/in.h>
11966 int main() {
11967 struct sockaddr_in6 sin6;
11968 return (sin6.sin6_family);
11969 }
11970 EOF
11971 val="$undef"
11972 set try; if eval $compile; then
11973     val="$define"
11974 fi
11975 set d_sockaddr_in6; eval $setvar
11976 $rm_try
11977
11978 echo " "
11979 echo "Checking the availability struct sockaddr_storage ..." >&4
11980 $cat >try.c <<EOF
11981 #include <sys/types.h>
11982 #include <sys/socket.h>
11983 #include <netinet/in.h>
11984 int main() {
11985 struct sockaddr_storage sastor;
11986 return (sastor.ss_family);
11987 }
11988 EOF
11989 val="$undef"
11990 set try; if eval $compile; then
11991     val="$define"
11992 fi
11993 set d_sockaddr_storage; eval $setvar
11994 $rm_try
11995
11996 echo " "
11997 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11998 $cat >try.c <<EOF
11999 #include <sys/types.h>
12000 #include <sys/socket.h>
12001 #include <netinet/in.h>
12002 int main() {
12003 struct sockaddr_in6 sin6;
12004 return (sin6.sin6_scope_id);
12005 }
12006 EOF
12007 val="$undef"
12008 set try; if eval $compile; then
12009     val="$define"
12010 fi
12011 set d_sin6_scope_id; eval $setvar
12012 $rm_try
12013
12014 echo " "
12015 echo "Checking the availability struct ip_mreq ..." >&4
12016 $cat >try.c <<EOF
12017 #include <sys/types.h>
12018 #include <sys/socket.h>
12019 #include <netinet/in.h>
12020 int main() {
12021 struct ip_mreq mreq;
12022 return (mreq.imr_multiaddr.s_addr);
12023 }
12024 EOF
12025 val="$undef"
12026 set try; if eval $compile; then
12027        val="$define"
12028 fi
12029 set d_ip_mreq; eval $setvar
12030 $rm_try
12031
12032 echo " "
12033 echo "Checking the availability struct ip_mreq_source ..." >&4
12034 $cat >try.c <<EOF
12035 #include <sys/types.h>
12036 #include <sys/socket.h>
12037 #include <netinet/in.h>
12038 int main() {
12039 struct ip_mreq_source mreq;
12040 return (mreq.imr_multiaddr.s_addr);
12041 }
12042 EOF
12043 val="$undef"
12044 set try; if eval $compile; then
12045        val="$define"
12046 fi
12047 set d_ip_mreq_source; eval $setvar
12048 $rm_try
12049
12050 echo " "
12051 echo "Checking the availability struct ipv6_mreq ..." >&4
12052 $cat >try.c <<EOF
12053 #include <sys/types.h>
12054 #include <sys/socket.h>
12055 #include <netinet/in.h>
12056 int main() {
12057 struct ipv6_mreq mreq;
12058 return (mreq.ipv6mr_interface);
12059 }
12060 EOF
12061 val="$undef"
12062 set try; if eval $compile; then
12063     val="$define"
12064 fi
12065 set d_ipv6_mreq; eval $setvar
12066 $rm_try
12067
12068 echo " "
12069 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12070 $cat >try.c <<EOF
12071 #include <sys/types.h>
12072 #include <sys/socket.h>
12073 #include <netinet/in.h>
12074 int main() {
12075 struct ipv6_mreq_source mreq;
12076 return (mreq.imr_multiaddr.s_addr);
12077 }
12078 EOF
12079 val="$undef"
12080 set try; if eval $compile; then
12081        val="$define"
12082 fi
12083 set d_ipv6_mreq_source; eval $setvar
12084 $rm_try
12085
12086 echo " "
12087 echo "Checking the availability of certain socket constants..." >&4
12088 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12089     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12090     $cat >try.c <<EOF
12091 #include <sys/types.h>
12092 #include <sys/socket.h>
12093 int main() {
12094     int i = $ENUM;
12095 }
12096 EOF
12097     val="$undef"
12098     set try; if eval $compile; then
12099         val="$define"
12100     fi
12101     set d_${enum}; eval $setvar
12102     $rm_try
12103 done
12104
12105 : see if this is a sys/uio.h system
12106 set sys/uio.h i_sysuio
12107 eval $inhdr
12108
12109 : Check for cmsghdr support
12110 echo " "
12111 echo "Checking to see if your system supports struct cmsghdr..." >&4
12112 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12113 eval $hasstruct
12114 case "$d_cmsghdr_s" in
12115 "$define")      echo "Yes, it does."   ;;
12116 *)              echo "No, it doesn't." ;;
12117 esac
12118
12119 : see if copysign exists
12120 set copysign d_copysign
12121 eval $inlibc
12122
12123 : see if copysignl exists
12124 set copysignl d_copysignl
12125 eval $inlibc
12126
12127 : see if crypt exists
12128 echo " "
12129 set crypt d_crypt
12130 eval $inlibc
12131 case "$d_crypt" in
12132 $define) cryptlib='' ;;
12133 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12134                 echo 'crypt() found.' >&4
12135                 val="$define"
12136                 cryptlib=''
12137         else
12138                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12139                 if $test -z "$cryptlib"; then
12140                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12141                 else
12142                         cryptlib=-lcrypt
12143                 fi
12144                 if $test -z "$cryptlib"; then
12145                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12146                 else
12147                         cryptlib=-lcrypt
12148                 fi
12149                 if $test -z "$cryptlib"; then
12150                         cryptlib=`./loc libcrypt$_a "" $libpth`
12151                 else
12152                         cryptlib=-lcrypt
12153                 fi
12154                 if $test -z "$cryptlib"; then
12155                         echo 'crypt() NOT found.' >&4
12156                         val="$undef"
12157                 else
12158                         val="$define"
12159                 fi
12160         fi
12161         set d_crypt
12162         eval $setvar
12163         ;;
12164 esac
12165
12166 : see if this is a crypt.h system
12167 set crypt.h i_crypt
12168 eval $inhdr
12169
12170 : see if crypt_r exists
12171 set crypt_r d_crypt_r
12172 eval $inlibc
12173 case "$d_crypt_r" in
12174 "$define")
12175         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12176         case "$d_crypt_r_proto:$usethreads" in
12177         ":define")      d_crypt_r_proto=define
12178                 set d_crypt_r_proto crypt_r $hdrs
12179                 eval $hasproto ;;
12180         *)      ;;
12181         esac
12182         case "$d_crypt_r_proto" in
12183         define)
12184         case "$crypt_r_proto" in
12185         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12186         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12187         esac
12188         case "$crypt_r_proto" in
12189         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12190         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12191         esac
12192         case "$crypt_r_proto" in
12193         ''|0)   d_crypt_r=undef
12194                 crypt_r_proto=0
12195                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12196         * )     case "$crypt_r_proto" in
12197                 REENTRANT_PROTO*) ;;
12198                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12199                 esac
12200                 echo "Prototype: $try" ;;
12201         esac
12202         ;;
12203         *)      case "$usethreads" in
12204                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12205                 esac
12206                 d_crypt_r=undef
12207                 crypt_r_proto=0
12208                 ;;
12209         esac
12210         ;;
12211 *)      crypt_r_proto=0
12212         ;;
12213 esac
12214
12215 : get csh whereabouts
12216 case "$csh" in
12217 'csh') val="$undef" ;;
12218 *) val="$define" ;;
12219 esac
12220 set d_csh
12221 eval $setvar
12222 : Respect a hint or command line value for full_csh.
12223 case "$full_csh" in
12224 '') full_csh=$csh ;;
12225 esac
12226
12227 : see if ctermid exists
12228 set ctermid d_ctermid
12229 eval $inlibc
12230
12231 : see if ctermid_r exists
12232 set ctermid_r d_ctermid_r
12233 eval $inlibc
12234 case "$d_ctermid_r" in
12235 "$define")
12236         hdrs="$i_systypes sys/types.h define stdio.h "
12237         case "$d_ctermid_r_proto:$usethreads" in
12238         ":define")      d_ctermid_r_proto=define
12239                 set d_ctermid_r_proto ctermid_r $hdrs
12240                 eval $hasproto ;;
12241         *)      ;;
12242         esac
12243         case "$d_ctermid_r_proto" in
12244         define)
12245         case "$ctermid_r_proto" in
12246         ''|0) try='char* ctermid_r(char*);'
12247         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12248         esac
12249         case "$ctermid_r_proto" in
12250         ''|0)   d_ctermid_r=undef
12251                 ctermid_r_proto=0
12252                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12253         * )     case "$ctermid_r_proto" in
12254                 REENTRANT_PROTO*) ;;
12255                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12256                 esac
12257                 echo "Prototype: $try" ;;
12258         esac
12259         ;;
12260         *)      case "$usethreads" in
12261                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12262                 esac
12263                 d_ctermid_r=undef
12264                 ctermid_r_proto=0
12265                 ;;
12266         esac
12267         ;;
12268 *)      ctermid_r_proto=0
12269         ;;
12270 esac
12271
12272 : see if ctime_r exists
12273 set ctime_r d_ctime_r
12274 eval $inlibc
12275 case "$d_ctime_r" in
12276 "$define")
12277         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12278         case "$d_ctime_r_proto:$usethreads" in
12279         ":define")      d_ctime_r_proto=define
12280                 set d_ctime_r_proto ctime_r $hdrs
12281                 eval $hasproto ;;
12282         *)      ;;
12283         esac
12284         case "$d_ctime_r_proto" in
12285         define)
12286         case "$ctime_r_proto" in
12287         ''|0) try='char* ctime_r(const time_t*, char*);'
12288         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12289         esac
12290         case "$ctime_r_proto" in
12291         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12292         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12293         esac
12294         case "$ctime_r_proto" in
12295         ''|0) try='int ctime_r(const time_t*, char*);'
12296         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12297         esac
12298         case "$ctime_r_proto" in
12299         ''|0) try='int ctime_r(const time_t*, char*, int);'
12300         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12301         esac
12302         case "$ctime_r_proto" in
12303         ''|0)   d_ctime_r=undef
12304                 ctime_r_proto=0
12305                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12306         * )     case "$ctime_r_proto" in
12307                 REENTRANT_PROTO*) ;;
12308                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12309                 esac
12310                 echo "Prototype: $try" ;;
12311         esac
12312         ;;
12313         *)      case "$usethreads" in
12314                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12315                 esac
12316                 d_ctime_r=undef
12317                 ctime_r_proto=0
12318                 ;;
12319         esac
12320         ;;
12321 *)      ctime_r_proto=0
12322         ;;
12323 esac
12324
12325 : see if cuserid exists
12326 set cuserid d_cuserid
12327 eval $inlibc
12328
12329 : see if dbm.h is available
12330 : see if dbmclose exists
12331 set dbmclose d_dbmclose
12332 eval $inlibc
12333
12334 case "$d_dbmclose" in
12335 $define)
12336         set dbm.h i_dbm
12337         eval $inhdr
12338         case "$i_dbm" in
12339         $define)
12340                 val="$undef"
12341                 set i_rpcsvcdbm
12342                 eval $setvar
12343                 ;;
12344         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12345                 eval $inhdr
12346                 ;;
12347         esac
12348         ;;
12349 *)      echo "We won't be including <dbm.h>"
12350         val="$undef"
12351         set i_dbm
12352         eval $setvar
12353         val="$undef"
12354         set i_rpcsvcdbm
12355         eval $setvar
12356         ;;
12357 esac
12358
12359 : see if prototype for dbminit is available
12360 echo " "
12361 set d_dbminitproto dbminit $i_dbm dbm.h
12362 eval $hasproto
12363
12364 : see if difftime exists
12365 set difftime d_difftime
12366 eval $inlibc
12367
12368 : see if this is a dirent system
12369 echo " "
12370 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12371         val="$define"
12372         echo "<dirent.h> found." >&4
12373 else
12374         val="$undef"
12375         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12376                 echo "<sys/dir.h> found." >&4
12377                 echo " "
12378         else
12379                 xinc=`./findhdr sys/ndir.h`
12380         fi
12381         echo "<dirent.h> NOT found." >&4
12382 fi
12383 set i_dirent
12384 eval $setvar
12385
12386 : Look for type of directory structure.
12387 echo " "
12388 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12389
12390 case "$direntrytype" in
12391 ''|' ')
12392         case "$i_dirent" in
12393         $define) guess1='struct dirent' ;;
12394         *) guess1='struct direct'  ;;
12395         esac
12396         ;;
12397 *)      guess1="$direntrytype"
12398         ;;
12399 esac
12400
12401 case "$guess1" in
12402 'struct dirent') guess2='struct direct' ;;
12403 *) guess2='struct dirent' ;;
12404 esac
12405
12406 if $contains "$guess1" try.c >/dev/null 2>&1; then
12407         direntrytype="$guess1"
12408         echo "Your directory entries are $direntrytype." >&4
12409 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12410         direntrytype="$guess2"
12411         echo "Your directory entries seem to be $direntrytype." >&4
12412 else
12413         echo "I don't recognize your system's directory entries." >&4
12414         rp="What type is used for directory entries on this system?"
12415         dflt="$guess1"
12416         . ./myread
12417         direntrytype="$ans"
12418 fi
12419 $rm_try
12420
12421 : see if the directory entry stores field length
12422 echo " "
12423 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12424 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12425         echo "Good, your directory entry keeps length information in d_namlen." >&4
12426         val="$define"
12427 else
12428         echo "Your directory entry does not know about the d_namlen field." >&4
12429         val="$undef"
12430 fi
12431 set d_dirnamlen
12432 eval $setvar
12433 $rm_try
12434
12435 : Look for DIR.dd_fd
12436 case "$i_dirent" in
12437 "$define")
12438     echo "Checking to see if DIR has a dd_fd member variable" >&4
12439     $cat >try.c <<EOCP
12440 #$i_stdlib I_STDLIB
12441 #ifdef I_STDLIB
12442 #include <stdlib.h>
12443 #endif
12444 #include <dirent.h>
12445
12446 int main() {
12447     DIR dir;
12448     dir.dd_fd = 1;
12449     return 0;
12450 }
12451 EOCP
12452     val=$undef
12453     set try
12454     if eval $compile; then
12455         echo "Yes, it does."
12456         val="$define"
12457     else
12458         echo "No, it does not."
12459         val="$undef"
12460     fi
12461     ;;
12462 *)
12463     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12464     val="$undef"
12465     ;;
12466 esac
12467 set d_dir_dd_fd
12468 eval $setvar
12469 $rm_try
12470
12471 : see if this is an sysdir system
12472 set sys/dir.h i_sysdir
12473 eval $inhdr
12474
12475 : see if this is an sysndir system
12476 set sys/ndir.h i_sysndir
12477 eval $inhdr
12478
12479 : Look for dirfd
12480 echo " "
12481 $cat >dirfd.c <<EOM
12482 #include <stdio.h>
12483 #$i_stdlib I_STDLIB
12484 #ifdef I_STDLIB
12485 #include <stdlib.h>
12486 #endif
12487 #$i_dirent I_DIRENT             /**/
12488 #$i_sysdir I_SYS_DIR            /**/
12489 #$i_sysndir I_SYS_NDIR          /**/
12490 #$i_systypes I_SYS_TYPES        /**/
12491 #if defined(I_SYS_TYPES)
12492 #include <sys/types.h>
12493 #endif
12494 #if defined(I_DIRENT)
12495 #include <dirent.h>
12496 #else
12497 #ifdef I_SYS_NDIR
12498 #include <sys/ndir.h>
12499 #else
12500 #ifdef I_SYS_DIR
12501 #include <sys/dir.h>
12502 #endif
12503 #endif
12504 #endif
12505 int main() {
12506         DIR *dirp = opendir(".");
12507         if (dirfd(dirp) >= 0)
12508                 exit(0);
12509         else
12510                 exit(1);
12511 }
12512 EOM
12513 val=$undef
12514 set dirfd
12515 if eval $compile; then
12516         val="$define"
12517 fi
12518 case "$val" in
12519 $define)        echo "dirfd() found." >&4       ;;
12520 *)              echo "dirfd() NOT found." >&4   ;;
12521 esac
12522 set d_dirfd
12523 eval $setvar
12524 $rm -f dirfd*
12525
12526 : see if dladdr exists
12527 set dladdr d_dladdr
12528 eval $inlibc
12529
12530 : see if dlerror exists
12531 xxx_runnm="$runnm"
12532 runnm=false
12533 set dlerror d_dlerror
12534 eval $inlibc
12535 runnm="$xxx_runnm"
12536
12537 : see if dlfcn is available
12538 set dlfcn.h i_dlfcn
12539 eval $inhdr
12540
12541 : Check what extension to use for shared libs
12542 case "$usedl" in
12543 $define|y|true)
12544         $cat << EOM
12545
12546 On a few systems, the dynamically loaded modules that perl generates and uses
12547 will need a different extension than shared libs. The default will probably
12548 be appropriate.
12549
12550 EOM
12551         case "$dlext" in
12552         '')     dflt="$so" ;;
12553         *)      dflt="$dlext" ;;
12554         esac
12555         rp='What is the extension of dynamically loaded modules'
12556         . ./myread
12557         dlext="$ans"
12558         ;;
12559 *)
12560         dlext="none"
12561         ;;
12562 esac
12563
12564 : Check if dlsym need a leading underscore
12565 echo " "
12566 val="$undef"
12567
12568 case "$dlsrc" in
12569 dl_dlopen.xs)
12570         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12571         $cat >dyna.c <<'EOM'
12572 fred () { }
12573 EOM
12574
12575 $cat >fred.c<<EOM
12576
12577 #include <stdio.h>
12578 #$i_stdlib I_STDLIB
12579 #ifdef I_STDLIB
12580 #include <stdlib.h>
12581 #endif
12582 #$i_dlfcn I_DLFCN
12583 #ifdef I_DLFCN
12584 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12585 #else
12586 #include <sys/types.h>
12587 #include <nlist.h>
12588 #include <link.h>
12589 #endif
12590
12591 extern int fred() ;
12592
12593 int main()
12594 {
12595     void * handle ;
12596     void * symbol ;
12597 #ifndef RTLD_LAZY
12598     int mode = 1 ;
12599 #else
12600     int mode = RTLD_LAZY ;
12601 #endif
12602     handle = dlopen("./dyna.$dlext", mode) ;
12603     if (handle == NULL) {
12604         printf ("1\n") ;
12605         fflush (stdout) ;
12606         exit(0);
12607     }
12608     symbol = dlsym(handle, "fred") ;
12609     if (symbol == NULL) {
12610         /* try putting a leading underscore */
12611         symbol = dlsym(handle, "_fred") ;
12612         if (symbol == NULL) {
12613             printf ("2\n") ;
12614             fflush (stdout) ;
12615             exit(0);
12616         }
12617         printf ("3\n") ;
12618     }
12619     else
12620         printf ("4\n") ;
12621     fflush (stdout) ;
12622     exit(0);
12623 }
12624 EOM
12625         : Call the object file tmp-dyna.o in case dlext=o.
12626         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12627                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12628                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12629                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12630                 xxx=`$run ./fred`
12631                 case $xxx in
12632                 1)      echo "Test program failed using dlopen." >&4
12633                         echo "Perhaps you should not use dynamic loading." >&4;;
12634                 2)      echo "Test program failed using dlsym." >&4
12635                         echo "Perhaps you should not use dynamic loading." >&4;;
12636                 3)      echo "dlsym needs a leading underscore" >&4
12637                         val="$define" ;;
12638                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12639                 esac
12640         else
12641                 echo "I can't compile and run the test program." >&4
12642                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12643         fi
12644         ;;
12645 esac
12646
12647 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12648
12649 set d_dlsymun
12650 eval $setvar
12651
12652 : see if drand48_r exists
12653 set drand48_r d_drand48_r
12654 eval $inlibc
12655 case "$d_drand48_r" in
12656 "$define")
12657         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12658         case "$d_drand48_r_proto:$usethreads" in
12659         ":define")      d_drand48_r_proto=define
12660                 set d_drand48_r_proto drand48_r $hdrs
12661                 eval $hasproto ;;
12662         *)      ;;
12663         esac
12664         case "$d_drand48_r_proto" in
12665         define)
12666         case "$drand48_r_proto" in
12667         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12668         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12669         esac
12670         case "$drand48_r_proto" in
12671         ''|0)   d_drand48_r=undef
12672                 drand48_r_proto=0
12673                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12674         * )     case "$drand48_r_proto" in
12675                 REENTRANT_PROTO*) ;;
12676                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12677                 esac
12678                 echo "Prototype: $try" ;;
12679         esac
12680         ;;
12681         *)      case "$usethreads" in
12682                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12683                 esac
12684                 d_drand48_r=undef
12685                 drand48_r_proto=0
12686                 ;;
12687         esac
12688         ;;
12689 *)      drand48_r_proto=0
12690         ;;
12691 esac
12692
12693 : see if prototype for drand48 is available
12694 echo " "
12695 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12696 eval $hasproto
12697
12698 : see if dup2 exists
12699 set dup2 d_dup2
12700 eval $inlibc
12701
12702 : see if dup3 exists
12703 set dup3 d_dup3
12704 eval $inlibc
12705
12706 : see if this is an xlocale.h system
12707 set xlocale.h i_xlocale
12708 eval $inhdr
12709
12710 : see if newlocale exists
12711 set newlocale d_newlocale
12712 eval $inlibc
12713
12714 : see if freelocale exists
12715 set freelocale d_freelocale
12716 eval $inlibc
12717
12718 : see if uselocale exists
12719 set uselocale d_uselocale
12720 eval $inlibc
12721
12722 : see if duplocale exists
12723 set duplocale d_duplocale
12724 eval $inlibc
12725
12726 : see if querylocale exists
12727 set querylocale d_querylocale
12728 eval $inlibc
12729
12730 : see if eaccess exists
12731 set eaccess d_eaccess
12732 eval $inlibc
12733
12734 : see if endgrent exists
12735 set endgrent d_endgrent
12736 eval $inlibc
12737
12738 : see if this is an grp system
12739 set grp.h i_grp
12740 eval $inhdr
12741
12742 case "$i_grp" in
12743 $define)
12744         xxx=`./findhdr grp.h`
12745         $cppstdin $cppflags $cppminus < $xxx >$$.h
12746
12747         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12748                 val="$define"
12749         else
12750                 val="$undef"
12751         fi
12752         set d_grpasswd
12753         eval $setvar
12754
12755         $rm -f $$.h
12756         ;;
12757 *)
12758         val="$undef";
12759         set d_grpasswd; eval $setvar
12760         ;;
12761 esac
12762
12763 : see if endgrent_r exists
12764 set endgrent_r d_endgrent_r
12765 eval $inlibc
12766 case "$d_endgrent_r" in
12767 "$define")
12768         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12769         case "$d_endgrent_r_proto:$usethreads" in
12770         ":define")      d_endgrent_r_proto=define
12771                 set d_endgrent_r_proto endgrent_r $hdrs
12772                 eval $hasproto ;;
12773         *)      ;;
12774         esac
12775         case "$d_endgrent_r_proto" in
12776         define)
12777         case "$endgrent_r_proto" in
12778         ''|0) try='int endgrent_r(FILE**);'
12779         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12780         esac
12781         case "$endgrent_r_proto" in
12782         ''|0) try='void endgrent_r(FILE**);'
12783         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12784         esac
12785         case "$endgrent_r_proto" in
12786         ''|0)   d_endgrent_r=undef
12787                 endgrent_r_proto=0
12788                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12789         * )     case "$endgrent_r_proto" in
12790                 REENTRANT_PROTO*) ;;
12791                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12792                 esac
12793                 echo "Prototype: $try" ;;
12794         esac
12795         ;;
12796         *)      case "$usethreads" in
12797                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12798                 esac
12799                 d_endgrent_r=undef
12800                 endgrent_r_proto=0
12801                 ;;
12802         esac
12803         ;;
12804 *)      endgrent_r_proto=0
12805         ;;
12806 esac
12807
12808 : see if endhostent exists
12809 set endhostent d_endhent
12810 eval $inlibc
12811
12812 : see if this is a netdb.h system
12813 set netdb.h i_netdb
12814 eval $inhdr
12815
12816 : see if endhostent_r exists
12817 set endhostent_r d_endhostent_r
12818 eval $inlibc
12819 case "$d_endhostent_r" in
12820 "$define")
12821         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12822         case "$d_endhostent_r_proto:$usethreads" in
12823         ":define")      d_endhostent_r_proto=define
12824                 set d_endhostent_r_proto endhostent_r $hdrs
12825                 eval $hasproto ;;
12826         *)      ;;
12827         esac
12828         case "$d_endhostent_r_proto" in
12829         define)
12830         case "$endhostent_r_proto" in
12831         ''|0) try='int endhostent_r(struct hostent_data*);'
12832         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12833         esac
12834         case "$endhostent_r_proto" in
12835         ''|0) try='void endhostent_r(struct hostent_data*);'
12836         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12837         esac
12838         case "$endhostent_r_proto" in
12839         ''|0)   d_endhostent_r=undef
12840                 endhostent_r_proto=0
12841                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12842         * )     case "$endhostent_r_proto" in
12843                 REENTRANT_PROTO*) ;;
12844                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12845                 esac
12846                 echo "Prototype: $try" ;;
12847         esac
12848         ;;
12849         *)      case "$usethreads" in
12850                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12851                 esac
12852                 d_endhostent_r=undef
12853                 endhostent_r_proto=0
12854                 ;;
12855         esac
12856         ;;
12857 *)      endhostent_r_proto=0
12858         ;;
12859 esac
12860
12861 : see if endnetent exists
12862 set endnetent d_endnent
12863 eval $inlibc
12864
12865 : see if endnetent_r exists
12866 set endnetent_r d_endnetent_r
12867 eval $inlibc
12868 case "$d_endnetent_r" in
12869 "$define")
12870         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12871         case "$d_endnetent_r_proto:$usethreads" in
12872         ":define")      d_endnetent_r_proto=define
12873                 set d_endnetent_r_proto endnetent_r $hdrs
12874                 eval $hasproto ;;
12875         *)      ;;
12876         esac
12877         case "$d_endnetent_r_proto" in
12878         define)
12879         case "$endnetent_r_proto" in
12880         ''|0) try='int endnetent_r(struct netent_data*);'
12881         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12882         esac
12883         case "$endnetent_r_proto" in
12884         ''|0) try='void endnetent_r(struct netent_data*);'
12885         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12886         esac
12887         case "$endnetent_r_proto" in
12888         ''|0)   d_endnetent_r=undef
12889                 endnetent_r_proto=0
12890                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12891         * )     case "$endnetent_r_proto" in
12892                 REENTRANT_PROTO*) ;;
12893                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12894                 esac
12895                 echo "Prototype: $try" ;;
12896         esac
12897         ;;
12898         *)      case "$usethreads" in
12899                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12900                 esac
12901                 d_endnetent_r=undef
12902                 endnetent_r_proto=0
12903                 ;;
12904         esac
12905         ;;
12906 *)      endnetent_r_proto=0
12907         ;;
12908 esac
12909
12910 : see if endprotoent exists
12911 set endprotoent d_endpent
12912 eval $inlibc
12913
12914 : see if endprotoent_r exists
12915 set endprotoent_r d_endprotoent_r
12916 eval $inlibc
12917 case "$d_endprotoent_r" in
12918 "$define")
12919         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12920         case "$d_endprotoent_r_proto:$usethreads" in
12921         ":define")      d_endprotoent_r_proto=define
12922                 set d_endprotoent_r_proto endprotoent_r $hdrs
12923                 eval $hasproto ;;
12924         *)      ;;
12925         esac
12926         case "$d_endprotoent_r_proto" in
12927         define)
12928         case "$endprotoent_r_proto" in
12929         ''|0) try='int endprotoent_r(struct protoent_data*);'
12930         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12931         esac
12932         case "$endprotoent_r_proto" in
12933         ''|0) try='void endprotoent_r(struct protoent_data*);'
12934         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12935         esac
12936         case "$endprotoent_r_proto" in
12937         ''|0)   d_endprotoent_r=undef
12938                 endprotoent_r_proto=0
12939                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12940         * )     case "$endprotoent_r_proto" in
12941                 REENTRANT_PROTO*) ;;
12942                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12943                 esac
12944                 echo "Prototype: $try" ;;
12945         esac
12946         ;;
12947         *)      case "$usethreads" in
12948                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12949                 esac
12950                 d_endprotoent_r=undef
12951                 endprotoent_r_proto=0
12952                 ;;
12953         esac
12954         ;;
12955 *)      endprotoent_r_proto=0
12956         ;;
12957 esac
12958
12959 : see if endpwent exists
12960 set endpwent d_endpwent
12961 eval $inlibc
12962
12963 : see if this is a pwd.h system
12964 set pwd.h i_pwd
12965 eval $inhdr
12966
12967 case "$i_pwd" in
12968 $define)
12969         xxx=`./findhdr pwd.h`
12970         $cppstdin $cppflags $cppminus < $xxx >$$.h
12971
12972         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12973                 val="$define"
12974         else
12975                 val="$undef"
12976         fi
12977         set d_pwquota
12978         eval $setvar
12979
12980         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12981                 val="$define"
12982         else
12983                 val="$undef"
12984         fi
12985         set d_pwage
12986         eval $setvar
12987
12988         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12989                 val="$define"
12990         else
12991                 val="$undef"
12992         fi
12993         set d_pwchange
12994         eval $setvar
12995
12996         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12997                 val="$define"
12998         else
12999                 val="$undef"
13000         fi
13001         set d_pwclass
13002         eval $setvar
13003
13004         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13005                 val="$define"
13006         else
13007                 val="$undef"
13008         fi
13009         set d_pwexpire
13010         eval $setvar
13011
13012         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13013                 val="$define"
13014         else
13015                 val="$undef"
13016         fi
13017         set d_pwcomment
13018         eval $setvar
13019
13020         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13021                 val="$define"
13022         else
13023                 val="$undef"
13024         fi
13025         set d_pwgecos
13026         eval $setvar
13027
13028         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13029                 val="$define"
13030         else
13031                 val="$undef"
13032         fi
13033         set d_pwpasswd
13034         eval $setvar
13035
13036         $rm -f $$.h
13037         ;;
13038 *)
13039         val="$undef";
13040         set d_pwquota; eval $setvar
13041         set d_pwage; eval $setvar
13042         set d_pwchange; eval $setvar
13043         set d_pwclass; eval $setvar
13044         set d_pwexpire; eval $setvar
13045         set d_pwcomment; eval $setvar
13046         set d_pwgecos; eval $setvar
13047         set d_pwpasswd; eval $setvar
13048         ;;
13049 esac
13050
13051 : see if endpwent_r exists
13052 set endpwent_r d_endpwent_r
13053 eval $inlibc
13054 case "$d_endpwent_r" in
13055 "$define")
13056         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13057         case "$d_endpwent_r_proto:$usethreads" in
13058         ":define")      d_endpwent_r_proto=define
13059                 set d_endpwent_r_proto endpwent_r $hdrs
13060                 eval $hasproto ;;
13061         *)      ;;
13062         esac
13063         case "$d_endpwent_r_proto" in
13064         define)
13065         case "$endpwent_r_proto" in
13066         ''|0) try='int endpwent_r(FILE**);'
13067         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13068         esac
13069         case "$endpwent_r_proto" in
13070         ''|0) try='void endpwent_r(FILE**);'
13071         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13072         esac
13073         case "$endpwent_r_proto" in
13074         ''|0)   d_endpwent_r=undef
13075                 endpwent_r_proto=0
13076                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13077         * )     case "$endpwent_r_proto" in
13078                 REENTRANT_PROTO*) ;;
13079                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13080                 esac
13081                 echo "Prototype: $try" ;;
13082         esac
13083         ;;
13084         *)      case "$usethreads" in
13085                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13086                 esac
13087                 d_endpwent_r=undef
13088                 endpwent_r_proto=0
13089                 ;;
13090         esac
13091         ;;
13092 *)      endpwent_r_proto=0
13093         ;;
13094 esac
13095
13096 : see if endservent exists
13097 set endservent d_endsent
13098 eval $inlibc
13099
13100 : see if endservent_r exists
13101 set endservent_r d_endservent_r
13102 eval $inlibc
13103 case "$d_endservent_r" in
13104 "$define")
13105         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13106         case "$d_endservent_r_proto:$usethreads" in
13107         ":define")      d_endservent_r_proto=define
13108                 set d_endservent_r_proto endservent_r $hdrs
13109                 eval $hasproto ;;
13110         *)      ;;
13111         esac
13112         case "$d_endservent_r_proto" in
13113         define)
13114         case "$endservent_r_proto" in
13115         ''|0) try='int endservent_r(struct servent_data*);'
13116         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13117         esac
13118         case "$endservent_r_proto" in
13119         ''|0) try='void endservent_r(struct servent_data*);'
13120         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13121         esac
13122         case "$endservent_r_proto" in
13123         ''|0)   d_endservent_r=undef
13124                 endservent_r_proto=0
13125                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13126         * )     case "$endservent_r_proto" in
13127                 REENTRANT_PROTO*) ;;
13128                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13129                 esac
13130                 echo "Prototype: $try" ;;
13131         esac
13132         ;;
13133         *)      case "$usethreads" in
13134                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13135                 esac
13136                 d_endservent_r=undef
13137                 endservent_r_proto=0
13138                 ;;
13139         esac
13140         ;;
13141 *)      endservent_r_proto=0
13142         ;;
13143 esac
13144
13145 : Locate the flags for 'open()'
13146 echo " "
13147 $cat >try.c <<EOCP
13148 #include <sys/types.h>
13149 #ifdef I_FCNTL
13150 #include <fcntl.h>
13151 #endif
13152 #ifdef I_SYS_FILE
13153 #include <sys/file.h>
13154 #endif
13155 #$i_stdlib I_STDLIB
13156 #ifdef I_STDLIB
13157 #include <stdlib.h>
13158 #endif
13159 int main() {
13160         if(O_RDONLY);
13161 #ifdef O_TRUNC
13162         exit(0);
13163 #else
13164         exit(1);
13165 #endif
13166 }
13167 EOCP
13168 : check sys/file.h first to get FREAD on Sun
13169 if $test `./findhdr sys/file.h` && \
13170                 set try -DI_SYS_FILE && eval $compile; then
13171         h_sysfile=true;
13172         echo "<sys/file.h> defines the O_* constants..." >&4
13173         if $run ./try; then
13174                 echo "and you have the 3 argument form of open()." >&4
13175                 val="$define"
13176         else
13177                 echo "but not the 3 argument form of open().  Oh, well." >&4
13178                 val="$undef"
13179         fi
13180 elif $test `./findhdr fcntl.h` && \
13181                 set try -DI_FCNTL && eval $compile; then
13182         h_fcntl=true;
13183         echo "<fcntl.h> defines the O_* constants..." >&4
13184         if $run ./try; then
13185                 echo "and you have the 3 argument form of open()." >&4
13186                 val="$define"
13187         else
13188                 echo "but not the 3 argument form of open().  Oh, well." >&4
13189                 val="$undef"
13190         fi
13191 else
13192         val="$undef"
13193         echo "I can't find the O_* constant definitions!  You got problems." >&4
13194 fi
13195 set d_open3
13196 eval $setvar
13197 $rm_try
13198
13199 : see if this is a sys/file.h system
13200 val=''
13201 set sys/file.h val
13202 eval $inhdr
13203
13204 : do we need to include sys/file.h ?
13205 case "$val" in
13206 "$define")
13207         echo " "
13208         if $h_sysfile; then
13209                 val="$define"
13210                 echo "We'll be including <sys/file.h>." >&4
13211         else
13212                 val="$undef"
13213                 echo "We won't be including <sys/file.h>." >&4
13214         fi
13215         ;;
13216 *)
13217         h_sysfile=false
13218         ;;
13219 esac
13220 set i_sysfile
13221 eval $setvar
13222
13223 : see if fcntl.h is there
13224 val=''
13225 set fcntl.h val
13226 eval $inhdr
13227
13228 : see if we can include fcntl.h
13229 case "$val" in
13230 "$define")
13231         echo " "
13232         if $h_fcntl; then
13233                 val="$define"
13234                 echo "We'll be including <fcntl.h>." >&4
13235         else
13236                 val="$undef"
13237                 if $h_sysfile; then
13238         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13239                 else
13240                         echo "We won't be including <fcntl.h>." >&4
13241                 fi
13242         fi
13243         ;;
13244 *)
13245         h_fcntl=false
13246         val="$undef"
13247         ;;
13248 esac
13249 set i_fcntl
13250 eval $setvar
13251
13252 : see if fork exists
13253 set fork d_fork
13254 eval $inlibc
13255
13256 : see if pipe exists
13257 set pipe d_pipe
13258 eval $inlibc
13259
13260 : check for non-blocking I/O stuff
13261 case "$h_sysfile" in
13262 true) echo "#include <sys/file.h>" > head.c;;
13263 *)
13264        case "$h_fcntl" in
13265        true) echo "#include <fcntl.h>" > head.c;;
13266        *) echo "#include <sys/fcntl.h>" > head.c;;
13267        esac
13268        ;;
13269 esac
13270 echo " "
13271 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13272 case "$o_nonblock" in
13273 '')
13274         $cat head.c > try.c
13275         $cat >>try.c <<EOCP
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 int main() {
13286 #ifdef O_NONBLOCK
13287         printf("O_NONBLOCK\n");
13288         exit(0);
13289 #endif
13290 #ifdef O_NDELAY
13291         printf("O_NDELAY\n");
13292         exit(0);
13293 #endif
13294 #ifdef FNDELAY
13295         printf("FNDELAY\n");
13296         exit(0);
13297 #endif
13298         exit(0);
13299 }
13300 EOCP
13301         set try
13302         if eval $compile_ok; then
13303                 o_nonblock=`$run ./try`
13304                 case "$o_nonblock" in
13305                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13306                 *) echo "Seems like we can use $o_nonblock.";;
13307                 esac
13308         else
13309                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13310         fi
13311         ;;
13312 *) echo "Using $hint value $o_nonblock.";;
13313 esac
13314 $rm_try
13315
13316 echo " "
13317 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13318 case "$eagain" in
13319 '')
13320         case "$d_fork:$d_pipe:$d_alarm" in
13321         define:define:define)
13322         $cat head.c > try.c
13323         $cat >>try.c <<EOCP
13324 #include <errno.h>
13325 #include <sys/types.h>
13326 #include <signal.h>
13327 #include <stdio.h>
13328 #$i_stdlib I_STDLIB
13329 #ifdef I_STDLIB
13330 #include <stdlib.h>
13331 #endif
13332 #$i_fcntl I_FCNTL
13333 #ifdef I_FCNTL
13334 #include <fcntl.h>
13335 #endif
13336 #define MY_O_NONBLOCK $o_nonblock
13337 #ifndef errno  /* XXX need better Configure test */
13338 extern int errno;
13339 #endif
13340 #$i_unistd I_UNISTD
13341 #ifdef I_UNISTD
13342 #include <unistd.h>
13343 #endif
13344 #include <string.h>
13345 $signal_t blech(int x) { exit(3); }
13346 EOCP
13347         $cat >> try.c <<'EOCP'
13348 int main()
13349 {
13350         int pd[2];
13351         int pu[2];
13352         char buf[1];
13353         char string[100];
13354         int ret;
13355
13356         ret = pipe(pd); /* Down: child -> parent */
13357         if (ret != 0)
13358                 exit(3);
13359         ret = pipe(pu); /* Up: parent -> child */
13360         if (ret != 0)
13361                 exit(3);
13362         if (0 != fork()) {
13363                 close(pd[1]);   /* Parent reads from pd[0] */
13364                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13365 #ifdef F_SETFL
13366                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13367                         exit(1);
13368 #else
13369                 exit(4);
13370 #endif
13371                 signal(SIGALRM, blech);
13372                 alarm(5);
13373                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13374                         exit(2);
13375                 sprintf(string, "%d\n", ret);
13376                 ret = write(2, string, strlen(string));
13377                 if (ret != strlen(string))
13378                         exit(3);
13379                 alarm(0);
13380 #ifdef EAGAIN
13381                 if (errno == EAGAIN) {
13382                         printf("EAGAIN\n");
13383                         goto ok;
13384                 }
13385 #endif
13386 #ifdef EWOULDBLOCK
13387                 if (errno == EWOULDBLOCK)
13388                         printf("EWOULDBLOCK\n");
13389 #endif
13390         ok:
13391                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13392                 if (ret != 1)
13393                         exit(3);
13394                 sleep(2);                               /* Give it time to close our pipe */
13395                 alarm(5);
13396                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13397                 alarm(0);
13398                 sprintf(string, "%d\n", ret);
13399                 ret = write(4, string, strlen(string));
13400                 if (ret != strlen(string))
13401                         exit(3);
13402                 exit(0);
13403         }
13404
13405         close(pd[0]);                   /* We write to pd[1] */
13406         close(pu[1]);                   /* We read from pu[0] */
13407         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13408         if (ret != 1)
13409                 exit(3);
13410         close(pd[1]);                   /* Pipe pd is now fully closed! */
13411         exit(0);                                /* Bye bye, thank you for playing! */
13412 }
13413 EOCP
13414         set try
13415         if eval $compile_ok; then
13416                 echo "$startsh" >mtry
13417                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13418                 chmod +x mtry
13419                 $run ./mtry >/dev/null 2>&1
13420                 case $? in
13421                 0) eagain=`$cat try.out`;;
13422                 1) echo "Could not perform non-blocking setting!";;
13423                 2) echo "I did a successful read() for something that was not there!";;
13424                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13425                 4) echo "Could not find F_SETFL!";;
13426                 *) echo "Something terribly wrong happened during testing.";;
13427                 esac
13428                 rd_nodata=`$cat try.ret`
13429                 echo "A read() system call with no data present returns $rd_nodata."
13430                 case "$rd_nodata" in
13431                 0|-1) ;;
13432                 *)
13433                         echo "(That's peculiar, fixing that to be -1.)"
13434                         rd_nodata=-1
13435                         ;;
13436                 esac
13437                 case "$eagain" in
13438                 '')
13439                         echo "Forcing errno EAGAIN on read() with no data available."
13440                         eagain=EAGAIN
13441                         ;;
13442                 *)
13443                         echo "Your read() sets errno to $eagain when no data is available."
13444                         ;;
13445                 esac
13446                 status=`$cat try.err`
13447                 case "$status" in
13448                 0) echo "And it correctly returns 0 to signal EOF.";;
13449                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13450                 *) echo "However, your read() returns '$status' on EOF??";;
13451                 esac
13452                 val="$define"
13453                 if test "$status" = "$rd_nodata"; then
13454                         echo "WARNING: you can't distinguish between EOF and no data!"
13455                         val="$undef"
13456                 fi
13457         else
13458                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13459                 eagain=EAGAIN
13460         fi
13461         ;;
13462         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13463                 eagain=EAGAIN
13464                 val="$define"
13465                 ;;
13466         esac
13467         set d_eofnblk
13468         eval $setvar
13469         ;;
13470 *)
13471         echo "Using $hint value $eagain."
13472         echo "Your read() returns $rd_nodata when no data is present."
13473         case "$d_eofnblk" in
13474         "$define") echo "And you can see EOF because read() returns 0.";;
13475         "$undef") echo "But you can't see EOF status from read() returned value.";;
13476         *)
13477                 echo "(Assuming you can't see EOF status from read anyway.)"
13478                 d_eofnblk=$undef
13479                 ;;
13480         esac
13481         ;;
13482 esac
13483 $rm_try head.c mtry
13484
13485 : see if erf exists
13486 set erf d_erf
13487 eval $inlibc
13488
13489 : see if erfc exists
13490 set erfc d_erfc
13491 eval $inlibc
13492
13493 : see if exp2 exists
13494 set exp2 d_exp2
13495 eval $inlibc
13496
13497 : see if expm1 exists
13498 set expm1 d_expm1
13499 eval $inlibc
13500
13501 : see if _ptr and _cnt from stdio act std
13502 echo " "
13503
13504 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13505         echo "(Looks like you have stdio.h from BSD.)"
13506         case "$stdio_ptr" in
13507         '') stdio_ptr='((fp)->_p)'
13508                 ptr_lval=$define
13509                 ;;
13510         *)      ptr_lval=$d_stdio_ptr_lval;;
13511         esac
13512         case "$stdio_cnt" in
13513         '') stdio_cnt='((fp)->_r)'
13514                 cnt_lval=$define
13515                 ;;
13516         *)      cnt_lval=$d_stdio_cnt_lval;;
13517         esac
13518         case "$stdio_base" in
13519         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13520         esac
13521         case "$stdio_bufsiz" in
13522         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13523         esac
13524 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13525         echo "(Looks like you have stdio.h from Linux.)"
13526         case "$stdio_ptr" in
13527         '') stdio_ptr='((fp)->_IO_read_ptr)'
13528                 ptr_lval=$define
13529                 ;;
13530         *)      ptr_lval=$d_stdio_ptr_lval;;
13531         esac
13532         case "$stdio_cnt" in
13533         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13534                 cnt_lval=$undef
13535                 ;;
13536         *)      cnt_lval=$d_stdio_cnt_lval;;
13537         esac
13538         case "$stdio_base" in
13539         '') stdio_base='((fp)->_IO_read_base)';;
13540         esac
13541         case "$stdio_bufsiz" in
13542         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13543         esac
13544 else
13545         case "$stdio_ptr" in
13546         '') stdio_ptr='((fp)->_ptr)'
13547                 ptr_lval=$define
13548                 ;;
13549         *)      ptr_lval=$d_stdio_ptr_lval;;
13550         esac
13551         case "$stdio_cnt" in
13552         '') stdio_cnt='((fp)->_cnt)'
13553                 cnt_lval=$define
13554                 ;;
13555         *)      cnt_lval=$d_stdio_cnt_lval;;
13556         esac
13557         case "$stdio_base" in
13558         '') stdio_base='((fp)->_base)';;
13559         esac
13560         case "$stdio_bufsiz" in
13561         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13562         esac
13563 fi
13564
13565 : test whether _ptr and _cnt really work
13566 echo "Checking how std your stdio is..." >&4
13567 $cat >try.c <<EOP
13568 #include <stdio.h>
13569 #$i_stdlib I_STDLIB
13570 #ifdef I_STDLIB
13571 #include <stdlib.h>
13572 #endif
13573 #define FILE_ptr(fp)    $stdio_ptr
13574 #define FILE_cnt(fp)    $stdio_cnt
13575 int main() {
13576         FILE *fp = fopen("try.c", "r");
13577         char c = getc(fp);
13578         if (
13579                 18 <= FILE_cnt(fp) &&
13580                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13581         )
13582                 exit(0);
13583         exit(1);
13584 }
13585 EOP
13586 val="$undef"
13587 set try
13588 if eval $compile && $to try.c; then
13589         if $run ./try; then
13590                 echo "Your stdio acts pretty std."
13591                 val="$define"
13592         else
13593                 echo "Your stdio isn't very std."
13594         fi
13595 else
13596         echo "Your stdio doesn't appear very std."
13597 fi
13598 $rm_try
13599
13600 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13601 # direct buffer manipulation no longer works.  The Configure tests
13602 # should be changed to correctly detect this, but until then,
13603 # the following check should at least let perl compile and run.
13604 # (This quick fix should be updated before 5.8.1.)
13605 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13606 # A. Dougherty, June 3, 2002.
13607 case "$d_gnulibc" in
13608 $define)
13609         case "$gnulibc_version" in
13610         2.[01]*)  ;;
13611         2.2) ;;
13612         2.2.[0-9]) ;;
13613         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13614                 val="$undef"
13615                 ;;
13616         esac
13617         ;;
13618 esac
13619 set d_stdstdio
13620 eval $setvar
13621
13622 : Can _ptr be used as an lvalue?
13623 case "$d_stdstdio$ptr_lval" in
13624 $define$define) val=$define ;;
13625 *) val=$undef ;;
13626 esac
13627 set d_stdio_ptr_lval
13628 eval $setvar
13629
13630 : Can _cnt be used as an lvalue?
13631 case "$d_stdstdio$cnt_lval" in
13632 $define$define) val=$define ;;
13633 *) val=$undef ;;
13634 esac
13635 set d_stdio_cnt_lval
13636 eval $setvar
13637
13638
13639 : test whether setting _ptr sets _cnt as a side effect
13640 d_stdio_ptr_lval_sets_cnt="$undef"
13641 d_stdio_ptr_lval_nochange_cnt="$undef"
13642 case "$d_stdio_ptr_lval$d_stdstdio" in
13643 $define$define)
13644         echo "Checking to see what happens if we set the stdio ptr..." >&4
13645 $cat >try.c <<EOP
13646 #include <stdio.h>
13647 /* Can we scream? */
13648 /* Eat dust sed :-) */
13649 /* In the buffer space, no one can hear you scream. */
13650 #$i_stdlib I_STDLIB
13651 #ifdef I_STDLIB
13652 #include <stdlib.h>
13653 #endif
13654 #define FILE_ptr(fp)    $stdio_ptr
13655 #define FILE_cnt(fp)    $stdio_cnt
13656 #include <sys/types.h>
13657 int main() {
13658         FILE *fp = fopen("try.c", "r");
13659         int c;
13660         char *ptr;
13661         size_t cnt;
13662         if (!fp) {
13663             puts("Fail even to read");
13664             exit(1);
13665         }
13666         c = getc(fp); /* Read away the first # */
13667         if (c == EOF) {
13668             puts("Fail even to read");
13669             exit(1);
13670         }
13671         if (!(
13672                 18 <= FILE_cnt(fp) &&
13673                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13674         )) {
13675                 puts("Fail even to read");
13676                 exit (1);
13677         }
13678         ptr = (char*) FILE_ptr(fp);
13679         cnt = (size_t)FILE_cnt(fp);
13680
13681         FILE_ptr(fp) += 42;
13682
13683         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13684                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13685                 exit (1);
13686         }
13687         if (FILE_cnt(fp) <= 20) {
13688                 printf ("Fail (<20 chars to test)");
13689                 exit (1);
13690         }
13691         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13692                 puts("Fail compare");
13693                 exit (1);
13694         }
13695         if (cnt == FILE_cnt(fp)) {
13696                 puts("Pass_unchanged");
13697                 exit (0);
13698         }
13699         if (FILE_cnt(fp) == (cnt - 42)) {
13700                 puts("Pass_changed");
13701                 exit (0);
13702         }
13703         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13704         return 1;
13705
13706 }
13707 EOP
13708         set try
13709         if eval $compile && $to try.c; then
13710                 case `$run ./try` in
13711                 Pass_changed)
13712                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13713                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13714                 Pass_unchanged)
13715                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13716                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13717                 Fail*)
13718                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13719                 *)
13720                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13721         esac
13722         else
13723                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13724         fi
13725         $rm_try
13726         ;;
13727 esac
13728
13729 : see if _base is also standard
13730 val="$undef"
13731 case "$d_stdstdio" in
13732 $define)
13733         $cat >try.c <<EOP
13734 #include <stdio.h>
13735 #$i_stdlib I_STDLIB
13736 #ifdef I_STDLIB
13737 #include <stdlib.h>
13738 #endif
13739 #define FILE_base(fp)   $stdio_base
13740 #define FILE_bufsiz(fp) $stdio_bufsiz
13741 int main() {
13742         FILE *fp = fopen("try.c", "r");
13743         char c = getc(fp);
13744         if (
13745                 19 <= FILE_bufsiz(fp) &&
13746                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13747         )
13748                 exit(0);
13749         exit(1);
13750 }
13751 EOP
13752         set try
13753         if eval $compile && $to try.c; then
13754                 if $run ./try; then
13755                         echo "And its _base field acts std."
13756                         val="$define"
13757                 else
13758                         echo "But its _base field isn't std."
13759                 fi
13760         else
13761                 echo "However, it seems to be lacking the _base field."
13762         fi
13763         $rm_try
13764         ;;
13765 esac
13766 set d_stdiobase
13767 eval $setvar
13768
13769 : see if fast_stdio exists
13770 val="$undef"
13771 case "$d_stdstdio:$d_stdio_ptr_lval" in
13772 "$define:$define")
13773         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13774         *$define*)
13775                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13776                 val="$define"
13777                 ;;
13778         esac
13779         ;;
13780 esac
13781 set d_faststdio
13782 eval $setvar
13783
13784 : see if fchdir exists
13785 set fchdir d_fchdir
13786 eval $inlibc
13787
13788 : see if fchmod exists
13789 set fchmod d_fchmod
13790 eval $inlibc
13791
13792 : check for openat, unlinkat, renameat, linkat, fchmodat
13793 set openat d_openat
13794 eval $inlibc
13795
13796 set unlinkat d_unlinkat
13797 eval $inlibc
13798
13799 set renameat d_renameat
13800 eval $inlibc
13801
13802 set linkat d_linkat
13803 eval $inlibc
13804
13805 set fchmodat d_fchmodat
13806 eval $inlibc
13807
13808 : see if fchown exists
13809 set fchown d_fchown
13810 eval $inlibc
13811
13812 : see if this is an fcntl system
13813 set fcntl d_fcntl
13814 eval $inlibc
13815
13816 : See if fcntl-based locking works.
13817 echo " "
13818 $cat >try.c <<EOCP
13819 #$i_stdlib I_STDLIB
13820 #ifdef I_STDLIB
13821 #include <stdlib.h>
13822 #endif
13823 #include <unistd.h>
13824 #include <fcntl.h>
13825 #include <signal.h>
13826 $signal_t blech(int x) { exit(3); }
13827 int main() {
13828 #if defined(F_SETLK) && defined(F_SETLKW)
13829      struct flock flock;
13830      int retval, fd;
13831      fd = open("try.c", O_RDONLY);
13832      flock.l_type = F_RDLCK;
13833      flock.l_whence = SEEK_SET;
13834      flock.l_start = flock.l_len = 0;
13835      signal(SIGALRM, blech);
13836      alarm(10);
13837      retval = fcntl(fd, F_SETLK, &flock);
13838      close(fd);
13839      (retval < 0 ? exit(2) : exit(0));
13840 #else
13841      exit(2);
13842 #endif
13843 }
13844 EOCP
13845 echo "Checking if fcntl-based file locking works... "
13846 case "$d_fcntl" in
13847 "$define")
13848         set try
13849         if eval $compile_ok; then
13850                 if $run ./try; then
13851                         echo "Yes, it seems to work."
13852                         val="$define"
13853                 else
13854                         echo "Nope, it didn't work."
13855                         val="$undef"
13856                         case "$?" in
13857                         3) $cat >&4 <<EOM
13858 ***
13859 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13860 *** This is (almost) impossible.
13861 *** If your NFS lock daemons are not feeling well, something like
13862 *** this may happen, please investigate.  Cannot continue, aborting.
13863 ***
13864 EOM
13865                                 exit 1
13866                                 ;;
13867                         esac
13868                 fi
13869         else
13870                 echo "I'm unable to compile the test program, so I'll assume not."
13871                 val="$undef"
13872         fi
13873         ;;
13874 *) val="$undef";
13875         echo "Nope, since you don't even have fcntl()."
13876         ;;
13877 esac
13878 set d_fcntl_can_lock
13879 eval $setvar
13880 $rm_try
13881
13882 : check for fd_set items
13883 $cat <<EOM
13884
13885 Checking to see how well your C compiler handles fd_set and friends ...
13886 EOM
13887 $cat >try.c <<EOCP
13888 #$i_stdlib I_STDLIB
13889 #ifdef I_STDLIB
13890 #include <stdlib.h>
13891 #endif
13892 #$i_systime I_SYS_TIME
13893 #$i_sysselct I_SYS_SELECT
13894 #$d_socket HAS_SOCKET
13895 #include <sys/types.h>
13896 #ifdef HAS_SOCKET
13897 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13898 #endif
13899 #ifdef I_SYS_TIME
13900 #include <sys/time.h>
13901 #endif
13902 #ifdef I_SYS_SELECT
13903 #include <sys/select.h>
13904 #endif
13905 int main() {
13906         fd_set fds;
13907
13908 #ifdef TRYBITS
13909         if(fds.fds_bits);
13910 #endif
13911
13912 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13913         exit(0);
13914 #else
13915         exit(1);
13916 #endif
13917 }
13918 EOCP
13919 set try -DTRYBITS
13920 if eval $compile; then
13921         d_fds_bits="$define"
13922         d_fd_set="$define"
13923         echo "Well, your system knows about the normal fd_set typedef..." >&4
13924         if $run ./try; then
13925                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13926                 d_fd_macros="$define"
13927         else
13928                 $cat >&4 <<'EOM'
13929 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13930 EOM
13931                 d_fd_macros="$undef"
13932         fi
13933 else
13934         $cat <<'EOM'
13935 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13936 EOM
13937         set try
13938         if eval $compile; then
13939                 d_fds_bits="$undef"
13940                 d_fd_set="$define"
13941                 echo "Well, your system has some sort of fd_set available..." >&4
13942                 if $run ./try; then
13943                         echo "and you have the normal fd_set macros." >&4
13944                         d_fd_macros="$define"
13945                 else
13946                         $cat <<'EOM'
13947 but not the normal fd_set macros!  Gross!  More work for me...
13948 EOM
13949                         d_fd_macros="$undef"
13950                 fi
13951         else
13952         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13953                 d_fd_set="$undef"
13954                 d_fds_bits="$undef"
13955                 d_fd_macros="$undef"
13956         fi
13957 fi
13958 $rm_try
13959
13960 : see if fdclose exists
13961 set fdclose d_fdclose
13962 eval $inlibc
13963
13964 : see if fdim exists
13965 set fdim d_fdim
13966 eval $inlibc
13967
13968 : see if fegetround exists
13969 set fegetround d_fegetround
13970 eval $inlibc
13971
13972 : see if fgetpos exists
13973 set fgetpos d_fgetpos
13974 eval $inlibc
13975
13976 : see if finite exists
13977 set finite d_finite
13978 eval $inlibc
13979
13980 : see if finitel exists
13981 set finitel d_finitel
13982 eval $inlibc
13983
13984 : see if flock exists
13985 set flock d_flock
13986 eval $inlibc
13987
13988 : see if prototype for flock is available
13989 echo " "
13990 set d_flockproto flock $i_sysfile sys/file.h
13991 eval $hasproto
13992
13993 : see if fma exists
13994 set fma d_fma
13995 eval $inlibc
13996
13997 : see if fmax exists
13998 set fmax d_fmax
13999 eval $inlibc
14000
14001 : see if fmin exists
14002 set fmin d_fmin
14003 eval $inlibc
14004
14005 : see if fp_class exists
14006 set fp_class d_fp_class
14007 eval $inlibc
14008
14009 : check for fpclassify
14010 echo "Checking to see if you have fpclassify..." >&4
14011 $cat >try.c <<EOCP
14012 #include <math.h>
14013 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14014 EOCP
14015 set try
14016 if eval $compile; then
14017         val="$define"
14018         echo "You have fpclassify."
14019 else
14020         val="$undef"
14021         echo "You do not have fpclassify."
14022 fi
14023 $rm_try
14024 set d_fpclassify
14025 eval $setvar
14026
14027 : see if fp_classify exists
14028 set fp_classify d_fp_classify
14029 eval $inlibc
14030
14031 : see if fp_classl exists
14032 set fp_classl d_fp_classl
14033 eval $inlibc
14034
14035 : see if pathconf exists
14036 set pathconf d_pathconf
14037 eval $inlibc
14038
14039 : see if fpathconf exists
14040 set fpathconf d_fpathconf
14041 eval $inlibc
14042
14043 : see if fpclass exists
14044 set fpclass d_fpclass
14045 eval $inlibc
14046
14047 : see if fpclassl exists
14048 set fpclassl d_fpclassl
14049 eval $inlibc
14050
14051 : see if fpgetround exists
14052 set fpgetround d_fpgetround
14053 eval $inlibc
14054
14055 : check for fpos64_t
14056 echo " "
14057 echo "Checking to see if you have fpos64_t..." >&4
14058 $cat >try.c <<EOCP
14059 #include <stdio.h>
14060 int main() { fpos64_t x = 7; }
14061 EOCP
14062 set try
14063 if eval $compile; then
14064         val="$define"
14065         echo "You have fpos64_t."
14066 else
14067         val="$undef"
14068         echo "You do not have fpos64_t."
14069         case "$fpossize" in
14070         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14071         esac
14072 fi
14073 $rm_try
14074 set d_fpos64_t
14075 eval $setvar
14076
14077 : see if frexpl exists
14078 set frexpl d_frexpl
14079 eval $inlibc
14080
14081 : see if this is a sys/param system
14082 set sys/param.h i_sysparam
14083 eval $inhdr
14084
14085 : see if this is a sys/mount.h system
14086 set sys/mount.h i_sysmount
14087 eval $inhdr
14088
14089 : Check for fs_data_s
14090 echo " "
14091 echo "Checking to see if your system supports struct fs_data..." >&4
14092 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14093 eval $hasstruct
14094 case "$d_fs_data_s" in
14095 "$define")      echo "Yes, it does."   ;;
14096 *)              echo "No, it doesn't." ;;
14097 esac
14098
14099 : see if fseeko exists
14100 set fseeko d_fseeko
14101 eval $inlibc
14102 case "$longsize" in
14103 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14104 esac
14105
14106 : see if fsetpos exists
14107 set fsetpos d_fsetpos
14108 eval $inlibc
14109
14110 : see if fstatfs exists
14111 set fstatfs d_fstatfs
14112 eval $inlibc
14113
14114 : see if statvfs exists
14115 set statvfs d_statvfs
14116 eval $inlibc
14117
14118 : see if fstatvfs exists
14119 set fstatvfs d_fstatvfs
14120 eval $inlibc
14121
14122 : see if fsync exists
14123 set fsync d_fsync
14124 eval $inlibc
14125
14126 : see if ftello exists
14127 set ftello d_ftello
14128 eval $inlibc
14129 case "$longsize" in
14130 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14131 esac
14132
14133 : check for a working futimes
14134 d_futimes="$undef"
14135 echo " "
14136 echo "Checking if you have a working futimes()" >&4
14137 $cat >try.c <<EOCP
14138 #include <stdio.h>
14139 #include <stdlib.h>
14140 #include <sys/time.h>
14141 #include <errno.h>
14142 #include <fcntl.h>
14143 #include <stdlib.h>
14144
14145 int main ()
14146 {
14147     int fd, rv;
14148     fd = open ("try.c", O_RDWR);
14149     if (-1 == fd) exit (1);
14150     rv = futimes (fd, NULL);
14151     exit (rv == -1 ? errno : 0);
14152 }
14153 EOCP
14154 set try
14155 if eval $compile; then
14156     `$run ./try`
14157     rc=$?
14158     case "$rc" in
14159         0)  echo "Yes, you have" >&4
14160             d_futimes="$define"
14161             ;;
14162         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14163             ;;
14164     esac
14165 else
14166     echo "No, it does not (probably harmless)" >&4
14167 fi
14168 $rm_try
14169
14170 : look for gai_strerror
14171 echo " "
14172 $cat >try.c <<'EOCP'
14173 #include <sys/types.h>
14174 #include <sys/socket.h>
14175 #include <netdb.h>
14176 int main ()
14177 {
14178     return (gai_strerror (0) ? 0 : 1);
14179     }
14180 EOCP
14181 set try
14182 val="$undef"
14183 if eval $compile; then
14184     `$run ./try`
14185     case "$?" in
14186         0)  echo "A working gai_strerror() found." >&4
14187             val="$define" ;;
14188         *)  echo "gai_strerror() found, but it doesn't work" >&4
14189             ;;
14190         esac
14191 else
14192     echo "gai_strerror() NOT found." >&4
14193     fi
14194 set d_gai_strerror
14195 eval $setvar
14196 $rm_try
14197
14198 : see if ndbm.h is available
14199 set ndbm.h i_ndbm
14200 eval $inhdr
14201 : Compatibility location for RedHat 7.1
14202 set gdbm/ndbm.h i_gdbmndbm
14203 eval $inhdr
14204 : Compatibility location for Debian 4.0
14205 set gdbm-ndbm.h i_gdbm_ndbm
14206 eval $inhdr
14207
14208 val="$undef"
14209 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14210         : see if dbm_open exists
14211         set dbm_open d_dbm_open
14212         eval $inlibc
14213         case "$d_dbm_open" in
14214         $undef)
14215                 i_ndbm="$undef"
14216                 i_gdbmndbm="$undef"
14217                 i_gdbm_ndbm="$undef"
14218                 echo "We won't be including <ndbm.h>"
14219                 val="$undef"
14220                 ;;
14221         *) val="$define"
14222            ;;
14223         esac
14224 fi
14225 set d_ndbm
14226 eval $setvar
14227
14228 ndbm_hdr_protochk='name=$1; hdr=$2;
14229 eval "ihdr=\$""i_$name";
14230 val="$undef";
14231 if $test "$ihdr" = "$define"; then
14232         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14233         case "$d_cplusplus" in
14234         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14235         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14236         esac;
14237         case "$val" in
14238         $define) $echo "Your <$hdr> seems to have prototypes";;
14239         *) $echo "Your <$hdr> does not seem to have prototypes";;
14240         esac;
14241 fi;
14242 set "d_${name}_h_uses_prototypes";
14243 eval $setvar'
14244
14245 set ndbm ndbm.h
14246 eval $ndbm_hdr_protochk
14247 set gdbmndbm gdbm/ndbm.h
14248 eval $ndbm_hdr_protochk
14249 set gdbm_ndbm gdbm-ndbm.h
14250 eval $ndbm_hdr_protochk
14251
14252 : see if getaddrinfo exists
14253 set getaddrinfo d_getaddrinfo
14254 eval $inlibc
14255
14256 : see if getcwd exists
14257 set getcwd d_getcwd
14258 eval $inlibc
14259
14260 : see if getespwnam exists
14261 set getespwnam d_getespwnam
14262 eval $inlibc
14263
14264 : see if getfsstat exists
14265 set getfsstat d_getfsstat
14266 eval $inlibc
14267
14268 : see if getgrent exists
14269 set getgrent d_getgrent
14270 eval $inlibc
14271
14272 : see if getgrent_r exists
14273 set getgrent_r d_getgrent_r
14274 eval $inlibc
14275 case "$d_getgrent_r" in
14276 "$define")
14277         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14278         case "$d_getgrent_r_proto:$usethreads" in
14279         ":define")      d_getgrent_r_proto=define
14280                 set d_getgrent_r_proto getgrent_r $hdrs
14281                 eval $hasproto ;;
14282         *)      ;;
14283         esac
14284         case "$d_getgrent_r_proto" in
14285         define)
14286         case "$getgrent_r_proto" in
14287         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14288         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14289         esac
14290         case "$getgrent_r_proto" in
14291         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14292         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14293         esac
14294         case "$getgrent_r_proto" in
14295         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14296         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14297         esac
14298         case "$getgrent_r_proto" in
14299         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14300         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14301         esac
14302         case "$getgrent_r_proto" in
14303         ''|0) try='int getgrent_r(struct group*, char*, int);'
14304         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14305         esac
14306         case "$getgrent_r_proto" in
14307         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14308         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14309         esac
14310         case "$getgrent_r_proto" in
14311         ''|0)   d_getgrent_r=undef
14312                 getgrent_r_proto=0
14313                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14314         * )     case "$getgrent_r_proto" in
14315                 REENTRANT_PROTO*) ;;
14316                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14317                 esac
14318                 echo "Prototype: $try" ;;
14319         esac
14320         ;;
14321         *)      case "$usethreads" in
14322                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14323                 esac
14324                 d_getgrent_r=undef
14325                 getgrent_r_proto=0
14326                 ;;
14327         esac
14328         ;;
14329 *)      getgrent_r_proto=0
14330         ;;
14331 esac
14332
14333 : see if getgrgid_r exists
14334 set getgrgid_r d_getgrgid_r
14335 eval $inlibc
14336 case "$d_getgrgid_r" in
14337 "$define")
14338         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14339         case "$d_getgrgid_r_proto:$usethreads" in
14340         ":define")      d_getgrgid_r_proto=define
14341                 set d_getgrgid_r_proto getgrgid_r $hdrs
14342                 eval $hasproto ;;
14343         *)      ;;
14344         esac
14345         case "$d_getgrgid_r_proto" in
14346         define)
14347         case "$getgrgid_r_proto" in
14348         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14349         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14350         esac
14351         case "$getgrgid_r_proto" in
14352         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14353         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14354         esac
14355         case "$getgrgid_r_proto" in
14356         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14357         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14358         esac
14359         case "$getgrgid_r_proto" in
14360         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14361         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14362         esac
14363         case "$getgrgid_r_proto" in
14364         ''|0)   d_getgrgid_r=undef
14365                 getgrgid_r_proto=0
14366                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14367         * )     case "$getgrgid_r_proto" in
14368                 REENTRANT_PROTO*) ;;
14369                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14370                 esac
14371                 echo "Prototype: $try" ;;
14372         esac
14373         ;;
14374         *)      case "$usethreads" in
14375                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14376                 esac
14377                 d_getgrgid_r=undef
14378                 getgrgid_r_proto=0
14379                 ;;
14380         esac
14381         ;;
14382 *)      getgrgid_r_proto=0
14383         ;;
14384 esac
14385
14386 : see if getgrnam_r exists
14387 set getgrnam_r d_getgrnam_r
14388 eval $inlibc
14389 case "$d_getgrnam_r" in
14390 "$define")
14391         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14392         case "$d_getgrnam_r_proto:$usethreads" in
14393         ":define")      d_getgrnam_r_proto=define
14394                 set d_getgrnam_r_proto getgrnam_r $hdrs
14395                 eval $hasproto ;;
14396         *)      ;;
14397         esac
14398         case "$d_getgrnam_r_proto" in
14399         define)
14400         case "$getgrnam_r_proto" in
14401         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14402         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14403         esac
14404         case "$getgrnam_r_proto" in
14405         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14406         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14407         esac
14408         case "$getgrnam_r_proto" in
14409         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14410         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14411         esac
14412         case "$getgrnam_r_proto" in
14413         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14414         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14415         esac
14416         case "$getgrnam_r_proto" in
14417         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14419         esac
14420         case "$getgrnam_r_proto" in
14421         ''|0)   d_getgrnam_r=undef
14422                 getgrnam_r_proto=0
14423                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14424         * )     case "$getgrnam_r_proto" in
14425                 REENTRANT_PROTO*) ;;
14426                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14427                 esac
14428                 echo "Prototype: $try" ;;
14429         esac
14430         ;;
14431         *)      case "$usethreads" in
14432                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14433                 esac
14434                 d_getgrnam_r=undef
14435                 getgrnam_r_proto=0
14436                 ;;
14437         esac
14438         ;;
14439 *)      getgrnam_r_proto=0
14440         ;;
14441 esac
14442
14443 : see if gethostbyaddr exists
14444 set gethostbyaddr d_gethbyaddr
14445 eval $inlibc
14446
14447 : see if gethostbyname exists
14448 set gethostbyname d_gethbyname
14449 eval $inlibc
14450
14451 : see if gethostent exists
14452 set gethostent d_gethent
14453 eval $inlibc
14454
14455 : see how we will look up host name
14456 echo " "
14457 call=''
14458 if set gethostname val -f d_gethname; eval $csym; $val; then
14459         echo 'gethostname() found.' >&4
14460         d_gethname="$define"
14461         call=gethostname
14462 fi
14463 if set uname val -f d_uname; eval $csym; $val; then
14464         if ./xenix; then
14465                 $cat <<'EOM'
14466 uname() was found, but you're running xenix, and older versions of xenix
14467 have a broken uname(). If you don't really know whether your xenix is old
14468 enough to have a broken system call, use the default answer.
14469
14470 EOM
14471                 dflt=y
14472                 case "$d_uname" in
14473                 "$define") dflt=n;;
14474                 esac
14475                 rp='Is your uname() broken?'
14476                 . ./myread
14477                 case "$ans" in
14478                 n*) d_uname="$define"; call=uname;;
14479                 esac
14480         else
14481                 echo 'uname() found.' >&4
14482                 d_uname="$define"
14483                 case "$call" in
14484                 '') call=uname ;;
14485                 esac
14486         fi
14487 fi
14488 case "$d_gethname" in
14489 '') d_gethname="$undef";;
14490 esac
14491 case "$d_uname" in
14492 '') d_uname="$undef";;
14493 esac
14494 case "$d_uname$d_gethname" in
14495 *define*)
14496         dflt=n
14497         cat <<EOM
14498
14499 Every now and then someone has a $call() that lies about the hostname
14500 but can't be fixed for political or economic reasons.  If you wish, I can
14501 pretend $call() isn't there and maybe compute hostname at run-time
14502 thanks to the '$phostname' command.
14503
14504 EOM
14505         rp="Shall I ignore $call() from now on?"
14506         . ./myread
14507         case "$ans" in
14508         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14509         esac;;
14510 esac
14511 case "$phostname" in
14512 '') aphostname='';;
14513 *) case "$aphostname" in
14514         /*) ;;
14515         *) set X $phostname
14516                 shift
14517                 file=$1
14518                 shift
14519                 file=`./loc $file $file $pth`
14520                 aphostname=`echo $file $*`
14521                 ;;
14522         esac
14523         ;;
14524 esac
14525 case "$d_uname$d_gethname" in
14526 *define*) ;;
14527 *)
14528         case "$phostname" in
14529         '')
14530                 echo "There will be no way for $package to get your hostname." >&4;;
14531         *)
14532         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14533                 ;;
14534         esac;;
14535 esac
14536 case "$d_phostname" in
14537 '') d_phostname="$undef";;
14538 esac
14539
14540 : see if gethostbyaddr_r exists
14541 set gethostbyaddr_r d_gethostbyaddr_r
14542 eval $inlibc
14543 case "$d_gethostbyaddr_r" in
14544 "$define")
14545         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14546         case "$d_gethostbyaddr_r_proto:$usethreads" in
14547         ":define")      d_gethostbyaddr_r_proto=define
14548                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14549                 eval $hasproto ;;
14550         *)      ;;
14551         esac
14552         case "$d_gethostbyaddr_r_proto" in
14553         define)
14554         case "$gethostbyaddr_r_proto" in
14555         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14556         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14557         esac
14558         case "$gethostbyaddr_r_proto" in
14559         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14560         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14561         esac
14562         case "$gethostbyaddr_r_proto" in
14563         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14564         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14565         esac
14566         case "$gethostbyaddr_r_proto" in
14567         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14568         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14569         esac
14570         case "$gethostbyaddr_r_proto" in
14571         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14572         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14573         esac
14574         case "$gethostbyaddr_r_proto" in
14575         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14576         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14577         esac
14578         case "$gethostbyaddr_r_proto" in
14579         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14580         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14581         esac
14582         case "$gethostbyaddr_r_proto" in
14583         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14584         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14585         esac
14586         case "$gethostbyaddr_r_proto" in
14587         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14588         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14589         esac
14590         case "$gethostbyaddr_r_proto" in
14591         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14592         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14593         esac
14594         case "$gethostbyaddr_r_proto" in
14595         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14596         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14597         esac
14598         case "$gethostbyaddr_r_proto" in
14599         ''|0)   d_gethostbyaddr_r=undef
14600                 gethostbyaddr_r_proto=0
14601                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14602         * )     case "$gethostbyaddr_r_proto" in
14603                 REENTRANT_PROTO*) ;;
14604                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14605                 esac
14606                 echo "Prototype: $try" ;;
14607         esac
14608         ;;
14609         *)      case "$usethreads" in
14610                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14611                 esac
14612                 d_gethostbyaddr_r=undef
14613                 gethostbyaddr_r_proto=0
14614                 ;;
14615         esac
14616         ;;
14617 *)      gethostbyaddr_r_proto=0
14618         ;;
14619 esac
14620
14621 : see if gethostbyname_r exists
14622 set gethostbyname_r d_gethostbyname_r
14623 eval $inlibc
14624 case "$d_gethostbyname_r" in
14625 "$define")
14626         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14627         case "$d_gethostbyname_r_proto:$usethreads" in
14628         ":define")      d_gethostbyname_r_proto=define
14629                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14630                 eval $hasproto ;;
14631         *)      ;;
14632         esac
14633         case "$d_gethostbyname_r_proto" in
14634         define)
14635         case "$gethostbyname_r_proto" in
14636         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14637         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14638         esac
14639         case "$gethostbyname_r_proto" in
14640         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14641         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14642         esac
14643         case "$gethostbyname_r_proto" in
14644         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14645         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14646         esac
14647         case "$gethostbyname_r_proto" in
14648         ''|0)   d_gethostbyname_r=undef
14649                 gethostbyname_r_proto=0
14650                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14651         * )     case "$gethostbyname_r_proto" in
14652                 REENTRANT_PROTO*) ;;
14653                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14654                 esac
14655                 echo "Prototype: $try" ;;
14656         esac
14657         ;;
14658         *)      case "$usethreads" in
14659                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14660                 esac
14661                 d_gethostbyname_r=undef
14662                 gethostbyname_r_proto=0
14663                 ;;
14664         esac
14665         ;;
14666 *)      gethostbyname_r_proto=0
14667         ;;
14668 esac
14669
14670 : see if gethostent_r exists
14671 set gethostent_r d_gethostent_r
14672 eval $inlibc
14673 case "$d_gethostent_r" in
14674 "$define")
14675         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14676         case "$d_gethostent_r_proto:$usethreads" in
14677         ":define")      d_gethostent_r_proto=define
14678                 set d_gethostent_r_proto gethostent_r $hdrs
14679                 eval $hasproto ;;
14680         *)      ;;
14681         esac
14682         case "$d_gethostent_r_proto" in
14683         define)
14684         case "$gethostent_r_proto" in
14685         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14686         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14687         esac
14688         case "$gethostent_r_proto" in
14689         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14690         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14691         esac
14692         case "$gethostent_r_proto" in
14693         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14694         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14695         esac
14696         case "$gethostent_r_proto" in
14697         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14698         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14699         esac
14700         case "$gethostent_r_proto" in
14701         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14702         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14703         esac
14704         case "$gethostent_r_proto" in
14705         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14706         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14707         esac
14708         case "$gethostent_r_proto" in
14709         ''|0)   d_gethostent_r=undef
14710                 gethostent_r_proto=0
14711                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14712         * )     case "$gethostent_r_proto" in
14713                 REENTRANT_PROTO*) ;;
14714                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14715                 esac
14716                 echo "Prototype: $try" ;;
14717         esac
14718         ;;
14719         *)      case "$usethreads" in
14720                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14721                 esac
14722                 d_gethostent_r=undef
14723                 gethostent_r_proto=0
14724                 ;;
14725         esac
14726         ;;
14727 *)      gethostent_r_proto=0
14728         ;;
14729 esac
14730
14731 : see if prototypes for various gethostxxx netdb.h functions are available
14732 echo " "
14733 set d_gethostprotos gethostent $i_netdb netdb.h
14734 eval $hasproto
14735
14736 : see if getitimer exists
14737 set getitimer d_getitimer
14738 eval $inlibc
14739
14740 : see if getlogin exists
14741 set getlogin d_getlogin
14742 eval $inlibc
14743
14744 : see if getlogin_r exists
14745 set getlogin_r d_getlogin_r
14746 eval $inlibc
14747 case "$d_getlogin_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14750         case "$d_getlogin_r_proto:$usethreads" in
14751         ":define")      d_getlogin_r_proto=define
14752                 set d_getlogin_r_proto getlogin_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_getlogin_r_proto" in
14757         define)
14758         case "$getlogin_r_proto" in
14759         ''|0) try='int getlogin_r(char*, size_t);'
14760         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14761         esac
14762         case "$getlogin_r_proto" in
14763         ''|0) try='int getlogin_r(char*, int);'
14764         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14765         esac
14766         case "$getlogin_r_proto" in
14767         ''|0) try='char* getlogin_r(char*, size_t);'
14768         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14769         esac
14770         case "$getlogin_r_proto" in
14771         ''|0) try='char* getlogin_r(char*, int);'
14772         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14773         esac
14774         case "$getlogin_r_proto" in
14775         ''|0)   d_getlogin_r=undef
14776                 getlogin_r_proto=0
14777                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14778         * )     case "$getlogin_r_proto" in
14779                 REENTRANT_PROTO*) ;;
14780                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14781                 esac
14782                 echo "Prototype: $try" ;;
14783         esac
14784         ;;
14785         *)      case "$usethreads" in
14786                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14787                 esac
14788                 d_getlogin_r=undef
14789                 getlogin_r_proto=0
14790                 ;;
14791         esac
14792         ;;
14793 *)      getlogin_r_proto=0
14794         ;;
14795 esac
14796
14797 : see if getmnt exists
14798 set getmnt d_getmnt
14799 eval $inlibc
14800
14801 : see if getmntent exists
14802 set getmntent d_getmntent
14803 eval $inlibc
14804
14805 : see if getnameinfo exists
14806 set getnameinfo d_getnameinfo
14807 eval $inlibc
14808
14809 : see if getnetbyaddr exists
14810 set getnetbyaddr d_getnbyaddr
14811 eval $inlibc
14812
14813 : see if getnetbyname exists
14814 set getnetbyname d_getnbyname
14815 eval $inlibc
14816
14817 : see if getnetent exists
14818 set getnetent d_getnent
14819 eval $inlibc
14820
14821 : see if getnetbyaddr_r exists
14822 set getnetbyaddr_r d_getnetbyaddr_r
14823 eval $inlibc
14824 case "$d_getnetbyaddr_r" in
14825 "$define")
14826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14827         case "$d_getnetbyaddr_r_proto:$usethreads" in
14828         ":define")      d_getnetbyaddr_r_proto=define
14829                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14830                 eval $hasproto ;;
14831         *)      ;;
14832         esac
14833         case "$d_getnetbyaddr_r_proto" in
14834         define)
14835         case "$getnetbyaddr_r_proto" in
14836         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14837         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14838         esac
14839         case "$getnetbyaddr_r_proto" in
14840         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14841         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14842         esac
14843         case "$getnetbyaddr_r_proto" in
14844         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14845         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14846         esac
14847         case "$getnetbyaddr_r_proto" in
14848         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14849         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14850         esac
14851         case "$getnetbyaddr_r_proto" in
14852         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14853         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14854         esac
14855         case "$getnetbyaddr_r_proto" in
14856         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14857         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14858         esac
14859         case "$getnetbyaddr_r_proto" in
14860         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14861         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14862         esac
14863         case "$getnetbyaddr_r_proto" in
14864         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14865         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14866         esac
14867         case "$getnetbyaddr_r_proto" in
14868         ''|0)   d_getnetbyaddr_r=undef
14869                 getnetbyaddr_r_proto=0
14870                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14871         * )     case "$getnetbyaddr_r_proto" in
14872                 REENTRANT_PROTO*) ;;
14873                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14874                 esac
14875                 echo "Prototype: $try" ;;
14876         esac
14877         ;;
14878         *)      case "$usethreads" in
14879                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14880                 esac
14881                 d_getnetbyaddr_r=undef
14882                 getnetbyaddr_r_proto=0
14883                 ;;
14884         esac
14885         ;;
14886 *)      getnetbyaddr_r_proto=0
14887         ;;
14888 esac
14889
14890 : see if getnetbyname_r exists
14891 set getnetbyname_r d_getnetbyname_r
14892 eval $inlibc
14893 case "$d_getnetbyname_r" in
14894 "$define")
14895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14896         case "$d_getnetbyname_r_proto:$usethreads" in
14897         ":define")      d_getnetbyname_r_proto=define
14898                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14899                 eval $hasproto ;;
14900         *)      ;;
14901         esac
14902         case "$d_getnetbyname_r_proto" in
14903         define)
14904         case "$getnetbyname_r_proto" in
14905         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14906         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14907         esac
14908         case "$getnetbyname_r_proto" in
14909         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14910         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14911         esac
14912         case "$getnetbyname_r_proto" in
14913         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14914         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14915         esac
14916         case "$getnetbyname_r_proto" in
14917         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14918         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14919         esac
14920         case "$getnetbyname_r_proto" in
14921         ''|0)   d_getnetbyname_r=undef
14922                 getnetbyname_r_proto=0
14923                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14924         * )     case "$getnetbyname_r_proto" in
14925                 REENTRANT_PROTO*) ;;
14926                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14927                 esac
14928                 echo "Prototype: $try" ;;
14929         esac
14930         ;;
14931         *)      case "$usethreads" in
14932                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14933                 esac
14934                 d_getnetbyname_r=undef
14935                 getnetbyname_r_proto=0
14936                 ;;
14937         esac
14938         ;;
14939 *)      getnetbyname_r_proto=0
14940         ;;
14941 esac
14942
14943 : see if getnetent_r exists
14944 set getnetent_r d_getnetent_r
14945 eval $inlibc
14946 case "$d_getnetent_r" in
14947 "$define")
14948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14949         case "$d_getnetent_r_proto:$usethreads" in
14950         ":define")      d_getnetent_r_proto=define
14951                 set d_getnetent_r_proto getnetent_r $hdrs
14952                 eval $hasproto ;;
14953         *)      ;;
14954         esac
14955         case "$d_getnetent_r_proto" in
14956         define)
14957         case "$getnetent_r_proto" in
14958         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14959         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14960         esac
14961         case "$getnetent_r_proto" in
14962         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14963         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14964         esac
14965         case "$getnetent_r_proto" in
14966         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14967         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14968         esac
14969         case "$getnetent_r_proto" in
14970         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14971         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14972         esac
14973         case "$getnetent_r_proto" in
14974         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14975         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14976         esac
14977         case "$getnetent_r_proto" in
14978         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14979         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14980         esac
14981         case "$getnetent_r_proto" in
14982         ''|0)   d_getnetent_r=undef
14983                 getnetent_r_proto=0
14984                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14985         * )     case "$getnetent_r_proto" in
14986                 REENTRANT_PROTO*) ;;
14987                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14988                 esac
14989                 echo "Prototype: $try" ;;
14990         esac
14991         ;;
14992         *)      case "$usethreads" in
14993                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14994                 esac
14995                 d_getnetent_r=undef
14996                 getnetent_r_proto=0
14997                 ;;
14998         esac
14999         ;;
15000 *)      getnetent_r_proto=0
15001         ;;
15002 esac
15003
15004 : see if prototypes for various getnetxxx netdb.h functions are available
15005 echo " "
15006 set d_getnetprotos getnetent $i_netdb netdb.h
15007 eval $hasproto
15008
15009 : see if getpagesize exists
15010 set getpagesize d_getpagsz
15011 eval $inlibc
15012
15013 : Optional checks for getprotobyname and getprotobynumber
15014
15015 : see if getprotobyname exists
15016 set getprotobyname d_getpbyname
15017 eval $inlibc
15018
15019 : see if getprotobynumber exists
15020 set getprotobynumber d_getpbynumber
15021 eval $inlibc
15022
15023 : see if getprotoent exists
15024 set getprotoent d_getpent
15025 eval $inlibc
15026
15027 : see if getpgid exists
15028 set getpgid d_getpgid
15029 eval $inlibc
15030
15031 : see if getpgrp2 exists
15032 set getpgrp2 d_getpgrp2
15033 eval $inlibc
15034
15035 : see if getppid exists
15036 set getppid d_getppid
15037 eval $inlibc
15038
15039 : see if getpriority exists
15040 set getpriority d_getprior
15041 eval $inlibc
15042
15043 : see if getprotobyname_r exists
15044 set getprotobyname_r d_getprotobyname_r
15045 eval $inlibc
15046 case "$d_getprotobyname_r" in
15047 "$define")
15048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15049         case "$d_getprotobyname_r_proto:$usethreads" in
15050         ":define")      d_getprotobyname_r_proto=define
15051                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15052                 eval $hasproto ;;
15053         *)      ;;
15054         esac
15055         case "$d_getprotobyname_r_proto" in
15056         define)
15057         case "$getprotobyname_r_proto" in
15058         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15059         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15060         esac
15061         case "$getprotobyname_r_proto" in
15062         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15063         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15064         esac
15065         case "$getprotobyname_r_proto" in
15066         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15067         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15068         esac
15069         case "$getprotobyname_r_proto" in
15070         ''|0)   d_getprotobyname_r=undef
15071                 getprotobyname_r_proto=0
15072                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15073         * )     case "$getprotobyname_r_proto" in
15074                 REENTRANT_PROTO*) ;;
15075                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15076                 esac
15077                 echo "Prototype: $try" ;;
15078         esac
15079         ;;
15080         *)      case "$usethreads" in
15081                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15082                 esac
15083                 d_getprotobyname_r=undef
15084                 getprotobyname_r_proto=0
15085                 ;;
15086         esac
15087         ;;
15088 *)      getprotobyname_r_proto=0
15089         ;;
15090 esac
15091
15092 : see if getprotobynumber_r exists
15093 set getprotobynumber_r d_getprotobynumber_r
15094 eval $inlibc
15095 case "$d_getprotobynumber_r" in
15096 "$define")
15097         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15098         case "$d_getprotobynumber_r_proto:$usethreads" in
15099         ":define")      d_getprotobynumber_r_proto=define
15100                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15101                 eval $hasproto ;;
15102         *)      ;;
15103         esac
15104         case "$d_getprotobynumber_r_proto" in
15105         define)
15106         case "$getprotobynumber_r_proto" in
15107         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15108         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15109         esac
15110         case "$getprotobynumber_r_proto" in
15111         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15112         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15113         esac
15114         case "$getprotobynumber_r_proto" in
15115         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15116         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15117         esac
15118         case "$getprotobynumber_r_proto" in
15119         ''|0)   d_getprotobynumber_r=undef
15120                 getprotobynumber_r_proto=0
15121                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15122         * )     case "$getprotobynumber_r_proto" in
15123                 REENTRANT_PROTO*) ;;
15124                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15125                 esac
15126                 echo "Prototype: $try" ;;
15127         esac
15128         ;;
15129         *)      case "$usethreads" in
15130                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15131                 esac
15132                 d_getprotobynumber_r=undef
15133                 getprotobynumber_r_proto=0
15134                 ;;
15135         esac
15136         ;;
15137 *)      getprotobynumber_r_proto=0
15138         ;;
15139 esac
15140
15141 : see if getprotoent_r exists
15142 set getprotoent_r d_getprotoent_r
15143 eval $inlibc
15144 case "$d_getprotoent_r" in
15145 "$define")
15146         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15147         case "$d_getprotoent_r_proto:$usethreads" in
15148         ":define")      d_getprotoent_r_proto=define
15149                 set d_getprotoent_r_proto getprotoent_r $hdrs
15150                 eval $hasproto ;;
15151         *)      ;;
15152         esac
15153         case "$d_getprotoent_r_proto" in
15154         define)
15155         case "$getprotoent_r_proto" in
15156         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15157         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15158         esac
15159         case "$getprotoent_r_proto" in
15160         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15161         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15162         esac
15163         case "$getprotoent_r_proto" in
15164         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15165         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15166         esac
15167         case "$getprotoent_r_proto" in
15168         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15169         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15170         esac
15171         case "$getprotoent_r_proto" in
15172         ''|0)   d_getprotoent_r=undef
15173                 getprotoent_r_proto=0
15174                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15175         * )     case "$getprotoent_r_proto" in
15176                 REENTRANT_PROTO*) ;;
15177                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15178                 esac
15179                 echo "Prototype: $try" ;;
15180         esac
15181         ;;
15182         *)      case "$usethreads" in
15183                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15184                 esac
15185                 d_getprotoent_r=undef
15186                 getprotoent_r_proto=0
15187                 ;;
15188         esac
15189         ;;
15190 *)      getprotoent_r_proto=0
15191         ;;
15192 esac
15193
15194 : see if prototypes for various getprotoxxx netdb.h functions are available
15195 echo " "
15196 set d_getprotoprotos getprotoent $i_netdb netdb.h
15197 eval $hasproto
15198
15199 : see if getprpwnam exists
15200 set getprpwnam d_getprpwnam
15201 eval $inlibc
15202
15203 : see if getpwent exists
15204 set getpwent d_getpwent
15205 eval $inlibc
15206
15207 : see if getpwent_r exists
15208 set getpwent_r d_getpwent_r
15209 eval $inlibc
15210 case "$d_getpwent_r" in
15211 "$define")
15212         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15213         case "$d_getpwent_r_proto:$usethreads" in
15214         ":define")      d_getpwent_r_proto=define
15215                 set d_getpwent_r_proto getpwent_r $hdrs
15216                 eval $hasproto ;;
15217         *)      ;;
15218         esac
15219         case "$d_getpwent_r_proto" in
15220         define)
15221         case "$getpwent_r_proto" in
15222         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15223         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15224         esac
15225         case "$getpwent_r_proto" in
15226         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15227         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15228         esac
15229         case "$getpwent_r_proto" in
15230         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15231         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15232         esac
15233         case "$getpwent_r_proto" in
15234         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15235         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15236         esac
15237         case "$getpwent_r_proto" in
15238         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15239         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15240         esac
15241         case "$getpwent_r_proto" in
15242         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15243         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15244         esac
15245         case "$getpwent_r_proto" in
15246         ''|0)   d_getpwent_r=undef
15247                 getpwent_r_proto=0
15248                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15249         * )     case "$getpwent_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_getpwent_r=undef
15260                 getpwent_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      getpwent_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if getpwnam_r exists
15269 set getpwnam_r d_getpwnam_r
15270 eval $inlibc
15271 case "$d_getpwnam_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15274         case "$d_getpwnam_r_proto:$usethreads" in
15275         ":define")      d_getpwnam_r_proto=define
15276                 set d_getpwnam_r_proto getpwnam_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_getpwnam_r_proto" in
15281         define)
15282         case "$getpwnam_r_proto" in
15283         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15284         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15285         esac
15286         case "$getpwnam_r_proto" in
15287         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15288         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15289         esac
15290         case "$getpwnam_r_proto" in
15291         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15292         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15293         esac
15294         case "$getpwnam_r_proto" in
15295         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15296         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15297         esac
15298         case "$getpwnam_r_proto" in
15299         ''|0)   d_getpwnam_r=undef
15300                 getpwnam_r_proto=0
15301                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15302         * )     case "$getpwnam_r_proto" in
15303                 REENTRANT_PROTO*) ;;
15304                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15305                 esac
15306                 echo "Prototype: $try" ;;
15307         esac
15308         ;;
15309         *)      case "$usethreads" in
15310                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15311                 esac
15312                 d_getpwnam_r=undef
15313                 getpwnam_r_proto=0
15314                 ;;
15315         esac
15316         ;;
15317 *)      getpwnam_r_proto=0
15318         ;;
15319 esac
15320
15321 : see if getpwuid_r exists
15322 set getpwuid_r d_getpwuid_r
15323 eval $inlibc
15324 case "$d_getpwuid_r" in
15325 "$define")
15326         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15327         case "$d_getpwuid_r_proto:$usethreads" in
15328         ":define")      d_getpwuid_r_proto=define
15329                 set d_getpwuid_r_proto getpwuid_r $hdrs
15330                 eval $hasproto ;;
15331         *)      ;;
15332         esac
15333         case "$d_getpwuid_r_proto" in
15334         define)
15335         case "$getpwuid_r_proto" in
15336         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15337         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15338         esac
15339         case "$getpwuid_r_proto" in
15340         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15341         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15342         esac
15343         case "$getpwuid_r_proto" in
15344         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15345         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15346         esac
15347         case "$getpwuid_r_proto" in
15348         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15349         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15350         esac
15351         case "$getpwuid_r_proto" in
15352         ''|0)   d_getpwuid_r=undef
15353                 getpwuid_r_proto=0
15354                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15355         * )     case "$getpwuid_r_proto" in
15356                 REENTRANT_PROTO*) ;;
15357                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15358                 esac
15359                 echo "Prototype: $try" ;;
15360         esac
15361         ;;
15362         *)      case "$usethreads" in
15363                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15364                 esac
15365                 d_getpwuid_r=undef
15366                 getpwuid_r_proto=0
15367                 ;;
15368         esac
15369         ;;
15370 *)      getpwuid_r_proto=0
15371         ;;
15372 esac
15373
15374 : Optional checks for getsbyname and getsbyport
15375
15376 : see if getservbyname exists
15377 set getservbyname d_getsbyname
15378 eval $inlibc
15379
15380 : see if getservbyport exists
15381 set getservbyport d_getsbyport
15382 eval $inlibc
15383
15384 : see if getservent exists
15385 set getservent d_getsent
15386 eval $inlibc
15387
15388 : see if getservbyname_r exists
15389 set getservbyname_r d_getservbyname_r
15390 eval $inlibc
15391 case "$d_getservbyname_r" in
15392 "$define")
15393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15394         case "$d_getservbyname_r_proto:$usethreads" in
15395         ":define")      d_getservbyname_r_proto=define
15396                 set d_getservbyname_r_proto getservbyname_r $hdrs
15397                 eval $hasproto ;;
15398         *)      ;;
15399         esac
15400         case "$d_getservbyname_r_proto" in
15401         define)
15402         case "$getservbyname_r_proto" in
15403         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15404         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15405         esac
15406         case "$getservbyname_r_proto" in
15407         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15408         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15409         esac
15410         case "$getservbyname_r_proto" in
15411         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15412         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15413         esac
15414         case "$getservbyname_r_proto" in
15415         ''|0)   d_getservbyname_r=undef
15416                 getservbyname_r_proto=0
15417                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15418         * )     case "$getservbyname_r_proto" in
15419                 REENTRANT_PROTO*) ;;
15420                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15421                 esac
15422                 echo "Prototype: $try" ;;
15423         esac
15424         ;;
15425         *)      case "$usethreads" in
15426                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15427                 esac
15428                 d_getservbyname_r=undef
15429                 getservbyname_r_proto=0
15430                 ;;
15431         esac
15432         ;;
15433 *)      getservbyname_r_proto=0
15434         ;;
15435 esac
15436
15437 : see if getservbyport_r exists
15438 set getservbyport_r d_getservbyport_r
15439 eval $inlibc
15440 case "$d_getservbyport_r" in
15441 "$define")
15442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15443         case "$d_getservbyport_r_proto:$usethreads" in
15444         ":define")      d_getservbyport_r_proto=define
15445                 set d_getservbyport_r_proto getservbyport_r $hdrs
15446                 eval $hasproto ;;
15447         *)      ;;
15448         esac
15449         case "$d_getservbyport_r_proto" in
15450         define)
15451         case "$getservbyport_r_proto" in
15452         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15453         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15454         esac
15455         case "$getservbyport_r_proto" in
15456         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15457         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15458         esac
15459         case "$getservbyport_r_proto" in
15460         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15461         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15462         esac
15463         case "$getservbyport_r_proto" in
15464         ''|0)   d_getservbyport_r=undef
15465                 getservbyport_r_proto=0
15466                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15467         * )     case "$getservbyport_r_proto" in
15468                 REENTRANT_PROTO*) ;;
15469                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15470                 esac
15471                 echo "Prototype: $try" ;;
15472         esac
15473         ;;
15474         *)      case "$usethreads" in
15475                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15476                 esac
15477                 d_getservbyport_r=undef
15478                 getservbyport_r_proto=0
15479                 ;;
15480         esac
15481         ;;
15482 *)      getservbyport_r_proto=0
15483         ;;
15484 esac
15485
15486 : see if getservent_r exists
15487 set getservent_r d_getservent_r
15488 eval $inlibc
15489 case "$d_getservent_r" in
15490 "$define")
15491         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15492         case "$d_getservent_r_proto:$usethreads" in
15493         ":define")      d_getservent_r_proto=define
15494                 set d_getservent_r_proto getservent_r $hdrs
15495                 eval $hasproto ;;
15496         *)      ;;
15497         esac
15498         case "$d_getservent_r_proto" in
15499         define)
15500         case "$getservent_r_proto" in
15501         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15502         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15503         esac
15504         case "$getservent_r_proto" in
15505         ''|0) try='int getservent_r(struct servent*, char*, int);'
15506         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15507         esac
15508         case "$getservent_r_proto" in
15509         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15510         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15511         esac
15512         case "$getservent_r_proto" in
15513         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15514         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15515         esac
15516         case "$getservent_r_proto" in
15517         ''|0)   d_getservent_r=undef
15518                 getservent_r_proto=0
15519                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15520         * )     case "$getservent_r_proto" in
15521                 REENTRANT_PROTO*) ;;
15522                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15523                 esac
15524                 echo "Prototype: $try" ;;
15525         esac
15526         ;;
15527         *)      case "$usethreads" in
15528                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15529                 esac
15530                 d_getservent_r=undef
15531                 getservent_r_proto=0
15532                 ;;
15533         esac
15534         ;;
15535 *)      getservent_r_proto=0
15536         ;;
15537 esac
15538
15539 : see if prototypes for various getservxxx netdb.h functions are available
15540 echo " "
15541 set d_getservprotos getservent $i_netdb netdb.h
15542 eval $hasproto
15543
15544 : see if getspnam exists
15545 set getspnam d_getspnam
15546 eval $inlibc
15547
15548 : see if this is a shadow.h system
15549 set shadow.h i_shadow
15550 eval $inhdr
15551
15552 : see if getspnam_r exists
15553 set getspnam_r d_getspnam_r
15554 eval $inlibc
15555 case "$d_getspnam_r" in
15556 "$define")
15557         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15558         case "$d_getspnam_r_proto:$usethreads" in
15559         ":define")      d_getspnam_r_proto=define
15560                 set d_getspnam_r_proto getspnam_r $hdrs
15561                 eval $hasproto ;;
15562         *)      ;;
15563         esac
15564         case "$d_getspnam_r_proto" in
15565         define)
15566         case "$getspnam_r_proto" in
15567         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15568         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15569         esac
15570         case "$getspnam_r_proto" in
15571         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15572         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15573         esac
15574         case "$getspnam_r_proto" in
15575         ''|0)   d_getspnam_r=undef
15576                 getspnam_r_proto=0
15577                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15578         * )     case "$getspnam_r_proto" in
15579                 REENTRANT_PROTO*) ;;
15580                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15581                 esac
15582                 echo "Prototype: $try" ;;
15583         esac
15584         ;;
15585         *)      case "$usethreads" in
15586                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15587                 esac
15588                 d_getspnam_r=undef
15589                 getspnam_r_proto=0
15590                 ;;
15591         esac
15592         ;;
15593 *)      getspnam_r_proto=0
15594         ;;
15595 esac
15596
15597 : see if gettimeofday or ftime exists
15598 set gettimeofday d_gettimeod
15599 eval $inlibc
15600 case "$d_gettimeod" in
15601 "$undef")
15602         set ftime d_ftime 
15603         eval $inlibc
15604         ;;
15605 *)
15606         val="$undef"; set d_ftime; eval $setvar
15607         ;;
15608 esac
15609 case "$d_gettimeod$d_ftime" in
15610 "$undef$undef")
15611         echo " "
15612         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15613         ;;
15614 esac
15615
15616 : see if gmtime_r exists
15617 set gmtime_r d_gmtime_r
15618 eval $inlibc
15619 case "$d_gmtime_r" in
15620 "$define")
15621         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15622         case "$d_gmtime_r_proto:$usethreads" in
15623         ":define")      d_gmtime_r_proto=define
15624                 set d_gmtime_r_proto gmtime_r $hdrs
15625                 eval $hasproto ;;
15626         *)      ;;
15627         esac
15628         case "$d_gmtime_r_proto" in
15629         define)
15630         case "$gmtime_r_proto" in
15631         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15632         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15633         esac
15634         case "$gmtime_r_proto" in
15635         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15636         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15637         esac
15638         case "$gmtime_r_proto" in
15639         ''|0)   d_gmtime_r=undef
15640                 gmtime_r_proto=0
15641                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15642         * )     case "$gmtime_r_proto" in
15643                 REENTRANT_PROTO*) ;;
15644                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15645                 esac
15646                 echo "Prototype: $try" ;;
15647         esac
15648         ;;
15649         *)      case "$usethreads" in
15650                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15651                 esac
15652                 d_gmtime_r=undef
15653                 gmtime_r_proto=0
15654                 ;;
15655         esac
15656         ;;
15657 *)      gmtime_r_proto=0
15658         ;;
15659 esac
15660
15661 : see if hasmntopt exists
15662 set hasmntopt d_hasmntopt
15663 eval $inlibc
15664
15665 : see if this is a netinet/in.h or sys/in.h system
15666 set netinet/in.h i_niin sys/in.h i_sysin
15667 eval $inhdr
15668
15669 : see if arpa/inet.h has to be included
15670 set arpa/inet.h i_arpainet
15671 eval $inhdr
15672
15673 : see if htonl --and friends-- exists
15674 val=''
15675 set htonl val
15676 eval $inlibc
15677
15678 : Maybe they are macros.
15679 case "$val" in
15680 $undef)
15681         $cat >htonl.c <<EOM
15682 #include <stdio.h>
15683 #include <sys/types.h>
15684 #$i_niin I_NETINET_IN
15685 #$i_sysin I_SYS_IN
15686 #$i_arpainet I_ARPA_INET
15687 #ifdef I_NETINET_IN
15688 #include <netinet/in.h>
15689 #endif
15690 #ifdef I_SYS_IN
15691 #include <sys/in.h>
15692 #endif
15693 #ifdef I_ARPA_INET
15694 #include <arpa/inet.h>
15695 #endif
15696 #ifdef htonl
15697 printf("Defined as a macro.");
15698 #endif
15699 EOM
15700         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15701         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15702                 val="$define"
15703                 echo "But it seems to be defined as a macro." >&4
15704         fi
15705         $rm -f htonl.?
15706         ;;
15707 esac
15708 set d_htonl
15709 eval $setvar
15710
15711 : see if hypot exists
15712 set hypot d_hypot
15713 eval $inlibc
15714
15715 : see if ilogb exists
15716 set ilogb d_ilogb
15717 eval $inlibc
15718
15719 : see if ilogbl exists
15720 set ilogbl d_ilogbl
15721 eval $inlibc
15722
15723 : check whether inet_aton exists
15724 set inet_aton d_inetaton
15725 eval $inlibc
15726
15727 : see if inet_ntop exists
15728 set inet_ntop d_inetntop
15729 eval $inlibc
15730
15731 : see if inet_pton exists
15732 set inet_pton d_inetpton
15733 eval $inlibc
15734
15735 : Look for isascii
15736 echo " "
15737 $cat >isascii.c <<EOCP
15738 #include <stdio.h>
15739 #include <ctype.h>
15740 #$i_stdlib I_STDLIB
15741 #ifdef I_STDLIB
15742 #include <stdlib.h>
15743 #endif
15744 int main() {
15745         int c = 'A';
15746         if (isascii(c))
15747                 exit(0);
15748         else
15749                 exit(1);
15750 }
15751 EOCP
15752 set isascii
15753 if eval $compile; then
15754         echo "isascii() found." >&4
15755         val="$define"
15756 else
15757         echo "isascii() NOT found." >&4
15758         val="$undef"
15759 fi
15760 set d_isascii
15761 eval $setvar
15762 $rm -f isascii*
15763
15764 : Look for isblank
15765 echo " "
15766 $cat >isblank.c <<'EOCP'
15767 #include <stdio.h>
15768 #include <ctype.h>
15769 int main() {
15770         int c = ' ';
15771         if (isblank(c))
15772                 return 0 ;
15773         else
15774                 return 1 ;
15775 }
15776 EOCP
15777 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15778         echo "isblank() found." >&4
15779         val="$define"
15780 else
15781         echo "isblank() NOT found." >&4
15782         val="$undef"
15783 fi
15784 set d_isblank
15785 eval $setvar
15786 $rm -f isblank*
15787
15788 : check for isfinite
15789 echo "Checking to see if you have isfinite..." >&4
15790 $cat >try.c <<EOCP
15791 #include <math.h>
15792 int main() { return isfinite(0.0); }
15793 EOCP
15794 set try
15795 if eval $compile; then
15796         val="$define"
15797         echo "You have isfinite."
15798 else
15799         val="$undef"
15800         echo "You do not have isfinite."
15801 fi
15802 $rm_try
15803 set d_isfinite
15804 eval $setvar
15805
15806 : see if isfinitel exists
15807 set isfinitel d_isfinitel
15808 eval $inlibc
15809
15810 : check for isinf
15811 echo "Checking to see if you have isinf..." >&4
15812 $cat >try.c <<EOCP
15813 #include <math.h>
15814 int main() { return isinf(0.0); }
15815 EOCP
15816 set try
15817 if eval $compile; then
15818         val="$define"
15819         echo "You have isinf."
15820 else
15821         val="$undef"
15822         echo "You do not have isinf."
15823 fi
15824 $rm_try
15825 set d_isinf
15826 eval $setvar
15827
15828 : see if isinfl exists
15829 set isinfl d_isinfl
15830 eval $inlibc
15831
15832 : check for isless
15833 echo "Checking to see if you have isless..." >&4
15834 $cat >try.c <<EOCP
15835 #include <math.h>
15836 int main() { return isless(2.0, 1.0); }
15837 EOCP
15838 set try
15839 if eval $compile; then
15840         val="$define"
15841         echo "You have isless."
15842 else
15843         val="$undef"
15844         echo "You do not have isless."
15845 fi
15846 $rm_try
15847 set d_isless
15848 eval $setvar
15849
15850 : check for isnan
15851 echo "Checking to see if you have isnan..." >&4
15852 $cat >try.c <<EOCP
15853 #include <math.h>
15854 int main() { return isnan(0.0); }
15855 EOCP
15856 set try
15857 if eval $compile; then
15858         val="$define"
15859         echo "You have isnan."
15860 else
15861         val="$undef"
15862         echo "You do not have isnan."
15863 fi
15864 $rm_try
15865 set d_isnan
15866 eval $setvar
15867
15868 : see if isnanl exists
15869 set isnanl d_isnanl
15870 eval $inlibc
15871
15872 : check for isnormal
15873 echo "Checking to see if you have isnormal..." >&4
15874 $cat >try.c <<EOCP
15875 #include <math.h>
15876 int main() { return isnormal(0.0); }
15877 EOCP
15878 set try
15879 if eval $compile; then
15880         val="$define"
15881         echo "You have isnormal."
15882 else
15883         val="$undef"
15884         echo "You do not have isnormal."
15885 fi
15886 $rm_try
15887 set d_isnormal
15888 eval $setvar
15889
15890 : see if j0 exists
15891 set j0 d_j0
15892 eval $inlibc
15893
15894 : see if j0l exists
15895 set j0l d_j0l
15896 eval $inlibc
15897
15898 : see if killpg exists
15899 set killpg d_killpg
15900 eval $inlibc
15901
15902 : see if localeconv exists
15903 set localeconv d_locconv
15904 eval $inlibc
15905
15906 : see if libc has the POSIX.1-2008 currency locale rules
15907 case "$d_locconv:$d_lc_monetary_2008" in
15908 $define:)
15909         $cat >try.c <<EOCP
15910 #include <locale.h>
15911 int main() {
15912         struct lconv *lc = localeconv();
15913         char int_p_cs_precedes = lc->int_p_cs_precedes;
15914         return 0;
15915 }
15916 EOCP
15917         set try
15918         if eval $compile; then
15919                 d_lc_monetary_2008="$define"
15920         else
15921                 d_lc_monetary_2008="$undef"
15922         fi;
15923         $rm_try
15924         ;;
15925 esac
15926
15927 : see if lchown exists
15928 echo " "
15929 $cat > try.c <<EOCP
15930 #include <pwd.h>
15931 #include <stdio.h>
15932 #include <stdlib.h>
15933 #$i_unistd      I_UNISTD
15934 #ifdef I_UNISTD
15935 #  include <unistd.h>
15936 #endif
15937 int main(int argc, char *argv[])
15938 {
15939    if (lchown("./try.c", -1, getgid()) == -1) {
15940        exit(EXIT_FAILURE);
15941    }
15942    exit(EXIT_SUCCESS);
15943 }
15944 EOCP
15945 set try
15946 if eval $compile && ./try; then
15947     $echo "lchown() found." >&4
15948     val="$define"
15949 else
15950     $echo "lchown() NOT found." >&4
15951     val="$undef"
15952 fi
15953 set d_lchown
15954 eval $setvar
15955 $rm_try
15956
15957 : See if number of significant digits in a double precision number is known
15958 echo " "
15959 $cat >ldbl_dig.c <<EOM
15960 #include <limits.h>
15961 #include <float.h>
15962 #ifdef LDBL_DIG
15963 printf("Contains LDBL_DIG");
15964 #endif
15965 EOM
15966 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15967 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15968         echo "LDBL_DIG found." >&4
15969         val="$define"
15970 else
15971         echo "LDBL_DIG NOT found." >&4
15972         val="$undef"
15973 fi
15974 $rm -f ldbl_dig.?
15975 set d_ldbl_dig
15976 eval $setvar
15977
15978 : see if lgamma exists
15979 set lgamma d_lgamma
15980 eval $inlibc
15981
15982 : see if lgamma_r exists
15983 set lgamma_r d_lgamma_r
15984 eval $inlibc
15985
15986 : check to see if math.h defines _LIB_VERSION
15987 d_libm_lib_version="$undef"
15988 echo " "
15989 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15990 $cat >try.c <<EOCP
15991 #include <unistd.h>
15992 #include <math.h>
15993 int main (int argc, char *argv[])
15994 {
15995     printf ("%d\n", _LIB_VERSION);
15996     return (0);
15997     } /* main */
15998 EOCP
15999 set try
16000 if eval $compile; then
16001     foo=`$run ./try`
16002     echo "Yes, it does ($foo)" >&4
16003     d_libm_lib_version="$define"
16004 else
16005     echo "No, it does not (probably harmless)" >&4
16006     fi
16007 $rm_try
16008
16009 : see if link exists
16010 set link d_link
16011 eval $inlibc
16012
16013 : see if llrint exists
16014 set llrint d_llrint
16015 eval $inlibc
16016
16017 : see if llrintl exists
16018 set llrintl d_llrintl
16019 eval $inlibc
16020
16021 : see if llround exists
16022 set llround d_llround
16023 eval $inlibc
16024
16025 : see if llroundl exists
16026 set llroundl d_llroundl
16027 eval $inlibc
16028
16029 : see if localeconv_l exists
16030 set localeconv_l d_localeconv_l
16031 eval $inlibc
16032
16033 : see if localtime_r exists
16034 set localtime_r d_localtime_r
16035 eval $inlibc
16036 case "$d_localtime_r" in
16037 "$define")
16038         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16039         case "$d_localtime_r_proto:$usethreads" in
16040         ":define")      d_localtime_r_proto=define
16041                 set d_localtime_r_proto localtime_r $hdrs
16042                 eval $hasproto ;;
16043         *)      ;;
16044         esac
16045         case "$d_localtime_r_proto" in
16046         define)
16047         case "$localtime_r_proto" in
16048         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16049         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16050         esac
16051         case "$localtime_r_proto" in
16052         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16053         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16054         esac
16055         case "$localtime_r_proto" in
16056         ''|0)   d_localtime_r=undef
16057                 localtime_r_proto=0
16058                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16059         * )     case "$localtime_r_proto" in
16060                 REENTRANT_PROTO*) ;;
16061                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16062                 esac
16063                 echo "Prototype: $try" ;;
16064         esac
16065         ;;
16066         *)      case "$usethreads" in
16067                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16068                 esac
16069                 d_localtime_r=undef
16070                 localtime_r_proto=0
16071                 ;;
16072         esac
16073         ;;
16074 *)      localtime_r_proto=0
16075         ;;
16076 esac
16077
16078 : see if localtime_r calls tzset
16079 case "$localtime_r_proto" in
16080 REENTRANT_PROTO*)
16081         $cat >try.c <<EOCP
16082 /*  Does our libc's localtime_r call tzset ?
16083  *  return 0 if so, 1 otherwise.
16084  */
16085 #$i_systypes    I_SYS_TYPES
16086 #$i_unistd      I_UNISTD
16087 #$i_time        I_TIME
16088 #$i_stdlib      I_STDLIB
16089 #$i_malloc      I_MALLOC
16090 #ifdef I_SYS_TYPES
16091 #  include <sys/types.h>
16092 #endif
16093 #ifdef I_UNISTD
16094 #  include <unistd.h>
16095 #endif
16096 #ifdef I_TIME
16097 #  include <time.h>
16098 #endif
16099 #ifdef I_STDLIB
16100 #include <stdlib.h>
16101 #endif
16102 #include <string.h>
16103 #ifdef I_MALLOC
16104 #  include <malloc.h>
16105 #endif
16106 int main()
16107 {
16108     time_t t = time(0L);
16109     char w_tz[]="TZ" "=GMT+5",
16110          e_tz[]="TZ" "=GMT-5",
16111         *tz_e = (char*)malloc(16),
16112         *tz_w = (char*)malloc(16);
16113     struct tm tm_e, tm_w;
16114     memset(&tm_e,'\0',sizeof(struct tm));
16115     memset(&tm_w,'\0',sizeof(struct tm));
16116     strcpy(tz_e,e_tz);
16117     strcpy(tz_w,w_tz);
16118
16119     putenv(tz_e);
16120     localtime_r(&t, &tm_e);
16121
16122     putenv(tz_w);
16123     localtime_r(&t, &tm_w);
16124
16125     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16126         return 1;
16127     return 0;
16128 }
16129 EOCP
16130         set try
16131         if eval $compile; then
16132             if $run ./try; then
16133                 d_localtime_r_needs_tzset=undef;
16134             else
16135                 d_localtime_r_needs_tzset=define;
16136             fi;
16137         else
16138             d_localtime_r_needs_tzset=undef;
16139         fi;
16140      ;;
16141   *)
16142      d_localtime_r_needs_tzset=undef;
16143      ;;
16144 esac
16145 $rm_try
16146
16147 : see if lockf exists
16148 set lockf d_lockf
16149 eval $inlibc
16150
16151 : see if log1p exists
16152 set log1p d_log1p
16153 eval $inlibc
16154
16155 : see if log2 exists
16156 set log2 d_log2
16157 eval $inlibc
16158
16159 : see if logb exists
16160 set logb d_logb
16161 eval $inlibc
16162
16163 : see if lrint exists
16164 set lrint d_lrint
16165 eval $inlibc
16166
16167 : see if lrintl exists
16168 set lrintl d_lrintl
16169 eval $inlibc
16170
16171 : see if lround exists
16172 set lround d_lround
16173 eval $inlibc
16174
16175 : see if lroundl exists
16176 set lroundl d_lroundl
16177 eval $inlibc
16178
16179 : see if prototype for lseek is available
16180 echo " "
16181 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16182 eval $hasproto
16183
16184 : see if lstat exists
16185 set lstat d_lstat
16186 eval $inlibc
16187
16188 : see if madvise exists
16189 set madvise d_madvise
16190 eval $inlibc
16191
16192 : see if malloc_size exists
16193 set malloc_size d_malloc_size
16194 eval $inlibc
16195
16196 : see if malloc_size_good exists
16197 set malloc_good_size d_malloc_good_size
16198 eval $inlibc
16199
16200 : see if malloc_usable_size exists
16201 set malloc_usable_size d_malloc_usable_size
16202 eval $inlibc
16203
16204 : see if mblen exists
16205 set mblen d_mblen
16206 eval $inlibc
16207
16208 : see if mbrlen exists
16209 set mbrlen d_mbrlen
16210 eval $inlibc
16211
16212 : see if mbrtowc exists
16213 set mbrtowc d_mbrtowc
16214 eval $inlibc
16215
16216 : see if mbstowcs exists
16217 set mbstowcs d_mbstowcs
16218 eval $inlibc
16219
16220 : see if mbtowc exists
16221 set mbtowc d_mbtowc
16222 eval $inlibc
16223
16224 : see if memmem exists
16225 : We need both a prototype in string.h and the symbol in libc.
16226 echo " "
16227 d_memmem_proto=''
16228 xx1="#$d_gnulibc HAS_GNULIBC"
16229 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16230 xx3='#   define _GNU_SOURCE'
16231 xx4='#endif'
16232 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16233 eval $hasproto
16234 case "$d_memmem_proto" in
16235     define) # see if memmem exists
16236         set memmem d_memmem
16237         eval $inlibc
16238         ;;
16239     *)  val=$undef
16240         set d_memmem
16241         eval $setvar
16242         ;;
16243 esac
16244
16245 : see if memrchr exists
16246 : We need both a prototype in string.h and the symbol in libc.
16247 echo " "
16248 d_memrchr_proto=''
16249 xx1="#$d_gnulibc HAS_GNULIBC"
16250 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16251 xx3='#   define _GNU_SOURCE'
16252 xx4='#endif'
16253 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16254 eval $hasproto
16255 case "$d_memrchr_proto" in
16256     define) # see if memrchr exists
16257         set memrchr d_memrchr
16258         eval $inlibc
16259         ;;
16260     *)  val=$undef
16261         set d_memrchr
16262         eval $setvar
16263         ;;
16264 esac
16265
16266 : see if mkdir exists
16267 set mkdir d_mkdir
16268 eval $inlibc
16269
16270 : see if mkdtemp exists
16271 set mkdtemp d_mkdtemp
16272 eval $inlibc
16273
16274 : see if mkfifo exists
16275 set mkfifo d_mkfifo
16276 eval $inlibc
16277
16278 : see if mkostemp exists
16279 set mkostemp d_mkostemp
16280 eval $inlibc
16281
16282 : see if mkstemp exists
16283 set mkstemp d_mkstemp
16284 eval $inlibc
16285
16286 : see if mkstemps exists
16287 set mkstemps d_mkstemps
16288 eval $inlibc
16289
16290 : see if mktime exists
16291 set mktime d_mktime
16292 eval $inlibc
16293
16294 : see if sys/mman.h has to be included
16295 set sys/mman.h i_sysmman
16296 eval $inhdr
16297
16298 : see if mmap exists
16299 set mmap d_mmap
16300 eval $inlibc
16301 : see what shmat returns
16302 : default to something harmless
16303 mmaptype='void *'
16304 case "$i_sysmman$d_mmap" in
16305 "$define$define")
16306         $cat >mmap.c <<'END'
16307 #include <sys/mman.h>
16308 void *mmap();
16309 END
16310         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16311                 mmaptype='void *'
16312         else
16313                 mmaptype='caddr_t'
16314         fi
16315         echo "and it returns ($mmaptype)." >&4
16316         ;;
16317 esac
16318
16319 : see if sqrtl exists
16320 set sqrtl d_sqrtl
16321 eval $inlibc
16322
16323 : see if scalbnl exists
16324 set scalbnl d_scalbnl
16325 eval $inlibc
16326
16327 : see if truncl exists
16328 set truncl d_truncl
16329 eval $inlibc
16330
16331 : see if modfl exists
16332 set modfl d_modfl
16333 eval $inlibc
16334
16335 : see if prototype for modfl is available
16336 echo " "
16337 set d_modflproto modfl define math.h
16338 eval $hasproto
16339
16340 if $test "$uselongdouble" = "$define"; then
16341     message=""
16342     if $test "$d_sqrtl" != "$define"; then
16343         message="$message sqrtl"
16344     fi
16345     if $test "$d_modfl" != "$define"; then
16346         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16347             echo "You have both truncl and copysignl, so I can emulate modfl."
16348         else
16349             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16350                 echo "You have both aintl and copysignl, so I can emulate modfl."
16351             else
16352                 message="$message modfl"
16353             fi
16354         fi
16355     fi
16356     if $test "$d_frexpl" != "$define"; then
16357         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16358             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16359         else
16360             message="$message frexpl"
16361         fi
16362     fi
16363     if $test "$d_ldexpl" != "$define"; then
16364         message="$message ldexpl"
16365     fi
16366
16367     if $test "$message" != ""; then
16368         $cat <<EOM >&4
16369
16370 *** You requested the use of long doubles but you do not seem to have
16371 *** the following mathematical functions needed for long double support:
16372 ***    $message
16373 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16374 *** Cannot continue, aborting.
16375
16376 EOM
16377
16378         exit 1
16379     fi
16380 fi
16381
16382 : see if mprotect exists
16383 set mprotect d_mprotect
16384 eval $inlibc
16385
16386 : see if msgctl exists
16387 set msgctl d_msgctl
16388 eval $inlibc
16389
16390 : see if msgget exists
16391 set msgget d_msgget
16392 eval $inlibc
16393
16394 : see if msgsnd exists
16395 set msgsnd d_msgsnd
16396 eval $inlibc
16397
16398 : see if msgrcv exists
16399 set msgrcv d_msgrcv
16400 eval $inlibc
16401
16402 : see how much of the 'msg*(2)' library is present.
16403 h_msg=true
16404 echo " "
16405 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16406 *"$undef"*) h_msg=false;;
16407 esac
16408 case "$osname" in
16409 freebsd)
16410     case "`ipcs 2>&1`" in
16411     "SVID messages"*"not configured"*)
16412         echo "Your $osname does not have the msg*(2) configured." >&4
16413         h_msg=false
16414         val="$undef"
16415         set msgctl d_msgctl
16416         eval $setvar
16417         set msgget d_msgget
16418         eval $setvar
16419         set msgsnd d_msgsnd
16420         eval $setvar
16421         set msgrcv d_msgrcv
16422         eval $setvar
16423         ;;
16424     esac
16425     ;;
16426 esac
16427 : we could also check for sys/ipc.h ...
16428 if $h_msg && $test `./findhdr sys/msg.h`; then
16429         echo "You have the full msg*(2) library." >&4
16430         val="$define"
16431 else
16432         echo "You don't have the full msg*(2) library." >&4
16433         val="$undef"
16434 fi
16435 set d_msg
16436 eval $setvar
16437
16438 : Check for msghdr_s
16439 echo " "
16440 echo "Checking to see if your system supports struct msghdr..." >&4
16441 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16442 eval $hasstruct
16443 case "$d_msghdr_s" in
16444 "$define")      echo "Yes, it does."   ;;
16445 *)              echo "No, it doesn't." ;;
16446 esac
16447
16448 : see if msync exists
16449 set msync d_msync
16450 eval $inlibc
16451
16452 : see if munmap exists
16453 set munmap d_munmap
16454 eval $inlibc
16455
16456 : see if nan exists
16457 set nan d_nan
16458 eval $inlibc
16459
16460 : see if nanosleep exists
16461 set nanosleep d_nanosleep
16462 eval $inlibc
16463
16464 : see if nearbyint exists
16465 set nearbyint d_nearbyint
16466 eval $inlibc
16467
16468 : see if nextafter exists
16469 set nextafter d_nextafter
16470 eval $inlibc
16471
16472 : see if nexttoward exists
16473 set nexttoward d_nexttoward
16474 eval $inlibc
16475
16476 : see if nice exists
16477 set nice d_nice
16478 eval $inlibc
16479
16480 : see if this is a langinfo.h system
16481 set langinfo.h i_langinfo
16482 eval $inhdr
16483
16484 : see if nl_langinfo exists
16485 set nl_langinfo d_nl_langinfo
16486 eval $inlibc
16487
16488 : see if this is a quadmath.h system
16489 set quadmath.h i_quadmath
16490 eval $inhdr
16491
16492 : Check basic sizes
16493 echo " "
16494 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16495
16496 case "$use64bitint:$d_quad:$quadtype" in
16497 define:define:?*)
16498         ivtype="$quadtype"
16499         uvtype="$uquadtype"
16500         ivsize=8
16501         uvsize=8
16502         ;;
16503 *)      ivtype="long"
16504         uvtype="unsigned long"
16505         ivsize=$longsize
16506         uvsize=$longsize
16507         ;;
16508 esac
16509
16510 case "$uselongdouble:$d_longdbl" in
16511 define:define)
16512         nvtype="long double"
16513         nvsize=$longdblsize
16514         ;;
16515 *)      nvtype=double
16516         nvsize=$doublesize
16517         ;;
16518 esac
16519
16520 case "$usequadmath:$i_quadmath" in
16521 define:define)
16522   nvtype="__float128"
16523   nvsize=16
16524   case "$libs" in
16525   *quadmath*) ;;
16526   *) $cat <<EOM >&4
16527
16528 *** You requested the use of the quadmath library, but you
16529 *** do not seem to have the quadmath library installed.
16530 *** Cannot continue, aborting.
16531 EOM
16532     exit 1
16533     ;;
16534   esac
16535   ;;
16536 define:*) $cat <<EOM >&4
16537
16538 *** You requested the use of the quadmath library, but you
16539 *** do not seem to have the required header, <quadmath.h>.
16540 EOM
16541   case "$gccversion" in
16542   [23].*|4.[0-5]*)
16543    $cat <<EOM >&4
16544 *** Your gcc looks a bit old:
16545 *** $gccversion
16546 EOM
16547     ;;
16548   '')
16549    $cat <<EOM >&4
16550 *** You are not running a gcc.
16551 EOM
16552     ;;
16553   esac
16554   $cat <<EOM >&4
16555 *** For the quadmath library you need at least gcc 4.6.
16556 *** Cannot continue, aborting.
16557 EOM
16558   exit 1
16559   ;;
16560 esac
16561
16562 $echo "(IV will be "$ivtype", $ivsize bytes)"
16563 $echo "(UV will be "$uvtype", $uvsize bytes)"
16564 $echo "(NV will be "$nvtype", $nvsize bytes)"
16565
16566 $cat >try.c <<EOCP
16567 #$i_inttypes I_INTTYPES
16568 #ifdef I_INTTYPES
16569 #include <inttypes.h>
16570 #endif
16571 #include <stdio.h>
16572 int main() {
16573 #ifdef INT8
16574    int8_t i =  INT8_MAX;
16575   uint8_t u = UINT8_MAX;
16576   printf("int8_t\n");
16577 #endif
16578 #ifdef INT16
16579    int16_t i =  INT16_MAX;
16580   uint16_t u = UINT16_MAX;
16581   printf("int16_t\n");
16582 #endif
16583 #ifdef INT32
16584    int32_t i =  INT32_MAX;
16585   uint32_t u = UINT32_MAX;
16586   printf("int32_t\n");
16587 #endif
16588 }
16589 EOCP
16590
16591 i8type="signed char"
16592 u8type="unsigned char"
16593 i8size=1
16594 u8size=1
16595
16596 case "$i16type" in
16597 '')     case "$shortsize" in
16598         2)      i16type=short
16599                 u16type="unsigned short"
16600                 i16size=$shortsize
16601                 u16size=$shortsize
16602                 ;;
16603         esac
16604         ;;
16605 esac
16606 case "$i16type" in
16607 '')     set try -DINT16
16608         if eval $compile; then
16609                 case "`$run ./try`" in
16610                 int16_t)
16611                         i16type=int16_t
16612                         u16type=uint16_t
16613                         i16size=2
16614                         u16size=2
16615                         ;;
16616                 esac
16617         fi
16618         ;;
16619 esac
16620 case "$i16type" in
16621 '')     if $test $shortsize -ge 2; then
16622                 i16type=short
16623                 u16type="unsigned short"
16624                 i16size=$shortsize
16625                 u16size=$shortsize
16626         fi
16627         ;;
16628 esac
16629
16630 case "$i32type" in
16631 '')     case "$longsize" in
16632         4)      i32type=long
16633                 u32type="unsigned long"
16634                 i32size=$longsize
16635                 u32size=$longsize
16636                 ;;
16637         *)      case "$intsize" in
16638                 4)      i32type=int
16639                         u32type="unsigned int"
16640                         i32size=$intsize
16641                         u32size=$intsize
16642                         ;;
16643                 esac
16644                 ;;
16645         esac
16646         ;;
16647 esac
16648 case "$i32type" in
16649 '')     set try -DINT32
16650         if eval $compile; then
16651                 case "`$run ./try`" in
16652                 int32_t)
16653                         i32type=int32_t
16654                         u32type=uint32_t
16655                         i32size=4
16656                         u32size=4
16657                         ;;
16658                 esac
16659         fi
16660         ;;
16661 esac
16662 case "$i32type" in
16663 '')     if $test $intsize -ge 4; then
16664                 i32type=int
16665                 u32type="unsigned int"
16666                 i32size=$intsize
16667                 u32size=$intsize
16668         fi
16669         ;;
16670 esac
16671
16672 case "$i64type" in
16673 '')     case "$d_quad:$quadtype" in
16674         define:?*)
16675                 i64type="$quadtype"
16676                 u64type="$uquadtype"
16677                 i64size=8
16678                 u64size=8
16679                 ;;
16680         esac
16681         ;;
16682 esac
16683
16684 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16685 $cat <<EOP >try.c
16686 #include <stdio.h>
16687 #$i_stdlib I_STDLIB
16688 #ifdef I_STDLIB
16689 #include <stdlib.h>
16690 #endif
16691 #include <sys/types.h>
16692 #include <signal.h>
16693 #ifdef SIGFPE
16694 /* volatile so that the compiler has to store it out to memory */
16695 volatile int bletched = 0;
16696 $signal_t blech(int s) { bletched = 1; }
16697 #endif
16698 int main() {
16699     $uvtype u = 0;
16700     $nvtype d;
16701     int     n = 8 * $uvsize;
16702     int     i;
16703 #ifdef SIGFPE
16704     signal(SIGFPE, blech);
16705 #endif
16706
16707     for (i = 0; i < n; i++) {
16708       u = u << 1 | ($uvtype)1;
16709       d = ($nvtype)u;
16710       if (($uvtype)d != u)
16711         break;
16712       if (d <= 0)
16713         break;
16714       d = ($nvtype)(u - 1);
16715       if (($uvtype)d != (u - 1))
16716         break;
16717 #ifdef SIGFPE
16718       if (bletched)
16719         break;
16720 #endif
16721     }
16722     printf("%d\n", ((i == n) ? -n : i));
16723     exit(0);
16724 }
16725 EOP
16726 set try
16727
16728 d_nv_preserves_uv="$undef"
16729 if eval $compile; then
16730         nv_preserves_uv_bits="`$run ./try`"
16731 fi
16732 case "$nv_preserves_uv_bits" in
16733 \-[1-9]*)
16734         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16735         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16736         d_nv_preserves_uv="$define"
16737         ;;
16738 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16739         d_nv_preserves_uv="$undef" ;;
16740 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16741         nv_preserves_uv_bits="0" ;;
16742 esac
16743 $rm_try
16744
16745 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16746 $cat <<EOP >try.c
16747 #include <stdio.h>
16748
16749 typedef $nvtype NV;
16750
16751 int
16752 main() {
16753   NV value = 2;
16754   int count = 1;
16755
16756   while(count < 256) {
16757     /* volatile so that the compiler has to store it out to memory */
16758     volatile NV up = value + 1.0;
16759     volatile NV negated = -value;
16760     volatile NV down = negated - 1.0;
16761     volatile NV got_up = up - value;
16762     int up_good = got_up == 1.0;
16763     int got_down = down - negated;
16764     int down_good = got_down == -1.0;
16765
16766     if (down_good != up_good) {
16767       fprintf(stderr,
16768               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16769               up_good, (double) got_up, down_good, (double) got_down,
16770               count, (double) value);
16771       return 1;
16772     }
16773     if (!up_good) {
16774       while (1) {
16775         if (count > 8) {
16776           count -= 8;
16777           fputs("256.0", stdout);
16778         } else {
16779           count--;
16780           fputs("2.0", stdout);
16781         }
16782         if (!count) {
16783           puts("");
16784           return 0;
16785         }
16786         fputs("*", stdout);
16787       }
16788     }
16789     value *= 2;
16790     ++count;
16791   }
16792   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16793           count, (double) value);
16794   return 1;
16795 }
16796 EOP
16797 set try
16798
16799 nv_overflows_integers_at='0'
16800 if eval $compile; then
16801     xxx="`$run ./try`"
16802     case "$?" in
16803         0)
16804             case "$xxx" in
16805                 2*)  cat >&4 <<EOM
16806 The largest integer your NVs can preserve is equal to $xxx
16807 EOM
16808                     nv_overflows_integers_at="$xxx"
16809                     ;;
16810                 *)  cat >&4 <<EOM
16811 Cannot determine the largest integer value your NVs can hold, unexpected output
16812 '$xxx'
16813 EOM
16814                     ;;
16815             esac
16816             ;;
16817         *)  cat >&4 <<EOM
16818 Cannot determine the largest integer value your NVs can hold
16819 EOM
16820             ;;
16821     esac
16822 fi
16823 $rm_try
16824
16825 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16826 $cat <<EOP >try.c
16827 #include <stdio.h>
16828 #$i_stdlib I_STDLIB
16829 #ifdef I_STDLIB
16830 #include <stdlib.h>
16831 #endif
16832 #include <string.h>
16833 #include <sys/types.h>
16834 #include <signal.h>
16835 #ifdef SIGFPE
16836 /* volatile so that the compiler has to store it out to memory */
16837 volatile int bletched = 0;
16838 $signal_t blech(int s) { bletched = 1; }
16839 #endif
16840
16841 int checkit($nvtype d, const char *where) {
16842     void *v = &d;
16843     unsigned char *p = (unsigned char *)v;
16844     unsigned char *end = p + sizeof(d);
16845     int fail = 0;
16846
16847     while (p < end)
16848         fail += *p++;
16849
16850     if (!fail)
16851         return 0;
16852
16853     p = (unsigned char *)v;
16854     printf("No - %s: 0x", where);
16855     while (p < end)
16856         printf ("%02X", *p++);
16857     printf("\n");
16858     return 1;
16859 }
16860
16861 int main(int argc, char **argv) {
16862     $nvtype d = 0.0;
16863     int fail = 0;
16864     fail += checkit(d, "0.0");
16865
16866     /* The compiler shouldn't be assuming that bletched is 0  */
16867     d = bletched;
16868
16869     fail += checkit(d, "bleched");
16870
16871 #ifdef SIGFPE
16872     signal(SIGFPE, blech);
16873 #endif
16874
16875     /* Paranoia - the compiler should have no way of knowing that ANSI says
16876        that argv[argc] will always be NULL.  Actually, if it did assume this it
16877        would be buggy, as this is C and main() can be called from elsewhere in
16878        the program.  */
16879     d = argv[argc] ? 1 : 0;
16880
16881     if (d) {
16882         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16883     }
16884
16885     fail += checkit(d, "ternary");
16886
16887     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16888
16889     if (d != 0.0) {
16890         printf("No - memset doesn't give 0.0\n");
16891         /* This might just blow up:  */
16892         printf("(gives %g)\n", d);
16893         return 1;
16894     }
16895
16896 #ifdef SIGFPE
16897     if (bletched) {
16898         printf("No - something bleched\n");
16899         return 1;
16900     }
16901 #endif
16902     if (fail) {
16903       printf("No - %d fail(s)\n", fail);
16904       return 1;
16905     }
16906     printf("Yes\n");
16907     return 0;
16908 }
16909 EOP
16910 set try
16911
16912 d_nv_zero_is_allbits_zero="$undef"
16913 if eval $compile; then
16914     xxx="`$run ./try`"
16915     case "$?" in
16916         0)
16917             case "$xxx" in
16918                 Yes)  cat >&4 <<EOM
16919 0.0 is represented as all bits zero in memory
16920 EOM
16921                     d_nv_zero_is_allbits_zero="$define"
16922                     ;;
16923                 *)  cat >&4 <<EOM
16924 0.0 is not represented as all bits zero in memory
16925 EOM
16926                     d_nv_zero_is_allbits_zero="$undef"
16927                     ;;
16928             esac
16929             ;;
16930         *)  cat >&4 <<EOM
16931 0.0 is not represented as all bits zero in memory
16932 EOM
16933             d_nv_zero_is_allbits_zero="$undef"
16934             ;;
16935     esac
16936 fi
16937 $rm_try
16938
16939 : check for off64_t
16940 echo " "
16941 echo "Checking to see if you have off64_t..." >&4
16942 $cat >try.c <<EOCP
16943 #include <sys/types.h>
16944 #include <unistd.h>
16945 int main() { off64_t x = 7; }
16946 EOCP
16947 set try
16948 if eval $compile; then
16949         val="$define"
16950         echo "You have off64_t."
16951 else
16952         val="$undef"
16953         echo "You do not have off64_t."
16954         case "$lseeksize" in
16955         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16956         esac
16957 fi
16958 $rm_try
16959 set d_off64_t
16960 eval $setvar
16961
16962 : how to create joinable pthreads
16963 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16964         echo " "
16965         echo "Checking what constant to use for creating joinable pthreads..." >&4
16966         $cat >try.c <<'EOCP'
16967 #include <pthread.h>
16968 int main() {
16969     int detachstate = JOINABLE;
16970 }
16971 EOCP
16972         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16973         if eval $compile; then
16974                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16975                 val="$undef" # Yes, undef.
16976                 set d_old_pthread_create_joinable
16977                 eval $setvar
16978                 val=""
16979                 set old_pthread_create_joinable
16980                 eval $setvar
16981         else
16982                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16983                 if eval $compile; then
16984                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16985                         val="$define"
16986                         set d_old_pthread_create_joinable
16987                         eval $setvar
16988                         val=PTHREAD_CREATE_UNDETACHED
16989                         set old_pthread_create_joinable
16990                         eval $setvar
16991                 else
16992                         set try -DJOINABLE=__UNDETACHED
16993                         if eval $compile; then
16994                                 echo "You seem to use __UNDETACHED." >&4
16995                                 val="$define"
16996                                 set d_old_pthread_create_joinable
16997                                 eval $setvar
16998                                 val=__UNDETACHED
16999                                 set old_pthread_create_joinable
17000                                 eval $setvar
17001                         else
17002                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17003                                 val="$define"
17004                                 set d_old_pthread_create_joinable
17005                                 eval $setvar
17006                                 val=0
17007                                 set old_pthread_create_joinable
17008                                 eval $setvar
17009                         fi
17010                 fi
17011         fi
17012         $rm_try
17013 else
17014     d_old_pthread_create_joinable="$undef"
17015     old_pthread_create_joinable=""
17016 fi
17017
17018 : see if pause exists
17019 set pause d_pause
17020 eval $inlibc
17021
17022 : see if pipe2 exists
17023 set pipe2 d_pipe2
17024 eval $inlibc
17025
17026 : see if poll exists
17027 set poll d_poll
17028 eval $inlibc
17029
17030 : see if prctl exists
17031 set prctl d_prctl
17032 eval $inlibc
17033
17034 : see if prctl supports PR_SET_NAME
17035 d_prctl_set_name=$undef
17036 case $d_prctl in
17037     $define)
17038         $cat >try.c <<EOM
17039 #ifdef __ANDROID__
17040 #include <unistd.h>
17041 #endif
17042 #include <sys/prctl.h>
17043
17044 int main (int argc, char *argv[])
17045 {
17046     return (prctl (PR_SET_NAME, "Test"));
17047     } /* main */
17048 EOM
17049         set try
17050         if eval $compile_ok && $run ./try; then
17051             echo "Your prctl (PR_SET_NAME, ...) works"
17052             d_prctl_set_name=$define
17053             fi
17054         $rm_try
17055         ;;
17056     esac
17057
17058 : see if readlink exists
17059 set readlink d_readlink
17060 eval $inlibc
17061
17062 : Check if there is a /proc symlink to the abs path of
17063 : the executing program.  We will honor hints of d_procselfexe=$undef
17064 : or procselfexe being non-empty, otherwise will try to determine both
17065 : if we have readlink.
17066 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17067 : referenced, and AmigaOS does not have a proc filesystem anyway.
17068 echo " "
17069 val="$undef"
17070 if $test "X$d_procselfexe" = Xundef; then
17071         procselfexe=''
17072 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17073         val="$define"
17074 elif $test "X$d_readlink" = Xdefine; then
17075         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17076         : and it feels more tidy to avoid an extra level of symlink
17077         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17078         while test $# -gt 0; do
17079             type=$1; try=$2
17080             shift; shift
17081             if $issymlink $try; then
17082                 $ls -l $try > reflect
17083                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17084                     echo "You have $type-like $try."
17085                     procselfexe='"'$try'"'
17086                     val="$define"
17087                     : This will break out of the loop
17088                     set X; shift
17089                 fi
17090             fi
17091         done
17092 fi
17093 $rm -f reflect
17094 set d_procselfexe
17095 eval $setvar
17096
17097 : backward compatibility for d_hvfork
17098 if test X$d_hvfork != X; then
17099         d_vfork="$d_hvfork"
17100         d_hvfork=''
17101 fi
17102 : see if there is a vfork
17103 val=''
17104 set vfork val
17105 eval $inlibc
17106
17107 d_pseudofork=$undef
17108
17109 : Ok, but do we want to use it. vfork is reportedly unreliable in
17110 : perl on Solaris 2.x, and probably elsewhere.
17111 case "$val" in
17112 $define)
17113         echo " "
17114         case "$usevfork" in
17115         false) dflt='n';;
17116         *) dflt='y';;
17117         esac
17118         cat <<'EOM'
17119
17120 Perl can only use a vfork() that doesn't suffer from strict
17121 restrictions on calling functions or modifying global data in
17122 the child.  For example, glibc-2.1 contains such a vfork()
17123 that is unsuitable.  If your system provides a proper fork()
17124 call, chances are that you do NOT want perl to use vfork().
17125
17126 EOM
17127         rp="Do you still want to use vfork()?"
17128         . ./myread
17129         case "$ans" in
17130         y|Y) ;;
17131         *)
17132                 echo "Ok, we won't use vfork()."
17133                 val="$undef"
17134                 ;;
17135         esac
17136         ;;
17137 esac
17138 set d_vfork
17139 eval $setvar
17140 case "$d_vfork" in
17141 $define) usevfork='true';;
17142 *) usevfork='false';;
17143 esac
17144
17145 : see whether the pthread_atfork exists
17146 $cat >try.c <<EOP
17147 #include <pthread.h>
17148 #include <stdio.h>
17149 int main() {
17150 #ifdef  PTHREAD_ATFORK
17151         pthread_atfork(NULL,NULL,NULL);
17152 #endif
17153 }
17154 EOP
17155
17156 : see if pthread_atfork exists
17157 set try -DPTHREAD_ATFORK
17158 if eval $compile; then
17159     val="$define"
17160 else
17161     val="$undef"
17162 fi
17163 case "$usethreads" in
17164 $define)
17165         case "$val" in
17166         $define) echo 'pthread_atfork found.' >&4        ;;
17167         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17168         esac
17169 esac
17170 set d_pthread_atfork
17171 eval $setvar
17172
17173 : see if pthread_attr_setscope exists
17174 set pthread_attr_setscope d_pthread_attr_setscope
17175 eval $inlibc
17176
17177 : see whether the various POSIXish _yields exist
17178 $cat >try.c <<EOP
17179 #include <pthread.h>
17180 #include <stdio.h>
17181 int main() {
17182 #ifdef SCHED_YIELD
17183         sched_yield();
17184 #else
17185 #ifdef PTHREAD_YIELD
17186         pthread_yield();
17187 #else
17188 #ifdef PTHREAD_YIELD_NULL
17189         pthread_yield(NULL);
17190 #endif
17191 #endif
17192 #endif
17193 }
17194 EOP
17195 : see if sched_yield exists
17196 set try -DSCHED_YIELD
17197 if eval $compile; then
17198     val="$define"
17199     sched_yield='sched_yield()'
17200 else
17201     val="$undef"
17202 fi
17203 case "$usethreads" in
17204 $define)
17205         case "$val" in
17206         $define) echo 'sched_yield() found.' >&4        ;;
17207         *)       echo 'sched_yield() NOT found.' >&4    ;;
17208         esac
17209 esac
17210 set d_sched_yield
17211 eval $setvar
17212
17213 : see if pthread_yield exists
17214 set try -DPTHREAD_YIELD
17215 if eval $compile; then
17216     val="$define"
17217     case "$sched_yield" in
17218     '') sched_yield='pthread_yield()' ;;
17219     esac
17220 else
17221     set try -DPTHREAD_YIELD_NULL
17222     if eval $compile; then
17223         val="$define"
17224         case "$sched_yield" in
17225         '') sched_yield='pthread_yield(NULL)' ;;
17226         esac
17227     else
17228         val="$undef"
17229     fi
17230 fi
17231 case "$usethreads" in
17232 $define)
17233         case "$val" in
17234         $define) echo 'pthread_yield() found.' >&4      ;;
17235         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17236         esac
17237         ;;
17238 esac
17239 set d_pthread_yield
17240 eval $setvar
17241 case "$sched_yield" in
17242 '') sched_yield=undef ;;
17243 esac
17244 $rm_try
17245
17246 : check for ptrdiff_t
17247 echo " "
17248 echo "Checking to see if you have ptrdiff_t..." >&4
17249 $cat >try.c <<EOCP
17250 #include <stddef.h>
17251 int main() { ptrdiff_t x = 7; }
17252 EOCP
17253 set try
17254 if eval $compile; then
17255         val="$define"
17256         echo "You have ptrdiff_t."
17257 else
17258         val="$undef"
17259         echo "You do not have ptrdiff_t."
17260 fi
17261 $rm_try
17262 set d_ptrdiff_t
17263 eval $setvar
17264
17265 : see if random_r exists
17266 set random_r d_random_r
17267 eval $inlibc
17268 case "$d_random_r" in
17269 "$define")
17270         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17271         case "$d_random_r_proto:$usethreads" in
17272         ":define")      d_random_r_proto=define
17273                 set d_random_r_proto random_r $hdrs
17274                 eval $hasproto ;;
17275         *)      ;;
17276         esac
17277         case "$d_random_r_proto" in
17278         define)
17279         case "$random_r_proto" in
17280         ''|0) try='int random_r(int*, struct random_data*);'
17281         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17282         esac
17283         case "$random_r_proto" in
17284         ''|0) try='int random_r(long*, struct random_data*);'
17285         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17286         esac
17287         case "$random_r_proto" in
17288         ''|0) try='int random_r(struct random_data*, int32_t*);'
17289         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17290         esac
17291         case "$random_r_proto" in
17292         ''|0)   d_random_r=undef
17293                 random_r_proto=0
17294                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17295         * )     case "$random_r_proto" in
17296                 REENTRANT_PROTO*) ;;
17297                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17298                 esac
17299                 echo "Prototype: $try" ;;
17300         esac
17301         ;;
17302         *)      case "$usethreads" in
17303                 define) echo "random_r has no prototype, not using it." >&4 ;;
17304                 esac
17305                 d_random_r=undef
17306                 random_r_proto=0
17307                 ;;
17308         esac
17309         ;;
17310 *)      random_r_proto=0
17311         ;;
17312 esac
17313
17314 : see if readdir and friends exist
17315 set readdir d_readdir
17316 eval $inlibc
17317 set seekdir d_seekdir
17318 eval $inlibc
17319 set telldir d_telldir
17320 eval $inlibc
17321 set rewinddir d_rewinddir
17322 eval $inlibc
17323
17324 : see if readdir64_r exists
17325 set readdir64_r d_readdir64_r
17326 eval $inlibc
17327 case "$d_readdir64_r" in
17328 "$define")
17329         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17330         case "$d_readdir64_r_proto:$usethreads" in
17331         ":define")      d_readdir64_r_proto=define
17332                 set d_readdir64_r_proto readdir64_r $hdrs
17333                 eval $hasproto ;;
17334         *)      ;;
17335         esac
17336         case "$d_readdir64_r_proto" in
17337         define)
17338         case "$readdir64_r_proto" in
17339         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17340         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17341         esac
17342         case "$readdir64_r_proto" in
17343         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17344         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17345         esac
17346         case "$readdir64_r_proto" in
17347         ''|0)   d_readdir64_r=undef
17348                 readdir64_r_proto=0
17349                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17350         * )     case "$readdir64_r_proto" in
17351                 REENTRANT_PROTO*) ;;
17352                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17353                 esac
17354                 echo "Prototype: $try" ;;
17355         esac
17356         ;;
17357         *)      case "$usethreads" in
17358                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17359                 esac
17360                 d_readdir64_r=undef
17361                 readdir64_r_proto=0
17362                 ;;
17363         esac
17364         ;;
17365 *)      readdir64_r_proto=0
17366         ;;
17367 esac
17368
17369 : see if readdir_r exists
17370 set readdir_r d_readdir_r
17371 eval $inlibc
17372 case "$d_readdir_r" in
17373 "$define")
17374         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17375         case "$d_readdir_r_proto:$usethreads" in
17376         ":define")      d_readdir_r_proto=define
17377                 set d_readdir_r_proto readdir_r $hdrs
17378                 eval $hasproto ;;
17379         *)      ;;
17380         esac
17381         case "$d_readdir_r_proto" in
17382         define)
17383         case "$readdir_r_proto" in
17384         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17385         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17386         esac
17387         case "$readdir_r_proto" in
17388         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17389         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17390         esac
17391         case "$readdir_r_proto" in
17392         ''|0)   d_readdir_r=undef
17393                 readdir_r_proto=0
17394                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17395         * )     case "$readdir_r_proto" in
17396                 REENTRANT_PROTO*) ;;
17397                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17398                 esac
17399                 echo "Prototype: $try" ;;
17400         esac
17401         ;;
17402         *)      case "$usethreads" in
17403                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17404                 esac
17405                 d_readdir_r=undef
17406                 readdir_r_proto=0
17407                 ;;
17408         esac
17409         ;;
17410 *)      readdir_r_proto=0
17411         ;;
17412 esac
17413
17414 : see if readv exists
17415 set readv d_readv
17416 eval $inlibc
17417
17418 : see if recvmsg exists
17419 set recvmsg d_recvmsg
17420 eval $inlibc
17421
17422 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17423 echo " "
17424 if set regcomp val -f d_regcomp; eval $csym; $val; then
17425         echo 'regcomp() found.' >&4
17426         d_regcomp="$define"
17427         d_regcmp="$undef"
17428         d_re_comp="$undef"
17429 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17430         echo 'regcmp() found.' >&4
17431         d_regcmp="$define"
17432         d_regcomp="$undef"
17433         d_re_comp="$undef"
17434 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17435         echo 're_comp() found, assuming re_exec() also exists.' >&4
17436         d_re_comp="$define"
17437         d_regcomp="$undef"
17438         d_regcmp="$undef"
17439 else
17440         $cat >&4 <<EOM
17441 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17442 EOM
17443         d_regcmp="$undef"
17444         d_re_comp="$undef"
17445         d_regcomp="$undef"
17446 fi
17447
17448 : see if remainder exists
17449 set remainder d_remainder
17450 eval $inlibc
17451
17452 : see if remquo exists
17453 set remquo d_remquo
17454 eval $inlibc
17455
17456 : see if rename exists
17457 set rename d_rename
17458 eval $inlibc
17459
17460 : see if rint exists
17461 set rint d_rint
17462 eval $inlibc
17463
17464 : see if rmdir exists
17465 set rmdir d_rmdir
17466 eval $inlibc
17467
17468 : see if round exists
17469 set round d_round
17470 eval $inlibc
17471
17472 : see if prototype for sbrk is available
17473 echo " "
17474 set d_sbrkproto sbrk $i_unistd unistd.h
17475 eval $hasproto
17476
17477 : see if scalbn exists
17478 set scalbn d_scalbn
17479 eval $inlibc
17480
17481 : see if select exists
17482 set select d_select
17483 eval $inlibc
17484
17485 : see if semctl exists
17486 set semctl d_semctl
17487 eval $inlibc
17488
17489 : see if semget exists
17490 set semget d_semget
17491 eval $inlibc
17492
17493 : see if semop exists
17494 set semop d_semop
17495 eval $inlibc
17496
17497 : see how much of the 'sem*(2)' library is present.
17498 h_sem=true
17499 echo " "
17500 case "$d_semctl$d_semget$d_semop" in
17501 *"$undef"*) h_sem=false;;
17502 esac
17503 case "$osname" in
17504 freebsd)
17505     case "`ipcs 2>&1`" in
17506     "SVID messages"*"not configured"*)
17507         echo "Your $osname does not have the sem*(2) configured." >&4
17508         h_sem=false
17509         val="$undef"
17510         set semctl d_semctl
17511         eval $setvar
17512         set semget d_semget
17513         eval $setvar
17514         set semop d_semop
17515         eval $setvar
17516         ;;
17517     esac
17518     ;;
17519 esac
17520 : we could also check for sys/ipc.h ...
17521 if $h_sem && $test `./findhdr sys/sem.h`; then
17522         echo "You have the full sem*(2) library." >&4
17523         val="$define"
17524 else
17525         echo "You don't have the full sem*(2) library." >&4
17526         val="$undef"
17527 fi
17528 set d_sem
17529 eval $setvar
17530
17531 : see whether sys/sem.h defines union semun
17532 echo " "
17533 $cat > try.c <<'END'
17534 #include <sys/types.h>
17535 #include <sys/ipc.h>
17536 #include <sys/sem.h>
17537 int main () { union semun semun; semun.buf = 0; }
17538 END
17539 set try
17540 if eval $compile; then
17541     echo "You have union semun in <sys/sem.h>." >&4
17542     val="$define"
17543 else
17544     echo "You do not have union semun in <sys/sem.h>." >&4
17545     val="$undef"
17546 fi
17547 $rm_try
17548 set d_union_semun
17549 eval $setvar
17550
17551 : see how to do semctl IPC_STAT
17552 case "$d_sem" in
17553 $define)
17554     echo " "
17555     $cat > tryh.h <<END
17556 #ifndef S_IRUSR
17557 #   ifdef S_IREAD
17558 #       define S_IRUSR S_IREAD
17559 #       define S_IWUSR S_IWRITE
17560 #       define S_IXUSR S_IEXEC
17561 #   else
17562 #       define S_IRUSR 0400
17563 #       define S_IWUSR 0200
17564 #       define S_IXUSR 0100
17565 #   endif
17566 #   define S_IRGRP (S_IRUSR>>3)
17567 #   define S_IWGRP (S_IWUSR>>3)
17568 #   define S_IXGRP (S_IXUSR>>3)
17569 #   define S_IROTH (S_IRUSR>>6)
17570 #   define S_IWOTH (S_IWUSR>>6)
17571 #   define S_IXOTH (S_IXUSR>>6)
17572 #endif
17573 #ifndef S_IRWXU
17574 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17575 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17576 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17577 #endif
17578 END
17579     : see whether semctl IPC_STAT can use union semun
17580     case "$d_semctl_semun" in
17581     '')
17582       val="$undef"
17583       $cat > try.c <<END
17584 #include <sys/types.h>
17585 #include <sys/ipc.h>
17586 #include <sys/sem.h>
17587 #include <sys/stat.h>
17588 #include <stdio.h>
17589 #include <errno.h>
17590 #include "tryh.h"
17591 #ifndef errno
17592 extern int errno;
17593 #endif
17594 #$d_union_semun HAS_UNION_SEMUN
17595 int main() {
17596     union semun
17597 #ifndef HAS_UNION_SEMUN
17598     {
17599         int val;
17600         struct semid_ds *buf;
17601         unsigned short *array;
17602     }
17603 #endif
17604     arg;
17605     int sem, st;
17606
17607 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17608     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17609     if (sem > -1) {
17610         struct semid_ds argbuf;
17611         arg.buf = &argbuf;
17612 #       ifdef IPC_STAT
17613         st = semctl(sem, 0, IPC_STAT, arg);
17614         if (st == 0)
17615             printf("semun\n");
17616         else
17617 #       endif /* IPC_STAT */
17618             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17619 #       ifdef IPC_RMID
17620         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17621 #       endif /* IPC_RMID */
17622             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17623     } else
17624 #endif /* IPC_PRIVATE && ... */
17625         printf("semget failed: errno = %d\n", errno);
17626   return 0;
17627 }
17628 END
17629       set try
17630       if eval $compile; then
17631           xxx=`$run ./try`
17632           case "$xxx" in
17633           semun) val="$define" ;;
17634           esac
17635       fi
17636       $rm_try
17637       set d_semctl_semun
17638       eval $setvar
17639       ;;
17640     esac
17641     case "$d_semctl_semun" in
17642     $define)
17643         echo "You can use union semun for semctl IPC_STAT." >&4
17644         also='also'
17645         ;;
17646     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17647         also=''
17648         ;;
17649     esac
17650
17651     : see whether semctl IPC_STAT can use struct semid_ds pointer
17652     case "$d_semctl_semid_ds" in
17653     '')
17654       val="$undef"
17655       $cat > try.c <<'END'
17656 #include <sys/types.h>
17657 #include <sys/ipc.h>
17658 #include <sys/sem.h>
17659 #include <sys/stat.h>
17660 #include "tryh.h"
17661 #include <stdio.h>
17662 #include <errno.h>
17663 #ifndef errno
17664 extern int errno;
17665 #endif
17666 int main() {
17667     union semun
17668 #ifndef HAS_UNION_SEMUN
17669     {
17670         int val;
17671         struct semid_ds *buf;
17672         unsigned short *array;
17673     }
17674 #endif
17675     arg;
17676     struct semid_ds argbuf;
17677     int sem, st;
17678
17679 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17680     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17681     if (sem > -1) {
17682         arg.buf = &argbuf;
17683 #       ifdef IPC_STAT
17684         st = semctl(sem, 0, IPC_STAT, arg);
17685         if (st == 0)
17686             printf("semid_ds\n");
17687         else
17688 #       endif /* IPC_STAT */
17689             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17690 #       ifdef IPC_RMID
17691         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17692 #       endif /* IPC_RMID */
17693             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17694     } else
17695 #endif /* IPC_PRIVATE && ... */
17696         printf("semget failed: errno = %d\n", errno);
17697
17698     return 0;
17699 }
17700 END
17701       set try
17702       if eval $compile; then
17703           xxx=`$run ./try`
17704           case "$xxx" in
17705           semid_ds) val="$define" ;;
17706           esac
17707       fi
17708       $rm_try
17709       set d_semctl_semid_ds
17710       eval $setvar
17711       ;;
17712     esac
17713     case "$d_semctl_semid_ds" in
17714     $define)
17715         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17716         ;;
17717     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17718         ;;
17719     esac
17720     ;;
17721 *)  val="$undef"
17722
17723     # We do not have the full sem*(2) library, so assume we can not
17724     # use either.
17725
17726     set d_semctl_semun
17727     eval $setvar
17728
17729     set d_semctl_semid_ds
17730     eval $setvar
17731     ;;
17732 esac
17733 $rm_try tryh.h
17734
17735 : see if sendmsg exists
17736 set sendmsg d_sendmsg
17737 eval $inlibc
17738
17739 : see if setegid exists
17740 set setegid d_setegid
17741 eval $inlibc
17742
17743 : see if seteuid exists
17744 set seteuid d_seteuid
17745 eval $inlibc
17746
17747 : see if setgrent exists
17748 set setgrent d_setgrent
17749 eval $inlibc
17750
17751 : see if setgrent_r exists
17752 set setgrent_r d_setgrent_r
17753 eval $inlibc
17754 case "$d_setgrent_r" in
17755 "$define")
17756         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17757         case "$d_setgrent_r_proto:$usethreads" in
17758         ":define")      d_setgrent_r_proto=define
17759                 set d_setgrent_r_proto setgrent_r $hdrs
17760                 eval $hasproto ;;
17761         *)      ;;
17762         esac
17763         case "$d_setgrent_r_proto" in
17764         define)
17765         case "$setgrent_r_proto" in
17766         ''|0) try='int setgrent_r(FILE**);'
17767         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17768         esac
17769         case "$setgrent_r_proto" in
17770         ''|0) try='void setgrent_r(FILE**);'
17771         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17772         esac
17773         case "$setgrent_r_proto" in
17774         ''|0)   d_setgrent_r=undef
17775                 setgrent_r_proto=0
17776                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17777         * )     case "$setgrent_r_proto" in
17778                 REENTRANT_PROTO*) ;;
17779                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17780                 esac
17781                 echo "Prototype: $try" ;;
17782         esac
17783         ;;
17784         *)      case "$usethreads" in
17785                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17786                 esac
17787                 d_setgrent_r=undef
17788                 setgrent_r_proto=0
17789                 ;;
17790         esac
17791         ;;
17792 *)      setgrent_r_proto=0
17793         ;;
17794 esac
17795
17796 : see if sethostent exists
17797 set sethostent d_sethent
17798 eval $inlibc
17799
17800 : see if sethostent_r exists
17801 set sethostent_r d_sethostent_r
17802 eval $inlibc
17803 case "$d_sethostent_r" in
17804 "$define")
17805         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17806         case "$d_sethostent_r_proto:$usethreads" in
17807         ":define")      d_sethostent_r_proto=define
17808                 set d_sethostent_r_proto sethostent_r $hdrs
17809                 eval $hasproto ;;
17810         *)      ;;
17811         esac
17812         case "$d_sethostent_r_proto" in
17813         define)
17814         case "$sethostent_r_proto" in
17815         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17816         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17817         esac
17818         case "$sethostent_r_proto" in
17819         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17820         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17821         esac
17822         case "$sethostent_r_proto" in
17823         ''|0)   d_sethostent_r=undef
17824                 sethostent_r_proto=0
17825                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17826         * )     case "$sethostent_r_proto" in
17827                 REENTRANT_PROTO*) ;;
17828                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17829                 esac
17830                 echo "Prototype: $try" ;;
17831         esac
17832         ;;
17833         *)      case "$usethreads" in
17834                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17835                 esac
17836                 d_sethostent_r=undef
17837                 sethostent_r_proto=0
17838                 ;;
17839         esac
17840         ;;
17841 *)      sethostent_r_proto=0
17842         ;;
17843 esac
17844
17845 : see if setitimer exists
17846 set setitimer d_setitimer
17847 eval $inlibc
17848
17849 : see if setlinebuf exists
17850 set setlinebuf d_setlinebuf
17851 eval $inlibc
17852
17853 : see if locale.h is available
17854 set locale.h i_locale
17855 eval $inhdr
17856
17857 : see if this system has wctype.h
17858 set wctype.h i_wctype
17859 eval $inhdr
17860
17861 : see if towupper exists
17862 set towupper d_towupper
17863 eval $inlibc
17864
17865 : check for setlocale function and behavior
17866 $cat <<EOM
17867
17868 Checking to see if you have setlocale() and its behavior
17869 EOM
17870 $cat >try.c <<EOCP
17871 #include <stdlib.h>
17872 #include <string.h>
17873 #$i_locale I_LOCALE
17874 #ifdef I_LOCALE
17875 #  include <locale.h>
17876 #endif
17877 #$i_wctype I_WCTYPE
17878 #ifdef I_WCTYPE
17879 #  include <wctype.h>
17880 #endif
17881
17882 int main() {
17883     const char * invalid_name = "\a";   /* This is really invalid! */
17884     int accepts_any_locale_name = 0;
17885     int has_C_UTF8 = 0;
17886     unsigned char bad_setlocale = 255;
17887
17888     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17889      * disabled.  It's hard to imagine an instance where meaningful locale
17890      * handling could be done without LC_CTYPE */
17891     const char *  name = setlocale(LC_CTYPE, "C");
17892
17893     if (name == NULL || strcmp(name, "C") != 0) {
17894         exit(bad_setlocale);
17895     }
17896
17897     name = setlocale(LC_CTYPE, invalid_name);
17898     if (name != NULL) {
17899
17900         /* Let it pass if it accepts the name but gives back one of the C
17901          * locales */
17902         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17903             accepts_any_locale_name = 1;
17904         }
17905     }
17906
17907     name = setlocale(LC_CTYPE, "C.UTF-8");
17908     if (name != NULL) {
17909         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17910
17911 #$d_towupper HAS_TOWUPPER
17912 #ifdef HAS_TOWUPPER
17913
17914         /* We assume that if the machine doesn't have the C99 towupper, it
17915          * doesn't have C.UTF-8, even if we successfully changed locales to
17916          * include it.  This seems safer even on platforms that didn't accept
17917          * the really invalid name */
17918
17919         if (towupper(y_with_diaeresis) == 0x178) {
17920             has_C_UTF8 = 1;
17921         }
17922
17923 #endif
17924
17925     }
17926
17927 #if 0
17928
17929     /* Currently unused code to determine if LC_ALL with disparate values uses
17930      * category = value pairs or positional, and to determine the separator
17931      * between the categories.  We could add code so that if the separator were
17932      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17933      * every possible ASCII separator would fit in the 5 bits available in the
17934      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17935      * positional, we probably would want to know the order of the categories.
17936      * Using a file between the C program and the shell script would really be
17937      * require to do that */
17938 #ifdef LC_ALL
17939
17940     unsigned char min_separator = ' ' - 1;
17941     unsigned char separator = min_separator;
17942     int uses_name_value_pair_names = 0;
17943
17944     name = setlocale(LC_ALL, "C");
17945     if (name == NULL || strcmp(name, "C") != 0) {
17946         exit(bad_setlocale);
17947     }
17948
17949     if (has_C_UTF8) {
17950         char * pos;
17951
17952         name = setlocale(LC_CTYPE, "C.UTF-8");
17953         if (name == NULL) {
17954             exit(bad_setlocale);
17955         }
17956         name = setlocale(LC_ALL, NULL);
17957         if (name == NULL) {
17958             exit(bad_setlocale);
17959         }
17960
17961         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17962         if (pos != NULL) {
17963             uses_name_value_pair_names = 1;
17964             if (pos == name) {
17965                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17966             }
17967             else {
17968                 separator = *(pos - 1);
17969             }
17970         }
17971         else {
17972             pos = strstr(name, "C.UTF-8");
17973             if (pos == NULL) {
17974                 /* bad */
17975             }
17976             else if (pos == name) {
17977                 separator = name[sizeof("C.UTF-8") - 1];
17978             }
17979             else {
17980                 separator = *(pos - 1);
17981             }
17982         }
17983     }
17984
17985 #endif
17986 #endif
17987
17988     exit( 0 /* (separator - min_separator) << 3
17989         | uses_name_value_pair_names      << 2
17990           */
17991         | has_C_UTF8                      << 1
17992         | accepts_any_locale_name);
17993
17994 }
17995 EOCP
17996 set try
17997 if eval $compile; then
17998     echo "Your system has setlocale()..." >&4
17999     $run ./try
18000     case $? in
18001         0) echo "and it seems sane" >&4
18002            d_setlocale="$define"
18003            d_setlocale_accepts_any_locale_name="$undef"
18004            d_has_C_UTF8="false"
18005            ;;
18006         1) echo "and it seems sane, but accepts any locale name as valid" >&4
18007            d_setlocale="$define"
18008            d_setlocale_accepts_any_locale_name="$define"
18009            d_has_C_UTF8="false"
18010            ;;
18011         2) echo "and it seems sane" >&4
18012            d_setlocale="$define"
18013            d_setlocale_accepts_any_locale_name="$undef"
18014            d_has_C_UTF8="true"
18015            ;;
18016         3) echo "and it seems sane, but accepts any locale name as valid" >&4
18017            d_setlocale="$define"
18018            d_setlocale_accepts_any_locale_name="$define"
18019            d_has_C_UTF8="true"
18020            ;;
18021         *) echo "but it doesn't seem to work, so we won't use it." >&4
18022            d_setlocale="$undef"
18023            d_setlocale_accepts_any_locale_name="$undef"
18024            d_has_C_UTF8="false"
18025            ;;
18026     esac
18027 else
18028     echo "your system does not have setlocale()" >&4
18029     d_setlocale="$undef"
18030     d_setlocale_accepts_any_locale_name="$undef"
18031     d_has_C_UTF8="false"
18032 fi
18033 $rm_try
18034
18035 : see if setlocale_r exists
18036 set setlocale_r d_setlocale_r
18037 eval $inlibc
18038 case "$d_setlocale_r" in
18039 "$define")
18040         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18041         case "$d_setlocale_r_proto:$usethreads" in
18042         ":define")      d_setlocale_r_proto=define
18043                 set d_setlocale_r_proto setlocale_r $hdrs
18044                 eval $hasproto ;;
18045         *)      ;;
18046         esac
18047         case "$d_setlocale_r_proto" in
18048         define)
18049         case "$setlocale_r_proto" in
18050         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18051         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18052         esac
18053         case "$setlocale_r_proto" in
18054         ''|0)   d_setlocale_r=undef
18055                 setlocale_r_proto=0
18056                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18057         * )     case "$setlocale_r_proto" in
18058                 REENTRANT_PROTO*) ;;
18059                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18060                 esac
18061                 echo "Prototype: $try" ;;
18062         esac
18063         ;;
18064         *)      case "$usethreads" in
18065                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18066                 esac
18067                 d_setlocale_r=undef
18068                 setlocale_r_proto=0
18069                 ;;
18070         esac
18071         ;;
18072 *)      setlocale_r_proto=0
18073         ;;
18074 esac
18075
18076 : see if setnetent exists
18077 set setnetent d_setnent
18078 eval $inlibc
18079
18080 : see if setnetent_r exists
18081 set setnetent_r d_setnetent_r
18082 eval $inlibc
18083 case "$d_setnetent_r" in
18084 "$define")
18085         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18086         case "$d_setnetent_r_proto:$usethreads" in
18087         ":define")      d_setnetent_r_proto=define
18088                 set d_setnetent_r_proto setnetent_r $hdrs
18089                 eval $hasproto ;;
18090         *)      ;;
18091         esac
18092         case "$d_setnetent_r_proto" in
18093         define)
18094         case "$setnetent_r_proto" in
18095         ''|0) try='int setnetent_r(int, struct netent_data*);'
18096         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18097         esac
18098         case "$setnetent_r_proto" in
18099         ''|0) try='void setnetent_r(int, struct netent_data*);'
18100         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18101         esac
18102         case "$setnetent_r_proto" in
18103         ''|0)   d_setnetent_r=undef
18104                 setnetent_r_proto=0
18105                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18106         * )     case "$setnetent_r_proto" in
18107                 REENTRANT_PROTO*) ;;
18108                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18109                 esac
18110                 echo "Prototype: $try" ;;
18111         esac
18112         ;;
18113         *)      case "$usethreads" in
18114                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18115                 esac
18116                 d_setnetent_r=undef
18117                 setnetent_r_proto=0
18118                 ;;
18119         esac
18120         ;;
18121 *)      setnetent_r_proto=0
18122         ;;
18123 esac
18124
18125 : see if setprotoent exists
18126 set setprotoent d_setpent
18127 eval $inlibc
18128
18129 : see if setpgid exists
18130 set setpgid d_setpgid
18131 eval $inlibc
18132
18133 : see if setpgrp2 exists
18134 set setpgrp2 d_setpgrp2
18135 eval $inlibc
18136
18137 : see if setpriority exists
18138 set setpriority d_setprior
18139 eval $inlibc
18140
18141 : see if setproctitle exists
18142 set setproctitle d_setproctitle
18143 eval $inlibc
18144
18145 : see if setprotoent_r exists
18146 set setprotoent_r d_setprotoent_r
18147 eval $inlibc
18148 case "$d_setprotoent_r" in
18149 "$define")
18150         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18151         case "$d_setprotoent_r_proto:$usethreads" in
18152         ":define")      d_setprotoent_r_proto=define
18153                 set d_setprotoent_r_proto setprotoent_r $hdrs
18154                 eval $hasproto ;;
18155         *)      ;;
18156         esac
18157         case "$d_setprotoent_r_proto" in
18158         define)
18159         case "$setprotoent_r_proto" in
18160         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18161         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18162         esac
18163         case "$setprotoent_r_proto" in
18164         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18165         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18166         esac
18167         case "$setprotoent_r_proto" in
18168         ''|0)   d_setprotoent_r=undef
18169                 setprotoent_r_proto=0
18170                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18171         * )     case "$setprotoent_r_proto" in
18172                 REENTRANT_PROTO*) ;;
18173                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18174                 esac
18175                 echo "Prototype: $try" ;;
18176         esac
18177         ;;
18178         *)      case "$usethreads" in
18179                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18180                 esac
18181                 d_setprotoent_r=undef
18182                 setprotoent_r_proto=0
18183                 ;;
18184         esac
18185         ;;
18186 *)      setprotoent_r_proto=0
18187         ;;
18188 esac
18189
18190 : see if setpwent exists
18191 set setpwent d_setpwent
18192 eval $inlibc
18193
18194 : see if setpwent_r exists
18195 set setpwent_r d_setpwent_r
18196 eval $inlibc
18197 case "$d_setpwent_r" in
18198 "$define")
18199         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18200         case "$d_setpwent_r_proto:$usethreads" in
18201         ":define")      d_setpwent_r_proto=define
18202                 set d_setpwent_r_proto setpwent_r $hdrs
18203                 eval $hasproto ;;
18204         *)      ;;
18205         esac
18206         case "$d_setpwent_r_proto" in
18207         define)
18208         case "$setpwent_r_proto" in
18209         ''|0) try='int setpwent_r(FILE**);'
18210         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18211         esac
18212         case "$setpwent_r_proto" in
18213         ''|0) try='void setpwent_r(FILE**);'
18214         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18215         esac
18216         case "$setpwent_r_proto" in
18217         ''|0)   d_setpwent_r=undef
18218                 setpwent_r_proto=0
18219                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18220         * )     case "$setpwent_r_proto" in
18221                 REENTRANT_PROTO*) ;;
18222                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18223                 esac
18224                 echo "Prototype: $try" ;;
18225         esac
18226         ;;
18227         *)      case "$usethreads" in
18228                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18229                 esac
18230                 d_setpwent_r=undef
18231                 setpwent_r_proto=0
18232                 ;;
18233         esac
18234         ;;
18235 *)      setpwent_r_proto=0
18236         ;;
18237 esac
18238
18239 : see if setregid exists
18240 set setregid d_setregid
18241 eval $inlibc
18242 set setresgid d_setresgid
18243 eval $inlibc
18244
18245 : see if setreuid exists
18246 set setreuid d_setreuid
18247 eval $inlibc
18248 set setresuid d_setresuid
18249 eval $inlibc
18250
18251 : see if setrgid exists
18252 set setrgid d_setrgid
18253 eval $inlibc
18254
18255 : see if setruid exists
18256 set setruid d_setruid
18257 eval $inlibc
18258
18259 : see if setservent exists
18260 set setservent d_setsent
18261 eval $inlibc
18262
18263 : see if setservent_r exists
18264 set setservent_r d_setservent_r
18265 eval $inlibc
18266 case "$d_setservent_r" in
18267 "$define")
18268         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18269         case "$d_setservent_r_proto:$usethreads" in
18270         ":define")      d_setservent_r_proto=define
18271                 set d_setservent_r_proto setservent_r $hdrs
18272                 eval $hasproto ;;
18273         *)      ;;
18274         esac
18275         case "$d_setservent_r_proto" in
18276         define)
18277         case "$setservent_r_proto" in
18278         ''|0) try='int setservent_r(int, struct servent_data*);'
18279         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18280         esac
18281         case "$setservent_r_proto" in
18282         ''|0) try='void setservent_r(int, struct servent_data*);'
18283         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18284         esac
18285         case "$setservent_r_proto" in
18286         ''|0)   d_setservent_r=undef
18287                 setservent_r_proto=0
18288                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18289         * )     case "$setservent_r_proto" in
18290                 REENTRANT_PROTO*) ;;
18291                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18292                 esac
18293                 echo "Prototype: $try" ;;
18294         esac
18295         ;;
18296         *)      case "$usethreads" in
18297                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18298                 esac
18299                 d_setservent_r=undef
18300                 setservent_r_proto=0
18301                 ;;
18302         esac
18303         ;;
18304 *)      setservent_r_proto=0
18305         ;;
18306 esac
18307
18308 : see if setsid exists
18309 set setsid d_setsid
18310 eval $inlibc
18311
18312 : see if setvbuf exists
18313 set setvbuf d_setvbuf
18314 eval $inlibc
18315
18316 : see if shmctl exists
18317 set shmctl d_shmctl
18318 eval $inlibc
18319
18320 : see if shmget exists
18321 set shmget d_shmget
18322 eval $inlibc
18323
18324 : see if shmat exists
18325 set shmat d_shmat
18326 eval $inlibc
18327 : see what shmat returns
18328 case "$d_shmat" in
18329 "$define")
18330         $cat >shmat.c <<'END'
18331 #include <sys/shm.h>
18332 void *shmat();
18333 END
18334         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18335                 shmattype='void *'
18336         else
18337                 shmattype='char *'
18338         fi
18339         echo "and it returns ($shmattype)." >&4
18340         : see if a prototype for shmat is available
18341         xxx=`./findhdr sys/shm.h`
18342         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18343         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18344                 val="$define"
18345         else
18346                 val="$undef"
18347         fi
18348         $rm -f shmat.[co]
18349         ;;
18350 *)
18351         val="$undef"
18352         ;;
18353 esac
18354 set d_shmatprototype
18355 eval $setvar
18356
18357 : see if shmdt exists
18358 set shmdt d_shmdt
18359 eval $inlibc
18360
18361 : see how much of the 'shm*(2)' library is present.
18362 h_shm=true
18363 echo " "
18364 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18365 *"$undef"*) h_shm=false;;
18366 esac
18367 case "$osname" in
18368 freebsd)
18369     case "`ipcs 2>&1`" in
18370     "SVID shared memory"*"not configured"*)
18371         echo "Your $osname does not have the shm*(2) configured." >&4
18372         h_shm=false
18373         val="$undef"
18374         set shmctl d_shmctl
18375         eval $setvar
18376         set shmget d_shmget
18377         eval $setvar
18378         set shmat d_shmat
18379         eval $setvar
18380         set shmdt d_shmdt
18381         eval $setvar
18382         ;;
18383     esac
18384     ;;
18385 esac
18386 : we could also check for sys/ipc.h ...
18387 if $h_shm && $test `./findhdr sys/shm.h`; then
18388         echo "You have the full shm*(2) library." >&4
18389         val="$define"
18390 else
18391         echo "You don't have the full shm*(2) library." >&4
18392         val="$undef"
18393 fi
18394 set d_shm
18395 eval $setvar
18396
18397 : see if we have sigaction
18398 echo " "
18399 if set sigaction val -f d_sigaction; eval $csym; $val; then
18400         echo 'sigaction() found.' >&4
18401         $cat > try.c <<EOP
18402 #include <stdio.h>
18403 #include <sys/types.h>
18404 #include <signal.h>
18405 #$i_stdlib I_STDLIB
18406 #ifdef I_STDLIB
18407 #include <stdlib.h>
18408 #endif
18409 int main()
18410 {
18411     struct sigaction act, oact;
18412     act.sa_flags = 0;
18413     oact.sa_handler = 0;
18414     /* so that act and oact are used */
18415     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18416 }
18417 EOP
18418         set try
18419         if eval $compile_ok; then
18420                 val="$define"
18421         else
18422                 echo "But you don't seem to have a usable struct sigaction." >&4
18423                 val="$undef"
18424         fi
18425 else
18426         echo 'sigaction NOT found.' >&4
18427         val="$undef"
18428 fi
18429 set d_sigaction; eval $setvar
18430 $rm_try
18431
18432 : see what type pids are declared as in the kernel
18433 rp="What is the type of process ids on this system?"
18434 set pid_t pidtype int stdio.h sys/types.h
18435 eval $typedef_ask
18436
18437 : see what type uids are declared as in the kernel
18438 echo " "
18439 echo "Looking for the type for user ids returned by getuid()."
18440 set uid_t uidtype xxx stdio.h sys/types.h
18441 eval $typedef
18442 case "$uidtype" in
18443 xxx)
18444         xxx=`./findhdr sys/user.h`
18445         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18446         case $1 in
18447         unsigned) dflt="$1 $2" ;;
18448         *) dflt="$1" ;;
18449         esac
18450         ;;
18451 *) dflt="$uidtype";;
18452 esac
18453 case "$uidtype" in
18454 uid_t)  echo "uid_t found." ;;
18455 *)      rp="What is the type for user ids returned by getuid()?"
18456         . ./myread
18457         uidtype="$ans"
18458         ;;
18459 esac
18460
18461 : Define hasfield_t macro for Configure internal use
18462 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18463 while $test $# -ge 2; do
18464     case "$1" in
18465         $define) echo "#include <$2>";;
18466     esac ;
18467     shift 2;
18468 done > try.c;
18469 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18470 set try;
18471 if eval $compile; then
18472         val="$define";
18473 else
18474         val="$undef";
18475 fi;
18476 set $varname;
18477 eval $setvar;
18478 $rm_try'
18479
18480 : see what siginfo fields we have
18481 case "$d_sigaction" in
18482 "$define")
18483         echo "Checking if your siginfo_t has si_errno field...">&4
18484         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18485         eval $hasfield_t;
18486
18487         echo "Checking if your siginfo_t has si_pid field...">&4
18488         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18489         eval $hasfield_t;
18490
18491         echo "Checking if your siginfo_t has si_uid field...">&4
18492         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18493         eval $hasfield_t;
18494
18495         echo "Checking if your siginfo_t has si_addr field...">&4
18496         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18497         eval $hasfield_t;
18498
18499         echo "Checking if your siginfo_t has si_status field...">&4
18500         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18501         eval $hasfield_t;
18502
18503         echo "Checking if your siginfo_t has si_band field...">&4
18504         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18505         eval $hasfield_t;
18506
18507         echo "Checking if your siginfo_t has si_value field...">&4
18508         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18509         eval $hasfield_t;
18510
18511         echo "Checking if your siginfo_t has si_fd field...">&4
18512         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18513         eval $hasfield_t;
18514
18515         ;;
18516 *)
18517         d_siginfo_si_errno="$undef"
18518         d_siginfo_si_pid="$undef"
18519         d_siginfo_si_uid="$undef"
18520         d_siginfo_si_addr="$undef"
18521         d_siginfo_si_status="$undef"
18522         d_siginfo_si_band="$undef"
18523         d_siginfo_si_value="$undef"
18524         d_siginfo_si_fd="$undef"
18525         ;;
18526 esac
18527
18528 : see if this is a sunmath.h system
18529 set sunmath.h i_sunmath
18530 eval $inhdr
18531
18532 : see if signbit exists
18533 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18534 $cat >try.c <<EOCP
18535 #$i_sunmath I_SUNMATH
18536 #include <math.h>
18537 #ifdef I_SUNMATH  /* Solaris special math library */
18538 #  include <sunmath.h>
18539 #endif
18540 #define NV $nvtype
18541 int main(int argc, char **argv)
18542 {
18543     NV x = 0.0;
18544     NV y = -1.0;
18545     if ((signbit(x) == 0) && (signbit(y) != 0))
18546         return 0;
18547     else
18548         return 1;
18549 }
18550 EOCP
18551 val="$undef"
18552 set try
18553 if eval $compile; then
18554     if $run ./try; then
18555         $echo "Yes." >&4
18556         val="$define"
18557     else
18558         $echo "Signbit seems to be available, but doesn't work as I expected."
18559         $echo "I won't use it." >&4
18560         val="$undef"
18561     fi
18562 else
18563     $echo "Nope." >&4
18564     dflt="$undef"
18565 fi
18566 set d_signbit
18567 eval $setvar
18568 $rm_try
18569
18570 : see if sigprocmask exists
18571 set sigprocmask d_sigprocmask
18572 eval $inlibc
18573
18574 : see if sigsetjmp exists
18575 echo " "
18576 case "$d_sigsetjmp" in
18577 '')
18578         $cat >try.c <<EOP
18579 #include <setjmp.h>
18580 #$i_stdlib I_STDLIB
18581 #ifdef I_STDLIB
18582 #include <stdlib.h>
18583 #endif
18584 sigjmp_buf env;
18585 int set = 1;
18586 int main()
18587 {
18588         if (sigsetjmp(env,1))
18589                 exit(set);
18590         set = 0;
18591         siglongjmp(env, 1);
18592         exit(1);
18593 }
18594 EOP
18595         set try
18596         if eval $compile; then
18597                 if $run ./try >/dev/null 2>&1; then
18598                         echo "POSIX sigsetjmp found." >&4
18599                         val="$define"
18600                 else
18601                         $cat >&4 <<EOM
18602 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18603 I'll ignore them.
18604 EOM
18605                         val="$undef"
18606                 fi
18607         else
18608                 echo "sigsetjmp not found." >&4
18609                 val="$undef"
18610         fi
18611         ;;
18612 *) val="$d_sigsetjmp"
18613         case "$d_sigsetjmp" in
18614         $define) echo "POSIX sigsetjmp found." >&4;;
18615         $undef) echo "sigsetjmp not found." >&4;;
18616         esac
18617         ;;
18618 esac
18619 set d_sigsetjmp
18620 eval $setvar
18621 $rm_try
18622
18623 : see if snprintf exists
18624 set snprintf d_snprintf
18625 eval $inlibc
18626
18627 : see if vsnprintf exists
18628 set vsnprintf d_vsnprintf
18629 eval $inlibc
18630
18631 case "$d_snprintf-$d_vsnprintf" in
18632 "$define-$define")
18633     $cat <<EOM
18634 Checking whether your snprintf() and vsnprintf() work okay...
18635 EOM
18636     $cat >try.c <<'EOCP'
18637 /* v?snprintf testing logic courtesy of Russ Allbery.
18638  * According to C99:
18639  * - if the buffer is too short it still must be \0-terminated
18640  * - if the buffer is too short the potentially required length
18641  *   must be returned and not -1
18642  * - if the buffer is NULL the potentially required length
18643  *   must be returned and not -1 or core dump
18644  */
18645 #include <stdio.h>
18646 #include <stdarg.h>
18647
18648 char buf[2];
18649
18650 int test (char *format, ...)
18651 {
18652     va_list args;
18653     int count;
18654
18655     va_start (args, format);
18656     count = vsnprintf (buf, sizeof buf, format, args);
18657     va_end (args);
18658     return count;
18659 }
18660
18661 int main ()
18662 {
18663     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18664              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18665 }
18666 EOCP
18667     set try
18668     if eval $compile; then
18669         `$run ./try`
18670         case "$?" in
18671         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18672         *) cat <<EOM >&4
18673 Your snprintf() and snprintf() don't seem to be working okay.
18674 EOM
18675            d_snprintf="$undef"
18676            d_vsnprintf="$undef"
18677            ;;
18678         esac
18679     else
18680         echo "(I can't seem to compile the test program--assuming they don't)"
18681         d_snprintf="$undef"
18682         d_vsnprintf="$undef"
18683     fi
18684     $rm_try
18685     ;;
18686 esac
18687
18688 : see if sockatmark exists
18689 set sockatmark d_sockatmark
18690 eval $inlibc
18691
18692 : see if prototype for sockatmark is available
18693 echo " "
18694 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18695 eval $hasproto
18696
18697 : see if socks5_init exists
18698 set socks5_init d_socks5_init
18699 eval $inlibc
18700
18701 : see if srand48_r exists
18702 set srand48_r d_srand48_r
18703 eval $inlibc
18704 case "$d_srand48_r" in
18705 "$define")
18706         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18707         case "$d_srand48_r_proto:$usethreads" in
18708         ":define")      d_srand48_r_proto=define
18709                 set d_srand48_r_proto srand48_r $hdrs
18710                 eval $hasproto ;;
18711         *)      ;;
18712         esac
18713         case "$d_srand48_r_proto" in
18714         define)
18715         case "$srand48_r_proto" in
18716         ''|0) try='int srand48_r(long, struct drand48_data*);'
18717         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18718         esac
18719         case "$srand48_r_proto" in
18720         ''|0)   d_srand48_r=undef
18721                 srand48_r_proto=0
18722                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18723         * )     case "$srand48_r_proto" in
18724                 REENTRANT_PROTO*) ;;
18725                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18726                 esac
18727                 echo "Prototype: $try" ;;
18728         esac
18729         ;;
18730         *)      case "$usethreads" in
18731                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18732                 esac
18733                 d_srand48_r=undef
18734                 srand48_r_proto=0
18735                 ;;
18736         esac
18737         ;;
18738 *)      srand48_r_proto=0
18739         ;;
18740 esac
18741
18742 : see if srandom_r exists
18743 set srandom_r d_srandom_r
18744 eval $inlibc
18745 case "$d_srandom_r" in
18746 "$define")
18747         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18748         case "$d_srandom_r_proto:$usethreads" in
18749         ":define")      d_srandom_r_proto=define
18750                 set d_srandom_r_proto srandom_r $hdrs
18751                 eval $hasproto ;;
18752         *)      ;;
18753         esac
18754         case "$d_srandom_r_proto" in
18755         define)
18756         case "$srandom_r_proto" in
18757         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18758         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18759         esac
18760         case "$srandom_r_proto" in
18761         ''|0)   d_srandom_r=undef
18762                 srandom_r_proto=0
18763                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18764         * )     case "$srandom_r_proto" in
18765                 REENTRANT_PROTO*) ;;
18766                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18767                 esac
18768                 echo "Prototype: $try" ;;
18769         esac
18770         ;;
18771         *)      case "$usethreads" in
18772                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18773                 esac
18774                 d_srandom_r=undef
18775                 srandom_r_proto=0
18776                 ;;
18777         esac
18778         ;;
18779 *)      srandom_r_proto=0
18780         ;;
18781 esac
18782
18783 : see if prototype for setresgid is available
18784 echo " "
18785 set d_sresgproto setresgid $i_unistd unistd.h
18786 eval $hasproto
18787
18788 : see if prototype for setresuid is available
18789 echo " "
18790 set d_sresuproto setresuid $i_unistd unistd.h
18791 eval $hasproto
18792
18793 : see if stat exists
18794 set stat d_stat
18795 eval $inlibc
18796
18797 : see if sys/stat.h is available
18798 set sys/stat.h i_sysstat
18799 eval $inhdr
18800
18801 : see if stat knows about block sizes
18802 echo " "
18803 echo "Checking to see if your struct stat has st_blocks field..." >&4
18804 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18805 eval $hasfield
18806
18807 : see if this is a sys/vfs.h system
18808 set sys/vfs.h i_sysvfs
18809 eval $inhdr
18810
18811 : see if this is a sys/statfs.h system
18812 set sys/statfs.h i_sysstatfs
18813 eval $inhdr
18814
18815 : Check for statfs_s
18816 echo " "
18817 echo "Checking to see if your system supports struct statfs..." >&4
18818 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
18819 eval $hasstruct
18820 case "$d_statfs_s" in
18821 "$define")      echo "Yes, it does."   ;;
18822 *)              echo "No, it doesn't." ;;
18823 esac
18824
18825 : see if struct statfs knows about f_flags
18826 case "$d_statfs_s" in
18827 define)
18828         echo " "
18829         echo "Checking to see if your struct statfs has f_flags field..." >&4
18830         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
18831         eval $hasfield
18832         ;;
18833 *)      val="$undef"
18834         set d_statfs_f_flags
18835         eval $setvar
18836         ;;
18837 esac
18838 case "$d_statfs_f_flags" in
18839 "$define")      echo "Yes, it does."   ;;
18840 *)              echo "No, it doesn't." ;;
18841 esac
18842
18843 : see what flavor, if any, of static inline is supported
18844 echo " "
18845 echo "Checking to see if your system supports static inline..."
18846 $cat > try.c <<'EOCP'
18847 #include <stdlib.h>
18848 extern int f_via_a(int x);
18849 extern int f_via_b(int x);
18850 int main(int argc, char **argv)
18851 {
18852     int y;
18853
18854     y = f_via_a(0);
18855 #ifdef USE_B
18856     y = f_via_b(0);
18857 #endif
18858     if (y == 42) {
18859         return EXIT_SUCCESS;
18860     }
18861     else {
18862         return EXIT_FAILURE;
18863     }
18864 }
18865 EOCP
18866 $cat > a.c <<'EOCP'
18867 static INLINE int f(int x) {
18868     int y;
18869     y = x + 42;
18870     return y;
18871 }
18872
18873 int f_via_a(int x)
18874 {
18875     return f(x);
18876 }
18877 EOCP
18878 $cat > b.c <<'EOCP'
18879 extern int f(int x);
18880
18881 int f_via_b(int x)
18882 {
18883     return f(x);
18884 }
18885 EOCP
18886
18887 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18888 case "$perl_static_inline" in
18889 '')     # Check the various possibilities, and break out on success.
18890         # For gcc, prefer __inline__, which will still permit
18891         # cflags.SH to add in -ansi.
18892         case "$gccversion" in
18893                 '') xxx="inline __inline__ __inline _inline";;
18894                 *)  xxx="__inline__ inline __inline _inline";;
18895         esac
18896         for inline in $xxx; do
18897                 set try -DINLINE=$inline a.c
18898                 if eval $compile && $run ./try; then
18899                         # Now make sure there is no external linkage of static
18900                         # functions
18901                         set try -DINLINE=$inline -DUSE_B a.c b.c
18902                         if eval $compile && $run ./try; then
18903                                 $echo "Your compiler supports static $inline, " >&4
18904                                 $echo "but it also creates an external definition," >&4
18905                                 $echo "so I won't use it." >&4
18906                                 val=$undef
18907                         else
18908                                 $echo "Your compiler supports static $inline." >&4
18909                                 val=$define
18910                                 perl_static_inline="static $inline";
18911                                 break;
18912                         fi
18913                 else
18914                         $echo "Your compiler does NOT support static $inline." >&4
18915                         val="$undef"
18916                 fi
18917         done
18918         ;;
18919 *inline*) # Some variant of inline exists.
18920         echo "Keeping your $hint value of $perl_static_inline."
18921         val=$define
18922         ;;
18923 static)  # No inline capabilities
18924         echo "Keeping your $hint value of $perl_static_inline."
18925         val=$undef
18926         ;;
18927 *)  # Unrecognized previous value -- blindly trust the supplied
18928         # value and hope it makes sense.  Use old value for
18929         # d_static_inline, if there is one.
18930         echo "Keeping your $hint value of $perl_static_inline."
18931         case "$d_static_inline" in
18932                 '') val=$define ;;
18933                 *)  val=$d_static_inline ;;
18934         esac
18935         ;;
18936 esac
18937 # Fallback to plain 'static' if nothing worked.
18938 case "$perl_static_inline" in
18939 '')
18940         perl_static_inline="static"
18941         val=$undef
18942         ;;
18943 esac
18944 set d_static_inline
18945 eval $setvar
18946 $rm -f a.[co] b.[co]
18947 $rm_try
18948
18949 : Check stream access
18950 $cat >&4 <<EOM
18951 Checking how to access stdio streams by file descriptor number...
18952 EOM
18953 case "$stdio_stream_array" in
18954 '')     $cat >try.c <<EOCP
18955 #include <stdio.h>
18956 int main() {
18957   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18958     printf("yes\n");
18959 }
18960 EOCP
18961         for s in _iob __iob __sF
18962         do
18963                 set try -DSTDIO_STREAM_ARRAY=$s
18964                 if eval $compile; then
18965                         case "`$run ./try`" in
18966                         yes)    stdio_stream_array=$s; break ;;
18967                         esac
18968                 fi
18969         done
18970         $rm_try
18971 esac
18972 case "$stdio_stream_array" in
18973 '')     $cat >&4 <<EOM
18974 I can't figure out how to access stdio streams by file descriptor number.
18975 EOM
18976         d_stdio_stream_array="$undef"
18977         ;;
18978 *)      $cat >&4 <<EOM
18979 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18980 EOM
18981         d_stdio_stream_array="$define"
18982         ;;
18983 esac
18984
18985 : see if strcoll exists
18986 set strcoll d_strcoll
18987 eval $inlibc
18988
18989 : see if strerror_l exists
18990 set strerror_l d_strerror_l
18991 eval $inlibc
18992
18993 : see if strerror_r exists
18994 set strerror_r d_strerror_r
18995 eval $inlibc
18996 case "$d_strerror_r" in
18997 "$define")
18998         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18999         case "$d_strerror_r_proto:$usethreads" in
19000         ":define")      d_strerror_r_proto=define
19001                 set d_strerror_r_proto strerror_r $hdrs
19002                 eval $hasproto ;;
19003         *)      ;;
19004         esac
19005         case "$d_strerror_r_proto" in
19006         define)
19007         case "$strerror_r_proto" in
19008         ''|0) try='int strerror_r(int, char*, size_t);'
19009         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19010         esac
19011         case "$strerror_r_proto" in
19012         ''|0) try='int strerror_r(int, char*, int);'
19013         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19014         esac
19015         case "$strerror_r_proto" in
19016         ''|0) try='char* strerror_r(int, char*, size_t);'
19017         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19018         esac
19019         case "$strerror_r_proto" in
19020         ''|0)   d_strerror_r=undef
19021                 strerror_r_proto=0
19022                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19023         * )     case "$strerror_r_proto" in
19024                 REENTRANT_PROTO*) ;;
19025                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19026                 esac
19027                 echo "Prototype: $try" ;;
19028         esac
19029         ;;
19030         *)      case "$usethreads" in
19031                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19032                 esac
19033                 d_strerror_r=undef
19034                 strerror_r_proto=0
19035                 ;;
19036         esac
19037         ;;
19038 *)      strerror_r_proto=0
19039         ;;
19040 esac
19041
19042 : see if strftime exists
19043 set strftime d_strftime
19044 eval $inlibc
19045
19046 : see if strlcat exists
19047 : We need both a prototype in string.h and the symbol in libc.
19048 echo " "
19049 d_strlcat_proto=''
19050 xx1="#$d_gnulibc HAS_GNULIBC"
19051 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19052 xx3='#   define _GNU_SOURCE'
19053 xx4='#endif'
19054 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19055 eval $hasproto
19056 case "$d_strlcat_proto" in
19057     define) # see if strlcat exists
19058         set strlcat d_strlcat
19059         eval $inlibc
19060         ;;
19061     *)  val=$undef
19062         set d_strlcat
19063         eval $setvar
19064         ;;
19065 esac
19066
19067 : see if strlcpy exists
19068 : We need both a prototype in string.h and the symbol in libc.
19069 echo " "
19070 d_strlcpy_proto=''
19071 xx1="#$d_gnulibc HAS_GNULIBC"
19072 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19073 xx3='#   define _GNU_SOURCE'
19074 xx4='#endif'
19075 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19076 eval $hasproto
19077 case "$d_strlcpy_proto" in
19078     define) # see if strlcpy exists
19079         set strlcpy d_strlcpy
19080         eval $inlibc
19081         ;;
19082     *)  val=$undef
19083         set d_strlcpy
19084         eval $setvar
19085         ;;
19086 esac
19087
19088 : see if strnlen exists
19089 set strnlen d_strnlen
19090 eval $inlibc
19091
19092 : see if strtod exists
19093 set strtod d_strtod
19094 eval $inlibc
19095
19096 : see if strtod_l exists
19097 set strtod_l d_strtod_l
19098 eval $inlibc
19099
19100 : see if strtol exists
19101 set strtol d_strtol
19102 eval $inlibc
19103
19104 : see if strtold exists
19105 set strtold d_strtold
19106 eval $inlibc
19107
19108 : see if strtold_l exists
19109 set strtold_l d_strtold_l
19110 eval $inlibc
19111
19112 : see if strtoll exists
19113 set strtoll d_strtoll
19114 eval $inlibc
19115
19116 case "$d_longlong-$d_strtoll" in
19117 "$define-$define")
19118         $cat <<EOM
19119 Checking whether your strtoll() works okay...
19120 EOM
19121         $cat >try.c <<'EOCP'
19122 #include <errno.h>
19123 #ifdef __hpux
19124 #define strtoll __strtoll
19125 #endif
19126 #ifdef __EMX__
19127 #define strtoll _strtoll
19128 #endif
19129 #include <stdio.h>
19130 #include <stdlib.h>
19131 static int bad = 0;
19132 void check(const char *s, long long ell, int een) {
19133         long long gll;
19134         errno = 0;
19135         gll = strtoll(s, 0, 10);
19136         if (!((gll == ell) && (errno == een)))
19137                 bad++;
19138 }
19139 int main() {
19140         check(" 1",                                      1LL, 0);
19141         check(" 0",                                      0LL, 0);
19142         check("-1",                                     -1LL, 0);
19143         check("-9223372036854775808", -9223372036854775808LL, 0);
19144         check("-9223372036854775808", -9223372036854775808LL, 0);
19145         check(" 9223372036854775807",  9223372036854775807LL, 0);
19146         check("-9223372036854775808", -9223372036854775808LL, 0);
19147         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19148         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19149         if (!bad)
19150                 printf("ok\n");
19151 }
19152 EOCP
19153         set try
19154         if eval $compile; then
19155                 yyy=`$run ./try`
19156                 case "$yyy" in
19157                 ok) echo "Your strtoll() seems to be working okay." ;;
19158                 *) cat <<EOM >&4
19159 Your strtoll() doesn't seem to be working okay.
19160 EOM
19161                    d_strtoll="$undef"
19162                    ;;
19163                 esac
19164         else
19165                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19166                 d_strtoll="$undef"
19167         fi
19168         ;;
19169 esac
19170
19171 : see if strtoq exists
19172 set strtoq d_strtoq
19173 eval $inlibc
19174
19175 : see if strtoul exists
19176 set strtoul d_strtoul
19177 eval $inlibc
19178
19179 case "$d_strtoul" in
19180 "$define")
19181         $cat <<EOM
19182 Checking whether your strtoul() works okay...
19183 EOM
19184         $cat >try.c <<'EOCP'
19185 #include <stdlib.h>
19186 #include <errno.h>
19187 #include <stdio.h>
19188 static int bad = 0;
19189 void check(const char *s, unsigned long eul, int een) {
19190         unsigned long gul;
19191         errno = 0;
19192         gul = strtoul(s, 0, 10);
19193         if (!((gul == eul) && (errno == een)))
19194                 bad++;
19195 }
19196 int main() {
19197         check(" 1", 1L, 0);
19198         check(" 0", 0L, 0);
19199 EOCP
19200         case "$longsize" in
19201         8)
19202             $cat >>try.c <<'EOCP'
19203         check("18446744073709551615", 18446744073709551615UL, 0);
19204         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19205 #if 0 /* strtoul() for /^-/ strings is undefined. */
19206         check("-1", 18446744073709551615UL, 0);
19207         check("-18446744073709551614", 2, 0);
19208         check("-18446744073709551615", 1, 0);
19209         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19210         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19211 #endif
19212 EOCP
19213                 ;;
19214         4)
19215                     $cat >>try.c <<'EOCP'
19216         check("4294967295", 4294967295UL, 0);
19217         check("4294967296", 4294967295UL, ERANGE);
19218 #if 0 /* strtoul() for /^-/ strings is undefined. */
19219         check("-1", 4294967295UL, 0);
19220         check("-4294967294", 2, 0);
19221         check("-4294967295", 1, 0);
19222         check("-4294967296", 4294967295UL, ERANGE);
19223         check("-4294967297", 4294967295UL, ERANGE);
19224 #endif
19225 EOCP
19226                 ;;
19227         *)
19228 : Should we write these tests to be more portable by sprintf-ing
19229 : ~0 and then manipulating that char string as input for strtol?
19230                 ;;
19231         esac
19232         $cat >>try.c <<'EOCP'
19233         if (!bad)
19234                 printf("ok\n");
19235         return 0;
19236 }
19237 EOCP
19238         set try
19239         if eval $compile; then
19240                 case "`$run ./try`" in
19241                 ok) echo "Your strtoul() seems to be working okay." ;;
19242                 *) cat <<EOM >&4
19243 Your strtoul() doesn't seem to be working okay.
19244 EOM
19245                    d_strtoul="$undef"
19246                    ;;
19247                 esac
19248         else
19249                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19250                 d_strtoul="$undef"
19251         fi
19252         ;;
19253 esac
19254
19255 : see if strtoull exists
19256 set strtoull d_strtoull
19257 eval $inlibc
19258
19259 case "$d_longlong-$d_strtoull" in
19260 "$define-$define")
19261         $cat <<EOM
19262 Checking whether your strtoull() works okay...
19263 EOM
19264         $cat >try.c <<'EOCP'
19265 #include <stdlib.h>
19266 #include <errno.h>
19267 #ifdef __hpux
19268 #define strtoull __strtoull
19269 #endif
19270 #include <stdio.h>
19271 static int bad = 0;
19272 void check(const char *s, long long eull, int een) {
19273         long long gull;
19274         errno = 0;
19275         gull = strtoull(s, 0, 10);
19276         if (!((gull == eull) && (errno == een)))
19277                 bad++;
19278 }
19279 int main() {
19280         check(" 1",                                        1LL, 0);
19281         check(" 0",                                        0LL, 0);
19282         check("18446744073709551615",  18446744073709551615ULL, 0);
19283         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19284 #if 0 /* strtoull() for /^-/ strings is undefined. */
19285         check("-1",                    18446744073709551615ULL, 0);
19286         check("-18446744073709551614",                     2LL, 0);
19287         check("-18446744073709551615",                     1LL, 0);
19288         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19289         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19290 #endif
19291         if (!bad)
19292                 printf("ok\n");
19293 }
19294 EOCP
19295         set try
19296         if eval $compile; then
19297                 case "`$run ./try`" in
19298                 ok) echo "Your strtoull() seems to be working okay." ;;
19299                 *) cat <<EOM >&4
19300 Your strtoull() doesn't seem to be working okay.
19301 EOM
19302                    d_strtoull="$undef"
19303                    ;;
19304                 esac
19305         else
19306                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19307                 d_strtoull="$undef"
19308         fi
19309         ;;
19310 esac
19311
19312 : see if strtouq exists
19313 set strtouq d_strtouq
19314 eval $inlibc
19315
19316 case "$d_strtouq" in
19317 "$define")
19318         $cat <<EOM
19319 Checking whether your strtouq() works okay...
19320 EOM
19321         $cat >try.c <<'EOCP'
19322 #include <stdlib.h>
19323 #include <errno.h>
19324 #include <stdio.h>
19325 static int bad = 0;
19326 void check(const char *s, unsigned long long eull, int een) {
19327         unsigned long long gull;
19328         errno = 0;
19329         gull = strtouq(s, 0, 10);
19330         if (!((gull == eull) && (errno == een)))
19331                 bad++;
19332 }
19333 int main() {
19334         check(" 1",                                        1LL, 0);
19335         check(" 0",                                        0LL, 0);
19336         check("18446744073709551615",  18446744073709551615ULL, 0);
19337         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19338 #if 0 /* strtouq() for /^-/ strings is undefined. */
19339         check("-1",                    18446744073709551615ULL, 0);
19340         check("-18446744073709551614",                     2LL, 0);
19341         check("-18446744073709551615",                     1LL, 0);
19342         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19343         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19344 #endif
19345         if (!bad)
19346                 printf("ok\n");
19347         return 0;
19348 }
19349 EOCP
19350         set try
19351         if eval $compile; then
19352                 case "`$run ./try`" in
19353                 ok) echo "Your strtouq() seems to be working okay." ;;
19354                 *) cat <<EOM >&4
19355 Your strtouq() doesn't seem to be working okay.
19356 EOM
19357                    d_strtouq="$undef"
19358                    ;;
19359                 esac
19360         else
19361                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19362                 d_strtouq="$undef"
19363         fi
19364         ;;
19365 esac
19366
19367 : see if strxfrm exists
19368 set strxfrm d_strxfrm
19369 eval $inlibc
19370
19371 : see if symlink exists
19372 set symlink d_symlink
19373 eval $inlibc
19374
19375 : see if syscall exists
19376 set syscall d_syscall
19377 eval $inlibc
19378
19379 : see if prototype for syscall is available
19380 echo " "
19381 set d_syscallproto syscall $i_unistd unistd.h
19382 eval $hasproto
19383
19384 : see if sysconf exists
19385 set sysconf d_sysconf
19386 eval $inlibc
19387
19388 : see if sys_errlist[] exists
19389 echo " "
19390 if test "X$d_syserrlst" = X; then
19391         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19392                 echo "You have sys_errlist[], so we could roll our own strerror."
19393                 d_syserrlst="$define"
19394         else
19395                 echo "You don't have sys_errlist[], so strerror() is welcome."
19396                 d_syserrlst="$undef"
19397         fi
19398 fi
19399
19400 : see if system exists
19401 set system d_system
19402 eval $inlibc
19403
19404 : see if tcgetpgrp exists
19405 set tcgetpgrp d_tcgetpgrp
19406 eval $inlibc
19407
19408 : see if tcsetpgrp exists
19409 set tcsetpgrp d_tcsetpgrp
19410 eval $inlibc
19411
19412 : see if prototype for telldir is available
19413 echo " "
19414 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19415 eval $hasproto
19416
19417 : see if tgamma exists
19418 set tgamma d_tgamma
19419 eval $inlibc
19420
19421 : check for thread_safe_nl_langinfo_l item
19422 $cat <<EOM
19423
19424 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19425 EOM
19426 $cat >try.c <<EOCP
19427 #$i_stdlib I_STDLIB
19428 #ifdef I_STDLIB
19429 #  include <stdlib.h>
19430 #endif
19431 #include <string.h>
19432 #$i_langinfo I_LANGINFO
19433 #ifdef I_LANGINFO
19434 #  include <langinfo.h>
19435 #endif
19436 #$i_pthread I_PTHREAD
19437 #ifdef I_PTHREAD
19438 #  include <pthread.h>
19439 #endif
19440 #$i_locale I_LOCALE
19441 #ifdef I_LOCALE
19442 #  include <locale.h>
19443 #endif
19444
19445 void *
19446 thread_start(void * arg)
19447 {
19448     nl_langinfo(RADIXCHAR);
19449 }
19450
19451 int main() {
19452     char * main_buffer;
19453     char save_main_buffer[1000];
19454     pthread_t subthread;
19455     pthread_attr_t attr;
19456
19457     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19458
19459     /* If too large for our generous allowance, just assume we don't have
19460      * it. */
19461     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19462         exit(1);
19463     }
19464
19465     strcpy(save_main_buffer, main_buffer);
19466
19467     if (pthread_attr_init(&attr) != 0) {
19468         exit(1);
19469     }
19470
19471     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19472         exit(1);
19473     }
19474
19475     if (pthread_join(subthread, NULL) != 0) {
19476         exit(1);
19477     }
19478
19479     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19480 }
19481 EOCP
19482 case "$usethreads" in
19483     define)
19484         set try
19485         if eval $compile; then
19486             echo "Your system has nl_langinfo_l()..." >&4
19487             if $run ./try; then
19488                 echo "and it is thread-safe (just as I'd hoped)." >&4
19489                 d_thread_safe_nl_langinfo_l="$define"
19490                 echo "$d_thread_safe_nl_langinfo_l" >&4
19491             else
19492                 echo "but it isn't thread-safe, so we won't use it." >&4
19493             fi
19494         else
19495             echo "your system does not have nl_langinfo_l()" >&4
19496         fi
19497         ;;
19498     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19499 esac
19500 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19501         d_thread_safe_nl_langinfo_l="$undef"
19502 fi
19503 $rm_try
19504
19505 : see if time exists
19506 echo " "
19507 if test "X$d_time" = X -o X"$timetype" = X; then
19508     if set time val -f d_time; eval $csym; $val; then
19509                 echo 'time() found.' >&4
19510                 val="$define"
19511                 rp="What is the type returned by time() on this system?"
19512                 set time_t timetype long stdio.h sys/types.h
19513                 eval $typedef_ask
19514     else
19515                 echo 'time() not found, hope that will do.' >&4
19516                 val="$undef"
19517                 timetype='int';
19518     fi
19519     set d_time
19520     eval $setvar
19521 fi
19522
19523 : see if timegm exists
19524 set timegm d_timegm
19525 eval $inlibc
19526
19527 : see if this is a sys/times.h system
19528 set sys/times.h i_systimes
19529 eval $inhdr
19530
19531 : see if times exists
19532 echo " "
19533 if set times val -f d_times; eval $csym; $val; then
19534         echo 'times() found.' >&4
19535         d_times="$define"
19536         inc=''
19537         case "$i_systimes" in
19538         "$define") inc='sys/times.h';;
19539         esac
19540         rp="What is the type returned by times() on this system?"
19541         set clock_t clocktype long stdio.h sys/types.h $inc
19542         eval $typedef_ask
19543 else
19544         echo 'times() NOT found, hope that will do.' >&4
19545         d_times="$undef"
19546         clocktype='int'
19547 fi
19548
19549 : see if tmpnam_r exists
19550 set tmpnam_r d_tmpnam_r
19551 eval $inlibc
19552 case "$d_tmpnam_r" in
19553 "$define")
19554         hdrs="$i_systypes sys/types.h define stdio.h "
19555         case "$d_tmpnam_r_proto:$usethreads" in
19556         ":define")      d_tmpnam_r_proto=define
19557                 set d_tmpnam_r_proto tmpnam_r $hdrs
19558                 eval $hasproto ;;
19559         *)      ;;
19560         esac
19561         case "$d_tmpnam_r_proto" in
19562         define)
19563         case "$tmpnam_r_proto" in
19564         ''|0) try='char* tmpnam_r(char*);'
19565         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19566         esac
19567         case "$tmpnam_r_proto" in
19568         ''|0)   d_tmpnam_r=undef
19569                 tmpnam_r_proto=0
19570                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19571         * )     case "$tmpnam_r_proto" in
19572                 REENTRANT_PROTO*) ;;
19573                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19574                 esac
19575                 echo "Prototype: $try" ;;
19576         esac
19577         ;;
19578         *)      case "$usethreads" in
19579                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19580                 esac
19581                 d_tmpnam_r=undef
19582                 tmpnam_r_proto=0
19583                 ;;
19584         esac
19585         ;;
19586 *)      tmpnam_r_proto=0
19587         ;;
19588 esac
19589
19590 : see if towlower exists
19591 set towlower d_towlower
19592 eval $inlibc
19593
19594 : see if trunc exists
19595 set trunc d_trunc
19596 eval $inlibc
19597
19598 : see if truncate exists
19599 set truncate d_truncate
19600 eval $inlibc
19601
19602 : see if ttyname_r exists
19603 set ttyname_r d_ttyname_r
19604 eval $inlibc
19605 case "$d_ttyname_r" in
19606 "$define")
19607         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19608         case "$d_ttyname_r_proto:$usethreads" in
19609         ":define")      d_ttyname_r_proto=define
19610                 set d_ttyname_r_proto ttyname_r $hdrs
19611                 eval $hasproto ;;
19612         *)      ;;
19613         esac
19614         case "$d_ttyname_r_proto" in
19615         define)
19616         case "$ttyname_r_proto" in
19617         ''|0) try='int ttyname_r(int, char*, size_t);'
19618         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19619         esac
19620         case "$ttyname_r_proto" in
19621         ''|0) try='int ttyname_r(int, char*, int);'
19622         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19623         esac
19624         case "$ttyname_r_proto" in
19625         ''|0) try='char* ttyname_r(int, char*, int);'
19626         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19627         esac
19628         case "$ttyname_r_proto" in
19629         ''|0)   d_ttyname_r=undef
19630                 ttyname_r_proto=0
19631                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19632         * )     case "$ttyname_r_proto" in
19633                 REENTRANT_PROTO*) ;;
19634                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19635                 esac
19636                 echo "Prototype: $try" ;;
19637         esac
19638         ;;
19639         *)      case "$usethreads" in
19640                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19641                 esac
19642                 d_ttyname_r=undef
19643                 ttyname_r_proto=0
19644                 ;;
19645         esac
19646         ;;
19647 *)      ttyname_r_proto=0
19648         ;;
19649 esac
19650
19651 : see if tzname[] exists
19652 echo " "
19653 if set tzname val -a d_tzname; eval $csym; $val; then
19654         val="$define"
19655         echo 'tzname[] found.' >&4
19656 else
19657         val="$undef"
19658         echo 'tzname[] NOT found.' >&4
19659 fi
19660 set d_tzname
19661 eval $setvar
19662
19663 : Check if is a multiplatform env
19664 case "$osname" in
19665 darwin) multiarch="$define" ;;
19666 esac
19667 case "$multiarch" in
19668 ''|[nN]*) multiarch="$undef" ;;
19669 esac
19670
19671 : check for ordering of bytes in a UV
19672 echo " "
19673 case "$multiarch" in
19674 *$define*)
19675         $cat <<EOM
19676 You seem to be doing a multiarchitecture build,
19677 skipping the byteorder check.
19678
19679 EOM
19680         byteorder='ffff'
19681         ;;
19682 *)
19683         case "$byteorder" in
19684         '')
19685                 $cat <<'EOM'
19686 In the following, larger digits indicate more significance.  A big-endian
19687 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19688 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19689 machines may have weird orders like 3412.  A Cray will report 87654321,
19690 an Alpha will report 12345678. If the test program works the default is
19691 probably right.
19692 I'm now running the test program...
19693 EOM
19694                 $cat >try.c <<EOCP
19695 #include <stdio.h>
19696 #$i_stdlib I_STDLIB
19697 #ifdef I_STDLIB
19698 #include <stdlib.h>
19699 #endif
19700 #include <sys/types.h>
19701 typedef $uvtype UV;
19702 int main()
19703 {
19704         int i;
19705         union {
19706                 UV l;
19707                 char c[$uvsize];
19708         } u;
19709
19710         if ($uvsize > 4)
19711                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19712         else
19713                 u.l = (UV)0x04030201;
19714         for (i = 0; i < $uvsize; i++)
19715                 printf("%c", u.c[i]+'0');
19716         printf("\n");
19717         exit(0);
19718 }
19719 EOCP
19720                 xxx_prompt=y
19721                 set try
19722                 if eval $compile && $run ./try > /dev/null; then
19723                         dflt=`$run ./try`
19724                         case "$dflt" in
19725                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19726                                 echo "(The test program ran ok.)"
19727                                 echo "byteorder=$dflt"
19728                                 xxx_prompt=n
19729                         ;;
19730                         ????|????????) echo "(The test program ran ok.)" ;;
19731                         *) echo "(The test program didn't run right for some reason.)" ;;
19732                         esac
19733                 else
19734                         dflt='4321'
19735                         cat <<'EOM'
19736 (I can't seem to compile the test program.  Guessing big-endian...)
19737 EOM
19738                 fi
19739                 case "$xxx_prompt" in
19740                 y)
19741                         rp="What is the order of bytes in $uvtype?"
19742                         . ./myread
19743                         byteorder="$ans"
19744                         ;;
19745                 *)      byteorder=$dflt
19746                         ;;
19747                 esac
19748                 ;;
19749         esac
19750         $rm_try
19751         ;;
19752 esac
19753
19754 : Checking 32bit alignedness
19755 $cat <<EOM
19756
19757 Checking to see whether you can access character data unalignedly...
19758 EOM
19759 case "$d_u32align" in
19760 '')   $cat >try.c <<EOCP
19761 #include <stdio.h>
19762 #$i_stdlib I_STDLIB
19763 #ifdef I_STDLIB
19764 #include <stdlib.h>
19765 #endif
19766 #define U32 $u32type
19767 #define BYTEORDER 0x$byteorder
19768 #define U8 $u8type
19769 #include <signal.h>
19770 #ifdef SIGBUS
19771 $signal_t bletch(int s) { exit(4); }
19772 #endif
19773 int main() {
19774 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19775     volatile U8 buf[8];
19776     volatile U32 *up;
19777     int i;
19778
19779     if (sizeof(U32) != 4) {
19780         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19781         exit(1);
19782     }
19783
19784     fflush(stdout);
19785
19786 #ifdef SIGBUS
19787     signal(SIGBUS, bletch);
19788 #endif
19789
19790     buf[0] = 0;
19791     buf[1] = 0;
19792     buf[2] = 0;
19793     buf[3] = 1;
19794     buf[4] = 0;
19795     buf[5] = 0;
19796     buf[6] = 0;
19797     buf[7] = 1;
19798
19799     for (i = 0; i < 4; i++) {
19800         up = (U32*)(buf + i);
19801         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19802                (*up == 1 << (8*(3-i)))  /* little-endian */
19803               )
19804            )
19805         {
19806             printf("read failed (%x)\n", *up);
19807             exit(2);
19808         }
19809     }
19810
19811     /* write test */
19812     for (i = 0; i < 4; i++) {
19813         up = (U32*)(buf + i);
19814         *up = 0xBeef;
19815         if (*up != 0xBeef) {
19816             printf("write failed (%x)\n", *up);
19817             exit(3);
19818         }
19819     }
19820
19821     exit(0);
19822 #else
19823     printf("1\n");
19824     exit(1);
19825 #endif
19826     return 0;
19827 }
19828 EOCP
19829 set try
19830 if eval $compile_ok; then
19831         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19832         $run ./try 2>&1 >/dev/null
19833         case "$?" in
19834         0)      cat >&4 <<EOM
19835 You can access character data pretty unalignedly.
19836 EOM
19837                 d_u32align="$undef"
19838                 ;;
19839         *)      cat >&4 <<EOM
19840 It seems that you must access character data in an aligned manner.
19841 EOM
19842                 d_u32align="$define"
19843                 ;;
19844         esac
19845 else
19846         rp='Can you access character data at unaligned addresses?'
19847         dflt='n'
19848         . ./myread
19849         case "$ans" in
19850         [yY]*)  d_u32align="$undef"  ;;
19851         *)      d_u32align="$define" ;;
19852         esac
19853 fi
19854 $rm_try
19855 ;;
19856 esac
19857
19858 : see if ualarm exists
19859 set ualarm d_ualarm
19860 eval $inlibc
19861
19862 : see if umask exists
19863 set umask d_umask
19864 eval $inlibc
19865
19866 : see if unordered exists
19867 set unordered d_unordered
19868 eval $inlibc
19869
19870 : see if unsetenv exists
19871 set unsetenv d_unsetenv
19872 eval $inlibc
19873
19874 : see if usleep exists
19875 set usleep d_usleep
19876 eval $inlibc
19877
19878 : see if prototype for usleep is available
19879 echo " "
19880 set d_usleepproto usleep $i_unistd unistd.h
19881 eval $hasproto
19882
19883 : see if ustat exists
19884 set ustat d_ustat
19885 eval $inlibc
19886
19887 : see if closedir exists
19888 set closedir d_closedir
19889 eval $inlibc
19890
19891 case "$d_closedir" in
19892 "$define")
19893         echo " "
19894         echo "Checking whether closedir() returns a status..." >&4
19895         cat > try.c <<EOM
19896 #$i_dirent I_DIRENT             /**/
19897 #$i_sysdir I_SYS_DIR            /**/
19898 #$i_sysndir I_SYS_NDIR          /**/
19899 #$i_systypes I_SYS_TYPES        /**/
19900
19901 #if defined(I_SYS_TYPES)
19902 #include <sys/types.h>
19903 #endif
19904 #if defined(I_DIRENT)
19905 #include <dirent.h>
19906 #else
19907 #ifdef I_SYS_NDIR
19908 #include <sys/ndir.h>
19909 #else
19910 #ifdef I_SYS_DIR
19911 #include <sys/dir.h>
19912 #endif
19913 #endif
19914 #endif
19915 int main() { return closedir(opendir(".")); }
19916 EOM
19917         set try
19918         if eval $compile_ok; then
19919                 if $run ./try > /dev/null 2>&1 ; then
19920                         echo "Yes, it does."
19921                         val="$undef"
19922                 else
19923                         echo "No, it doesn't."
19924                         val="$define"
19925                 fi
19926         else
19927                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19928                 val="$define"
19929         fi
19930         ;;
19931 *)
19932         val="$undef";
19933         ;;
19934 esac
19935 set d_void_closedir
19936 eval $setvar
19937 $rm_try
19938
19939 : see if there is a wait4
19940 set wait4 d_wait4
19941 eval $inlibc
19942
19943 : see if waitpid exists
19944 set waitpid d_waitpid
19945 eval $inlibc
19946
19947 : see if wcrtomb exists
19948 set wcrtomb d_wcrtomb
19949 eval $inlibc
19950
19951 : look for wcscmp
19952 echo " "
19953 $cat >try.c <<'EOCP'
19954 #include <stdio.h>
19955 #include <wchar.h>
19956 int main ()
19957 {
19958     wchar_t *s = L" ";
19959     return (wcscmp (s, s) ? 1 : 0);
19960     }
19961 EOCP
19962 set try
19963 val="$undef"
19964 if eval $compile; then
19965     `$run ./try`
19966     case "$?" in
19967         0)  echo "A working wcscmp() found." >&4
19968             val="$define" ;;
19969         *)  echo "wcscmp() found, but it doesn't work" >&4
19970             ;;
19971         esac
19972 else
19973     echo "wcscmp() NOT found." >&4
19974     fi
19975 set d_wcscmp
19976 eval $setvar
19977 $rm_try
19978
19979 : see if wcstombs exists
19980 set wcstombs d_wcstombs
19981 eval $inlibc
19982
19983 : look for wcsxfrm
19984 echo " "
19985 $cat >try.c <<'EOCP'
19986 #include <errno.h>
19987 #include <wchar.h>
19988 int main ()
19989 {
19990     wchar_t dst[4], *src = L" ";
19991     errno = 0;
19992     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19993     }
19994 EOCP
19995 set try
19996 val="$undef"
19997 if eval $compile; then
19998     `$run ./try`
19999     case "$?" in
20000         0)  echo "A working wcsxfrm() found." >&4
20001             val="$define" ;;
20002         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20003             ;;
20004         esac
20005 else
20006     echo "wcsxfrm() NOT found." >&4
20007     fi
20008 set d_wcsxfrm
20009 eval $setvar
20010 $rm_try
20011
20012 : see if wctomb exists
20013 set wctomb d_wctomb
20014 eval $inlibc
20015
20016 : see if writev exists
20017 set writev d_writev
20018 eval $inlibc
20019
20020 : check for alignment requirements
20021 echo " "
20022 case "$alignbytes" in
20023     '') echo "Checking alignment constraints..." >&4
20024         $cat >try.c <<EOCP
20025 #include <stdio.h>
20026 struct foobar {
20027     char foo;
20028     $nvtype bar;
20029 } try_algn;
20030 int main()
20031 {
20032     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20033     return(0);
20034 }
20035 EOCP
20036         set try
20037         if eval $compile_ok; then
20038             dflt=`$run ./try`
20039         else
20040             dflt='8'
20041             echo "(I can't seem to compile the test program...)"
20042         fi
20043         case "$multiarch" in
20044             *$define*)
20045                 : The usual safe value is 8, but Darwin with -Duselongdouble
20046                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20047                 : Configure to pick a larger value if needed.
20048                 if $test "$dflt" -lt 8; then
20049                     dflt='8'
20050                     echo "Setting alignment to 8 for multiarch support.">&4
20051                 fi
20052                 ;;
20053         esac
20054         ;;
20055     *) dflt="$alignbytes"
20056         ;;
20057 esac
20058 rp="Doubles must be aligned on a how-many-byte boundary?"
20059 . ./myread
20060 alignbytes="$ans"
20061 $rm_try
20062
20063 : set the base revision
20064 baserev=5.0
20065
20066 : length of character in bytes. Is always 1, otherwise it is not C
20067 : This used to be a test using sizeof
20068 charsize=1
20069
20070 : Check for the number of bits in a character
20071 case "$charbits" in
20072 '')     echo "Checking how long a character is (in bits)..." >&4
20073         $cat >try.c <<EOCP
20074 #include <stdio.h>
20075 int main ()
20076 {
20077     int n;
20078     unsigned char c;
20079     for (c = 1, n = 0; c; c <<= 1, n++) ;
20080     printf ("%d\n", n);
20081     return (0);
20082     }
20083 EOCP
20084         set try
20085         if eval $compile_ok; then
20086                 dflt=`$run ./try`
20087         else
20088                 dflt='8'
20089                 echo "(I can't seem to compile the test program.  Guessing...)"
20090         fi
20091         ;;
20092 *)
20093         dflt="$charbits"
20094         ;;
20095 esac
20096 rp="What is the length of a character (in bits)?"
20097 . ./myread
20098 charbits="$ans"
20099 $rm_try
20100 case "$charbits" in
20101 8)      ;;
20102 *)      cat >&4 << EOM
20103 Your system has an unsigned character size of $charbits bits, which
20104 is rather unusual (normally it is 8 bits).  Perl likely will not work
20105 correctly on your system, with subtle bugs in various places.
20106 EOM
20107         rp='Do you really want to continue?'
20108         dflt='n'
20109         . ./myread
20110         case "$ans" in
20111                 [yY])   echo >&4 "Okay, continuing."    ;;
20112                 *)      exit 1                          ;;
20113         esac
20114 esac
20115
20116 : how do we concatenate cpp tokens here?
20117 echo " "
20118 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20119 $cat >cpp_stuff.c <<'EOCP'
20120 #define RCAT(a,b)a/**/b
20121 #define ACAT(a,b)a ## b
20122 RCAT(Rei,ser)
20123 ACAT(Cir,cus)
20124 EOCP
20125 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20126 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20127         echo "Oh!  Smells like ANSI's been here." >&4
20128         echo "We can catify or stringify, separately or together!"
20129         cpp_stuff=42
20130 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20131         echo "Ah, yes!  The good old days!" >&4
20132         echo "However, in the good old days we don't know how to stringify and"
20133         echo "catify at the same time."
20134         cpp_stuff=1
20135 else
20136         $cat >&4 <<EOM
20137 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20138 You're going to have to edit the values of CAT[2-5] in config.h...
20139 EOM
20140         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20141 fi
20142 $rm -f cpp_stuff.*
20143
20144 : see if this is a db.h system
20145 set db.h i_db
20146 eval $inhdr
20147
20148 case "$i_db" in
20149 $define)
20150         : Check db version.
20151         echo " "
20152         echo "Checking Berkeley DB version ..." >&4
20153         $cat >try.c <<EOCP
20154 #include <sys/types.h>
20155 #include <stdio.h>
20156 #$i_stdlib I_STDLIB
20157 #ifdef I_STDLIB
20158 #include <stdlib.h>
20159 #endif
20160 #include <db.h>
20161 int main(int argc, char *argv[])
20162 {
20163 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20164     int Major, Minor, Patch ;
20165     unsigned long Version ;
20166     (void)db_version(&Major, &Minor, &Patch) ;
20167     if (argc == 2) {
20168         printf("%d %d %d %d %d %d\n",
20169                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20170                Major, Minor, Patch);
20171         exit(0);
20172     }
20173     printf("You have Berkeley DB Version 2 or greater.\n");
20174
20175     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20176                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20177     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20178                 Major, Minor, Patch) ;
20179
20180     /* check that db.h & libdb are compatible */
20181     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20182         printf("db.h and libdb are incompatible.\n") ;
20183         exit(3);
20184     }
20185
20186     printf("db.h and libdb are compatible.\n") ;
20187
20188     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20189                 + DB_VERSION_PATCH ;
20190
20191     /* needs to be >= 2.3.4 */
20192     if (Version < 2003004) {
20193     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20194         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20195         exit(2);
20196     }
20197
20198     exit(0);
20199 #else
20200 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20201     if (argc == 2) {
20202         printf("1 0 0\n");
20203         exit(0);
20204     }
20205     printf("You have Berkeley DB Version 1.\n");
20206     exit(0);    /* DB version < 2: the coast is clear. */
20207 #else
20208     exit(1);    /* <db.h> not Berkeley DB? */
20209 #endif
20210 #endif
20211 }
20212 EOCP
20213         set try
20214         if eval $compile_ok && $run ./try; then
20215                 echo 'Looks OK.' >&4
20216                 set `$run ./try 1`
20217                 db_version_major=$1
20218                 db_version_minor=$2
20219                 db_version_patch=$3
20220         else
20221                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20222                 i_db=$undef
20223                 case " $libs " in
20224                 *"-ldb "*)
20225                         : Remove db from list of libraries to use
20226                         echo "Removing unusable -ldb from library list" >&4
20227                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20228                         shift
20229                         libs="$*"
20230                         echo "libs = $libs" >&4
20231                         ;;
20232                 esac
20233         fi
20234         $rm_try
20235         ;;
20236 esac
20237
20238 case "$i_db" in
20239 define)
20240         : Check the return type needed for hash
20241         echo " "
20242         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20243         $cat >try.c <<EOCP
20244 #include <sys/types.h>
20245 #include <db.h>
20246
20247 #ifndef DB_VERSION_MAJOR
20248 u_int32_t hash_cb (const void* ptr, size_t size)
20249 {
20250         return 0;
20251 }
20252 HASHINFO info;
20253 int main()
20254 {
20255         info.hash = hash_cb;
20256 }
20257 #endif
20258 EOCP
20259         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20260                 if $contains warning try.out >>/dev/null 2>&1 ; then
20261                         db_hashtype='int'
20262                 else
20263                         db_hashtype='u_int32_t'
20264                 fi
20265         else
20266                 : XXX Maybe we should just give up here.
20267                 db_hashtype=u_int32_t
20268                 $cat try.out >&4
20269                 echo "Help:  I can't seem to compile the db test program." >&4
20270                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20271         fi
20272         $rm_try
20273         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20274         ;;
20275 *)      db_hashtype=u_int32_t
20276         ;;
20277 esac
20278 case "$i_db" in
20279 define)
20280         : Check the return type needed for prefix
20281         echo " "
20282         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20283         cat >try.c <<EOCP
20284 #include <sys/types.h>
20285 #include <db.h>
20286
20287 #ifndef DB_VERSION_MAJOR
20288 size_t prefix_cb (const DBT *key1, const DBT *key2)
20289 {
20290         return 0;
20291 }
20292 BTREEINFO info;
20293 int main()
20294 {
20295         info.prefix = prefix_cb;
20296 }
20297 #endif
20298 EOCP
20299         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20300                 if $contains warning try.out >>/dev/null 2>&1 ; then
20301                         db_prefixtype='int'
20302                 else
20303                         db_prefixtype='size_t'
20304                 fi
20305         else
20306                 db_prefixtype='size_t'
20307                 : XXX Maybe we should just give up here.
20308                 $cat try.out >&4
20309                 echo "Help:  I can't seem to compile the db test program." >&4
20310                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20311         fi
20312         $rm_try
20313         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20314         ;;
20315 *)      db_prefixtype='size_t'
20316         ;;
20317 esac
20318
20319 : Include . in @INC
20320 $cat <<EOM
20321
20322 Historically Perl has provided a final fallback of the current working
20323 directory '.' when searching for a library. This, however, can lead to
20324 problems when a Perl program which loads optional modules is called from
20325 a shared directory. This can lead to executing unexpected code.
20326
20327 EOM
20328
20329 # When changing to exclude by default:
20330 case "$default_inc_excludes_dot" in
20331     $undef|false|[nN]*) dflt="n" ;;
20332     *)                  dflt="y" ;;
20333 esac
20334 # To turn exclude off by default:
20335 #case "$default_inc_excludes_dot" in
20336 #    $define|true|[yY]*) dflt="y" ;;
20337 #    *)                  dflt="n" ;;
20338 #esac
20339
20340 rp='Exclude '.' from @INC by default? '
20341 . ./myread
20342 case "$ans" in
20343     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20344     *)          default_inc_excludes_dot="$define" ;;
20345 esac
20346
20347 : Check what kind of inf/nan your system has
20348 $echo "Checking the kind of infinities and nans you have..." >&4
20349 $echo "(The following tests may crash.  That's okay.)" >&4
20350 $cat >try.c <<EOP
20351 #define DOUBLESIZE $doublesize
20352 #$d_longdbl HAS_LONG_DOUBLE
20353 #ifdef HAS_LONG_DOUBLE
20354 #define LONG_DOUBLESIZE $longdblsize
20355 #define LONG_DOUBLEKIND $longdblkind
20356 #endif
20357 #include <math.h>
20358 #include <string.h>
20359 #include <stdio.h>
20360 /* Note that whether the sign bit is on or off
20361  * for NaN depends on the CPU/FPU, and possibly
20362  * can be affected by the build toolchain.
20363  *
20364  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20365  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20366  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20367  * (respectively) as opposed to the more usual
20368  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20369  *
20370  * Pre-IEEE-754 floating point format do not even have inf/nan support
20371  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20372  * to even mention, causing immediate SIGFPE or equivalent: this is
20373  * the case with VAX floating point, for example.
20374  */
20375 static void bytes(void *v, unsigned int n) {
20376   unsigned char *p = (unsigned char *)v;
20377   int i;
20378   for (i = 0; i < n; i++) {
20379     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20380   }
20381 }
20382 int main(int argc, char *argv[]) {
20383    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20384     * because some compilers are 'smart' and not only warn but refuse to
20385     * compile such 'illegal' values. */
20386    double dinf = exp(1e9);
20387    double dnan = sqrt(-1.0);
20388 #ifdef HAS_LONG_DOUBLE
20389    long double ldinf = (long double)exp(1e9);
20390    long double ldnan = (long double)sqrt(-1.0);
20391 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20392 /* the 80-bit long doubles might have garbage in their excess bytes */
20393     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20394     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20395 # endif
20396   if (argc == 2) {
20397     switch (argv[1][0]) {
20398     case '1': bytes(&dinf, sizeof(dinf)); break;
20399     case '2': bytes(&dnan, sizeof(dnan)); break;
20400     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20401     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20402 #endif
20403     }
20404   }
20405   return 0;
20406 }
20407 EOP
20408 set try
20409 if eval $compile; then
20410     doubleinfbytes=`$run ./try 1`
20411     doublenanbytes=`$run ./try 2`
20412     case "$d_longdbl" in
20413     $define)
20414       longdblinfbytes=`$run ./try 3`
20415       longdblnanbytes=`$run ./try 4`
20416       ;;
20417     esac
20418 else
20419     # Defaults in case the above test program failed.
20420     case "$doublekind" in
20421     1) # IEEE 754 32-bit LE
20422        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20423        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20424        ;;
20425     2) # IEEE 754 32-bit BE
20426        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20427        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20428        ;;
20429     3) # IEEE 754 64-bit LE
20430        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20431        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20432        ;;
20433     4) # IEEE 754 64-bit BE
20434        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20435        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20436        ;;
20437     5) # IEEE 754 128-bit LE
20438        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20439        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20440        ;;
20441     6) # IEEE 754 128-bit BE
20442        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20443        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20444        ;;
20445     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20446        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20447        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20448        ;;
20449     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20450        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20451        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20452        ;;
20453     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20454        doubleinfbytes=$undef
20455        doublenanbytes=$undef
20456        ;;
20457     *) # No idea.
20458        doubleinfbytes=$undef
20459        doublenanbytes=$undef
20460        ;;
20461     esac
20462     case "$longdblkind" in
20463     1) # IEEE 754 128-bit LE
20464        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20465        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20466        ;;
20467     2) # IEEE 754 128-bit BE
20468        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20469        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20470        ;;
20471     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20472        case "$longdblsize" in
20473        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20474            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20475            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20476            ;;
20477        16) # x86_64
20478            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20479            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20480            ;;
20481        *)  # No idea.
20482            longdblinfbytes=$undef
20483            longdblnanbytes=$undef
20484        ;;
20485        esac
20486        ;;
20487     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20488        case "$longdblsize" in
20489        12) # 32-bit system
20490            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20491            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20492            ;;
20493        16) # 64-bit system
20494            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20495            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20496            ;;
20497        *)  # No idea.
20498            longdblinfbytes=$undef
20499            longdblnanbytes=$undef
20500        ;;
20501        esac
20502        ;;
20503     5) # 128-bit LE-LE "double double"
20504        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20505        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20506        ;;
20507     6) # 128-bit BE-BE "double double"
20508        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20509        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20510        ;;
20511     7) # 128-bit LE-BE "double double"
20512        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20513        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20514        ;;
20515     8) # 128-bit BE-LE "double double"
20516        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20517        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20518        ;;
20519     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20520        longdblinfbytes=$undef
20521        longdblnanbytes=$undef
20522        ;;
20523     *) # No idea.
20524        longdblinfbytes=$undef
20525        longdblnanbytes=$undef
20526        ;;
20527     esac
20528 fi
20529 # In case the program crashed the values are empty, turn them undef.
20530 case "$doubleinfbytes" in
20531 '') doubleinfbytes=$undef ;;
20532 esac
20533 case "$doublenanbytes" in
20534 '') doublenanbytes=$undef ;;
20535 esac
20536 case "$longdblinfbytes" in
20537 '') longdblinfbytes=$undef ;;
20538 esac
20539 case "$longdblnanbytes" in
20540 '') longdblnanbytes=$undef ;;
20541 esac
20542 $rm_try
20543
20544 : Check the length of the double mantissa
20545 $echo "Checking how many mantissa bits your doubles have..." >&4
20546 $cat >try.c <<EOP
20547 #$i_sunmath I_SUNMATH
20548 #include <float.h>
20549 #ifdef I_SUNMATH
20550 # include <sunmath.h>
20551 #endif
20552 #ifdef DBL_MANT_DIG
20553 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20554 #endif
20555 #include <stdio.h>
20556 int main(int argc, char *argv[]) {
20557 #ifdef BITS
20558   printf("%d\n", BITS);
20559 #endif
20560   return 0;
20561 }
20562 EOP
20563 set try
20564 if eval $compile; then
20565     doublemantbits=`$run ./try`
20566 else
20567     doublemantbits="$undef"
20568 fi
20569 $rm_try
20570
20571 : Check the length of the longdouble mantissa
20572 $echo "Checking how many mantissa bits your long doubles have..." >&4
20573 $cat >try.c <<EOP
20574 #$i_sunmath I_SUNMATH
20575 #include <float.h>
20576 #ifdef I_SUNMATH
20577 # include <sunmath.h>
20578 #endif
20579 #$d_longdbl HAS_LONG_DOUBLE
20580 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20581 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20582 /* This format has no implicit bit.  Beware, however, that for
20583  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20584  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20585  * and the top bit must have been one since 387, zero is plain invalid.
20586  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20587 #  define BITS LDBL_MANT_DIG
20588 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20589 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20590  * reason e.g. Irix thinks 107.  But in any case, we want only
20591  * the number of real bits, the implicit bits are of no interest.  */
20592 #  define BITS 2 * (DBL_MANT_DIG - 1)
20593 # else
20594 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20595 # endif
20596 #endif
20597 #include <stdio.h>
20598 int main(int argc, char *argv[]) {
20599 #ifdef BITS
20600   printf("%d\n", BITS);
20601 #endif
20602   return 0;
20603 }
20604 EOP
20605 set try
20606 if eval $compile; then
20607     longdblmantbits=`$run ./try`
20608 else
20609     longdblmantbits="$undef"
20610 fi
20611 $rm_try
20612
20613 : Check the length of the NV mantissa
20614 $echo "Checking how many mantissa bits your NVs have..." >&4
20615 if test "X$usequadmath" = "X$define"; then
20616   nvmantbits=112 # 128-1-15
20617 else
20618   if test "X$nvsize" = "X$doublesize"; then
20619     nvmantbits="$doublemantbits"
20620   else
20621      if test "X$nvsize" = "X$longdblsize"; then
20622        nvmantbits="$longdblmantbits"
20623      else
20624        nvmantbits="$undef"
20625      fi
20626   fi
20627 fi
20628
20629 : How can we generate normalized random numbers ?
20630 echo " "
20631 echo "Using our internal random number implementation..." >&4
20632
20633 case "$ccflags" in
20634 *-Dmy_rand=*|*-Dmy_srand=*)
20635         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20636         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20637         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20638         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20639         ;;
20640 esac
20641
20642 randfunc=Perl_drand48
20643 drand01="Perl_drand48()"
20644 seedfunc="Perl_drand48_init"
20645 randbits=48
20646 randseedtype=U32
20647
20648 : Probe whether dtrace builds an object, as newer Illumos requires an input
20649 : object file that uses at least one of the probes defined in the .d file
20650 case "$usedtrace" in
20651 $define)
20652     case "$dtracexnolibs" in
20653     $define|true|[yY]*)
20654         dtracexnolibs=$define
20655         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20656         ;;
20657     ' '|'')
20658         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20659              dtracexnolibs=$define
20660              echo "Your dtrace accepts -xnolibs"
20661         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20662              dtracexnolibs=$undef
20663              echo "Your dtrace doesn't accept -xnolibs"
20664         else
20665              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20666              exit 1
20667         fi
20668         ;;
20669     *)
20670         dtracexnolibs=$undef
20671         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20672         ;;
20673     esac
20674     case $dtracexnolibs in
20675     $define) xnolibs=-xnolibs ;;
20676     *) xnolibs= ;;
20677     esac
20678
20679     case "$dtraceobject" in
20680     $define|true|[yY]*)
20681         dtraceobject=$define
20682         ;;
20683     ' '|'')
20684         $cat >try.c <<EOM
20685 #include "perldtrace.h"
20686 int main(void) {
20687     PERL_LOADED_FILE("dummy");
20688     return 0;
20689 }
20690 EOM
20691         dtraceobject=$undef
20692         if $cc -c -o try.o $optimize $ccflags try.c \
20693                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20694                 dtraceobject=$define
20695             echo "Your dtrace builds an object file"
20696         fi
20697         ;;
20698     *) dtraceobject=$undef ;;
20699     esac
20700     $rm_try perldtrace.o perldtrace.h
20701 esac
20702
20703 : Determine if this is an EBCDIC system
20704 echo " "
20705 echo "Determining whether or not we are on an EBCDIC system..." >&4
20706 $cat >try.c <<'EOM'
20707 int main()
20708 {
20709   if ('M'==0xd4) return 0;
20710   return 1;
20711 }
20712 EOM
20713
20714 val=$undef
20715 set try
20716 if eval $compile_ok; then
20717         if $run ./try; then
20718                 echo "You seem to speak EBCDIC." >&4
20719                 val="$define"
20720         else
20721                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20722         fi
20723 else
20724         echo "I'm unable to compile the test program." >&4
20725         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20726 fi
20727 $rm_try
20728 set ebcdic
20729 eval $setvar
20730
20731 : Check how to flush
20732 echo " "
20733 $cat >&4 <<EOM
20734 Checking how to flush all pending stdio output...
20735 EOM
20736 # I only know how to find the first 32 possibly open files on SunOS.
20737 # See also hints/sunos_4_1.sh and util.c  --AD
20738 case "$osname" in
20739 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20740 esac
20741 $cat >>try.c <<EOCP
20742 #include <stdio.h>
20743 #$i_stdlib I_STDLIB
20744 #ifdef I_STDLIB
20745 #include <stdlib.h>
20746 #endif
20747 #$i_unistd I_UNISTD
20748 #ifdef I_UNISTD
20749 # include <unistd.h>
20750 #endif
20751 #$d_sysconf HAS_SYSCONF
20752 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20753 #ifdef HAS_STDIO_STREAM_ARRAY
20754 # define STDIO_STREAM_ARRAY $stdio_stream_array
20755 #endif
20756 int main() {
20757   FILE* p;
20758   unlink("try.out");
20759   p = fopen("try.out", "w");
20760 #ifdef TRY_FPUTC
20761   fputc('x', p);
20762 #else
20763 # ifdef TRY_FPRINTF
20764   fprintf(p, "x");
20765 # endif
20766 #endif
20767 #ifdef TRY_FFLUSH_NULL
20768   fflush(NULL);
20769 #endif
20770 #ifdef TRY_FFLUSH_ALL
20771   {
20772     long open_max = -1;
20773 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20774     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20775 # else
20776 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20777     open_max = sysconf(_SC_OPEN_MAX);
20778 #  else
20779 #   ifdef FOPEN_MAX
20780     open_max = FOPEN_MAX;
20781 #   else
20782 #    ifdef OPEN_MAX
20783     open_max = OPEN_MAX;
20784 #    else
20785 #     ifdef _NFILE
20786     open_max = _NFILE;
20787 #     endif
20788 #    endif
20789 #   endif
20790 #  endif
20791 # endif
20792 # ifdef HAS_STDIO_STREAM_ARRAY
20793     if (open_max > 0) {
20794       long i;
20795       for (i = 0; i < open_max; i++)
20796             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20797                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20798                 STDIO_STREAM_ARRAY[i]._flag)
20799                 fflush(&STDIO_STREAM_ARRAY[i]);
20800     }
20801   }
20802 # endif
20803 #endif
20804   _exit(42);
20805 }
20806 EOCP
20807 : first we have to find out how _not_ to flush
20808 $to try.c
20809 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20810     output=''
20811     set try -DTRY_FPUTC
20812     if eval $compile; then
20813             $run ./try 2>/dev/null
20814             code="$?"
20815             $from try.out
20816             if $test ! -s try.out -a "X$code" = X42; then
20817                 output=-DTRY_FPUTC
20818             fi
20819     fi
20820     case "$output" in
20821     '')
20822             set try -DTRY_FPRINTF
20823             if eval $compile; then
20824                     $run ./try 2>/dev/null
20825                     code="$?"
20826                     $from try.out
20827                     if $test ! -s try.out -a "X$code" = X42; then
20828                         output=-DTRY_FPRINTF
20829                     fi
20830             fi
20831         ;;
20832     esac
20833 fi
20834 : check for fflush NULL behavior
20835 case "$fflushNULL" in
20836 '')     set try -DTRY_FFLUSH_NULL $output
20837         if eval $compile; then
20838                 $run ./try 2>/dev/null
20839                 code="$?"
20840                 $from try.out
20841                 if $test -s try.out -a "X$code" = X42; then
20842                         fflushNULL="`$cat try.out`"
20843                 else
20844                         if $test "X$code" != X42; then
20845                                 $cat >&4 <<EOM
20846 (If this test failed, don't worry, we'll try another method shortly.)
20847 EOM
20848                         fi
20849                 fi
20850         fi
20851         $rm -f core try.core core.try.*
20852         case "$fflushNULL" in
20853         x)      $cat >&4 <<EOM
20854 Your fflush(NULL) works okay for output streams.
20855 Let's see if it clobbers input pipes...
20856 EOM
20857 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20858 # bug that improperly flushes the input end of pipes.  So we avoid the
20859 # autoflush on fork/system/exec support for now. :-(
20860 $cat >tryp.c <<EOCP
20861 #include <stdio.h>
20862 int
20863 main(int argc, char **argv)
20864 {
20865     char buf[1024];
20866     int i;
20867     char *bp = buf;
20868     while (1) {
20869         while ((i = getc(stdin)) != -1
20870                && (*bp++ = i) != '\n'
20871                && bp < &buf[1024])
20872         /* DO NOTHING */ ;
20873         *bp = '\0';
20874         fprintf(stdout, "%s", buf);
20875         fflush(NULL);
20876         if (i == -1)
20877             return 0;
20878         bp = buf;
20879     }
20880 }
20881 EOCP
20882                 fflushNULL="$define"
20883                 set tryp
20884                 if eval $compile; then
20885                     $rm -f tryp.out
20886                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20887                     if $test "X$targethost" != X; then
20888                         $to tryp.c
20889                         $to tryp
20890                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20891                     else
20892                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20893                     fi
20894                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20895                        $cat >&4 <<EOM
20896 fflush(NULL) seems to behave okay with input streams.
20897 EOM
20898                         fflushNULL="$define"
20899                     else
20900                         $cat >&4 <<EOM
20901 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20902 EOM
20903                         fflushNULL="$undef"
20904                     fi
20905                 fi
20906                 $rm -f core tryp.c tryp.core core.tryp.*
20907                 ;;
20908         '')     $cat >&4 <<EOM
20909 Your fflush(NULL) isn't working (contrary to ANSI C).
20910 EOM
20911                 fflushNULL="$undef"
20912                 ;;
20913         *)      $cat >&4 <<EOM
20914 Cannot figure out whether your fflush(NULL) works or not.
20915 I'm assuming it doesn't (contrary to ANSI C).
20916 EOM
20917                 fflushNULL="$undef"
20918                 ;;
20919         esac
20920         ;;
20921 $define|true|[yY]*)
20922         fflushNULL="$define"
20923         ;;
20924 *)
20925         fflushNULL="$undef"
20926         ;;
20927 esac
20928 : check explicit looping only if NULL did not work, and if the pipe
20929 : bug does not show up on an explicit flush too
20930 case "$fflushNULL" in
20931 "$undef")
20932         $cat >tryp.c <<EOCP
20933 #include <stdio.h>
20934 int
20935 main(int argc, char **argv)
20936 {
20937     char buf[1024];
20938     int i;
20939     char *bp = buf;
20940     while (1) {
20941         while ((i = getc(stdin)) != -1
20942                && (*bp++ = i) != '\n'
20943                && bp < &buf[1024])
20944         /* DO NOTHING */ ;
20945         *bp = '\0';
20946         fprintf(stdout, "%s", buf);
20947         fflush(stdin);
20948         if (i == -1)
20949             return 0;
20950         bp = buf;
20951     }
20952 }
20953 EOCP
20954         set tryp
20955         if eval $compile; then
20956             $rm -f tryp.out
20957             if $test "X$targethost" != X; then
20958                 $to tryp.c
20959                 $to tryp
20960                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20961             else
20962                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20963             fi
20964             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20965                $cat >&4 <<EOM
20966 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20967 EOM
20968                 : now check for fflushall behaviour
20969                 case "$fflushall" in
20970                 '')     set try -DTRY_FFLUSH_ALL $output
20971                         if eval $compile; then
20972                                 $cat >&4 <<EOM
20973 (Now testing the other method--but note that this also may fail.)
20974 EOM
20975                                 $run ./try 2>/dev/null
20976                                 code=$?
20977                                 $from try.out
20978                                 if $test -s try.out -a "X$code" = X42; then
20979                                         fflushall="`$cat try.out`"
20980                                 fi
20981                         fi
20982                         $rm_try
20983                         case "$fflushall" in
20984                         x)      $cat >&4 <<EOM
20985 Whew. Flushing explicitly all the stdio streams works.
20986 EOM
20987                                 fflushall="$define"
20988                                 ;;
20989                         '')     $cat >&4 <<EOM
20990 Sigh. Flushing explicitly all the stdio streams doesn't work.
20991 EOM
20992                                 fflushall="$undef"
20993                                 ;;
20994                         *)      $cat >&4 <<EOM
20995 Cannot figure out whether flushing stdio streams explicitly works or not.
20996 I'm assuming it doesn't.
20997 EOM
20998                                 fflushall="$undef"
20999                                 ;;
21000                         esac
21001                         ;;
21002                 "$define"|true|[yY]*)
21003                         fflushall="$define"
21004                         ;;
21005                 *)
21006                         fflushall="$undef"
21007                         ;;
21008                 esac
21009             else
21010                 $cat >&4 <<EOM
21011 All is futile.  Even fflush(stdin) clobbers input pipes!
21012 EOM
21013                 fflushall="$undef"
21014             fi
21015         else
21016             fflushall="$undef"
21017         fi
21018         $rm -f core tryp.c tryp.core core.tryp.*
21019         ;;
21020 *)      fflushall="$undef"
21021         ;;
21022 esac
21023
21024 case "$fflushNULL$fflushall" in
21025 undefundef)
21026         $cat <<EOM
21027 OK, I give up.  I cannot figure out how to flush pending stdio output.
21028 We won't be flushing handles at all before fork/exec/popen.
21029 EOM
21030         ;;
21031 esac
21032 $rm_try tryp
21033
21034 : Store the full pathname to the ar program for use in the C program
21035 : Respect a hint or command line value for full_ar.
21036 case "$full_ar" in
21037 '') full_ar=$ar ;;
21038 esac
21039
21040 : Store the full pathname to the sed program for use in the C program
21041 full_sed=$sed
21042
21043 : see what type gids are declared as in the kernel
21044 echo " "
21045 echo "Looking for the type for group ids returned by getgid()."
21046 set gid_t gidtype xxx stdio.h sys/types.h
21047 eval $typedef
21048 case "$gidtype" in
21049 xxx)
21050         xxx=`./findhdr sys/user.h`
21051         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21052         case $1 in
21053         unsigned) dflt="$1 $2" ;;
21054         *) dflt="$1" ;;
21055         esac
21056         ;;
21057 *) dflt="$gidtype";;
21058 esac
21059 case "$gidtype" in
21060 gid_t) echo "gid_t found." ;;
21061 *)      rp="What is the type for group ids returned by getgid()?"
21062         . ./myread
21063         gidtype="$ans"
21064         ;;
21065 esac
21066
21067 : Check the size of GID
21068 echo " "
21069 case "$gidtype" in
21070 *_t) zzz="$gidtype"     ;;
21071 *)   zzz="gid"          ;;
21072 esac
21073 echo "Checking the size of $zzz..." >&4
21074 cat > try.c <<EOCP
21075 #include <sys/types.h>
21076 #include <stdio.h>
21077 #$i_stdlib I_STDLIB
21078 #ifdef I_STDLIB
21079 #include <stdlib.h>
21080 #endif
21081 int main() {
21082     printf("%d\n", (int)sizeof($gidtype));
21083     exit(0);
21084 }
21085 EOCP
21086 set try
21087 if eval $compile_ok; then
21088         yyy=`$run ./try`
21089         case "$yyy" in
21090         '')     gidsize=4
21091                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21092                 ;;
21093         *)      gidsize=$yyy
21094                 echo "Your $zzz is $gidsize bytes long."
21095                 ;;
21096         esac
21097 else
21098         gidsize=4
21099         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21100 fi
21101
21102 : Check if GID is signed
21103 echo " "
21104 case "$gidtype" in
21105 *_t) zzz="$gidtype"     ;;
21106 *)   zzz="gid"          ;;
21107 esac
21108 echo "Checking the sign of $zzz..." >&4
21109 cat > try.c <<EOCP
21110 #include <sys/types.h>
21111 #include <stdio.h>
21112 int main() {
21113         $gidtype foo = -1;
21114         if (foo < 0)
21115                 printf("-1\n");
21116         else
21117                 printf("1\n");
21118 }
21119 EOCP
21120 set try
21121 if eval $compile; then
21122         yyy=`$run ./try`
21123         case "$yyy" in
21124         '')     gidsign=1
21125                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21126                 ;;
21127         *)      gidsign=$yyy
21128                 case "$gidsign" in
21129                  1) echo "Your $zzz is unsigned." ;;
21130                 -1) echo "Your $zzz is signed."   ;;
21131                 esac
21132                 ;;
21133         esac
21134 else
21135         gidsign=1
21136         echo "(I can't compile the test program--guessing unsigned.)" >&4
21137 fi
21138
21139 : Check 64bit sizes
21140 echo " "
21141
21142 if $test X"$quadtype" != X; then
21143
21144 echo "Checking how to print 64-bit integers..." >&4
21145
21146 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21147         $cat >try.c <<'EOCP'
21148 #include <sys/types.h>
21149 #include <stdio.h>
21150 int main() {
21151   int q = 12345678901;
21152   printf("%ld\n", q);
21153 }
21154 EOCP
21155         set try
21156         if eval $compile; then
21157                 yyy=`$run ./try`
21158                 case "$yyy" in
21159                 12345678901)
21160                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21161                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21162                         echo "We will use %d."
21163                         ;;
21164                 esac
21165         fi
21166 fi
21167
21168 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21169         $cat >try.c <<'EOCP'
21170 #include <sys/types.h>
21171 #include <stdio.h>
21172 int main() {
21173   long q = 12345678901;
21174   printf("%ld\n", q);
21175 }
21176 EOCP
21177         set try
21178         if eval $compile; then
21179                 yyy=`$run ./try`
21180                 case "$yyy" in
21181                 12345678901)
21182                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21183                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21184                         echo "We will use %ld."
21185                         ;;
21186                 esac
21187         fi
21188 fi
21189
21190 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21191         $cat >try.c <<'EOCP'
21192 #include <sys/types.h>
21193 #include <inttypes.h>
21194 #include <stdio.h>
21195 int main() {
21196   int64_t q = 12345678901;
21197   printf("%" PRId64 "\n", q);
21198 }
21199 EOCP
21200         set try
21201         if eval $compile; then
21202                 yyy=`$run ./try`
21203                 case "$yyy" in
21204                 12345678901)
21205                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21206                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21207                         echo "We will use the C9X style."
21208                         ;;
21209                 esac
21210         fi
21211 fi
21212
21213 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21214         $cat >try.c <<EOCP
21215 #include <sys/types.h>
21216 #include <stdio.h>
21217 int main() {
21218   $quadtype q = 12345678901;
21219   printf("%Ld\n", q);
21220 }
21221 EOCP
21222         set try
21223         if eval $compile; then
21224                 yyy=`$run ./try`
21225                 case "$yyy" in
21226                 12345678901)
21227                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21228                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21229                         echo "We will use %Ld."
21230                         ;;
21231                 esac
21232         fi
21233 fi
21234
21235 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21236         $cat >try.c <<'EOCP'
21237 #include <sys/types.h>
21238 #include <stdio.h>
21239 int main() {
21240   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21241   printf("%lld\n", q);
21242 }
21243 EOCP
21244         set try
21245         if eval $compile; then
21246                 yyy=`$run ./try`
21247                 case "$yyy" in
21248                 12345678901)
21249                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21250                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21251                         echo "We will use the %lld style."
21252                         ;;
21253                 esac
21254         fi
21255 fi
21256
21257 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21258         $cat >try.c <<EOCP
21259 #include <sys/types.h>
21260 #include <stdio.h>
21261 int main() {
21262   $quadtype q = 12345678901;
21263   printf("%qd\n", q);
21264 }
21265 EOCP
21266         set try
21267         if eval $compile; then
21268                 yyy=`$run ./try`
21269                 case "$yyy" in
21270                 12345678901)
21271                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21272                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21273                         echo "We will use %qd."
21274                         ;;
21275                 esac
21276         fi
21277 fi
21278
21279 if $test X"$sPRId64" = X; then
21280         echo "Cannot figure out how to print 64-bit integers." >&4
21281 fi
21282 $rm_try
21283
21284 fi
21285
21286 case "$sPRId64" in
21287 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21288         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21289         ;;
21290 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21291         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21292         ;;
21293 esac
21294
21295 : Check format strings for internal types
21296 echo " "
21297 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21298
21299 if $test X"$ivsize" = X8; then
21300         ivdformat="$sPRId64"
21301         uvuformat="$sPRIu64"
21302         uvoformat="$sPRIo64"
21303         uvxformat="$sPRIx64"
21304         uvXUformat="$sPRIXU64"
21305 else
21306         if $test X"$ivsize" = X"$longsize"; then
21307                 ivdformat='"ld"'
21308                 uvuformat='"lu"'
21309                 uvoformat='"lo"'
21310                 uvxformat='"lx"'
21311                 uvXUformat='"lX"'
21312         else
21313                 if $test X"$ivsize" = X"$intsize"; then
21314                         ivdformat='"d"'
21315                         uvuformat='"u"'
21316                         uvoformat='"o"'
21317                         uvxformat='"x"'
21318                         uvXUformat='"X"'
21319                 else
21320                         : far out
21321                         if $test X"$ivsize" = X"$shortsize"; then
21322                                 ivdformat='"hd"'
21323                                 uvuformat='"hu"'
21324                                 uvoformat='"ho"'
21325                                 uvxformat='"hx"'
21326                                 uvXUformat='"hX"'
21327                         fi
21328                 fi
21329         fi
21330 fi
21331
21332 if $test X"$usequadmath" = X"$define"; then
21333     nveformat='"Qe"'
21334     nvfformat='"Qf"'
21335     nvgformat='"Qg"'
21336     nvEUformat='"QE"'
21337     nvFUformat='"QF"'
21338     nvGUformat='"QG"'
21339 else
21340     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21341         nveformat="$sPRIeldbl"
21342         nvfformat="$sPRIfldbl"
21343         nvgformat="$sPRIgldbl"
21344         nvEUformat="$sPRIEUldbl"
21345         nvFUformat="$sPRIFUldbl"
21346         nvGUformat="$sPRIGUldbl"
21347     else
21348         nveformat='"e"'
21349         nvfformat='"f"'
21350         nvgformat='"g"'
21351         nvEUformat='"E"'
21352         nvFUformat='"F"'
21353         nvGUformat='"G"'
21354     fi
21355 fi
21356
21357 case "$ivdformat" in
21358 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21359     exit 1
21360     ;;
21361 esac
21362
21363 : Check format string for GID
21364
21365 echo " "
21366 $echo "Checking the format string to be used for gids..." >&4
21367
21368 case "$gidsign" in
21369 -1)     if $test X"$gidsize" = X"$ivsize"; then
21370                 gidformat="$ivdformat"
21371         else
21372                 if $test X"$gidsize" = X"$longsize"; then
21373                         gidformat='"ld"'
21374                 else
21375                         if $test X"$gidsize" = X"$intsize"; then
21376                                 gidformat='"d"'
21377                         else
21378                                 if $test X"$gidsize" = X"$shortsize"; then
21379                                         gidformat='"hd"'
21380                                 fi
21381                         fi
21382                 fi
21383         fi
21384         ;;
21385 *)      if $test X"$gidsize" = X"$uvsize"; then
21386                 gidformat="$uvuformat"
21387         else
21388                 if $test X"$gidsize" = X"$longsize"; then
21389                         gidformat='"lu"'
21390                 else
21391                         if $test X"$gidsize" = X"$intsize"; then
21392                                 gidformat='"u"'
21393                         else
21394                                 if $test X"$gidsize" = X"$shortsize"; then
21395                                         gidformat='"hu"'
21396                                 fi
21397                         fi
21398                 fi
21399         fi
21400         ;;
21401 esac
21402
21403 : see if getgroups exists
21404 set getgroups d_getgrps
21405 eval $inlibc
21406
21407 : see if setgroups exists
21408 set setgroups d_setgrps
21409 eval $inlibc
21410
21411 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21412 echo " "
21413 case "$d_getgrps$d_setgrps" in
21414 *define*)
21415         case "$groupstype" in
21416         '') dflt="$gidtype" ;;
21417         *)  dflt="$groupstype" ;;
21418         esac
21419         $cat <<EOM
21420 What type of pointer is the second argument to getgroups() and setgroups()?
21421 Usually this is the same as group ids, $gidtype, but not always.
21422
21423 EOM
21424         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21425         . ./myread
21426         groupstype="$ans"
21427         ;;
21428 *)  groupstype="$gidtype";;
21429 esac
21430
21431 : check whether make sets MAKE
21432 echo " "
21433 echo "Checking if your $make program sets \$(MAKE)..." >&4
21434 case "$make_set_make" in
21435 '')
21436         $sed 's/^X //' > testmake.mak << 'EOF'
21437 Xall:
21438 X       @echo 'maketemp="$(MAKE)"'
21439 EOF
21440         case "`$make -f testmake.mak 2>/dev/null`" in
21441         *maketemp=*) make_set_make='#' ;;
21442         *)      make_set_make="MAKE=$make" ;;
21443         esac
21444         $rm -f testmake.mak
21445         ;;
21446 esac
21447 case "$make_set_make" in
21448 '#') echo "Yup, it does.";;
21449 *) echo "Nope, it doesn't.";;
21450 esac
21451
21452 : see what type is used for mode_t
21453 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21454 set mode_t modetype int stdio.h sys/types.h
21455 eval $typedef_ask
21456
21457 : see if we need va_copy
21458 echo " "
21459 $cat >try.c <<EOCP
21460 #include <stdarg.h>
21461 #include <stdio.h>
21462 #include <stdlib.h>
21463 #include <signal.h>
21464
21465 int
21466 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21467 {
21468   return vfprintf(f, fmt, *valp);
21469 }
21470
21471 int
21472 myvfprintf(FILE *f, const  char *fmt, va_list val)
21473 {
21474   return ivfprintf(f, fmt, &val);
21475 }
21476
21477 int
21478 myprintf(char *fmt, ...)
21479 {
21480   va_list val;
21481   va_start(val, fmt);
21482   return myvfprintf(stdout, fmt, val);
21483 }
21484
21485 int
21486 main(int ac, char **av)
21487 {
21488   signal(SIGSEGV, exit);
21489
21490   myprintf("%s%cs all right, then\n", "that", '\'');
21491   exit(0);
21492 }
21493 EOCP
21494 set try
21495 if eval $compile && $run ./try 2>&1 >/dev/null; then
21496         case "`$run ./try`" in
21497         "that's all right, then")
21498                 okay=yes
21499                 ;;
21500         esac
21501 fi
21502 case "$okay" in
21503 yes)    echo "It seems that you don't need va_copy()." >&4
21504         need_va_copy="$undef"
21505         ;;
21506 *)      echo "It seems that va_copy() or similar will be needed." >&4
21507         need_va_copy="$define"
21508         ;;
21509 esac
21510 $rm_try
21511
21512 : see what type is used for size_t
21513 rp="What is the type used for the length parameter for string functions?"
21514 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21515 eval $typedef_ask
21516
21517 : check for type of arguments to gethostbyaddr.
21518 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21519         case "$d_gethbyaddr" in
21520         $define)
21521                 $cat <<EOM
21522
21523 Checking to see what type of arguments are accepted by gethostbyaddr().
21524 EOM
21525                 hdrs="$define sys/types.h
21526                         $d_socket sys/socket.h
21527                         $i_niin netinet/in.h
21528                         $i_netdb netdb.h
21529                         $i_unistd unistd.h"
21530                 : The first arg can 'char *' or 'void *'
21531                 : The second arg is some of integral type
21532                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21533                         for yyy in size_t long int; do
21534                                 case "$netdb_host_type" in
21535                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21536                                         if ./protochk "$try" $hdrs; then
21537                                                 echo "Your system accepts $xxx for the first arg."
21538                                                 echo "...and $yyy for the second arg."
21539                                                 netdb_host_type="$xxx"
21540                                                 netdb_hlen_type="$yyy"
21541                                         fi
21542                                         ;;
21543                                 esac
21544                         done
21545                 done
21546                 : In case none of those worked, prompt the user.
21547                 case "$netdb_host_type" in
21548                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21549                         dflt='char *'
21550                         . ./myread
21551                         netdb_host_type=$ans
21552                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21553                         dflt="$sizetype"
21554                         . ./myread
21555                         netdb_hlen_type=$ans
21556                         ;;
21557                 esac
21558                 ;;
21559         *)      : no gethostbyaddr, so pick harmless defaults
21560                 netdb_host_type='char *'
21561                 netdb_hlen_type="$sizetype"
21562                 ;;
21563         esac
21564         # Remove the "const" if needed. -- but then we'll have a
21565         # prototype clash!
21566         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21567 fi
21568
21569 : check for type of argument to gethostbyname.
21570 if test "X$netdb_name_type" = X ; then
21571         case "$d_gethbyname" in
21572         $define)
21573                 $cat <<EOM
21574
21575 Checking to see what type of argument is accepted by gethostbyname().
21576 EOM
21577                 hdrs="$define sys/types.h
21578                         $d_socket sys/socket.h
21579                         $i_niin netinet/in.h
21580                         $i_netdb netdb.h
21581                         $i_unistd unistd.h"
21582                 for xxx in "const char *" "char *"; do
21583                         case "$netdb_name_type" in
21584                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21585                                 if ./protochk "$try" $hdrs; then
21586                                         echo "Your system accepts $xxx."
21587                                         netdb_name_type="$xxx"
21588                                 fi
21589                                 ;;
21590                         esac
21591                 done
21592                 : In case none of those worked, prompt the user.
21593                 case "$netdb_name_type" in
21594                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21595                         dflt='char *'
21596                         . ./myread
21597                         netdb_name_type=$ans
21598                         ;;
21599                 esac
21600                 ;;
21601         *)      : no gethostbyname, so pick harmless default
21602                 netdb_name_type='char *'
21603                 ;;
21604         esac
21605 fi
21606
21607 : check for type of 1st argument to getnetbyaddr.
21608 if test "X$netdb_net_type" = X ; then
21609         case "$d_getnbyaddr" in
21610         $define)
21611                 $cat <<EOM
21612
21613 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21614 EOM
21615                 hdrs="$define sys/types.h
21616                         $d_socket sys/socket.h
21617                         $i_niin netinet/in.h
21618                         $i_netdb netdb.h
21619                         $i_unistd unistd.h"
21620                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21621                         case "$netdb_net_type" in
21622                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21623                                 if ./protochk "$try" $hdrs; then
21624                                         echo "Your system accepts $xxx."
21625                                         netdb_net_type="$xxx"
21626                                 fi
21627                                 ;;
21628                         esac
21629                 done
21630                 : In case none of those worked, prompt the user.
21631                 case "$netdb_net_type" in
21632                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21633                         dflt='long'
21634                         . ./myread
21635                         netdb_net_type=$ans
21636                         ;;
21637                 esac
21638                 ;;
21639         *)      : no getnetbyaddr, so pick harmless default
21640                 netdb_net_type='long'
21641                 ;;
21642         esac
21643 fi
21644 : locate the preferred pager for this system
21645 fn=f/
21646 case "$pager" in
21647 '')
21648         dflt=''
21649         case "$pg" in
21650         /*) dflt=$pg;;
21651         [a-zA-Z]:/*) dflt=$pg;;
21652         esac
21653         case "$more" in
21654         /*) dflt=$more;;
21655         [a-zA-Z]:/*) dflt=$more;;
21656         esac
21657         case "$less" in
21658         /*) dflt=$less;;
21659         [a-zA-Z]:/*) dflt=$less;;
21660         esac
21661         case "$dflt" in
21662         '') dflt=/usr/ucb/more;;
21663         esac
21664         ;;
21665 *)      dflt="$pager"
21666         ;;
21667 esac
21668 fn="f/($dflt)"
21669 echo " "
21670 rp='What pager is used on your system?'
21671 . ./getfile
21672 pager="$ans"
21673
21674 : see if ar generates random libraries by itself
21675 echo " "
21676 echo "Checking how to generate random libraries on your machine..." >&4
21677 echo 'int bar1() { return bar2(); }' > bar1.c
21678 echo 'int bar2() { return 2; }' > bar2.c
21679 $cat > foo.c <<EOP
21680 #$i_stdlib I_STDLIB
21681 #ifdef I_STDLIB
21682 #include <stdlib.h>
21683 #endif
21684 int main() { printf("%d\n", bar1()); exit(0); }
21685 EOP
21686 $cc $ccflags -c bar1.c >/dev/null 2>&1
21687 $cc $ccflags -c bar2.c >/dev/null 2>&1
21688 $cc $ccflags -c foo.c >/dev/null 2>&1
21689 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21690 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21691         $run ./foobar >/dev/null 2>&1; then
21692         echo "$ar appears to generate random libraries itself."
21693         orderlib=false
21694         if [ "X$ranlib" = "X" ]; then
21695             ranlib=":"
21696         fi
21697 elif $ar s bar$_a >/dev/null 2>&1 &&
21698         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21699         $run ./foobar >/dev/null 2>&1; then
21700                 echo "a table of contents needs to be added with '$ar s'."
21701                 orderlib=false
21702                 ranlib="$ar s"
21703 elif $ar ts bar$_a >/dev/null 2>&1 &&
21704         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21705         $run ./foobar >/dev/null 2>&1; then
21706                 echo "a table of contents needs to be added with '$ar ts'."
21707                 orderlib=false
21708                 ranlib="$ar ts"
21709 else
21710         case "$ranlib" in
21711         :) ranlib='';;
21712         '')
21713                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21714                 $test -f $ranlib || ranlib=''
21715                 ;;
21716         esac
21717         if $test -n "$ranlib"; then
21718                 echo "your system has '$ranlib'; we'll use that."
21719                 orderlib=false
21720         else
21721                 echo "your system doesn't seem to support random libraries"
21722                 echo "so we'll use lorder and tsort to order the libraries."
21723                 orderlib=true
21724                 ranlib=":"
21725         fi
21726 fi
21727 $rm -f foo* bar*
21728
21729 : Check the max offset that gmtime and localtime accept
21730 echo "Checking max offsets that gmtime () accepts"
21731
21732 case "$sGMTIME_min/$sGMTIME_max" in
21733     0/0|/)
21734         $cat >try.c <<EOCP
21735 #include <sys/types.h>
21736 #include <stdio.h>
21737 #include <time.h>
21738
21739 int i;
21740 struct tm *tmp;
21741 time_t pt;
21742
21743 void gm_check (time_t t, int min_year, int max_year)
21744 {
21745     tmp = gmtime (&t);
21746     if ( tmp == NULL ||
21747         /* Check tm_year overflow */
21748          tmp->tm_year < min_year || tmp->tm_year > max_year)
21749         tmp = NULL;
21750     else
21751         pt = t;
21752     } /* gm_check */
21753
21754 int check_max ()
21755 {
21756     tmp = NULL;
21757     pt  = 0;
21758 #ifdef MAXLONG
21759     gm_check (MAXLONG, 69, 0x7fffffff);
21760 #endif
21761     if (tmp == NULL || tmp->tm_year < 0) {
21762         for (i = 63; i >= 0; i--) {
21763             time_t x = pt | ((time_t)1 << i);
21764             if (x < 0 || x < pt) continue;
21765             gm_check (x, 69, 0x7fffffff);
21766             }
21767         }
21768     printf ("sGMTIME_max=%ld\n", pt);
21769     return (0);
21770     } /* check_max */
21771
21772 int check_min ()
21773 {
21774     tmp = NULL;
21775     pt  = 0;
21776 #ifdef MINLONG
21777     gm_check (MINLONG, -1900, 70);
21778 #endif
21779     if (tmp == NULL) {
21780         for (i = 36; i >= 0; i--) {
21781             time_t x = pt - ((time_t)1 << i);
21782             if (x > 0) continue;
21783             gm_check (x, -1900, 70);
21784             }
21785         }
21786     printf ("sGMTIME_min=%ld\n", pt);
21787     return (0);
21788     } /* check_min */
21789
21790 int main (int argc, char *argv[])
21791 {
21792     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21793     check_max ();
21794     check_min ();
21795     return (0);
21796     } /* main */
21797 EOCP
21798         set try
21799         if eval $compile; then
21800             eval `$run ./try 2>/dev/null`
21801         else
21802             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21803             fi
21804         $rm_try
21805         ;;
21806     esac
21807
21808 echo "Checking max offsets that localtime () accepts"
21809
21810 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21811     0/0|/)
21812         $cat >try.c <<EOCP
21813 #include <sys/types.h>
21814 #include <stdio.h>
21815 #include <time.h>
21816
21817 int i;
21818 struct tm *tmp;
21819 time_t pt;
21820
21821 void local_check (time_t t, int min_year, int max_year)
21822 {
21823     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21824         tmp = NULL;
21825     else
21826         tmp = localtime (&t);
21827     if ( tmp == NULL ||
21828         /* Check tm_year overflow */
21829          tmp->tm_year < min_year || tmp->tm_year > max_year)
21830         tmp = NULL;
21831     else
21832         pt = t;
21833     } /* local_check */
21834
21835 int check_max ()
21836 {
21837     tmp = NULL;
21838     pt  = 0;
21839 #ifdef MAXLONG
21840     local_check (MAXLONG, 69, 0x7fffffff);
21841 #endif
21842     if (tmp == NULL || tmp->tm_year < 0) {
21843         for (i = 63; i >= 0; i--) {
21844             time_t x = pt | ((time_t)1 << i);
21845             if (x < 0 || x < pt) continue;
21846             local_check (x, 69, 0x7fffffff);
21847             }
21848         }
21849     printf ("sLOCALTIME_max=%ld\n", pt);
21850     return (0);
21851    } /* check_max */
21852
21853 int check_min ()
21854 {
21855     tmp = NULL;
21856     pt  = 0;
21857 #ifdef MINLONG
21858     local_check (MINLONG, -1900, 70);
21859 #endif
21860     if (tmp == NULL) {
21861         for (i = 36; i >= 0; i--) {
21862             time_t x = pt - ((time_t)1 << i);
21863             if (x > 0) continue;
21864             local_check (x, -1900, 70);
21865             }
21866         }
21867     printf ("sLOCALTIME_min=%ld\n", pt);
21868     return (0);
21869     } /* check_min */
21870
21871 int main (int argc, char *argv[])
21872 {
21873     check_max ();
21874     check_min ();
21875     return (0);
21876     } /* main */
21877 EOCP
21878         set try
21879         if eval $compile; then
21880             eval `$run ./try 2>/dev/null`
21881         else
21882             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21883             fi
21884         $rm_try
21885         ;;
21886     esac
21887
21888 : check for type of arguments to select.
21889 case "$selecttype" in
21890 '') case "$d_select" in
21891         $define)
21892                 echo " "
21893                 $cat <<EOM
21894 Checking to see what type of arguments are accepted by select().
21895 EOM
21896                 hdrs="$define sys/types.h
21897                         $i_systime sys/time.h
21898                         $i_sysselct sys/select.h
21899                         $d_socket sys/socket.h"
21900                 : The first arg can be int, unsigned, or size_t
21901                 : The last arg may or may not be 'const'
21902                 val=''
21903                 : void pointer has been seen but using that
21904                 : breaks the selectminbits test
21905                 for xxx in 'fd_set *' 'int *'; do
21906                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21907                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21908                                         case "$val" in
21909                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21910                                                 if ./protochk "$try" $hdrs; then
21911                                                         echo "Your system accepts $xxx."
21912                                                         val="$xxx"
21913                                                 fi
21914                                                 ;;
21915                                         esac
21916                                 done
21917                         done
21918                 done
21919                 case "$val" in
21920                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21921                         case "$d_fd_set" in
21922                                 $define) dflt="fd_set *" ;;
21923                                 *)              dflt="int *" ;;
21924                         esac
21925                         . ./myread
21926                         val=$ans
21927                         ;;
21928                 esac
21929                 selecttype="$val"
21930                 ;;
21931         *)      : no select, so pick a harmless default
21932                 selecttype='int *'
21933                 ;;
21934         esac
21935         ;;
21936 esac
21937
21938 : check for the select 'width'
21939 case "$selectminbits" in
21940 '') safebits=`expr $ptrsize \* 8`
21941     case "$d_select" in
21942         $define)
21943                 $cat <<EOM
21944
21945 Checking to see on how many bits at a time your select() operates...
21946 EOM
21947                 $cat >try.c <<EOCP
21948 #include <sys/types.h>
21949 #$i_time I_TIME
21950 #$i_systime I_SYS_TIME
21951 #$i_systimek I_SYS_TIME_KERNEL
21952 #ifdef I_TIME
21953 #   include <time.h>
21954 #endif
21955 #ifdef I_SYS_TIME
21956 #   ifdef I_SYS_TIME_KERNEL
21957 #       define KERNEL
21958 #   endif
21959 #   include <sys/time.h>
21960 #   ifdef I_SYS_TIME_KERNEL
21961 #       undef KERNEL
21962 #   endif
21963 #endif
21964 #$i_sysselct I_SYS_SELECT
21965 #ifdef I_SYS_SELECT
21966 #include <sys/select.h>
21967 #endif
21968 #$d_socket HAS_SOCKET
21969 #ifdef HAS_SOCKET
21970 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21971 #endif
21972 #include <stdio.h>
21973 #$i_stdlib I_STDLIB
21974 #ifdef I_STDLIB
21975 #include <stdlib.h>
21976 #endif
21977 $selecttype b;
21978 #define S sizeof(*(b))
21979 #define MINBITS 64
21980 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21981 #define NBITS  (NBYTES * 8)
21982 int main() {
21983     char *s = (char *)malloc(NBYTES);
21984     struct timeval t;
21985     int i;
21986     FILE* fp;
21987     int fd;
21988
21989     if (!s)
21990         exit(1);
21991     fclose(stdin);
21992     fp = fopen("try.c", "r");
21993     if (fp == 0)
21994       exit(2);
21995     fd = fileno(fp);
21996     if (fd < 0)
21997       exit(3);
21998     b = ($selecttype)s;
21999     for (i = 0; i < NBITS; i++)
22000         FD_SET(i, b);
22001     t.tv_sec  = 0;
22002     t.tv_usec = 0;
22003     select(fd + 1, b, 0, 0, &t);
22004     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22005     free(s);
22006     printf("%d\n", i + 1);
22007     return 0;
22008 }
22009 EOCP
22010                 set try
22011                 if eval $compile_ok; then
22012                         selectminbits=`$run ./try 2>/dev/null`
22013                         case "$selectminbits" in
22014                         '')     cat >&4 <<EOM
22015 Cannot figure out on how many bits at a time your select() operates.
22016 I'll play safe and guess it is $safebits bits.
22017 EOM
22018                                 selectminbits=$safebits
22019                                 bits="$safebits bits"
22020                                 ;;
22021                         1)      bits="1 bit" ;;
22022                         *)      bits="$selectminbits bits" ;;
22023                         esac
22024                         echo "Your select() operates on $bits at a time." >&4
22025                 else
22026                         rp='What is the minimum number of bits your select() operates on?'
22027                         case "$byteorder" in
22028                         12345678)       dflt=64 ;;
22029                         1234)           dflt=32 ;;
22030                         *)              dflt=1  ;;
22031                         esac
22032                         . ./myread
22033                         val=$ans
22034                         selectminbits="$val"
22035                 fi
22036                 $rm_try
22037                 ;;
22038         *)      : no select, so pick a harmless default
22039                 selectminbits=$safebits
22040                 ;;
22041         esac
22042         ;;
22043 esac
22044
22045 : Trace out the files included by signal.h, then look for SIGxxx names.
22046 case "$sig_num_init" in
22047 '')
22048 if [ "X$fieldn" = X ]; then
22049         : Just make some guesses.  We check them later.
22050         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22051 else
22052         xxx=`echo '#include <signal.h>' |
22053         $cppstdin $cppminus $cppflags 2>/dev/null |
22054         $grep '^[       ]*#.*include' |
22055         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22056                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22057 fi
22058 xxxfiles=''
22059 for xx in $xxx /dev/null ; do
22060         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22061 done
22062 case "$xxxfiles" in
22063 '')     xxxfiles=`./findhdr signal.h` ;;
22064 esac
22065 xxx=`awk '
22066 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22067         print substr($2, 4, 20)
22068 }
22069 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22070         print substr($3, 4, 20)
22071 }' $xxxfiles`
22072 : Append some common names just in case the awk scan failed.
22073 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22074 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22075 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22076 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22077 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22078
22079 : generate a few handy files for later
22080 $cat > signal.c <<EOCP
22081 #include <sys/types.h>
22082 #include <signal.h>
22083 #$i_stdlib I_STDLIB
22084 #ifdef I_STDLIB
22085 #include <stdlib.h>
22086 #endif
22087 #include <stdio.h>
22088 int main() {
22089
22090 /* Strange style to avoid deeply-nested #if/#else/#endif */
22091 #ifndef NSIG
22092 #  ifdef _NSIG
22093 #    define NSIG (_NSIG)
22094 #  endif
22095 #endif
22096
22097 #ifndef NSIG
22098 #  ifdef SIGMAX
22099 #    define NSIG (SIGMAX+1)
22100 #  endif
22101 #endif
22102
22103 #ifndef NSIG
22104 #  ifdef SIG_MAX
22105 #    define NSIG (SIG_MAX+1)
22106 #  endif
22107 #endif
22108
22109 #ifndef NSIG
22110 #  ifdef _SIG_MAX
22111 #    define NSIG (_SIG_MAX+1)
22112 #  endif
22113 #endif
22114
22115 #ifndef NSIG
22116 #  ifdef MAXSIG
22117 #    define NSIG (MAXSIG+1)
22118 #  endif
22119 #endif
22120
22121 #ifndef NSIG
22122 #  ifdef MAX_SIG
22123 #    define NSIG (MAX_SIG+1)
22124 #  endif
22125 #endif
22126
22127 #ifndef NSIG
22128 #  ifdef SIGARRAYSIZE
22129 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22130 #  endif
22131 #endif
22132
22133 #ifndef NSIG
22134 #  ifdef _sys_nsig
22135 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22136 #  endif
22137 #endif
22138
22139 /* Default to some arbitrary number that's big enough to get most
22140    of the common signals.
22141 */
22142 #ifndef NSIG
22143 #    define NSIG 50
22144 #endif
22145
22146 printf("NSIG %d\n", NSIG);
22147
22148 #ifndef JUST_NSIG
22149
22150 EOCP
22151
22152 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22153 {
22154         printf "#ifdef SIG"; printf $1; printf "\n"
22155         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22156         printf $1; printf ");\n"
22157         printf "#endif\n"
22158 }
22159 END {
22160         printf "#endif /* JUST_NSIG */\n";
22161         printf "exit(0);\n}\n";
22162 }
22163 ' >>signal.c
22164 $cat >signal.awk <<'EOP'
22165 BEGIN { ndups = 0 }
22166 $1 ~ /^NSIG$/ { nsig = $2 }
22167 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22168     if ($2 > maxsig) { maxsig = $2 }
22169     if (sig_name[$2]) {
22170         dup_name[ndups] = $1
22171         dup_num[ndups] = $2
22172         ndups++
22173     }
22174     else {
22175         sig_name[$2] = $1
22176         sig_num[$2] = $2
22177     }
22178 }
22179 END {
22180     if (nsig == 0) {
22181         nsig = maxsig + 1
22182     }
22183     printf("NSIG %d\n", nsig);
22184     for (n = 1; n < nsig; n++) {
22185         if (sig_name[n]) {
22186             printf("%s %d\n", sig_name[n], sig_num[n])
22187         }
22188         else {
22189             printf("NUM%d %d\n", n, n)
22190         }
22191     }
22192     for (n = 0; n < ndups; n++) {
22193         printf("%s %d\n", dup_name[n], dup_num[n])
22194     }
22195 }
22196 EOP
22197 $cat >signal_cmd <<EOS
22198 $startsh
22199 if $test -s signal.lst; then
22200     echo "Using your existing signal.lst file"
22201         exit 0
22202 fi
22203 xxx="$xxx"
22204 EOS
22205 $cat >>signal_cmd <<'EOS'
22206
22207 set signal
22208 if eval $compile_ok; then
22209         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22210                 $uniq | $awk -f signal.awk >signal.lst
22211 else
22212         echo "(I can't seem be able to compile the whole test program)" >&4
22213         echo "(I'll try it in little pieces.)" >&4
22214         set signal -DJUST_NSIG
22215         if eval $compile_ok; then
22216                 $run ./signal$_exe > signal.nsg
22217                 $cat signal.nsg
22218         else
22219                 echo "I can't seem to figure out how many signals you have." >&4
22220                 echo "Guessing 50." >&4
22221                 echo 'NSIG 50' > signal.nsg
22222         fi
22223         : Now look at all the signal names, one at a time.
22224         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22225                 $cat > signal.c <<EOCP
22226 #include <sys/types.h>
22227 #include <signal.h>
22228 #include <stdio.h>
22229 int main() {
22230 printf("$xx %d\n", SIG${xx});
22231 return 0;
22232 }
22233 EOCP
22234                 set signal
22235                 if eval $compile; then
22236                         echo "SIG${xx} found."
22237                         $run ./signal$_exe  >> signal.ls1
22238                 else
22239                         echo "SIG${xx} NOT found."
22240                 fi
22241         done
22242         if $test -s signal.ls1; then
22243                 $cat signal.nsg signal.ls1 |
22244                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22245         fi
22246
22247 fi
22248 if $test -s signal.lst; then
22249         :
22250 else
22251         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22252         echo 'kill -l' >signal
22253         set X `csh -f <signal`
22254         $rm -f signal
22255         shift
22256         case $# in
22257         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22258         esac
22259         echo $@ | $tr ' ' $trnl | \
22260             $awk '{ printf "%s %d\n", $1, ++s; }
22261                   END { printf "NSIG %d\n", ++s }' >signal.lst
22262 fi
22263 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22264 EOS
22265 chmod a+x signal_cmd
22266 $eunicefix signal_cmd
22267 ;;
22268 esac
22269
22270 : generate list of signal names
22271 case "$sig_num_init" in
22272 '')
22273 echo " "
22274 case "$sig_name_init" in
22275 '') doinit=yes ;;
22276 *)  case "$sig_num_init" in
22277     ''|*,*) doinit=yes ;;
22278     esac ;;
22279 esac
22280 case "$doinit" in
22281 yes)
22282         echo "Generating a list of signal names and numbers..." >&4
22283         . ./signal_cmd
22284         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22285         sig_name=`$awk 'BEGIN { printf "ZERO " }
22286                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22287         sig_num=`$awk  'BEGIN { printf "0 " }
22288                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22289         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22290                              !/^NSIG/   { printf "\"%s\", ", $1 }
22291                              END        { printf "0\n" }' signal.lst`
22292         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22293                              !/^NSIG/   { printf "%d, ", $2}
22294                              END        { printf "0\n"}' signal.lst`
22295         ;;
22296 esac
22297 echo "The following $sig_count signals are available:"
22298 echo " "
22299 echo $sig_name | $awk \
22300 'BEGIN { linelen = 0 }
22301 {
22302         for (i = 1; i <= NF; i++) {
22303                 name = "SIG" $i " "
22304                 linelen = linelen + length(name)
22305                 if (linelen > 70) {
22306                         printf "\n"
22307                         linelen = length(name)
22308                 }
22309                 printf "%s", name
22310         }
22311         printf "\n"
22312 }'
22313 sig_size=`echo $sig_name | awk '{print NF}'`
22314 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22315 ;;
22316 esac
22317
22318 : Check size of size
22319 echo " "
22320 case "$sizetype" in
22321 *_t) zzz="$sizetype"    ;;
22322 *)   zzz="filesize"     ;;
22323 esac
22324 echo "Checking the size of $zzz..." >&4
22325 cat > try.c <<EOCP
22326 #include <sys/types.h>
22327 #include <stdio.h>
22328 #$i_stdlib I_STDLIB
22329 #ifdef I_STDLIB
22330 #include <stdlib.h>
22331 #endif
22332 int main() {
22333     printf("%d\n", (int)sizeof($sizetype));
22334     exit(0);
22335 }
22336 EOCP
22337 set try
22338 if eval $compile_ok; then
22339         yyy=`$run ./try`
22340         case "$yyy" in
22341         '')     sizesize=4
22342                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22343                 ;;
22344         *)      sizesize=$yyy
22345                 echo "Your $zzz size is $sizesize bytes."
22346                 ;;
22347         esac
22348 else
22349         sizesize=4
22350         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22351 fi
22352
22353 : check for socklen_t
22354 echo " "
22355 echo "Checking to see if you have socklen_t..." >&4
22356 $cat >try.c <<EOCP
22357 #include <sys/types.h>
22358 #$d_socket HAS_SOCKET
22359 #ifdef HAS_SOCKET
22360 #include <sys/socket.h>
22361 #endif
22362 int main() { socklen_t x = 16; }
22363 EOCP
22364 set try
22365 if eval $compile; then
22366         val="$define"
22367         echo "You have socklen_t."
22368 else
22369         val="$undef"
22370         echo "You do not have socklen_t."
22371         case "$sizetype" in
22372         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22373         esac
22374 fi
22375 $rm_try
22376 set d_socklen_t
22377 eval $setvar
22378
22379 : see if this is a socks.h system
22380 set socks.h i_socks
22381 eval $inhdr
22382
22383 : check for type of the size argument to socket calls
22384 case "$d_socket" in
22385 "$define")
22386         $cat <<EOM
22387
22388 Checking to see what type is the last argument of accept().
22389 EOM
22390         yyy=''
22391         case "$d_socklen_t" in
22392         "$define") yyy="$yyy socklen_t"
22393         esac
22394         yyy="$yyy $sizetype int long unsigned"
22395         for xxx in $yyy; do
22396                 case "$socksizetype" in
22397                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22398                         case "$usesocks" in
22399                         "$define")
22400                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22401                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22402                                         socksizetype="$xxx"
22403                                 fi
22404                                 ;;
22405                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22406                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22407                                         socksizetype="$xxx"
22408                                 fi
22409                                 ;;
22410                         esac
22411                         ;;
22412                 esac
22413         done
22414 : In case none of those worked, prompt the user.
22415         case "$socksizetype" in
22416         '')     rp='What is the type for socket address structure sizes?'
22417                 dflt='int'
22418                 . ./myread
22419                 socksizetype=$ans
22420                 ;;
22421         esac
22422         ;;
22423 *)      : no sockets, so pick relatively harmless default
22424         socksizetype='int'
22425         ;;
22426 esac
22427
22428 : see what type is used for signed size_t
22429 set ssize_t ssizetype int stdio.h sys/types.h
22430 eval $typedef
22431 dflt="$ssizetype"
22432 $cat > try.c <<EOM
22433 #include <stdio.h>
22434 #$i_stdlib I_STDLIB
22435 #ifdef I_STDLIB
22436 #include <stdlib.h>
22437 #endif
22438 #include <sys/types.h>
22439 #define Size_t $sizetype
22440 #define SSize_t $dflt
22441 int main()
22442 {
22443         if (sizeof(Size_t) == sizeof(SSize_t))
22444                 printf("$dflt\n");
22445         else if (sizeof(Size_t) == sizeof(int))
22446                 printf("int\n");
22447         else
22448                 printf("long\n");
22449         exit(0);
22450 }
22451 EOM
22452 echo " "
22453 set try
22454 if eval $compile_ok && $run ./try > /dev/null; then
22455         ssizetype=`$run ./try`
22456         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22457 else
22458         $cat >&4 <<EOM
22459 Help! I can't compile and run the ssize_t test program: please enlighten me!
22460 (This is probably a misconfiguration in your system or libraries, and
22461 you really ought to fix it.  Still, I'll try anyway.)
22462
22463 I need a type that is the same size as $sizetype, but is guaranteed to
22464 be signed.  Common values are ssize_t, int and long.
22465
22466 EOM
22467         rp="What signed type is the same size as $sizetype?"
22468         . ./myread
22469         ssizetype="$ans"
22470 fi
22471 $rm_try
22472
22473 : Check the size of st_ino
22474 $echo " "
22475 $echo "Checking the size of st_ino..." >&4
22476 $cat > try.c <<EOCP
22477 #include <sys/stat.h>
22478 #include <stdio.h>
22479 #$i_stdlib I_STDLIB
22480 #ifdef I_STDLIB
22481 #include <stdlib.h>
22482 #endif
22483 int main() {
22484     struct stat st;
22485     printf("%d\n", (int)sizeof(st.st_ino));
22486     exit(0);
22487 }
22488 EOCP
22489 set try
22490 if eval $compile_ok; then
22491         val=`$run ./try`
22492         case "$val" in
22493         '')     st_ino_size=4
22494                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22495                 ;;
22496         *)      st_ino_size=$val
22497                 $echo "Your st_ino is $st_ino_size bytes long."
22498                 ;;
22499         esac
22500 else
22501         st_ino_size=4
22502         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22503 fi
22504 $rm_try
22505
22506 : Check if st_ino is signed
22507 $echo " "
22508 $echo "Checking the sign of st_ino..." >&4
22509 $cat > try.c <<EOCP
22510 #include <sys/stat.h>
22511 #include <stdio.h>
22512 int main() {
22513         struct stat foo;
22514         foo.st_ino = -1;
22515         if (foo.st_ino < 0)
22516                 printf("-1\n");
22517         else
22518                 printf("1\n");
22519 }
22520 EOCP
22521 set try
22522 if eval $compile; then
22523         val=`$run ./try`
22524         case "$val" in
22525         '')     st_ino_sign=1
22526                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22527                 ;;
22528         *)      st_ino_sign=$val
22529                 case "$st_ino_sign" in
22530                  1) $echo "Your st_ino is unsigned." ;;
22531                 -1) $echo "Your st_ino is signed."   ;;
22532                 esac
22533                 ;;
22534         esac
22535 else
22536         st_ino_sign=1
22537         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22538 fi
22539 $rm_try
22540
22541 : see what type of char stdio uses.
22542 echo " "
22543 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22544 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22545         echo "Your stdio uses unsigned chars." >&4
22546         stdchar="unsigned char"
22547 else
22548         echo "Your stdio uses signed chars." >&4
22549         stdchar="char"
22550 fi
22551 $rm -f stdioh
22552
22553 : Check size of UID
22554 echo " "
22555 case "$uidtype" in
22556 *_t) zzz="$uidtype"     ;;
22557 *)   zzz="uid"          ;;
22558 esac
22559 echo "Checking the size of $zzz..." >&4
22560 cat > try.c <<EOCP
22561 #include <sys/types.h>
22562 #include <stdio.h>
22563 #$i_stdlib I_STDLIB
22564 #ifdef I_STDLIB
22565 #include <stdlib.h>
22566 #endif
22567 int main() {
22568     printf("%d\n", (int)sizeof($uidtype));
22569     exit(0);
22570 }
22571 EOCP
22572 set try
22573 if eval $compile_ok; then
22574         yyy=`$run ./try`
22575         case "$yyy" in
22576         '')     uidsize=4
22577                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22578                 ;;
22579         *)      uidsize=$yyy
22580                 echo "Your $zzz is $uidsize bytes long."
22581                 ;;
22582         esac
22583 else
22584         uidsize=4
22585         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22586 fi
22587
22588 : Check if UID is signed
22589 echo " "
22590 case "$uidtype" in
22591 *_t) zzz="$uidtype"     ;;
22592 *)   zzz="uid"          ;;
22593 esac
22594 echo "Checking the sign of $zzz..." >&4
22595 cat > try.c <<EOCP
22596 #include <sys/types.h>
22597 #include <stdio.h>
22598 int main() {
22599         $uidtype foo = -1;
22600         if (foo < 0)
22601                 printf("-1\n");
22602         else
22603                 printf("1\n");
22604 }
22605 EOCP
22606 set try
22607 if eval $compile; then
22608         yyy=`$run ./try`
22609         case "$yyy" in
22610         '')     uidsign=1
22611                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22612                 ;;
22613         *)      uidsign=$yyy
22614                 case "$uidsign" in
22615                  1) echo "Your $zzz is unsigned." ;;
22616                 -1) echo "Your $zzz is signed."   ;;
22617                 esac
22618                 ;;
22619         esac
22620 else
22621         uidsign=1
22622         echo "(I can't compile the test program--guessing unsigned.)" >&4
22623 fi
22624
22625 : Check format string for UID
22626 echo " "
22627 $echo "Checking the format string to be used for uids..." >&4
22628
22629 case "$uidsign" in
22630 -1)     if $test X"$uidsize" = X"$ivsize"; then
22631                 uidformat="$ivdformat"
22632         else
22633                 if $test X"$uidsize" = X"$longsize"; then
22634                         uidformat='"ld"'
22635                 else
22636                         if $test X"$uidsize" = X"$intsize"; then
22637                                 uidformat='"d"'
22638                         else
22639                                 if $test X"$uidsize" = X"$shortsize"; then
22640                                         uidformat='"hd"'
22641                                 fi
22642                         fi
22643                 fi
22644         fi
22645         ;;
22646 *)      if $test X"$uidsize" = X"$uvsize"; then
22647                 uidformat="$uvuformat"
22648         else
22649                 if $test X"$uidsize" = X"$longsize"; then
22650                         uidformat='"lu"'
22651                 else
22652                         if $test X"$uidsize" = X"$intsize"; then
22653                                 uidformat='"u"'
22654                         else
22655                                 if $test X"$uidsize" = X"$shortsize"; then
22656                                         uidformat='"hu"'
22657                                 fi
22658                         fi
22659                 fi
22660         fi
22661         ;;
22662 esac
22663
22664 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22665 echo " "
22666 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22667 $cat >try.c <<'EOM'
22668 /* Intentionally a long probe as I'd like to sanity check that the exact
22669    approach is going to work, as thinking it will work, but only having it
22670    part working at runtime is worse than not having it.  */
22671
22672 #include <sys/types.h>
22673 #include <sys/sysctl.h>
22674 #include <sys/param.h>
22675 #include <stdio.h>
22676 #include <string.h>
22677 #include <stdlib.h>
22678 #include <unistd.h>
22679
22680 int
22681 main(int argc, char **argv) {
22682     char *buffer;
22683     char *argv_leaf = strrchr(argv[0], '/');
22684     char *buffer_leaf;
22685     size_t size = 0;
22686     int mib[4];
22687
22688     mib[0] = CTL_KERN;
22689     mib[1] = KERN_PROC;
22690     mib[2] = KERN_PROC_PATHNAME;
22691     mib[3] = -1;
22692
22693     if (!argv_leaf) {
22694         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22695         return 1;
22696     }
22697
22698     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22699         perror("sysctl");
22700         return 2;
22701     }
22702
22703     if (size < strlen(argv_leaf) + 1) {
22704         fprintf(stderr, "size %lu is too short for a path\n",
22705                 (unsigned long) size);
22706         return 3;
22707     }
22708
22709     if (size > MAXPATHLEN * MAXPATHLEN) {
22710         fprintf(stderr, "size %lu is too long for a path\n",
22711                 (unsigned long) size);
22712         return 4;
22713     }
22714
22715     buffer = (char *)malloc(size);
22716     if (!buffer) {
22717         perror("malloc");
22718         return 5;
22719     }
22720
22721     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22722         perror("sysctl");
22723         return 6;
22724     }
22725
22726     if (strlen(buffer) + 1 != size) {
22727         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22728                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22729         return 7;
22730     }
22731
22732
22733     if (*buffer != '/') {
22734         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22735         return 8;
22736     }
22737
22738     if (strstr(buffer, "/./")) {
22739         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22740         return 9;
22741     }
22742
22743     if (strstr(buffer, "/../")) {
22744         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22745         return 10;
22746     }
22747
22748     buffer_leaf = strrchr(buffer, '/');
22749     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22750         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22751         return 11;
22752     }
22753
22754     free(buffer);
22755
22756     return 0;
22757 }
22758 EOM
22759
22760 val=$undef
22761 set try
22762 if eval $compile; then
22763         if $run ./try; then
22764                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22765                 val="$define"
22766         else
22767                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22768                 val="$undef"
22769         fi
22770 else
22771         echo "I'm unable to compile the test program." >&4
22772         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22773         val="$undef"
22774 fi
22775 $rm_try
22776 set usekernprocpathname
22777 eval $setvar
22778
22779 : Determine if we can use _NSGetExecutablePath to find executing program
22780 echo " "
22781 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22782 $cat >try.c <<'EOM'
22783 /* Intentionally a long probe as I'd like to sanity check that the exact
22784    approach is going to work, as thinking it will work, but only having it
22785    part working at runtime is worse than not having it.  */
22786 #include <mach-o/dyld.h>
22787 #include <stdio.h>
22788 #include <stdlib.h>
22789 #include <sys/param.h>
22790 #include <string.h>
22791
22792 int
22793 main(int argc, char **argv) {
22794     char buf[1];
22795     uint32_t size = sizeof(buf);
22796     int result;
22797     char *buffer;
22798     char *tidied;
22799     char *argv_leaf = strrchr(argv[0], '/');
22800     char *tidied_leaf;
22801
22802     if (!argv_leaf) {
22803         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22804         return 1;
22805     }
22806
22807     _NSGetExecutablePath(buf, &size);
22808     if (size > MAXPATHLEN * MAXPATHLEN) {
22809         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22810                 (unsigned int) size);
22811         return 2;
22812     }
22813
22814     buffer = (char *)malloc(size);
22815     if (!buffer) {
22816         perror("malloc");
22817         return 3;
22818     }
22819
22820     result = _NSGetExecutablePath(buffer, &size);
22821     if (result != 0) {
22822         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22823                 result, (unsigned int) size);
22824         return 4;
22825     }
22826
22827     tidied = realpath(buffer, NULL);
22828     if (!tidied) {
22829         perror("realpath");
22830         return 5;
22831     }
22832
22833     free(buffer);
22834
22835     if (*tidied != '/') {
22836         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22837         return 6;
22838     }
22839
22840     if (strstr(tidied, "/./")) {
22841         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22842         return 7;
22843     }
22844
22845     if (strstr(tidied, "/../")) {
22846         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22847         return 8;
22848     }
22849
22850     tidied_leaf = strrchr(tidied, '/');
22851     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22852         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22853         return 9;
22854     }
22855
22856     free(tidied);
22857
22858     return 0;
22859 }
22860 EOM
22861
22862 val=$undef
22863 set try
22864 if eval $compile; then
22865         if $run ./try; then
22866                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22867                 val="$define"
22868         else
22869                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22870         fi
22871 else
22872         echo "I'm unable to compile the test program." >&4
22873         echo "I'll assume no _NSGetExecutablePath here." >&4
22874 fi
22875 $rm_try
22876 set usensgetexecutablepath
22877 eval $setvar
22878
22879 : Check if site customization support was requested
22880 case "$usesitecustomize" in
22881     $define|true|[Yy]*)
22882         usesitecustomize="$define"
22883         ;;
22884     *)
22885         usesitecustomize="$undef"
22886         ;;
22887     esac
22888
22889 : determine compiler compiler
22890 case "$yacc" in
22891 '')
22892         dflt=yacc;;
22893 *)
22894         dflt="$yacc";;
22895 esac
22896 echo " "
22897 comp='yacc'
22898 if $test -f "$byacc$_exe"; then
22899         dflt="$byacc"
22900         comp="byacc or $comp"
22901 fi
22902 if $test -f "$bison$_exe"; then
22903         comp="$comp or bison -y"
22904 fi
22905 rp="Which compiler compiler ($comp) shall I use?"
22906 . ./myread
22907 yacc="$ans"
22908 case "$yacc" in
22909 *bis*)
22910         case "$yacc" in
22911         *-y*) ;;
22912         *)
22913                 yacc="$yacc -y"
22914                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22915                 ;;
22916         esac
22917         ;;
22918 esac
22919
22920 : see if this is a bfd.h system
22921 set bfd.h i_bfd
22922 eval $inhdr
22923
22924 : see if this is an execinfo.h system
22925 set execinfo.h i_execinfo
22926 eval $inhdr
22927
22928 : see if this is a fenv.h system
22929 set fenv.h i_fenv
22930 eval $inhdr
22931
22932 : see if this is a fp.h system
22933 set fp.h i_fp
22934 eval $inhdr
22935
22936 : see if this is a fp_class.h system
22937 set fp_class.h i_fp_class
22938 eval $inhdr
22939
22940 : see if gdbm.h is available
22941 set gdbm.h t_gdbm
22942 eval $inhdr
22943 case "$t_gdbm" in
22944 $define)
22945         : see if gdbm_open exists
22946         set gdbm_open d_gdbm_open
22947         eval $inlibc
22948         case "$d_gdbm_open" in
22949         $undef)
22950                 t_gdbm="$undef"
22951                 echo "We won't be including <gdbm.h>"
22952                 ;;
22953         esac
22954         ;;
22955 esac
22956 val="$t_gdbm"
22957 set i_gdbm
22958 eval $setvar
22959
22960 : see if this is a ieeefp.h system
22961 case "$i_ieeefp" in
22962 '' ) set ieeefp.h i_ieeefp
22963      eval $inhdr
22964      ;;
22965 esac
22966
22967 : see if this is a libutil.h system
22968 set libutil.h i_libutil
22969 eval $inhdr
22970
22971 : see if mach cthreads are available
22972 if test "X$usethreads" = "X$define"; then
22973         set mach/cthreads.h i_machcthr
22974         eval $inhdr
22975 else
22976         i_machcthr="$undef"
22977 fi
22978
22979 : see if this is a mntent.h system
22980 set mntent.h i_mntent
22981 eval $inhdr
22982
22983 : see if net/errno.h is available
22984 val=''
22985 set net/errno.h val
22986 eval $inhdr
22987
22988 : Unfortunately, it causes problems on some systems.  Arrgh.
22989 case "$val" in
22990 $define)
22991         cat > try.c <<'EOM'
22992 #include <stdio.h>
22993 #include <errno.h>
22994 #include <net/errno.h>
22995 int func()
22996 {
22997         return ENOTSOCK;
22998 }
22999 EOM
23000         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23001                 echo "We'll be including <net/errno.h>." >&4
23002         else
23003                 echo "We won't be including <net/errno.h>." >&4
23004                 val="$undef"
23005         fi
23006         $rm_try
23007         ;;
23008 esac
23009 set i_neterrno
23010 eval $setvar
23011
23012 : see if netinet/tcp.h is available
23013 set netinet/tcp.h i_netinettcp
23014 eval $inhdr
23015
23016 : see if this is a poll.h system
23017 set poll.h i_poll
23018 eval $inhdr
23019
23020 : see if this is a prot.h system
23021 set prot.h i_prot
23022 eval $inhdr
23023
23024 : Preprocessor symbols
23025 echo " "
23026 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23027 $cat <<'EOSH' > Cppsym.know
23028 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23029 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23030 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23031 arch_pwr ardent ARM ARM32 atarist att386 att3b
23032 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23033 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23034 byteorder byte_order
23035 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23036 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23037 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23038 ELF encore EPI EXTENSIONS
23039 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23040 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23041 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23042 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23043 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23044 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23045 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23046 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23047 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23048 ksr1
23049 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23050 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23051 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23052 luna88k Lynx
23053 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23054 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23055 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23056 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23057 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23058 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23059 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23060 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23061 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23062 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23063 ns32000 ns32016 ns32332 ns32k nsc32000
23064 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23065 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23066 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23067 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23068 QK_USER QNX
23069 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23070 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23071 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23072 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23073 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23074 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23075 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23076 SYSV4 SYSV5 sysV68 sysV88
23077 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23078 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23079 tower32_800 tower32_850 tss
23080 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23081 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23082 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23083 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23084 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23085 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23086 uxpm uxps
23087 vax venix VMESA vms
23088 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23089 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23090 z8000 zarch
23091 EOSH
23092 # Maybe put other stuff here too.
23093 ./tr '-' '_' <<EOSH >>Cppsym.know
23094 $osname
23095 EOSH
23096 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23097 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23098 $cat Cppsym.know > Cppsym.c
23099 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23100 $rm -f Cppsym.a Cppsym.b Cppsym.c
23101 cat <<EOSH > Cppsym
23102 $startsh
23103 if $test \$# -gt 0; then
23104     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23105     if $test -s Cppsym.got; then
23106         $rm -f Cppsym.got
23107         exit 0
23108     fi
23109     $rm -f Cppsym.got
23110     exit 1
23111 else
23112     $tr " " "$trnl" | ./Cppsym.try
23113     exit 0
23114 fi
23115 EOSH
23116 chmod +x Cppsym
23117 $eunicefix Cppsym
23118 cat <<EOSH > Cppsym.try
23119 $startsh
23120 cat <<'EOCP' > try.c
23121 #include <stdio.h>
23122 #if cpp_stuff == 1
23123 #define STRINGIFY(a)    "a"
23124 #endif
23125 #if cpp_stuff == 42
23126 #define StGiFy(a)  #a
23127 #define STRINGIFY(a)    StGiFy(a)
23128 #endif
23129 #if $cpp_stuff != 1 && $cpp_stuff != 42
23130 #   include "Bletch: How does this C preprocessor stringify macros?"
23131 #endif
23132 int main() {
23133 EOCP
23134 $awk \\
23135 EOSH
23136 cat <<'EOSH' >> Cppsym.try
23137 'length($1) > 0 {
23138     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23139     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23140     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23141     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23142 }' >> try.c
23143 echo 'return 0;}' >> try.c
23144 EOSH
23145 cat <<EOSH >> Cppsym.try
23146 ccflags="$ccflags"
23147 case "$osname-$gccversion" in
23148 irix-) ccflags="\$ccflags -woff 1178" ;;
23149 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23150 esac
23151 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23152 EOSH
23153 chmod +x Cppsym.try
23154 $eunicefix Cppsym.try
23155 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23156 : Add in any Linux cpp "predefined macros":
23157 case "$osname::$gccversion" in
23158   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23159     tHdrH=_tmpHdr
23160     rm -f $tHdrH'.h' $tHdrH
23161     touch $tHdrH'.h'
23162     # Filter out macro arguments, such as Linux's __INT8_C(c)
23163     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23164        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23165        if [ -s $tHdrH'_cppsym.real' ]; then
23166           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23167        fi
23168     fi
23169     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23170   ;;
23171 esac
23172 : now check the C compiler for additional symbols
23173 postprocess_cc_v=''
23174 case "$osname" in
23175 aix) postprocess_cc_v="|$tr , ' '" ;;
23176 esac
23177 $cat >ccsym <<EOS
23178 $startsh
23179 $cat >tmp.c <<EOF
23180 extern int foo;
23181 EOF
23182 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23183 do
23184         case "\$i" in
23185         -D*) echo "\$i" | $sed 's/^-D//';;
23186         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23187         esac
23188 done
23189 $rm_try
23190 EOS
23191 postprocess_cc_v=''
23192 chmod +x ccsym
23193 $eunicefix ccsym
23194 ./ccsym > ccsym1.raw
23195 if $test -s ccsym1.raw; then
23196     $sort ccsym1.raw | $uniq >ccsym.raw
23197 else
23198     mv ccsym1.raw ccsym.raw
23199 fi
23200
23201 $awk '/\=/ { print $0; next }
23202         { print $0"=1" }' ccsym.raw >ccsym.list
23203 $comm -13 Cppsym.true ccsym.list >ccsym.own
23204 $comm -12 Cppsym.true ccsym.list >ccsym.com
23205 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23206 also=''
23207 if $test -z ccsym.raw; then
23208         echo "Your C compiler doesn't seem to define any symbols!" >&4
23209         echo " "
23210         echo "However, your C preprocessor defines the following symbols:"
23211         $cat Cppsym.true
23212         ccsymbols=''
23213         cppsymbols=`$cat Cppsym.true`
23214         cppsymbols=`echo $cppsymbols`
23215         cppccsymbols="$cppsymbols"
23216 else
23217         if $test -s ccsym.com; then
23218                 echo "Your C compiler and pre-processor define these symbols:"
23219                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23220                 also='also '
23221                 symbols='ones'
23222                 cppccsymbols=`$cat ccsym.com`
23223                 cppccsymbols=`echo $cppccsymbols`
23224                 $test "$silent" || sleep 1
23225         fi
23226         if $test -s ccsym.cpp; then
23227                 $test "$also" && echo " "
23228                 echo "Your C pre-processor ${also}defines the following symbols:"
23229                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23230                 also='further '
23231                 cppsymbols=`$cat ccsym.cpp`
23232                 cppsymbols=`echo $cppsymbols`
23233                 $test "$silent" || sleep 1
23234         fi
23235         if $test -s ccsym.own; then
23236                 $test "$also" && echo " "
23237                 echo "Your C compiler ${also}defines the following cpp symbols:"
23238                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23239                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23240                 ccsymbols=`$cat ccsym.own`
23241                 ccsymbols=`echo $ccsymbols`
23242                 $test "$silent" || sleep 1
23243         fi
23244 fi
23245
23246 : add -D_FORTIFY_SOURCE if feasible and not already there
23247 case "$gccversion" in
23248 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23249         *-O*)   case "$ccflags$cppsymbols" in
23250                 *_FORTIFY_SOURCE=*) # Don't add it again.
23251                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23252                         ;;
23253                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23254                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23255                         ;;
23256                 esac
23257                 ;;
23258         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23259                 ;;
23260         esac
23261         ;;
23262 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23263         ;;
23264 esac
23265
23266 : script used to emit important warnings
23267 cat >warn <<EOS
23268 $startsh
23269 if test \$# -gt 0; then
23270         echo "\$@" >msg
23271 else
23272         cat >msg
23273 fi
23274 echo "*** WARNING:" >&4
23275 sed -e 's/^/*** /' <msg >&4
23276 echo "*** " >&4
23277 cat msg >>config.msg
23278 echo " " >>config.msg
23279 rm -f msg
23280 EOS
23281 chmod +x warn
23282 $eunicefix warn
23283
23284 : see if this is a termio system
23285 val="$undef"
23286 val2="$undef"
23287 val3="$undef"
23288 if $test `./findhdr termios.h`; then
23289     set tcsetattr i_termios
23290     eval $inlibc
23291     val3="$i_termios"
23292 fi
23293 echo " "
23294 case "$val3" in
23295     "$define") echo "You have POSIX termios.h... good!" >&4;;
23296     *)  if ./Cppsym pyr; then
23297             case "`$run /bin/universe`" in
23298                 ucb) if $test `./findhdr sgtty.h`; then
23299                         val2="$define"
23300                         echo "<sgtty.h> found." >&4
23301                     else
23302                         echo "System is pyramid with BSD universe."
23303                         ./warn "<sgtty.h> not found--you could have problems."
23304                     fi;;
23305                 *)  if $test `./findhdr termio.h`; then
23306                         val="$define"
23307                         echo "<termio.h> found." >&4
23308                     else
23309                         echo "System is pyramid with USG universe."
23310                         ./warn "<termio.h> not found--you could have problems."
23311                     fi;;
23312             esac
23313         elif ./usg; then
23314             if $test `./findhdr termio.h`; then
23315                 echo "<termio.h> found." >&4
23316                 val="$define"
23317             elif $test `./findhdr sgtty.h`; then
23318                 echo "<sgtty.h> found." >&4
23319                 val2="$define"
23320             else
23321                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23322             fi
23323         else
23324             if $test `./findhdr sgtty.h`; then
23325                 echo "<sgtty.h> found." >&4
23326                 val2="$define"
23327             elif $test `./findhdr termio.h`; then
23328                 echo "<termio.h> found." >&4
23329                 val="$define"
23330             else
23331                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23332             fi
23333         fi;;
23334 esac
23335 set i_termio; eval $setvar
23336 val=$val2; set i_sgtty; eval $setvar
23337 val=$val3; set i_termios; eval $setvar
23338
23339 : see if stdbool is available
23340 : we want a real compile instead of Inhdr because some Solaris systems
23341 : have stdbool.h, but it can only be used if the compiler indicates it
23342 : is sufficiently c99-compliant.
23343 echo " "
23344 $cat >try.c <<EOCP
23345 #include <stdio.h>
23346 #include <stdbool.h>
23347 int func(bool x)
23348 {
23349     return x ? 1 : 0;
23350 }
23351 int main(int argc, char **argv)
23352 {
23353     return func(0);
23354 }
23355 EOCP
23356 set try
23357 if eval $compile; then
23358         echo "<stdbool.h> found." >&4
23359         val="$define"
23360 else
23361         echo "<stdbool.h> NOT found." >&4
23362         val="$undef"
23363 fi
23364 $rm_try
23365 set i_stdbool
23366 eval $setvar
23367
23368 : see if stdint is available
23369 set stdint.h i_stdint
23370 eval $inhdr
23371
23372 : see if sys/access.h is available
23373 set sys/access.h i_sysaccess
23374 eval $inhdr
23375
23376 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23377 set sys/filio.h i_sysfilio
23378 eval $inhdr
23379 echo " "
23380 if $test `./findhdr sys/ioctl.h`; then
23381         val="$define"
23382         echo '<sys/ioctl.h> found.' >&4
23383 else
23384         val="$undef"
23385         if $test $i_sysfilio = "$define"; then
23386             echo '<sys/ioctl.h> NOT found.' >&4
23387         else
23388                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23389                 $test $i_termio = "$define" && xxx="termio.h"
23390                 $test $i_termios = "$define" && xxx="termios.h"
23391 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23392         fi
23393 fi
23394 set i_sysioctl
23395 eval $setvar
23396
23397 : see if socket ioctl defs are in sys/sockio.h
23398 echo " "
23399 xxx=`./findhdr sys/sockio.h`
23400 if $test "$xxx"; then
23401         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23402                 val="$define"
23403                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23404         else
23405                 val="$undef"
23406                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23407         fi
23408 else
23409         val="$undef"
23410         $cat <<EOM
23411 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23412 EOM
23413 fi
23414 set i_syssockio
23415 eval $setvar
23416
23417 : see if this is a syslog.h system
23418 set syslog.h i_syslog
23419 eval $inhdr
23420
23421 : see if this is a sys/mode.h system
23422 set sys/mode.h i_sysmode
23423 eval $inhdr
23424
23425 : see if there is a sys/poll.h file
23426 set sys/poll.h i_syspoll
23427 eval $inhdr
23428
23429 : see if sys/resource.h has to be included
23430 set sys/resource.h i_sysresrc
23431 eval $inhdr
23432
23433 : see if sys/security.h is available
23434 set sys/security.h i_syssecrt
23435 eval $inhdr
23436
23437 : see if this is a sys/statvfs.h system
23438 set sys/statvfs.h i_sysstatvfs
23439 eval $inhdr
23440
23441 : see if this is a sys/un.h system
23442 set sys/un.h i_sysun
23443 eval $inhdr
23444
23445 : see if this is a sys/utsname.h system
23446 set sys/utsname.h i_sysutsname
23447 eval $inhdr
23448
23449 : see if this is a syswait system
23450 set sys/wait.h i_syswait
23451 eval $inhdr
23452
23453 : see if this is a ustat.h system
23454 set ustat.h i_ustat
23455 eval $inhdr
23456
23457 : see if this is an utime system
23458 set utime.h i_utime
23459 eval $inhdr
23460
23461 : see if this is a vfork system
23462 case "$d_vfork" in
23463 "$define")
23464         set vfork.h i_vfork
23465         eval $inhdr
23466         ;;
23467 *)
23468         i_vfork="$undef"
23469         ;;
23470 esac
23471
23472 : see if wchar.h is present
23473 set wchar.h i_wchar
23474 eval $inhdr
23475
23476 : Check extensions
23477 echo " "
23478 echo "Looking for extensions..." >&4
23479 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23480 : contain old or inaccurate or duplicate values.
23481 nonxs_extensions=''
23482 xs_extensions=''
23483 : We do not use find because it might not be available.
23484 : We do not just use MANIFEST because the user may have dropped
23485 : some additional extensions into the source tree and expect them
23486 : to be built.
23487
23488 : Function to recursively find available extensions, ignoring DynaLoader
23489 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23490 : In 5.10.1 and later, extensions are stored in directories
23491 : like File-Glob instead of the older File/Glob/.
23492 find_extensions='
23493     for xxx in *; do
23494         case "$xxx" in
23495             DynaLoader|dynaload) ;;
23496             *)
23497             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23498             case "$this_ext" in
23499                 Scalar/List/Utils) this_ext="List/Util" ;;
23500                 PathTools)         this_ext="Cwd"       ;;
23501             esac;
23502             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23503             if $contains " $this_ext " "$tdir/$$.tmp"; then
23504                 echo >&4;
23505                 echo "Duplicate directories detected for extension $xxx" >&4;
23506                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23507                 case "$knowitall" in
23508                 "") dflt=y;;
23509                 *) dflt=n;;
23510                 esac;
23511                 . ../UU/myread;
23512                 case "$ans" in
23513                 n*|N*) ;;
23514                 *) echo >&4;
23515                     echo "Ok.  Stopping Configure." >&4;
23516                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23517                     exit 1;;
23518                 esac;
23519                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23520             fi;
23521             $ls -1 "$xxx" > "$tdir/$$.tmp";
23522             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23523                 xs_extensions="$xs_extensions $this_ext";
23524             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23525                 xs_extensions="$xs_extensions $this_ext";
23526             elif $test -d "$xxx"; then
23527                 nonxs_extensions="$nonxs_extensions $this_ext";
23528             fi;
23529             $rm -f "$tdir/$$.tmp";
23530             ;;
23531         esac;
23532     done'
23533 tdir=`pwd`
23534 cd "$rsrc/cpan"
23535 set X
23536 shift
23537 eval $find_extensions
23538 cd "$rsrc/dist"
23539 set X
23540 shift
23541 eval $find_extensions
23542 cd "$rsrc/ext"
23543 set X
23544 shift
23545 eval $find_extensions
23546 set X $xs_extensions
23547 shift
23548 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23549 set X $nonxs_extensions
23550 shift
23551 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23552 cd "$tdir"
23553 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23554
23555 : Now see which are supported on this system.
23556 avail_ext=''
23557 for xxx in $xs_extensions ; do
23558         case "$xxx" in
23559         Amiga*)
23560                 case "$osname" in
23561                 amigaos) avail_ext="$avail_ext $xxx" ;;
23562                 esac
23563                 ;;
23564         DB_File|db_file)
23565                 case "$i_db" in
23566                 $define) avail_ext="$avail_ext $xxx" ;;
23567                 esac
23568                 ;;
23569         GDBM_File|gdbm_fil)
23570                 case "$i_gdbm" in
23571                 $define) avail_ext="$avail_ext $xxx" ;;
23572                 esac
23573                 ;;
23574         IPC/SysV|ipc/sysv)
23575                 : XXX Do we need a useipcsysv variable here
23576                 case "${d_msg}${d_sem}${d_shm}" in
23577                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23578                 esac
23579                 ;;
23580         NDBM_File|ndbm_fil)
23581                 case "$d_ndbm" in
23582                 $define)
23583                     case "$osname-$use64bitint" in
23584                     hpux-define)
23585                         case "$libs" in
23586                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23587                         esac
23588                         ;;
23589                     *) avail_ext="$avail_ext $xxx" ;;
23590                     esac
23591                     ;;
23592                 esac
23593                 ;;
23594         ODBM_File|odbm_fil)
23595                 case "${i_dbm}${i_rpcsvcdbm}" in
23596                 *"${define}"*)
23597                     case "$d_cplusplus" in
23598                     define) ;; # delete as a function name will not work
23599                     *)  case "$osname-$use64bitint" in
23600                         hpux-define)
23601                             case "$libs" in
23602                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23603                             esac
23604                             ;;
23605                         *) avail_ext="$avail_ext $xxx" ;;
23606                         esac
23607                         ;;
23608                     esac
23609                     ;;
23610                 esac
23611                 ;;
23612         Opcode|opcode)
23613                 case "$useopcode" in
23614                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23615                 esac
23616                 ;;
23617         POSIX|posix)
23618                 case "$useposix" in
23619                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23620                 esac
23621                 ;;
23622         Socket|socket)
23623                 case "$d_socket" in
23624                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23625                 esac
23626                 ;;
23627         I18N/Langinfo|langinfo)
23628                 case "$uselanginfo" in
23629                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23630                 esac
23631                 ;;
23632         Sys/Syslog|sys/syslog)
23633                 case $osname in
23634                         amigaos) ;; # not really very useful on AmigaOS
23635                         *)
23636                         : XXX syslog requires socket
23637                         case "$d_socket" in
23638                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23639                         esac
23640                         ;;
23641                 esac
23642                 ;;
23643         Thread|thread)
23644                 case "$usethreads" in
23645                 true|$define|y)
23646                         case "$use5005threads" in
23647                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23648                         esac
23649                 esac
23650                 ;;
23651         threads|threads/shared)
23652                 # threads and threads::shared are special cases.
23653                 # To stop people from asking "Perl 5.8.0 was supposed
23654                 # to have this new fancy threads implementation but my
23655                 # perl doesn't have it" and from people trying to
23656                 # (re)install the threads module using CPAN.pm and
23657                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23658                 # the threads.pm and threads/shared.pm will always be
23659                 # there, croaking informatively ("you need to rebuild
23660                 # all of Perl with threads, sorry") when threads haven't
23661                 # been compiled in.
23662                 # --jhi
23663                 avail_ext="$avail_ext $xxx"
23664                 ;;
23665         VMS*)
23666                 ;;
23667         Win32*)
23668                 case "$osname" in
23669                 cygwin) avail_ext="$avail_ext $xxx" ;;
23670                 esac
23671                 ;;
23672         XS/APItest|xs/apitest)
23673                 # This is just for testing.  Skip it unless we have dynamic loading.
23674
23675                 case "$usedl" in
23676                 $define) avail_ext="$avail_ext $xxx" ;;
23677                 esac
23678                 ;;
23679         XS/Typemap|xs/typemap)
23680                 # This is just for testing.  Skip it unless we have dynamic loading.
23681                 case "$usedl" in
23682                 $define) avail_ext="$avail_ext $xxx" ;;
23683                 esac
23684                 ;;
23685         *)      avail_ext="$avail_ext $xxx"
23686                 ;;
23687         esac
23688 done
23689
23690 set X $avail_ext
23691 shift
23692 avail_ext="$*"
23693
23694 case "$onlyextensions" in
23695 '') ;;
23696 *)  keepextensions=''
23697     echo "You have requested that only certain extensions be included..." >&4
23698     for i in $onlyextensions; do
23699         case " $avail_ext " in
23700         *" $i "*)
23701             echo "Keeping extension $i."
23702             keepextensions="$keepextensions $i"
23703             ;;
23704         *) echo "Ignoring extension $i." ;;
23705         esac
23706     done
23707     avail_ext="$keepextensions"
23708     ;;
23709 esac
23710
23711 case "$noextensions" in
23712 '') ;;
23713 *)  keepextensions=''
23714     echo "You have requested that certain extensions be ignored..." >&4
23715     for i in $avail_ext; do
23716         case " $noextensions " in
23717         *" $i "*) echo "Ignoring extension $i." ;;
23718         *) echo "Keeping extension $i.";
23719            keepextensions="$keepextensions $i"
23720            ;;
23721         esac
23722     done
23723     avail_ext="$keepextensions"
23724     ;;
23725 esac
23726
23727 : Now see which nonxs extensions are supported on this system.
23728 : For now assume all are.
23729 nonxs_ext=''
23730 for xxx in $nonxs_extensions ; do
23731         case "$xxx" in
23732         VMS*)
23733                 ;;
23734         *)      nonxs_ext="$nonxs_ext $xxx"
23735                 ;;
23736         esac
23737 done
23738
23739 set X $nonxs_ext
23740 shift
23741 nonxs_ext="$*"
23742
23743 case $usedl in
23744 $define)
23745         $cat <<EOM
23746 A number of extensions are supplied with $package.  You may choose to
23747 compile these extensions for dynamic loading (the default), compile
23748 them into the $package executable (static loading), or not include
23749 them at all.  Answer "none" to include no extensions.
23750 Note that DynaLoader is always built and need not be mentioned here.
23751
23752 EOM
23753         case "$dynamic_ext" in
23754         '')
23755                 : Exclude those listed in static_ext
23756                 dflt=''
23757                 for xxx in $avail_ext; do
23758                         case " $static_ext " in
23759                         *" $xxx "*) ;;
23760                         *) dflt="$dflt $xxx" ;;
23761                         esac
23762                 done
23763                 set X $dflt
23764                 shift
23765                 dflt="$*"
23766                 ;;
23767         *)      dflt="$dynamic_ext"
23768                 # Perhaps we are reusing an old out-of-date config.sh.
23769                 case "$hint" in
23770                 previous)
23771                         if test X"$dynamic_ext" != X"$avail_ext"; then
23772                                 $cat <<EOM
23773 NOTICE:  Your previous config.sh list may be incorrect.
23774 The extensions now available to you are
23775         ${avail_ext}
23776 but the default list from your previous config.sh is
23777         ${dynamic_ext}
23778
23779 EOM
23780                         fi
23781                         ;;
23782                 esac
23783                 ;;
23784         esac
23785         case "$dflt" in
23786         '')     dflt=none;;
23787         esac
23788         rp="What extensions do you wish to load dynamically?"
23789         . ./myread
23790         case "$ans" in
23791         none) dynamic_ext=' ' ;;
23792         *) dynamic_ext="$ans" ;;
23793         esac
23794
23795         case "$static_ext" in
23796         '')
23797                 : Exclude those already listed in dynamic linking
23798                 dflt=''
23799                 for xxx in $avail_ext; do
23800                         case " $dynamic_ext " in
23801                         *" $xxx "*) ;;
23802                         *) dflt="$dflt $xxx" ;;
23803                         esac
23804                 done
23805                 set X $dflt
23806                 shift
23807                 dflt="$*"
23808                 ;;
23809         *)  dflt="$static_ext"
23810                 ;;
23811         esac
23812
23813         case "$dflt" in
23814         '')     dflt=none;;
23815         esac
23816         rp="What extensions do you wish to load statically?"
23817         . ./myread
23818         case "$ans" in
23819         none) static_ext=' ' ;;
23820         *) static_ext="$ans" ;;
23821         esac
23822         ;;
23823 *)
23824         $cat <<EOM
23825 A number of extensions are supplied with $package.  Answer "none"
23826 to include no extensions.
23827 Note that DynaLoader is always built and need not be mentioned here.
23828
23829 EOM
23830         case "$static_ext" in
23831         '') dflt="$avail_ext" ;;
23832         *)      dflt="$static_ext"
23833                 # Perhaps we are reusing an old out-of-date config.sh.
23834                 case "$hint" in
23835                 previous)
23836                         if test X"$static_ext" != X"$avail_ext"; then
23837                                 $cat <<EOM
23838 NOTICE:  Your previous config.sh list may be incorrect.
23839 The extensions now available to you are
23840         ${avail_ext}
23841 but the default list from your previous config.sh is
23842         ${static_ext}
23843
23844 EOM
23845                         fi
23846                         ;;
23847                 esac
23848                 ;;
23849         esac
23850         : Exclude those that are not xs extensions
23851         case "$dflt" in
23852         '')     dflt=none;;
23853         esac
23854         rp="What extensions do you wish to include?"
23855         . ./myread
23856         case "$ans" in
23857         none) static_ext=' ' ;;
23858         *) static_ext="$ans" ;;
23859         esac
23860         ;;
23861 esac
23862 #
23863 # Encode is a special case.  If we are building Encode as a static
23864 # extension, we need to explicitly list its subextensions as well.
23865 # For other nested extensions, this is handled automatically by
23866 # the appropriate Makefile.PL.
23867 case " $static_ext " in
23868         *" Encode "*) # Add the subextensions of Encode
23869         cd "$rsrc/cpan"
23870         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23871                 static_ext="$static_ext Encode/$xxx"
23872                 known_extensions="$known_extensions Encode/$xxx"
23873         done
23874         cd "$tdir"
23875         ;;
23876 esac
23877
23878 set X $dynamic_ext $static_ext $nonxs_ext
23879 shift
23880 extensions="$*"
23881
23882 # Sanity check:  We require an extension suitable for use with
23883 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23884 # should show up as failures in the test suite, but it's helpful to
23885 # catch them now.) The 'extensions' list is normally sorted
23886 # alphabetically, so we need to accept either
23887 #    DB_File ... Fcntl ... IO  ....
23888 # or something like
23889 #    Fcntl ... NDBM_File ... IO  ....
23890 case " $extensions"  in
23891 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23892 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23893 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23894 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23895    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23896    ;;
23897 esac
23898
23899 : Remove libraries needed only for extensions
23900 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23901 : The exception is SunOS 4.x, which needs them.
23902 case "${osname}X${osvers}" in
23903 sunos*X4*)
23904     perllibs="$libs"
23905     ;;
23906 *) case "$usedl" in
23907     $define|true|[yY]*)
23908             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23909             shift
23910             perllibs="$*"
23911             ;;
23912     *)  perllibs="$libs"
23913             ;;
23914     esac
23915     ;;
23916 esac
23917
23918 : Remove build directory name from cppstdin so it can be used from
23919 : either the present location or the final installed location.
23920 echo " "
23921 : Get out of the UU directory to get correct path name.
23922 cd ..
23923 case "$cppstdin" in
23924 `pwd`/cppstdin)
23925         echo "Stripping down cppstdin path name"
23926         cppstdin=cppstdin
23927         ;;
23928 esac
23929 cd UU
23930
23931 : end of configuration questions
23932 echo " "
23933 echo "End of configuration questions."
23934 echo " "
23935
23936 : back to where it started
23937 if test -d ../UU; then
23938         cd ..
23939 fi
23940
23941 : configuration may be unconditionally patched via a 'config.arch' file
23942 if $test -f config.arch; then
23943         echo "I see a config.arch file, loading it." >&4
23944         . ./config.arch
23945 fi
23946
23947 : configuration may be patched via a 'config.over' file
23948 if $test -f config.over; then
23949         echo " "
23950         dflt=y
23951         rp='I see a config.over file.  Do you wish to load it?'
23952         . UU/myread
23953         case "$ans" in
23954         n*) echo "OK, I'll ignore it.";;
23955         *)      . ./config.over
23956                 echo "Configuration override changes have been loaded."
23957                 ;;
23958         esac
23959 fi
23960
23961 : in case they want portability, strip down executable paths
23962 case "$d_portable" in
23963 "$define")
23964         echo " "
23965         echo "Stripping down executable paths..." >&4
23966         for file in $loclist $trylist; do
23967                 eval temp=\$$file
23968                 eval $file=`basename $temp`
23969         done
23970         ;;
23971 esac
23972
23973 : create config.sh file
23974 echo " "
23975 echo "Creating config.sh..." >&4
23976 $spitshell <<EOT >config.sh
23977 $startsh
23978 #
23979 # This file was produced by running the Configure script. It holds all the
23980 # definitions figured out by Configure. Should you modify one of these values,
23981 # do not forget to propagate your changes by running "Configure -der". You may
23982 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23983 #
23984
23985 # Package name      : $package
23986 # Source directory  : $src
23987 # Configuration time: $cf_time
23988 # Configured by     : $cf_by
23989 # Target system     : $myuname
23990
23991 EOT
23992 : Add in command line options if available
23993 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23994
23995 $spitshell <<EOT >>config.sh
23996
23997 Author='$Author'
23998 Date='$Date'
23999 Header='$Header'
24000 Id='$Id'
24001 Locker='$Locker'
24002 Log='$Log'
24003 RCSfile='$RCSfile'
24004 Revision='$Revision'
24005 Source='$Source'
24006 State='$State'
24007 _a='$_a'
24008 _exe='$_exe'
24009 _o='$_o'
24010 afs='$afs'
24011 afsroot='$afsroot'
24012 alignbytes='$alignbytes'
24013 aphostname='$aphostname'
24014 api_revision='$api_revision'
24015 api_subversion='$api_subversion'
24016 api_version='$api_version'
24017 api_versionstring='$api_versionstring'
24018 ar='$ar'
24019 archlib='$archlib'
24020 archlibexp='$archlibexp'
24021 archname64='$archname64'
24022 archname='$archname'
24023 archobjs='$archobjs'
24024 asctime_r_proto='$asctime_r_proto'
24025 awk='$awk'
24026 baserev='$baserev'
24027 bash='$bash'
24028 bin='$bin'
24029 bin_ELF='$bin_ELF'
24030 binexp='$binexp'
24031 bison='$bison'
24032 byacc='$byacc'
24033 byteorder='$byteorder'
24034 c='$c'
24035 castflags='$castflags'
24036 cat='$cat'
24037 cc='$cc'
24038 cccdlflags='$cccdlflags'
24039 ccdlflags='$ccdlflags'
24040 ccflags='$ccflags'
24041 ccflags_uselargefiles='$ccflags_uselargefiles'
24042 ccname='$ccname'
24043 ccsymbols='$ccsymbols'
24044 ccversion='$ccversion'
24045 cf_by='$cf_by'
24046 cf_email='$cf_email'
24047 cf_time='$cf_time'
24048 charbits='$charbits'
24049 charsize='$charsize'
24050 chgrp='$chgrp'
24051 chmod='$chmod'
24052 chown='$chown'
24053 clocktype='$clocktype'
24054 comm='$comm'
24055 compress='$compress'
24056 contains='$contains'
24057 cp='$cp'
24058 cpio='$cpio'
24059 cpp='$cpp'
24060 cpp_stuff='$cpp_stuff'
24061 cppccsymbols='$cppccsymbols'
24062 cppflags='$cppflags'
24063 cpplast='$cpplast'
24064 cppminus='$cppminus'
24065 cpprun='$cpprun'
24066 cppstdin='$cppstdin'
24067 cppsymbols='$cppsymbols'
24068 crypt_r_proto='$crypt_r_proto'
24069 cryptlib='$cryptlib'
24070 csh='$csh'
24071 ctermid_r_proto='$ctermid_r_proto'
24072 ctime_r_proto='$ctime_r_proto'
24073 d_Gconvert='$d_Gconvert'
24074 d_PRIEUldbl='$d_PRIEUldbl'
24075 d_PRIFUldbl='$d_PRIFUldbl'
24076 d_PRIGUldbl='$d_PRIGUldbl'
24077 d_PRIXU64='$d_PRIXU64'
24078 d_PRId64='$d_PRId64'
24079 d_PRIeldbl='$d_PRIeldbl'
24080 d_PRIfldbl='$d_PRIfldbl'
24081 d_PRIgldbl='$d_PRIgldbl'
24082 d_PRIi64='$d_PRIi64'
24083 d_PRIo64='$d_PRIo64'
24084 d_PRIu64='$d_PRIu64'
24085 d_PRIx64='$d_PRIx64'
24086 d_SCNfldbl='$d_SCNfldbl'
24087 d__fwalk='$d__fwalk'
24088 d_accept4='$d_accept4'
24089 d_access='$d_access'
24090 d_accessx='$d_accessx'
24091 d_acosh='$d_acosh'
24092 d_aintl='$d_aintl'
24093 d_alarm='$d_alarm'
24094 d_archlib='$d_archlib'
24095 d_asctime64='$d_asctime64'
24096 d_asctime_r='$d_asctime_r'
24097 d_asinh='$d_asinh'
24098 d_atanh='$d_atanh'
24099 d_atolf='$d_atolf'
24100 d_atoll='$d_atoll'
24101 d_attribute_always_inline='$d_attribute_always_inline'
24102 d_attribute_deprecated='$d_attribute_deprecated'
24103 d_attribute_format='$d_attribute_format'
24104 d_attribute_malloc='$d_attribute_malloc'
24105 d_attribute_nonnull='$d_attribute_nonnull'
24106 d_attribute_noreturn='$d_attribute_noreturn'
24107 d_attribute_pure='$d_attribute_pure'
24108 d_attribute_unused='$d_attribute_unused'
24109 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24110 d_backtrace='$d_backtrace'
24111 d_bsd='$d_bsd'
24112 d_bsdgetpgrp='$d_bsdgetpgrp'
24113 d_bsdsetpgrp='$d_bsdsetpgrp'
24114 d_builtin_add_overflow='$d_builtin_add_overflow'
24115 d_builtin_choose_expr='$d_builtin_choose_expr'
24116 d_builtin_expect='$d_builtin_expect'
24117 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24118 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24119 d_c99_variadic_macros='$d_c99_variadic_macros'
24120 d_casti32='$d_casti32'
24121 d_castneg='$d_castneg'
24122 d_cbrt='$d_cbrt'
24123 d_chown='$d_chown'
24124 d_chroot='$d_chroot'
24125 d_chsize='$d_chsize'
24126 d_class='$d_class'
24127 d_clearenv='$d_clearenv'
24128 d_closedir='$d_closedir'
24129 d_cmsghdr_s='$d_cmsghdr_s'
24130 d_copysign='$d_copysign'
24131 d_copysignl='$d_copysignl'
24132 d_cplusplus='$d_cplusplus'
24133 d_crypt='$d_crypt'
24134 d_crypt_r='$d_crypt_r'
24135 d_csh='$d_csh'
24136 d_ctermid='$d_ctermid'
24137 d_ctermid_r='$d_ctermid_r'
24138 d_ctime64='$d_ctime64'
24139 d_ctime_r='$d_ctime_r'
24140 d_cuserid='$d_cuserid'
24141 d_dbminitproto='$d_dbminitproto'
24142 d_difftime64='$d_difftime64'
24143 d_difftime='$d_difftime'
24144 d_dir_dd_fd='$d_dir_dd_fd'
24145 d_dirfd='$d_dirfd'
24146 d_dirnamlen='$d_dirnamlen'
24147 d_dladdr='$d_dladdr'
24148 d_dlerror='$d_dlerror'
24149 d_dlopen='$d_dlopen'
24150 d_dlsymun='$d_dlsymun'
24151 d_dosuid='$d_dosuid'
24152 d_double_has_inf='$d_double_has_inf'
24153 d_double_has_nan='$d_double_has_nan'
24154 d_double_has_negative_zero='$d_double_has_negative_zero'
24155 d_double_has_subnormals='$d_double_has_subnormals'
24156 d_double_style_cray='$d_double_style_cray'
24157 d_double_style_ibm='$d_double_style_ibm'
24158 d_double_style_ieee='$d_double_style_ieee'
24159 d_double_style_vax='$d_double_style_vax'
24160 d_drand48_r='$d_drand48_r'
24161 d_drand48proto='$d_drand48proto'
24162 d_dup2='$d_dup2'
24163 d_dup3='$d_dup3'
24164 d_duplocale='$d_duplocale'
24165 d_eaccess='$d_eaccess'
24166 d_endgrent='$d_endgrent'
24167 d_endgrent_r='$d_endgrent_r'
24168 d_endhent='$d_endhent'
24169 d_endhostent_r='$d_endhostent_r'
24170 d_endnent='$d_endnent'
24171 d_endnetent_r='$d_endnetent_r'
24172 d_endpent='$d_endpent'
24173 d_endprotoent_r='$d_endprotoent_r'
24174 d_endpwent='$d_endpwent'
24175 d_endpwent_r='$d_endpwent_r'
24176 d_endsent='$d_endsent'
24177 d_endservent_r='$d_endservent_r'
24178 d_eofnblk='$d_eofnblk'
24179 d_erf='$d_erf'
24180 d_erfc='$d_erfc'
24181 d_eunice='$d_eunice'
24182 d_exp2='$d_exp2'
24183 d_expm1='$d_expm1'
24184 d_faststdio='$d_faststdio'
24185 d_fchdir='$d_fchdir'
24186 d_fchmod='$d_fchmod'
24187 d_fchmodat='$d_fchmodat'
24188 d_fchown='$d_fchown'
24189 d_fcntl='$d_fcntl'
24190 d_fcntl_can_lock='$d_fcntl_can_lock'
24191 d_fd_macros='$d_fd_macros'
24192 d_fd_set='$d_fd_set'
24193 d_fdclose='$d_fdclose'
24194 d_fdim='$d_fdim'
24195 d_fds_bits='$d_fds_bits'
24196 d_fegetround='$d_fegetround'
24197 d_fgetpos='$d_fgetpos'
24198 d_finite='$d_finite'
24199 d_finitel='$d_finitel'
24200 d_flexfnam='$d_flexfnam'
24201 d_flock='$d_flock'
24202 d_flockproto='$d_flockproto'
24203 d_fma='$d_fma'
24204 d_fmax='$d_fmax'
24205 d_fmin='$d_fmin'
24206 d_fork='$d_fork'
24207 d_fp_class='$d_fp_class'
24208 d_fp_classify='$d_fp_classify'
24209 d_fp_classl='$d_fp_classl'
24210 d_fpathconf='$d_fpathconf'
24211 d_fpclass='$d_fpclass'
24212 d_fpclassify='$d_fpclassify'
24213 d_fpclassl='$d_fpclassl'
24214 d_fpgetround='$d_fpgetround'
24215 d_fpos64_t='$d_fpos64_t'
24216 d_freelocale='$d_freelocale'
24217 d_frexpl='$d_frexpl'
24218 d_fs_data_s='$d_fs_data_s'
24219 d_fseeko='$d_fseeko'
24220 d_fsetpos='$d_fsetpos'
24221 d_fstatfs='$d_fstatfs'
24222 d_fstatvfs='$d_fstatvfs'
24223 d_fsync='$d_fsync'
24224 d_ftello='$d_ftello'
24225 d_ftime='$d_ftime'
24226 d_futimes='$d_futimes'
24227 d_gai_strerror='$d_gai_strerror'
24228 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24229 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24230 d_getaddrinfo='$d_getaddrinfo'
24231 d_getcwd='$d_getcwd'
24232 d_getespwnam='$d_getespwnam'
24233 d_getfsstat='$d_getfsstat'
24234 d_getgrent='$d_getgrent'
24235 d_getgrent_r='$d_getgrent_r'
24236 d_getgrgid_r='$d_getgrgid_r'
24237 d_getgrnam_r='$d_getgrnam_r'
24238 d_getgrps='$d_getgrps'
24239 d_gethbyaddr='$d_gethbyaddr'
24240 d_gethbyname='$d_gethbyname'
24241 d_gethent='$d_gethent'
24242 d_gethname='$d_gethname'
24243 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24244 d_gethostbyname_r='$d_gethostbyname_r'
24245 d_gethostent_r='$d_gethostent_r'
24246 d_gethostprotos='$d_gethostprotos'
24247 d_getitimer='$d_getitimer'
24248 d_getlogin='$d_getlogin'
24249 d_getlogin_r='$d_getlogin_r'
24250 d_getmnt='$d_getmnt'
24251 d_getmntent='$d_getmntent'
24252 d_getnameinfo='$d_getnameinfo'
24253 d_getnbyaddr='$d_getnbyaddr'
24254 d_getnbyname='$d_getnbyname'
24255 d_getnent='$d_getnent'
24256 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24257 d_getnetbyname_r='$d_getnetbyname_r'
24258 d_getnetent_r='$d_getnetent_r'
24259 d_getnetprotos='$d_getnetprotos'
24260 d_getpagsz='$d_getpagsz'
24261 d_getpbyname='$d_getpbyname'
24262 d_getpbynumber='$d_getpbynumber'
24263 d_getpent='$d_getpent'
24264 d_getpgid='$d_getpgid'
24265 d_getpgrp2='$d_getpgrp2'
24266 d_getpgrp='$d_getpgrp'
24267 d_getppid='$d_getppid'
24268 d_getprior='$d_getprior'
24269 d_getprotobyname_r='$d_getprotobyname_r'
24270 d_getprotobynumber_r='$d_getprotobynumber_r'
24271 d_getprotoent_r='$d_getprotoent_r'
24272 d_getprotoprotos='$d_getprotoprotos'
24273 d_getprpwnam='$d_getprpwnam'
24274 d_getpwent='$d_getpwent'
24275 d_getpwent_r='$d_getpwent_r'
24276 d_getpwnam_r='$d_getpwnam_r'
24277 d_getpwuid_r='$d_getpwuid_r'
24278 d_getsbyname='$d_getsbyname'
24279 d_getsbyport='$d_getsbyport'
24280 d_getsent='$d_getsent'
24281 d_getservbyname_r='$d_getservbyname_r'
24282 d_getservbyport_r='$d_getservbyport_r'
24283 d_getservent_r='$d_getservent_r'
24284 d_getservprotos='$d_getservprotos'
24285 d_getspnam='$d_getspnam'
24286 d_getspnam_r='$d_getspnam_r'
24287 d_gettimeod='$d_gettimeod'
24288 d_gmtime64='$d_gmtime64'
24289 d_gmtime_r='$d_gmtime_r'
24290 d_gnulibc='$d_gnulibc'
24291 d_grpasswd='$d_grpasswd'
24292 d_has_C_UTF8='$d_has_C_UTF8'
24293 d_hasmntopt='$d_hasmntopt'
24294 d_htonl='$d_htonl'
24295 d_hypot='$d_hypot'
24296 d_ilogb='$d_ilogb'
24297 d_ilogbl='$d_ilogbl'
24298 d_inc_version_list='$d_inc_version_list'
24299 d_inetaton='$d_inetaton'
24300 d_inetntop='$d_inetntop'
24301 d_inetpton='$d_inetpton'
24302 d_int64_t='$d_int64_t'
24303 d_ip_mreq='$d_ip_mreq'
24304 d_ip_mreq_source='$d_ip_mreq_source'
24305 d_ipv6_mreq='$d_ipv6_mreq'
24306 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24307 d_isascii='$d_isascii'
24308 d_isblank='$d_isblank'
24309 d_isfinite='$d_isfinite'
24310 d_isfinitel='$d_isfinitel'
24311 d_isinf='$d_isinf'
24312 d_isinfl='$d_isinfl'
24313 d_isless='$d_isless'
24314 d_isnan='$d_isnan'
24315 d_isnanl='$d_isnanl'
24316 d_isnormal='$d_isnormal'
24317 d_j0='$d_j0'
24318 d_j0l='$d_j0l'
24319 d_killpg='$d_killpg'
24320 d_lc_monetary_2008='$d_lc_monetary_2008'
24321 d_lchown='$d_lchown'
24322 d_ldbl_dig='$d_ldbl_dig'
24323 d_ldexpl='$d_ldexpl'
24324 d_lgamma='$d_lgamma'
24325 d_lgamma_r='$d_lgamma_r'
24326 d_libm_lib_version='$d_libm_lib_version'
24327 d_libname_unique='$d_libname_unique'
24328 d_link='$d_link'
24329 d_linkat='$d_linkat'
24330 d_llrint='$d_llrint'
24331 d_llrintl='$d_llrintl'
24332 d_llround='$d_llround'
24333 d_llroundl='$d_llroundl'
24334 d_localeconv_l='$d_localeconv_l'
24335 d_localtime64='$d_localtime64'
24336 d_localtime_r='$d_localtime_r'
24337 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24338 d_locconv='$d_locconv'
24339 d_lockf='$d_lockf'
24340 d_log1p='$d_log1p'
24341 d_log2='$d_log2'
24342 d_logb='$d_logb'
24343 d_long_double_style_ieee='$d_long_double_style_ieee'
24344 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24345 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24346 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24347 d_long_double_style_vax='$d_long_double_style_vax'
24348 d_longdbl='$d_longdbl'
24349 d_longlong='$d_longlong'
24350 d_lrint='$d_lrint'
24351 d_lrintl='$d_lrintl'
24352 d_lround='$d_lround'
24353 d_lroundl='$d_lroundl'
24354 d_lseekproto='$d_lseekproto'
24355 d_lstat='$d_lstat'
24356 d_madvise='$d_madvise'
24357 d_malloc_good_size='$d_malloc_good_size'
24358 d_malloc_size='$d_malloc_size'
24359 d_malloc_usable_size='$d_malloc_usable_size'
24360 d_mblen='$d_mblen'
24361 d_mbrlen='$d_mbrlen'
24362 d_mbrtowc='$d_mbrtowc'
24363 d_mbstowcs='$d_mbstowcs'
24364 d_mbtowc='$d_mbtowc'
24365 d_memmem='$d_memmem'
24366 d_memrchr='$d_memrchr'
24367 d_mkdir='$d_mkdir'
24368 d_mkdtemp='$d_mkdtemp'
24369 d_mkfifo='$d_mkfifo'
24370 d_mkostemp='$d_mkostemp'
24371 d_mkstemp='$d_mkstemp'
24372 d_mkstemps='$d_mkstemps'
24373 d_mktime64='$d_mktime64'
24374 d_mktime='$d_mktime'
24375 d_mmap='$d_mmap'
24376 d_modfl='$d_modfl'
24377 d_modflproto='$d_modflproto'
24378 d_mprotect='$d_mprotect'
24379 d_msg='$d_msg'
24380 d_msg_ctrunc='$d_msg_ctrunc'
24381 d_msg_dontroute='$d_msg_dontroute'
24382 d_msg_oob='$d_msg_oob'
24383 d_msg_peek='$d_msg_peek'
24384 d_msg_proxy='$d_msg_proxy'
24385 d_msgctl='$d_msgctl'
24386 d_msgget='$d_msgget'
24387 d_msghdr_s='$d_msghdr_s'
24388 d_msgrcv='$d_msgrcv'
24389 d_msgsnd='$d_msgsnd'
24390 d_msync='$d_msync'
24391 d_munmap='$d_munmap'
24392 d_mymalloc='$d_mymalloc'
24393 d_nan='$d_nan'
24394 d_nanosleep='$d_nanosleep'
24395 d_ndbm='$d_ndbm'
24396 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24397 d_nearbyint='$d_nearbyint'
24398 d_newlocale='$d_newlocale'
24399 d_nextafter='$d_nextafter'
24400 d_nexttoward='$d_nexttoward'
24401 d_nice='$d_nice'
24402 d_nl_langinfo='$d_nl_langinfo'
24403 d_nv_preserves_uv='$d_nv_preserves_uv'
24404 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24405 d_off64_t='$d_off64_t'
24406 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24407 d_oldpthreads='$d_oldpthreads'
24408 d_oldsock='$d_oldsock'
24409 d_open3='$d_open3'
24410 d_openat='$d_openat'
24411 d_pathconf='$d_pathconf'
24412 d_pause='$d_pause'
24413 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24414 d_phostname='$d_phostname'
24415 d_pipe2='$d_pipe2'
24416 d_pipe='$d_pipe'
24417 d_poll='$d_poll'
24418 d_portable='$d_portable'
24419 d_prctl='$d_prctl'
24420 d_prctl_set_name='$d_prctl_set_name'
24421 d_printf_format_null='$d_printf_format_null'
24422 d_procselfexe='$d_procselfexe'
24423 d_pseudofork='$d_pseudofork'
24424 d_pthread_atfork='$d_pthread_atfork'
24425 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24426 d_pthread_yield='$d_pthread_yield'
24427 d_ptrdiff_t='$d_ptrdiff_t'
24428 d_pwage='$d_pwage'
24429 d_pwchange='$d_pwchange'
24430 d_pwclass='$d_pwclass'
24431 d_pwcomment='$d_pwcomment'
24432 d_pwexpire='$d_pwexpire'
24433 d_pwgecos='$d_pwgecos'
24434 d_pwpasswd='$d_pwpasswd'
24435 d_pwquota='$d_pwquota'
24436 d_qgcvt='$d_qgcvt'
24437 d_quad='$d_quad'
24438 d_querylocale='$d_querylocale'
24439 d_random_r='$d_random_r'
24440 d_re_comp='$d_re_comp'
24441 d_readdir64_r='$d_readdir64_r'
24442 d_readdir='$d_readdir'
24443 d_readdir_r='$d_readdir_r'
24444 d_readlink='$d_readlink'
24445 d_readv='$d_readv'
24446 d_recvmsg='$d_recvmsg'
24447 d_regcmp='$d_regcmp'
24448 d_regcomp='$d_regcomp'
24449 d_remainder='$d_remainder'
24450 d_remquo='$d_remquo'
24451 d_rename='$d_rename'
24452 d_renameat='$d_renameat'
24453 d_rewinddir='$d_rewinddir'
24454 d_rint='$d_rint'
24455 d_rmdir='$d_rmdir'
24456 d_round='$d_round'
24457 d_sbrkproto='$d_sbrkproto'
24458 d_scalbn='$d_scalbn'
24459 d_scalbnl='$d_scalbnl'
24460 d_sched_yield='$d_sched_yield'
24461 d_scm_rights='$d_scm_rights'
24462 d_seekdir='$d_seekdir'
24463 d_select='$d_select'
24464 d_sem='$d_sem'
24465 d_semctl='$d_semctl'
24466 d_semctl_semid_ds='$d_semctl_semid_ds'
24467 d_semctl_semun='$d_semctl_semun'
24468 d_semget='$d_semget'
24469 d_semop='$d_semop'
24470 d_sendmsg='$d_sendmsg'
24471 d_setegid='$d_setegid'
24472 d_seteuid='$d_seteuid'
24473 d_setgrent='$d_setgrent'
24474 d_setgrent_r='$d_setgrent_r'
24475 d_setgrps='$d_setgrps'
24476 d_sethent='$d_sethent'
24477 d_sethostent_r='$d_sethostent_r'
24478 d_setitimer='$d_setitimer'
24479 d_setlinebuf='$d_setlinebuf'
24480 d_setlocale='$d_setlocale'
24481 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24482 d_setlocale_r='$d_setlocale_r'
24483 d_setnent='$d_setnent'
24484 d_setnetent_r='$d_setnetent_r'
24485 d_setpent='$d_setpent'
24486 d_setpgid='$d_setpgid'
24487 d_setpgrp2='$d_setpgrp2'
24488 d_setpgrp='$d_setpgrp'
24489 d_setprior='$d_setprior'
24490 d_setproctitle='$d_setproctitle'
24491 d_setprotoent_r='$d_setprotoent_r'
24492 d_setpwent='$d_setpwent'
24493 d_setpwent_r='$d_setpwent_r'
24494 d_setregid='$d_setregid'
24495 d_setresgid='$d_setresgid'
24496 d_setresuid='$d_setresuid'
24497 d_setreuid='$d_setreuid'
24498 d_setrgid='$d_setrgid'
24499 d_setruid='$d_setruid'
24500 d_setsent='$d_setsent'
24501 d_setservent_r='$d_setservent_r'
24502 d_setsid='$d_setsid'
24503 d_setvbuf='$d_setvbuf'
24504 d_shm='$d_shm'
24505 d_shmat='$d_shmat'
24506 d_shmatprototype='$d_shmatprototype'
24507 d_shmctl='$d_shmctl'
24508 d_shmdt='$d_shmdt'
24509 d_shmget='$d_shmget'
24510 d_sigaction='$d_sigaction'
24511 d_siginfo_si_addr='$d_siginfo_si_addr'
24512 d_siginfo_si_band='$d_siginfo_si_band'
24513 d_siginfo_si_errno='$d_siginfo_si_errno'
24514 d_siginfo_si_fd='$d_siginfo_si_fd'
24515 d_siginfo_si_pid='$d_siginfo_si_pid'
24516 d_siginfo_si_status='$d_siginfo_si_status'
24517 d_siginfo_si_uid='$d_siginfo_si_uid'
24518 d_siginfo_si_value='$d_siginfo_si_value'
24519 d_signbit='$d_signbit'
24520 d_sigprocmask='$d_sigprocmask'
24521 d_sigsetjmp='$d_sigsetjmp'
24522 d_sin6_scope_id='$d_sin6_scope_id'
24523 d_sitearch='$d_sitearch'
24524 d_snprintf='$d_snprintf'
24525 d_sockaddr_in6='$d_sockaddr_in6'
24526 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24527 d_sockaddr_storage='$d_sockaddr_storage'
24528 d_sockatmark='$d_sockatmark'
24529 d_sockatmarkproto='$d_sockatmarkproto'
24530 d_socket='$d_socket'
24531 d_socklen_t='$d_socklen_t'
24532 d_sockpair='$d_sockpair'
24533 d_socks5_init='$d_socks5_init'
24534 d_sqrtl='$d_sqrtl'
24535 d_srand48_r='$d_srand48_r'
24536 d_srandom_r='$d_srandom_r'
24537 d_sresgproto='$d_sresgproto'
24538 d_sresuproto='$d_sresuproto'
24539 d_stat='$d_stat'
24540 d_statblks='$d_statblks'
24541 d_statfs_f_flags='$d_statfs_f_flags'
24542 d_statfs_s='$d_statfs_s'
24543 d_static_inline='$d_static_inline'
24544 d_statvfs='$d_statvfs'
24545 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24546 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24547 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24548 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24549 d_stdio_stream_array='$d_stdio_stream_array'
24550 d_stdiobase='$d_stdiobase'
24551 d_stdstdio='$d_stdstdio'
24552 d_strcoll='$d_strcoll'
24553 d_strerror_l='$d_strerror_l'
24554 d_strerror_r='$d_strerror_r'
24555 d_strftime='$d_strftime'
24556 d_strlcat='$d_strlcat'
24557 d_strlcpy='$d_strlcpy'
24558 d_strnlen='$d_strnlen'
24559 d_strtod='$d_strtod'
24560 d_strtod_l='$d_strtod_l'
24561 d_strtol='$d_strtol'
24562 d_strtold='$d_strtold'
24563 d_strtold_l='$d_strtold_l'
24564 d_strtoll='$d_strtoll'
24565 d_strtoq='$d_strtoq'
24566 d_strtoul='$d_strtoul'
24567 d_strtoull='$d_strtoull'
24568 d_strtouq='$d_strtouq'
24569 d_strxfrm='$d_strxfrm'
24570 d_suidsafe='$d_suidsafe'
24571 d_symlink='$d_symlink'
24572 d_syscall='$d_syscall'
24573 d_syscallproto='$d_syscallproto'
24574 d_sysconf='$d_sysconf'
24575 d_sysernlst='$d_sysernlst'
24576 d_syserrlst='$d_syserrlst'
24577 d_system='$d_system'
24578 d_tcgetpgrp='$d_tcgetpgrp'
24579 d_tcsetpgrp='$d_tcsetpgrp'
24580 d_telldir='$d_telldir'
24581 d_telldirproto='$d_telldirproto'
24582 d_tgamma='$d_tgamma'
24583 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24584 d_time='$d_time'
24585 d_timegm='$d_timegm'
24586 d_times='$d_times'
24587 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24588 d_tm_tm_zone='$d_tm_tm_zone'
24589 d_tmpnam_r='$d_tmpnam_r'
24590 d_towlower='$d_towlower'
24591 d_towupper='$d_towupper'
24592 d_trunc='$d_trunc'
24593 d_truncate='$d_truncate'
24594 d_truncl='$d_truncl'
24595 d_ttyname_r='$d_ttyname_r'
24596 d_tzname='$d_tzname'
24597 d_u32align='$d_u32align'
24598 d_ualarm='$d_ualarm'
24599 d_umask='$d_umask'
24600 d_uname='$d_uname'
24601 d_union_semun='$d_union_semun'
24602 d_unlinkat='$d_unlinkat'
24603 d_unordered='$d_unordered'
24604 d_unsetenv='$d_unsetenv'
24605 d_uselocale='$d_uselocale'
24606 d_usleep='$d_usleep'
24607 d_usleepproto='$d_usleepproto'
24608 d_ustat='$d_ustat'
24609 d_vendorarch='$d_vendorarch'
24610 d_vendorbin='$d_vendorbin'
24611 d_vendorlib='$d_vendorlib'
24612 d_vendorscript='$d_vendorscript'
24613 d_vfork='$d_vfork'
24614 d_void_closedir='$d_void_closedir'
24615 d_voidsig='$d_voidsig'
24616 d_voidtty='$d_voidtty'
24617 d_vsnprintf='$d_vsnprintf'
24618 d_wait4='$d_wait4'
24619 d_waitpid='$d_waitpid'
24620 d_wcrtomb='$d_wcrtomb'
24621 d_wcscmp='$d_wcscmp'
24622 d_wcstombs='$d_wcstombs'
24623 d_wcsxfrm='$d_wcsxfrm'
24624 d_wctomb='$d_wctomb'
24625 d_writev='$d_writev'
24626 d_xenix='$d_xenix'
24627 date='$date'
24628 db_hashtype='$db_hashtype'
24629 db_prefixtype='$db_prefixtype'
24630 db_version_major='$db_version_major'
24631 db_version_minor='$db_version_minor'
24632 db_version_patch='$db_version_patch'
24633 default_inc_excludes_dot='$default_inc_excludes_dot'
24634 direntrytype='$direntrytype'
24635 dlext='$dlext'
24636 dlsrc='$dlsrc'
24637 doubleinfbytes='$doubleinfbytes'
24638 doublekind='$doublekind'
24639 doublemantbits='$doublemantbits'
24640 doublenanbytes='$doublenanbytes'
24641 doublesize='$doublesize'
24642 drand01='$drand01'
24643 drand48_r_proto='$drand48_r_proto'
24644 dtrace='$dtrace'
24645 dtraceobject='$dtraceobject'
24646 dtracexnolibs='$dtracexnolibs'
24647 dynamic_ext='$dynamic_ext'
24648 eagain='$eagain'
24649 ebcdic='$ebcdic'
24650 echo='$echo'
24651 egrep='$egrep'
24652 emacs='$emacs'
24653 endgrent_r_proto='$endgrent_r_proto'
24654 endhostent_r_proto='$endhostent_r_proto'
24655 endnetent_r_proto='$endnetent_r_proto'
24656 endprotoent_r_proto='$endprotoent_r_proto'
24657 endpwent_r_proto='$endpwent_r_proto'
24658 endservent_r_proto='$endservent_r_proto'
24659 eunicefix='$eunicefix'
24660 exe_ext='$exe_ext'
24661 expr='$expr'
24662 extensions='$extensions'
24663 extern_C='$extern_C'
24664 extras='$extras'
24665 fflushNULL='$fflushNULL'
24666 fflushall='$fflushall'
24667 find='$find'
24668 firstmakefile='$firstmakefile'
24669 flex='$flex'
24670 fpossize='$fpossize'
24671 fpostype='$fpostype'
24672 freetype='$freetype'
24673 from='$from'
24674 full_ar='$full_ar'
24675 full_csh='$full_csh'
24676 full_sed='$full_sed'
24677 gccansipedantic='$gccansipedantic'
24678 gccosandvers='$gccosandvers'
24679 gccversion='$gccversion'
24680 getgrent_r_proto='$getgrent_r_proto'
24681 getgrgid_r_proto='$getgrgid_r_proto'
24682 getgrnam_r_proto='$getgrnam_r_proto'
24683 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24684 gethostbyname_r_proto='$gethostbyname_r_proto'
24685 gethostent_r_proto='$gethostent_r_proto'
24686 getlogin_r_proto='$getlogin_r_proto'
24687 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24688 getnetbyname_r_proto='$getnetbyname_r_proto'
24689 getnetent_r_proto='$getnetent_r_proto'
24690 getprotobyname_r_proto='$getprotobyname_r_proto'
24691 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24692 getprotoent_r_proto='$getprotoent_r_proto'
24693 getpwent_r_proto='$getpwent_r_proto'
24694 getpwnam_r_proto='$getpwnam_r_proto'
24695 getpwuid_r_proto='$getpwuid_r_proto'
24696 getservbyname_r_proto='$getservbyname_r_proto'
24697 getservbyport_r_proto='$getservbyport_r_proto'
24698 getservent_r_proto='$getservent_r_proto'
24699 getspnam_r_proto='$getspnam_r_proto'
24700 gidformat='$gidformat'
24701 gidsign='$gidsign'
24702 gidsize='$gidsize'
24703 gidtype='$gidtype'
24704 glibpth='$glibpth'
24705 gmake='$gmake'
24706 gmtime_r_proto='$gmtime_r_proto'
24707 gnulibc_version='$gnulibc_version'
24708 grep='$grep'
24709 groupcat='$groupcat'
24710 groupstype='$groupstype'
24711 gzip='$gzip'
24712 h_fcntl='$h_fcntl'
24713 h_sysfile='$h_sysfile'
24714 hint='$hint'
24715 hostcat='$hostcat'
24716 hostgenerate='$hostgenerate'
24717 hostosname='$hostosname'
24718 hostperl='$hostperl'
24719 html1dir='$html1dir'
24720 html1direxp='$html1direxp'
24721 html3dir='$html3dir'
24722 html3direxp='$html3direxp'
24723 i16size='$i16size'
24724 i16type='$i16type'
24725 i32size='$i32size'
24726 i32type='$i32type'
24727 i64size='$i64size'
24728 i64type='$i64type'
24729 i8size='$i8size'
24730 i8type='$i8type'
24731 i_arpainet='$i_arpainet'
24732 i_bfd='$i_bfd'
24733 i_bsdioctl='$i_bsdioctl'
24734 i_crypt='$i_crypt'
24735 i_db='$i_db'
24736 i_dbm='$i_dbm'
24737 i_dirent='$i_dirent'
24738 i_dlfcn='$i_dlfcn'
24739 i_execinfo='$i_execinfo'
24740 i_fcntl='$i_fcntl'
24741 i_fenv='$i_fenv'
24742 i_fp='$i_fp'
24743 i_fp_class='$i_fp_class'
24744 i_gdbm='$i_gdbm'
24745 i_gdbm_ndbm='$i_gdbm_ndbm'
24746 i_gdbmndbm='$i_gdbmndbm'
24747 i_grp='$i_grp'
24748 i_ieeefp='$i_ieeefp'
24749 i_inttypes='$i_inttypes'
24750 i_langinfo='$i_langinfo'
24751 i_libutil='$i_libutil'
24752 i_locale='$i_locale'
24753 i_machcthr='$i_machcthr'
24754 i_malloc='$i_malloc'
24755 i_mallocmalloc='$i_mallocmalloc'
24756 i_mntent='$i_mntent'
24757 i_ndbm='$i_ndbm'
24758 i_netdb='$i_netdb'
24759 i_neterrno='$i_neterrno'
24760 i_netinettcp='$i_netinettcp'
24761 i_niin='$i_niin'
24762 i_poll='$i_poll'
24763 i_prot='$i_prot'
24764 i_pthread='$i_pthread'
24765 i_pwd='$i_pwd'
24766 i_quadmath='$i_quadmath'
24767 i_rpcsvcdbm='$i_rpcsvcdbm'
24768 i_sgtty='$i_sgtty'
24769 i_shadow='$i_shadow'
24770 i_socks='$i_socks'
24771 i_stdbool='$i_stdbool'
24772 i_stdint='$i_stdint'
24773 i_stdlib='$i_stdlib'
24774 i_sunmath='$i_sunmath'
24775 i_sysaccess='$i_sysaccess'
24776 i_sysdir='$i_sysdir'
24777 i_sysfile='$i_sysfile'
24778 i_sysfilio='$i_sysfilio'
24779 i_sysin='$i_sysin'
24780 i_sysioctl='$i_sysioctl'
24781 i_syslog='$i_syslog'
24782 i_sysmman='$i_sysmman'
24783 i_sysmode='$i_sysmode'
24784 i_sysmount='$i_sysmount'
24785 i_sysndir='$i_sysndir'
24786 i_sysparam='$i_sysparam'
24787 i_syspoll='$i_syspoll'
24788 i_sysresrc='$i_sysresrc'
24789 i_syssecrt='$i_syssecrt'
24790 i_sysselct='$i_sysselct'
24791 i_syssockio='$i_syssockio'
24792 i_sysstat='$i_sysstat'
24793 i_sysstatfs='$i_sysstatfs'
24794 i_sysstatvfs='$i_sysstatvfs'
24795 i_systime='$i_systime'
24796 i_systimek='$i_systimek'
24797 i_systimes='$i_systimes'
24798 i_systypes='$i_systypes'
24799 i_sysuio='$i_sysuio'
24800 i_sysun='$i_sysun'
24801 i_sysutsname='$i_sysutsname'
24802 i_sysvfs='$i_sysvfs'
24803 i_syswait='$i_syswait'
24804 i_termio='$i_termio'
24805 i_termios='$i_termios'
24806 i_time='$i_time'
24807 i_unistd='$i_unistd'
24808 i_ustat='$i_ustat'
24809 i_utime='$i_utime'
24810 i_vfork='$i_vfork'
24811 i_wchar='$i_wchar'
24812 i_wctype='$i_wctype'
24813 i_xlocale='$i_xlocale'
24814 ignore_versioned_solibs='$ignore_versioned_solibs'
24815 inc_version_list='$inc_version_list'
24816 inc_version_list_init='$inc_version_list_init'
24817 incpath='$incpath'
24818 incpth='$incpth'
24819 inews='$inews'
24820 initialinstalllocation='$initialinstalllocation'
24821 installarchlib='$installarchlib'
24822 installbin='$installbin'
24823 installhtml1dir='$installhtml1dir'
24824 installhtml3dir='$installhtml3dir'
24825 installman1dir='$installman1dir'
24826 installman3dir='$installman3dir'
24827 installprefix='$installprefix'
24828 installprefixexp='$installprefixexp'
24829 installprivlib='$installprivlib'
24830 installscript='$installscript'
24831 installsitearch='$installsitearch'
24832 installsitebin='$installsitebin'
24833 installsitehtml1dir='$installsitehtml1dir'
24834 installsitehtml3dir='$installsitehtml3dir'
24835 installsitelib='$installsitelib'
24836 installsiteman1dir='$installsiteman1dir'
24837 installsiteman3dir='$installsiteman3dir'
24838 installsitescript='$installsitescript'
24839 installstyle='$installstyle'
24840 installusrbinperl='$installusrbinperl'
24841 installvendorarch='$installvendorarch'
24842 installvendorbin='$installvendorbin'
24843 installvendorhtml1dir='$installvendorhtml1dir'
24844 installvendorhtml3dir='$installvendorhtml3dir'
24845 installvendorlib='$installvendorlib'
24846 installvendorman1dir='$installvendorman1dir'
24847 installvendorman3dir='$installvendorman3dir'
24848 installvendorscript='$installvendorscript'
24849 intsize='$intsize'
24850 issymlink='$issymlink'
24851 ivdformat='$ivdformat'
24852 ivsize='$ivsize'
24853 ivtype='$ivtype'
24854 known_extensions='$known_extensions'
24855 ksh='$ksh'
24856 ld='$ld'
24857 ld_can_script='$ld_can_script'
24858 lddlflags='$lddlflags'
24859 ldflags='$ldflags'
24860 ldflags_uselargefiles='$ldflags_uselargefiles'
24861 ldlibpthname='$ldlibpthname'
24862 less='$less'
24863 lib_ext='$lib_ext'
24864 libc='$libc'
24865 libperl='$libperl'
24866 libpth='$libpth'
24867 libs='$libs'
24868 libsdirs='$libsdirs'
24869 libsfiles='$libsfiles'
24870 libsfound='$libsfound'
24871 libspath='$libspath'
24872 libswanted='$libswanted'
24873 libswanted_uselargefiles='$libswanted_uselargefiles'
24874 line='$line'
24875 lint='$lint'
24876 lkflags='$lkflags'
24877 ln='$ln'
24878 lns='$lns'
24879 localtime_r_proto='$localtime_r_proto'
24880 locincpth='$locincpth'
24881 loclibpth='$loclibpth'
24882 longdblinfbytes='$longdblinfbytes'
24883 longdblkind='$longdblkind'
24884 longdblmantbits='$longdblmantbits'
24885 longdblnanbytes='$longdblnanbytes'
24886 longdblsize='$longdblsize'
24887 longlongsize='$longlongsize'
24888 longsize='$longsize'
24889 lp='$lp'
24890 lpr='$lpr'
24891 ls='$ls'
24892 lseeksize='$lseeksize'
24893 lseektype='$lseektype'
24894 mail='$mail'
24895 mailx='$mailx'
24896 make='$make'
24897 make_set_make='$make_set_make'
24898 mallocobj='$mallocobj'
24899 mallocsrc='$mallocsrc'
24900 malloctype='$malloctype'
24901 man1dir='$man1dir'
24902 man1direxp='$man1direxp'
24903 man1ext='$man1ext'
24904 man3dir='$man3dir'
24905 man3direxp='$man3direxp'
24906 man3ext='$man3ext'
24907 mips_type='$mips_type'
24908 mistrustnm='$mistrustnm'
24909 mkdir='$mkdir'
24910 mmaptype='$mmaptype'
24911 modetype='$modetype'
24912 more='$more'
24913 multiarch='$multiarch'
24914 mv='$mv'
24915 myarchname='$myarchname'
24916 mydomain='$mydomain'
24917 myhostname='$myhostname'
24918 myuname='$myuname'
24919 n='$n'
24920 need_va_copy='$need_va_copy'
24921 netdb_hlen_type='$netdb_hlen_type'
24922 netdb_host_type='$netdb_host_type'
24923 netdb_name_type='$netdb_name_type'
24924 netdb_net_type='$netdb_net_type'
24925 nm='$nm'
24926 nm_opt='$nm_opt'
24927 nm_so_opt='$nm_so_opt'
24928 nonxs_ext='$nonxs_ext'
24929 nroff='$nroff'
24930 nvEUformat='$nvEUformat'
24931 nvFUformat='$nvFUformat'
24932 nvGUformat='$nvGUformat'
24933 nv_overflows_integers_at='$nv_overflows_integers_at'
24934 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24935 nveformat='$nveformat'
24936 nvfformat='$nvfformat'
24937 nvgformat='$nvgformat'
24938 nvmantbits='$nvmantbits'
24939 nvsize='$nvsize'
24940 nvtype='$nvtype'
24941 o_nonblock='$o_nonblock'
24942 obj_ext='$obj_ext'
24943 old_pthread_create_joinable='$old_pthread_create_joinable'
24944 optimize='$optimize'
24945 orderlib='$orderlib'
24946 osname='$osname'
24947 osvers='$osvers'
24948 otherlibdirs='$otherlibdirs'
24949 package='$package'
24950 pager='$pager'
24951 passcat='$passcat'
24952 patchlevel='$patchlevel'
24953 path_sep='$path_sep'
24954 perl5='$perl5'
24955 perl='$perl'
24956 perl_patchlevel='$perl_patchlevel'
24957 perl_static_inline='$perl_static_inline'
24958 perladmin='$perladmin'
24959 perllibs='$perllibs'
24960 perlpath='$perlpath'
24961 pg='$pg'
24962 phostname='$phostname'
24963 pidtype='$pidtype'
24964 plibpth='$plibpth'
24965 pmake='$pmake'
24966 pr='$pr'
24967 prefix='$prefix'
24968 prefixexp='$prefixexp'
24969 privlib='$privlib'
24970 privlibexp='$privlibexp'
24971 procselfexe='$procselfexe'
24972 ptrsize='$ptrsize'
24973 quadkind='$quadkind'
24974 quadtype='$quadtype'
24975 randbits='$randbits'
24976 randfunc='$randfunc'
24977 random_r_proto='$random_r_proto'
24978 randseedtype='$randseedtype'
24979 ranlib='$ranlib'
24980 rd_nodata='$rd_nodata'
24981 readdir64_r_proto='$readdir64_r_proto'
24982 readdir_r_proto='$readdir_r_proto'
24983 revision='$revision'
24984 rm='$rm'
24985 rm_try='$rm_try'
24986 rmail='$rmail'
24987 run='$run'
24988 runnm='$runnm'
24989 sGMTIME_max='$sGMTIME_max'
24990 sGMTIME_min='$sGMTIME_min'
24991 sLOCALTIME_max='$sLOCALTIME_max'
24992 sLOCALTIME_min='$sLOCALTIME_min'
24993 sPRIEUldbl='$sPRIEUldbl'
24994 sPRIFUldbl='$sPRIFUldbl'
24995 sPRIGUldbl='$sPRIGUldbl'
24996 sPRIXU64='$sPRIXU64'
24997 sPRId64='$sPRId64'
24998 sPRIeldbl='$sPRIeldbl'
24999 sPRIfldbl='$sPRIfldbl'
25000 sPRIgldbl='$sPRIgldbl'
25001 sPRIi64='$sPRIi64'
25002 sPRIo64='$sPRIo64'
25003 sPRIu64='$sPRIu64'
25004 sPRIx64='$sPRIx64'
25005 sSCNfldbl='$sSCNfldbl'
25006 sched_yield='$sched_yield'
25007 scriptdir='$scriptdir'
25008 scriptdirexp='$scriptdirexp'
25009 sed='$sed'
25010 seedfunc='$seedfunc'
25011 selectminbits='$selectminbits'
25012 selecttype='$selecttype'
25013 sendmail='$sendmail'
25014 setgrent_r_proto='$setgrent_r_proto'
25015 sethostent_r_proto='$sethostent_r_proto'
25016 setlocale_r_proto='$setlocale_r_proto'
25017 setnetent_r_proto='$setnetent_r_proto'
25018 setprotoent_r_proto='$setprotoent_r_proto'
25019 setpwent_r_proto='$setpwent_r_proto'
25020 setservent_r_proto='$setservent_r_proto'
25021 sh='$sh'
25022 shar='$shar'
25023 sharpbang='$sharpbang'
25024 shmattype='$shmattype'
25025 shortsize='$shortsize'
25026 shrpenv='$shrpenv'
25027 shsharp='$shsharp'
25028 sig_count='$sig_count'
25029 sig_name='$sig_name'
25030 sig_name_init='$sig_name_init'
25031 sig_num='$sig_num'
25032 sig_num_init='$sig_num_init'
25033 sig_size='$sig_size'
25034 signal_t='$signal_t'
25035 sitearch='$sitearch'
25036 sitearchexp='$sitearchexp'
25037 sitebin='$sitebin'
25038 sitebinexp='$sitebinexp'
25039 sitehtml1dir='$sitehtml1dir'
25040 sitehtml1direxp='$sitehtml1direxp'
25041 sitehtml3dir='$sitehtml3dir'
25042 sitehtml3direxp='$sitehtml3direxp'
25043 sitelib='$sitelib'
25044 sitelib_stem='$sitelib_stem'
25045 sitelibexp='$sitelibexp'
25046 siteman1dir='$siteman1dir'
25047 siteman1direxp='$siteman1direxp'
25048 siteman3dir='$siteman3dir'
25049 siteman3direxp='$siteman3direxp'
25050 siteprefix='$siteprefix'
25051 siteprefixexp='$siteprefixexp'
25052 sitescript='$sitescript'
25053 sitescriptexp='$sitescriptexp'
25054 sizesize='$sizesize'
25055 sizetype='$sizetype'
25056 sleep='$sleep'
25057 smail='$smail'
25058 so='$so'
25059 sockethdr='$sockethdr'
25060 socketlib='$socketlib'
25061 socksizetype='$socksizetype'
25062 sort='$sort'
25063 spackage='$spackage'
25064 spitshell='$spitshell'
25065 srand48_r_proto='$srand48_r_proto'
25066 srandom_r_proto='$srandom_r_proto'
25067 src='$src'
25068 ssizetype='$ssizetype'
25069 st_ino_sign='$st_ino_sign'
25070 st_ino_size='$st_ino_size'
25071 startperl='$startperl'
25072 startsh='$startsh'
25073 static_ext='$static_ext'
25074 stdchar='$stdchar'
25075 stdio_base='$stdio_base'
25076 stdio_bufsiz='$stdio_bufsiz'
25077 stdio_cnt='$stdio_cnt'
25078 stdio_filbuf='$stdio_filbuf'
25079 stdio_ptr='$stdio_ptr'
25080 stdio_stream_array='$stdio_stream_array'
25081 strerror_r_proto='$strerror_r_proto'
25082 submit='$submit'
25083 subversion='$subversion'
25084 sysman='$sysman'
25085 sysroot='$sysroot'
25086 tail='$tail'
25087 tar='$tar'
25088 targetarch='$targetarch'
25089 targetdir='$targetdir'
25090 targetenv='$targetenv'
25091 targethost='$targethost'
25092 targetmkdir='$targetmkdir'
25093 targetport='$targetport'
25094 targetsh='$targetsh'
25095 tbl='$tbl'
25096 tee='$tee'
25097 test='$test'
25098 timeincl='$timeincl'
25099 timetype='$timetype'
25100 tmpnam_r_proto='$tmpnam_r_proto'
25101 to='$to'
25102 touch='$touch'
25103 tr='$tr'
25104 trnl='$trnl'
25105 troff='$troff'
25106 ttyname_r_proto='$ttyname_r_proto'
25107 u16size='$u16size'
25108 u16type='$u16type'
25109 u32size='$u32size'
25110 u32type='$u32type'
25111 u64size='$u64size'
25112 u64type='$u64type'
25113 u8size='$u8size'
25114 u8type='$u8type'
25115 uidformat='$uidformat'
25116 uidsign='$uidsign'
25117 uidsize='$uidsize'
25118 uidtype='$uidtype'
25119 uname='$uname'
25120 uniq='$uniq'
25121 uquadtype='$uquadtype'
25122 use5005threads='$use5005threads'
25123 use64bitall='$use64bitall'
25124 use64bitint='$use64bitint'
25125 usecbacktrace='$usecbacktrace'
25126 usecrosscompile='$usecrosscompile'
25127 usedevel='$usedevel'
25128 usedl='$usedl'
25129 usedtrace='$usedtrace'
25130 usefaststdio='$usefaststdio'
25131 useithreads='$useithreads'
25132 usekernprocpathname='$usekernprocpathname'
25133 uselanginfo='$uselanginfo'
25134 uselargefiles='$uselargefiles'
25135 uselongdouble='$uselongdouble'
25136 usemallocwrap='$usemallocwrap'
25137 usemorebits='$usemorebits'
25138 usemultiplicity='$usemultiplicity'
25139 usemymalloc='$usemymalloc'
25140 usenm='$usenm'
25141 usensgetexecutablepath='$usensgetexecutablepath'
25142 useopcode='$useopcode'
25143 useperlio='$useperlio'
25144 useposix='$useposix'
25145 usequadmath='$usequadmath'
25146 usereentrant='$usereentrant'
25147 userelocatableinc='$userelocatableinc'
25148 useshrplib='$useshrplib'
25149 usesitecustomize='$usesitecustomize'
25150 usesocks='$usesocks'
25151 usethreads='$usethreads'
25152 usevendorprefix='$usevendorprefix'
25153 useversionedarchname='$useversionedarchname'
25154 usevfork='$usevfork'
25155 usrinc='$usrinc'
25156 uuname='$uuname'
25157 uvXUformat='$uvXUformat'
25158 uvoformat='$uvoformat'
25159 uvsize='$uvsize'
25160 uvtype='$uvtype'
25161 uvuformat='$uvuformat'
25162 uvxformat='$uvxformat'
25163 vendorarch='$vendorarch'
25164 vendorarchexp='$vendorarchexp'
25165 vendorbin='$vendorbin'
25166 vendorbinexp='$vendorbinexp'
25167 vendorhtml1dir='$vendorhtml1dir'
25168 vendorhtml1direxp='$vendorhtml1direxp'
25169 vendorhtml3dir='$vendorhtml3dir'
25170 vendorhtml3direxp='$vendorhtml3direxp'
25171 vendorlib='$vendorlib'
25172 vendorlib_stem='$vendorlib_stem'
25173 vendorlibexp='$vendorlibexp'
25174 vendorman1dir='$vendorman1dir'
25175 vendorman1direxp='$vendorman1direxp'
25176 vendorman3dir='$vendorman3dir'
25177 vendorman3direxp='$vendorman3direxp'
25178 vendorprefix='$vendorprefix'
25179 vendorprefixexp='$vendorprefixexp'
25180 vendorscript='$vendorscript'
25181 vendorscriptexp='$vendorscriptexp'
25182 version='$version'
25183 version_patchlevel_string='$version_patchlevel_string'
25184 versiononly='$versiononly'
25185 vi='$vi'
25186 xlibpth='$xlibpth'
25187 yacc='$yacc'
25188 yaccflags='$yaccflags'
25189 zcat='$zcat'
25190 zip='$zip'
25191 EOT
25192
25193 : add special variables
25194 $test -f $src/patchlevel.h && \
25195 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25196 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25197 echo "PERL_CONFIG_SH=true" >>config.sh
25198
25199 : propagate old symbols
25200 if $test -f UU/config.sh; then
25201         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25202         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25203                 config.sh config.sh UU/oldconfig.sh |\
25204                 $sort | $uniq -u >UU/oldsyms
25205         set X `$cat UU/oldsyms`
25206         shift
25207         case $# in
25208         0) ;;
25209         *)
25210                 $cat <<EOM
25211 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25212 EOM
25213                 echo ": Variables propagated from previous config.sh file." >>config.sh
25214                 for sym in `$cat UU/oldsyms`; do
25215                         echo "    Propagating $hint variable "'$'"$sym..."
25216                         eval 'tmp="$'"${sym}"'"'
25217                         echo "$tmp" | \
25218                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25219                 done
25220                 ;;
25221         esac
25222 fi
25223
25224 : preserve RCS keywords in files with variable substitution, grrr
25225 Id='$Id'
25226
25227 : Finish up by extracting the .SH files
25228 case "$alldone" in
25229 exit)
25230         echo "Stopping at your request, leaving temporary files around."
25231         exit 0
25232         ;;
25233 cont)
25234         ;;
25235 '')
25236         dflt=''
25237         nostick=true
25238         $cat <<EOM
25239
25240 If you'd like to make any changes to the config.sh file before I begin
25241 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25242
25243 EOM
25244         rp="Press return or use a shell escape to edit config.sh:"
25245         . UU/myread
25246         nostick=''
25247         case "$ans" in
25248         '') ;;
25249         *) : in case they cannot read
25250                 sh 1>&4 -c "$ans";;
25251         esac
25252         ;;
25253 esac
25254
25255 : if this fails, just run all the .SH files by hand
25256 . ./config.sh
25257
25258 echo " "
25259 exec 1>&4
25260 pwd=`pwd`
25261 . ./UU/extract
25262 cd "$pwd"
25263
25264 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25265         dflt=y
25266         case "$silent" in
25267         true) ;;
25268         *)
25269                 $cat <<EOM
25270
25271 Now you need to generate make dependencies by running "$make depend".
25272 You might prefer to run it in background: "$make depend > makedepend.out &"
25273 It can take a while, so you might not want to run it right now.
25274
25275 EOM
25276                 ;;
25277         esac
25278         rp="Run $make depend now?"
25279         . UU/myread
25280         case "$ans" in
25281         y*)
25282                 $make depend && echo "Now you must run '$make'."
25283                 ;;
25284         *)
25285                 echo "You must run '$make depend' then '$make'."
25286                 ;;
25287         esac
25288 elif test -f [Mm]akefile; then
25289         echo " "
25290         echo "Now you must run a $make."
25291 else
25292         echo "Configure done."
25293 fi
25294
25295 if $test -f Policy.sh; then
25296     $cat <<EOM
25297
25298 If you compile $package on a different machine or from a different object
25299 directory, copy the Policy.sh file from this object directory to the
25300 new one before you run Configure -- this will help you with most of
25301 the policy defaults.
25302
25303 EOM
25304 fi
25305 if $test -f UU/config.msg; then
25306     echo "Hmm.  I also noted the following information while running:"
25307     echo " "
25308     $cat UU/config.msg >&4
25309 fi
25310 $rm -f kit*isdone ark*isdone
25311 $rm -rf UU
25312
25313 : End of Configure
25314