This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: Include <stdlib.h> in futimes check
[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 by perlbug@perl.org)
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_deprecated=''
386 d_attribute_format=''
387 d_attribute_malloc=''
388 d_attribute_nonnull=''
389 d_attribute_noreturn=''
390 d_attribute_pure=''
391 d_attribute_unused=''
392 d_attribute_warn_unused_result=''
393 d_printf_format_null=''
394 d_backtrace=''
395 d_builtin_choose_expr=''
396 d_builtin_expect=''
397 d_builtin_add_overflow=''
398 d_builtin_mul_overflow=''
399 d_builtin_sub_overflow=''
400 d_c99_variadic_macros=''
401 d_casti32=''
402 castflags=''
403 d_castneg=''
404 d_cbrt=''
405 d_chown=''
406 d_chroot=''
407 d_chsize=''
408 d_class=''
409 d_clearenv=''
410 d_closedir=''
411 d_void_closedir=''
412 d_cmsghdr_s=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_dup3=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localeconv_l=''
632 d_localtime_r=''
633 d_localtime_r_needs_tzset=''
634 localtime_r_proto=''
635 d_locconv=''
636 d_lockf=''
637 d_log1p=''
638 d_log2=''
639 d_logb=''
640 d_ldexpl=''
641 d_long_double_style_ieee=''
642 d_long_double_style_ieee_doubledouble=''
643 d_long_double_style_ieee_extended=''
644 d_long_double_style_ieee_std=''
645 d_long_double_style_vax=''
646 d_longdbl=''
647 longdblkind=''
648 longdblsize=''
649 d_longlong=''
650 longlongsize=''
651 d_lrint=''
652 d_lrintl=''
653 d_lround=''
654 d_lroundl=''
655 d_lseekproto=''
656 d_lstat=''
657 d_madvise=''
658 d_malloc_good_size=''
659 d_malloc_size=''
660 d_mblen=''
661 d_mbrlen=''
662 d_mbrtowc=''
663 d_mbstowcs=''
664 d_mbtowc=''
665 d_memmem=''
666 d_memrchr=''
667 d_mkdir=''
668 d_mkdtemp=''
669 d_mkfifo=''
670 d_mkostemp=''
671 d_mkstemp=''
672 d_mkstemps=''
673 d_mktime=''
674 d_mmap=''
675 mmaptype=''
676 d_modfl=''
677 d_modflproto=''
678 d_mprotect=''
679 d_msg=''
680 d_msgctl=''
681 d_msgget=''
682 d_msghdr_s=''
683 d_msgrcv=''
684 d_msgsnd=''
685 d_msync=''
686 d_munmap=''
687 d_nan=''
688 d_nanosleep=''
689 d_nearbyint=''
690 d_duplocale=''
691 d_freelocale=''
692 d_newlocale=''
693 d_querylocale=''
694 d_uselocale=''
695 i_xlocale=''
696 d_nextafter=''
697 d_nexttoward=''
698 d_nice=''
699 d_nl_langinfo=''
700 d_thread_safe_nl_langinfo_l=''
701 d_off64_t=''
702 d_open3=''
703 d_fpathconf=''
704 d_pathconf=''
705 d_pause=''
706 d_pipe2=''
707 d_pipe=''
708 d_poll=''
709 d_portable=''
710 d_prctl=''
711 d_prctl_set_name=''
712 d_procselfexe=''
713 procselfexe=''
714 d_old_pthread_create_joinable=''
715 old_pthread_create_joinable=''
716 d_pthread_atfork=''
717 d_pthread_attr_setscope=''
718 d_pthread_yield=''
719 d_sched_yield=''
720 sched_yield=''
721 d_ptrdiff_t=''
722 d_qgcvt=''
723 d_random_r=''
724 random_r_proto=''
725 d_readdir64_r=''
726 readdir64_r_proto=''
727 d_readdir=''
728 d_rewinddir=''
729 d_seekdir=''
730 d_telldir=''
731 d_readdir_r=''
732 readdir_r_proto=''
733 d_readlink=''
734 d_readv=''
735 d_recvmsg=''
736 d_re_comp=''
737 d_regcmp=''
738 d_regcomp=''
739 d_remainder=''
740 d_remquo=''
741 d_rename=''
742 d_rint=''
743 d_rmdir=''
744 d_round=''
745 d_sbrkproto=''
746 d_scalbn=''
747 d_scalbnl=''
748 d_select=''
749 d_sem=''
750 d_semctl=''
751 d_semget=''
752 d_semop=''
753 d_sendmsg=''
754 d_setegid=''
755 d_seteuid=''
756 d_setgrent=''
757 d_setgrent_r=''
758 setgrent_r_proto=''
759 d_setgrps=''
760 d_sethent=''
761 d_sethostent_r=''
762 sethostent_r_proto=''
763 d_setitimer=''
764 d_setlinebuf=''
765 d_has_C_UTF8=''
766 d_setlocale=''
767 d_setlocale_accepts_any_locale_name=''
768 d_setlocale_r=''
769 setlocale_r_proto=''
770 d_setnent=''
771 d_setnetent_r=''
772 setnetent_r_proto=''
773 d_setpent=''
774 d_setpgid=''
775 d_setpgrp2=''
776 d_bsdsetpgrp=''
777 d_setpgrp=''
778 d_setprior=''
779 d_setproctitle=''
780 d_setprotoent_r=''
781 setprotoent_r_proto=''
782 d_setpwent=''
783 d_setpwent_r=''
784 setpwent_r_proto=''
785 d_setregid=''
786 d_setresgid=''
787 d_setresuid=''
788 d_setreuid=''
789 d_setrgid=''
790 d_setruid=''
791 d_setsent=''
792 d_setservent_r=''
793 setservent_r_proto=''
794 d_setsid=''
795 d_setvbuf=''
796 d_shm=''
797 d_shmat=''
798 d_shmatprototype=''
799 shmattype=''
800 d_shmctl=''
801 d_shmdt=''
802 d_shmget=''
803 d_sigaction=''
804 d_siginfo_si_addr=''
805 d_siginfo_si_band=''
806 d_siginfo_si_errno=''
807 d_siginfo_si_fd=''
808 d_siginfo_si_pid=''
809 d_siginfo_si_status=''
810 d_siginfo_si_uid=''
811 d_siginfo_si_value=''
812 d_signbit=''
813 d_sigprocmask=''
814 d_sigsetjmp=''
815 usesitecustomize=''
816 d_snprintf=''
817 d_vsnprintf=''
818 d_sockatmark=''
819 d_sockatmarkproto=''
820 d_ip_mreq=''
821 d_ip_mreq_source=''
822 d_ipv6_mreq=''
823 d_ipv6_mreq_source=''
824 d_msg_ctrunc=''
825 d_msg_dontroute=''
826 d_msg_oob=''
827 d_msg_peek=''
828 d_msg_proxy=''
829 d_oldsock=''
830 d_scm_rights=''
831 d_sin6_scope_id=''
832 d_sockaddr_in6=''
833 d_sockaddr_sa_len=''
834 d_socket=''
835 d_sockpair=''
836 sockethdr=''
837 socketlib=''
838 d_socklen_t=''
839 d_socks5_init=''
840 d_sqrtl=''
841 d_srand48_r=''
842 srand48_r_proto=''
843 d_srandom_r=''
844 srandom_r_proto=''
845 d_sresgproto=''
846 d_sresuproto=''
847 d_stat=''
848 d_statblks=''
849 d_statfs_f_flags=''
850 d_statfs_s=''
851 d_static_inline=''
852 perl_static_inline=''
853 d_fstatvfs=''
854 d_statvfs=''
855 d_stdio_cnt_lval=''
856 d_stdio_ptr_lval=''
857 d_stdio_ptr_lval_nochange_cnt=''
858 d_stdio_ptr_lval_sets_cnt=''
859 d_stdiobase=''
860 d_stdstdio=''
861 stdio_base=''
862 stdio_bufsiz=''
863 stdio_cnt=''
864 stdio_filbuf=''
865 stdio_ptr=''
866 d_strcoll=''
867 d_sysernlst=''
868 d_syserrlst=''
869 d_strerror_l=''
870 d_strerror_r=''
871 strerror_r_proto=''
872 d_strftime=''
873 d_strlcat=''
874 d_strlcpy=''
875 d_strnlen=''
876 d_strtod=''
877 d_strtod_l=''
878 d_strtol=''
879 d_strtold=''
880 d_strtold_l=''
881 d_strtoll=''
882 d_strtoq=''
883 d_strtoul=''
884 d_strtoull=''
885 d_strtouq=''
886 d_strxfrm=''
887 d_symlink=''
888 d_syscall=''
889 d_syscallproto=''
890 d_sysconf=''
891 d_system=''
892 d_tcgetpgrp=''
893 d_tcsetpgrp=''
894 d_telldirproto=''
895 d_tgamma=''
896 d_time=''
897 timetype=''
898 d_asctime64=''
899 d_ctime64=''
900 d_difftime64=''
901 d_gmtime64=''
902 d_localtime64=''
903 d_mktime64=''
904 d_timegm=''
905 clocktype=''
906 d_times=''
907 d_tmpnam_r=''
908 tmpnam_r_proto=''
909 d_towlower=''
910 d_towupper=''
911 d_trunc=''
912 d_truncate=''
913 d_truncl=''
914 d_ttyname_r=''
915 ttyname_r_proto=''
916 d_tzname=''
917 d_u32align=''
918 d_ualarm=''
919 d_umask=''
920 d_semctl_semid_ds=''
921 d_semctl_semun=''
922 d_union_semun=''
923 d_unordered=''
924 d_unsetenv=''
925 d_usleep=''
926 d_usleepproto=''
927 d_ustat=''
928 d_pseudofork=''
929 d_vfork=''
930 usevfork=''
931 d_voidsig=''
932 signal_t=''
933 d_wait4=''
934 d_waitpid=''
935 d_wcscmp=''
936 d_wcstombs=''
937 d_wcsxfrm=''
938 d_wctomb=''
939 d_writev=''
940 default_inc_excludes_dot=''
941 dlext=''
942 bin_ELF=''
943 cccdlflags=''
944 ccdlflags=''
945 dlsrc=''
946 ld=''
947 ld_can_script=''
948 lddlflags=''
949 usedl=''
950 doublesize=''
951 dtraceobject=''
952 dtracexnolibs=''
953 ebcdic=''
954 fflushNULL=''
955 fflushall=''
956 fpossize=''
957 fpostype=''
958 gccansipedantic=''
959 gccosandvers=''
960 gccversion=''
961 gidformat=''
962 gidsign=''
963 gidsize=''
964 gidtype=''
965 groupstype=''
966 h_fcntl=''
967 h_sysfile=''
968 html1dir=''
969 html1direxp=''
970 installhtml1dir=''
971 html3dir=''
972 html3direxp=''
973 installhtml3dir=''
974 i_arpainet=''
975 i_bfd=''
976 i_crypt=''
977 db_hashtype=''
978 db_prefixtype=''
979 db_version_major=''
980 db_version_minor=''
981 db_version_patch=''
982 i_db=''
983 i_dbm=''
984 i_rpcsvcdbm=''
985 d_dirnamlen=''
986 direntrytype=''
987 i_dirent=''
988 i_dlfcn=''
989 i_execinfo=''
990 i_fcntl=''
991 i_fenv=''
992 i_fp=''
993 i_fp_class=''
994 i_gdbm=''
995 d_grpasswd=''
996 i_grp=''
997 i_ieeefp=''
998 i_inttypes=''
999 i_langinfo=''
1000 i_libutil=''
1001 i_locale=''
1002 i_machcthr=''
1003 i_malloc=''
1004 i_mallocmalloc=''
1005 i_mntent=''
1006 d_gdbm_ndbm_h_uses_prototypes=''
1007 d_gdbmndbm_h_uses_prototypes=''
1008 d_ndbm=''
1009 d_ndbm_h_uses_prototypes=''
1010 i_gdbm_ndbm=''
1011 i_gdbmndbm=''
1012 i_ndbm=''
1013 i_netdb=''
1014 i_neterrno=''
1015 i_netinettcp=''
1016 i_niin=''
1017 i_sysin=''
1018 i_poll=''
1019 i_prot=''
1020 i_pthread=''
1021 d_pwage=''
1022 d_pwchange=''
1023 d_pwclass=''
1024 d_pwcomment=''
1025 d_pwexpire=''
1026 d_pwgecos=''
1027 d_pwpasswd=''
1028 d_pwquota=''
1029 i_pwd=''
1030 i_quadmath=''
1031 i_shadow=''
1032 i_socks=''
1033 i_stdbool=''
1034 i_stdint=''
1035 i_stdlib=''
1036 i_sunmath=''
1037 i_sysaccess=''
1038 i_sysdir=''
1039 i_sysfile=''
1040 d_voidtty=''
1041 i_bsdioctl=''
1042 i_sysfilio=''
1043 i_sysioctl=''
1044 i_syssockio=''
1045 i_syslog=''
1046 i_sysmman=''
1047 i_sysmode=''
1048 i_sysmount=''
1049 i_sysndir=''
1050 i_sysparam=''
1051 i_syspoll=''
1052 i_sysresrc=''
1053 i_syssecrt=''
1054 i_sysselct=''
1055 i_sysstat=''
1056 i_sysstatfs=''
1057 i_sysstatvfs=''
1058 i_systimes=''
1059 i_systypes=''
1060 i_sysuio=''
1061 i_sysun=''
1062 i_sysutsname=''
1063 i_sysvfs=''
1064 i_syswait=''
1065 i_sgtty=''
1066 i_termio=''
1067 i_termios=''
1068 d_tm_tm_gmtoff=''
1069 d_tm_tm_zone=''
1070 i_systime=''
1071 i_systimek=''
1072 i_time=''
1073 timeincl=''
1074 i_unistd=''
1075 i_ustat=''
1076 i_utime=''
1077 i_vfork=''
1078 i_wchar=''
1079 i_wctype=''
1080 d_inc_version_list=''
1081 inc_version_list=''
1082 inc_version_list_init=''
1083 doubleinfbytes=''
1084 doublenanbytes=''
1085 longdblinfbytes=''
1086 longdblnanbytes=''
1087 installprefix=''
1088 installprefixexp=''
1089 installstyle=''
1090 installusrbinperl=''
1091 intsize=''
1092 longsize=''
1093 shortsize=''
1094 issymlink=''
1095 libc=''
1096 ldlibpthname=''
1097 libperl=''
1098 shrpenv=''
1099 useshrplib=''
1100 glibpth=''
1101 incpth=''
1102 libpth=''
1103 loclibpth=''
1104 plibpth=''
1105 xlibpth=''
1106 ignore_versioned_solibs=''
1107 libs=''
1108 libsdirs=''
1109 libsfiles=''
1110 libsfound=''
1111 libspath=''
1112 lns=''
1113 d_PRIEUldbl=''
1114 d_PRIFUldbl=''
1115 d_PRIGUldbl=''
1116 d_PRIeldbl=''
1117 d_PRIfldbl=''
1118 d_PRIgldbl=''
1119 d_SCNfldbl=''
1120 d_double_has_inf=''
1121 d_double_has_nan=''
1122 d_double_has_negative_zero=''
1123 d_double_has_subnormals=''
1124 d_double_style_cray=''
1125 d_double_style_ibm=''
1126 d_double_style_ieee=''
1127 d_double_style_vax=''
1128 doublekind=''
1129 sPRIEUldbl=''
1130 sPRIFUldbl=''
1131 sPRIGUldbl=''
1132 sPRIeldbl=''
1133 sPRIfldbl=''
1134 sPRIgldbl=''
1135 sSCNfldbl=''
1136 lseeksize=''
1137 lseektype=''
1138 make_set_make=''
1139 d_mymalloc=''
1140 freetype=''
1141 mallocobj=''
1142 mallocsrc=''
1143 malloctype=''
1144 usemallocwrap=''
1145 usemymalloc=''
1146 installman1dir=''
1147 man1dir=''
1148 man1direxp=''
1149 man1ext=''
1150 installman3dir=''
1151 man3dir=''
1152 man3direxp=''
1153 man3ext=''
1154 doublemantbits=''
1155 longdblmantbits=''
1156 nvmantbits=''
1157 modetype=''
1158 multiarch=''
1159 mydomain=''
1160 myhostname=''
1161 phostname=''
1162 c=''
1163 n=''
1164 d_eofnblk=''
1165 eagain=''
1166 o_nonblock=''
1167 rd_nodata=''
1168 need_va_copy=''
1169 netdb_hlen_type=''
1170 netdb_host_type=''
1171 netdb_name_type=''
1172 netdb_net_type=''
1173 groupcat=''
1174 hostcat=''
1175 passcat=''
1176 orderlib=''
1177 ranlib=''
1178 d_perl_otherlibdirs=''
1179 otherlibdirs=''
1180 package=''
1181 spackage=''
1182 pager=''
1183 api_revision=''
1184 api_subversion=''
1185 api_version=''
1186 api_versionstring=''
1187 patchlevel=''
1188 perl_patchlevel=''
1189 revision=''
1190 subversion=''
1191 version=''
1192 version_patchlevel_string=''
1193 perl5=''
1194 perladmin=''
1195 perlpath=''
1196 d_nv_preserves_uv=''
1197 d_nv_zero_is_allbits_zero=''
1198 i16size=''
1199 i16type=''
1200 i32size=''
1201 i32type=''
1202 i64size=''
1203 i64type=''
1204 i8size=''
1205 i8type=''
1206 ivsize=''
1207 ivtype=''
1208 nv_overflows_integers_at=''
1209 nv_preserves_uv_bits=''
1210 nvsize=''
1211 nvtype=''
1212 u16size=''
1213 u16type=''
1214 u32size=''
1215 u32type=''
1216 u64size=''
1217 u64type=''
1218 u8size=''
1219 u8type=''
1220 uvsize=''
1221 uvtype=''
1222 ivdformat=''
1223 nvEUformat=''
1224 nvFUformat=''
1225 nvGUformat=''
1226 nveformat=''
1227 nvfformat=''
1228 nvgformat=''
1229 uvXUformat=''
1230 uvoformat=''
1231 uvuformat=''
1232 uvxformat=''
1233 pidtype=''
1234 prefix=''
1235 prefixexp=''
1236 installprivlib=''
1237 privlib=''
1238 privlibexp=''
1239 ptrsize=''
1240 d_PRIXU64=''
1241 d_PRId64=''
1242 d_PRIi64=''
1243 d_PRIo64=''
1244 d_PRIu64=''
1245 d_PRIx64=''
1246 sPRIXU64=''
1247 sPRId64=''
1248 sPRIi64=''
1249 sPRIo64=''
1250 sPRIu64=''
1251 sPRIx64=''
1252 d_quad=''
1253 quadkind=''
1254 quadtype=''
1255 uquadtype=''
1256 drand01=''
1257 randbits=''
1258 randfunc=''
1259 randseedtype=''
1260 seedfunc=''
1261 installscript=''
1262 scriptdir=''
1263 scriptdirexp=''
1264 selectminbits=''
1265 selecttype=''
1266 sh=''
1267 targetsh=''
1268 sig_count=''
1269 sig_name=''
1270 sig_name_init=''
1271 sig_num=''
1272 sig_num_init=''
1273 sig_size=''
1274 d_sitearch=''
1275 installsitearch=''
1276 sitearch=''
1277 sitearchexp=''
1278 installsitebin=''
1279 sitebin=''
1280 sitebinexp=''
1281 installsitehtml1dir=''
1282 sitehtml1dir=''
1283 sitehtml1direxp=''
1284 installsitehtml3dir=''
1285 sitehtml3dir=''
1286 sitehtml3direxp=''
1287 installsitelib=''
1288 sitelib=''
1289 sitelib_stem=''
1290 sitelibexp=''
1291 installsiteman1dir=''
1292 siteman1dir=''
1293 siteman1direxp=''
1294 installsiteman3dir=''
1295 siteman3dir=''
1296 siteman3direxp=''
1297 siteprefix=''
1298 siteprefixexp=''
1299 installsitescript=''
1300 sitescript=''
1301 sitescriptexp=''
1302 sizesize=''
1303 sizetype=''
1304 d_libname_unique=''
1305 so=''
1306 socksizetype=''
1307 sharpbang=''
1308 shsharp=''
1309 spitshell=''
1310 src=''
1311 ssizetype=''
1312 st_ino_sign=''
1313 st_ino_size=''
1314 startperl=''
1315 startsh=''
1316 stdchar=''
1317 d_stdio_stream_array=''
1318 stdio_stream_array=''
1319 sysman=''
1320 sGMTIME_max=''
1321 sGMTIME_min=''
1322 sLOCALTIME_max=''
1323 sLOCALTIME_min=''
1324 trnl=''
1325 uidformat=''
1326 uidsign=''
1327 uidsize=''
1328 uidtype=''
1329 archname64=''
1330 use64bitall=''
1331 use64bitint=''
1332 usecbacktrace=''
1333 dtrace=''
1334 usedtrace=''
1335 usefaststdio=''
1336 usekernprocpathname=''
1337 ccflags_uselargefiles=''
1338 ldflags_uselargefiles=''
1339 libswanted_uselargefiles=''
1340 uselargefiles=''
1341 uselongdouble=''
1342 usemorebits=''
1343 usemultiplicity=''
1344 nm_opt=''
1345 nm_so_opt=''
1346 runnm=''
1347 usenm=''
1348 usensgetexecutablepath=''
1349 useperlio=''
1350 usequadmath=''
1351 usesocks=''
1352 d_oldpthreads=''
1353 use5005threads=''
1354 useithreads=''
1355 usereentrant=''
1356 usethreads=''
1357 incpath=''
1358 mips_type=''
1359 usrinc=''
1360 d_vendorarch=''
1361 installvendorarch=''
1362 vendorarch=''
1363 vendorarchexp=''
1364 d_vendorbin=''
1365 installvendorbin=''
1366 vendorbin=''
1367 vendorbinexp=''
1368 installvendorhtml1dir=''
1369 vendorhtml1dir=''
1370 vendorhtml1direxp=''
1371 installvendorhtml3dir=''
1372 vendorhtml3dir=''
1373 vendorhtml3direxp=''
1374 d_vendorlib=''
1375 installvendorlib=''
1376 vendorlib=''
1377 vendorlib_stem=''
1378 vendorlibexp=''
1379 installvendorman1dir=''
1380 vendorman1dir=''
1381 vendorman1direxp=''
1382 installvendorman3dir=''
1383 vendorman3dir=''
1384 vendorman3direxp=''
1385 usevendorprefix=''
1386 vendorprefix=''
1387 vendorprefixexp=''
1388 d_vendorscript=''
1389 installvendorscript=''
1390 vendorscript=''
1391 vendorscriptexp=''
1392 versiononly=''
1393 yacc=''
1394 yaccflags=''
1395 CONFIG=''
1396
1397 : Detect odd OSs
1398 define='define'
1399 undef='undef'
1400 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1401 rmlist=''
1402
1403 : We must find out about Eunice early
1404 eunicefix=':'
1405 if test -f /etc/unixtovms; then
1406         eunicefix=/etc/unixtovms
1407 fi
1408 if test -f /etc/unixtovms.exe; then
1409         eunicefix=/etc/unixtovms.exe
1410 fi
1411
1412 : Set executable suffix now -- needed before hints available
1413 if test -f "/libs/version.library"; then
1414 : Amiga OS
1415     _exe=""
1416 elif test -f "/system/gnu_library/bin/ar.pm"; then
1417 : Stratus VOS
1418     _exe=".pm"
1419 elif test -n "$DJGPP"; then
1420 : DOS DJGPP
1421     _exe=".exe"
1422 elif test -f /kern/cookiejar; then
1423 : MiNT
1424     _exe=""
1425 elif test -d c:/. -o -n "$is_os2" ; then
1426 : OS/2 or cygwin
1427     _exe=".exe"
1428 fi
1429
1430 groupstype=''
1431 i_whoami=''
1432 : Possible local include directories to search.
1433 : Set locincpth to "" in a hint file to defeat local include searches.
1434 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1435 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1436 :
1437 : no include file wanted by default
1438 inclwanted=''
1439
1440 : Enable -DEBUGGING and -DDEBUGGING from the command line
1441 EBUGGING=''
1442 DEBUGGING=''
1443
1444 : Trailing extension.  Override this in a hint file, if needed.
1445 : Extra object files, if any, needed on this platform.
1446 archobjs=''
1447 libnames=''
1448 : change the next line if compiling for Xenix/286 on Xenix/386
1449 xlibpth='/usr/lib/386 /lib/386'
1450 : Possible local library directories to search.
1451 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1452 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1453
1454 : general looking path for locating libraries
1455 glibpth="/lib /usr/lib $xlibpth"
1456 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1457 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1458 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1459 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1460
1461 : Private path used by Configure to find libraries.  Its value
1462 : is prepended to libpth. This variable takes care of special
1463 : machines, like the mips.  Usually, it should be empty.
1464 plibpth=''
1465
1466 : default library list
1467 libswanted=''
1468 : some systems want to use only the non-versioned libso:s
1469 ignore_versioned_solibs=''
1470 ccname=''
1471 ccversion=''
1472 perllibs=''
1473 : set useposix=false in your hint file to disable the POSIX extension.
1474 useposix=true
1475 : set useopcode=false in your hint file to disable the Opcode extension.
1476 useopcode=true
1477 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1478 uselanginfo=true
1479 archname64=''
1480 ccflags_uselargefiles=''
1481 ldflags_uselargefiles=''
1482 libswanted_uselargefiles=''
1483 : set usemultiplicity on the Configure command line to enable multiplicity.
1484 : set usesocks on the Configure command line to enable socks.
1485 archname=''
1486 : set usethreads on the Configure command line to enable threads.
1487 usereentrant='undef'
1488 : List of libraries we want.
1489 : If anyone needs extra -lxxx, put those in a hint file.
1490 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1491 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1492 : We probably want to search /usr/shlib before most other libraries.
1493 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1494 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1495 glibpth="/usr/shlib $glibpth"
1496 : Do not use vfork unless overridden by a hint file.
1497 usevfork=false
1498
1499 : Find the basic shell for Bourne shell scripts
1500 case "$sh" in
1501 '')
1502         case "$SYSTYPE" in
1503         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1504         *) xxx='/bin/sh';;
1505         esac
1506         if test -f "$xxx"; then
1507                 sh="$xxx"
1508         else
1509                 : Build up a list and do a single loop so we can 'break' out.
1510                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1511                 for xxx in sh bash ksh pdksh ash; do
1512                         for p in $pth; do
1513                                 try="$try ${p}/${xxx}"
1514                         done
1515                 done
1516                 for xxx in $try; do
1517                         if test -f "$xxx"; then
1518                                 sh="$xxx";
1519                                 break
1520                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1521                                 sh="$xxx";
1522                                 break
1523                         elif test -f "$xxx.exe"; then
1524                                 sh="$xxx";
1525                                 break
1526                         fi
1527                 done
1528         fi
1529         ;;
1530 esac
1531
1532 case "$sh" in
1533 '')     cat >&2 <<EOM
1534 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1535
1536 Usually it's in /bin/sh.  How did you even get this far?
1537 Please contact me (Perl Maintainers) at perlbug@perl.org and
1538 we'll try to straighten this all out.
1539 EOM
1540         exit 1
1541         ;;
1542 esac
1543
1544 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1545 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1546 targetsh=$sh
1547
1548 : see if sh knows # comments
1549 if `$sh -c '#' >/dev/null 2>&1`; then
1550         shsharp=true
1551         spitshell=cat
1552         xcat=/bin/cat
1553         test -f $xcat$_exe || xcat=/usr/bin/cat
1554         if test ! -f $xcat$_exe; then
1555                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1556                         if test -f $p/cat$_exe; then
1557                                 xcat=$p/cat
1558                                 break
1559                         fi
1560                 done
1561                 if test ! -f $xcat$_exe; then
1562                         echo "Can't find cat anywhere!"
1563                         exit 1
1564                 fi
1565         fi
1566         echo "#!$xcat" >sharp
1567         $eunicefix sharp
1568         chmod +x sharp
1569         ./sharp > today 2>/dev/null
1570         if test -s today; then
1571                 sharpbang='#!'
1572         else
1573                 echo "#! $xcat" > sharp
1574                 $eunicefix sharp
1575                 chmod +x sharp
1576                 ./sharp > today 2>/dev/null
1577                 if test -s today; then
1578                         sharpbang='#! '
1579                 else
1580                         sharpbang=': use '
1581                 fi
1582         fi
1583 else
1584         echo " "
1585         echo "Your $sh doesn't grok # comments--I will strip them later on."
1586         shsharp=false
1587         cd ..
1588         echo "exec grep -v '^[  ]*#'" >spitshell
1589         chmod +x spitshell
1590         $eunicefix spitshell
1591         spitshell=`pwd`/spitshell
1592         cd UU
1593         echo "I presume that if # doesn't work, #! won't work either!"
1594         sharpbang=': use '
1595 fi
1596 rm -f sharp today
1597
1598 : figure out how to guarantee sh startup
1599 case "$startsh" in
1600 '') startsh=${sharpbang}${sh} ;;
1601 *)
1602 esac
1603 cat >sharp <<EOSS
1604 $startsh
1605 set abc
1606 test "$?abc" != 1
1607 EOSS
1608
1609 chmod +x sharp
1610 $eunicefix sharp
1611 if ./sharp; then
1612         : echo "Yup, it does."
1613 else
1614         echo "Hmm... '$startsh' does not guarantee sh startup..."
1615         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1616 fi
1617 rm -f sharp
1618
1619 : Save command line options in file UU/cmdline.opt for later use in
1620 : generating config.sh.
1621 cat > cmdline.opt <<EOSH
1622 : Configure command line arguments.
1623 config_arg0='$0'
1624 config_args='$*'
1625 config_argc=$#
1626 EOSH
1627 argn=1
1628 args_exp=''
1629 args_sep=''
1630 for arg in "$@"; do
1631         cat >>cmdline.opt <<EOSH
1632 config_arg$argn='$arg'
1633 EOSH
1634         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1635 $arg
1636 EOC
1637         arg_exp=`cat cmdl.opt`
1638         args_exp="$args_exp$args_sep'$arg_exp'"
1639         argn=`expr $argn + 1`
1640         args_sep=' '
1641 done
1642 rm -f cmdl.opt
1643
1644 : produce awk script to parse command line options
1645 cat >options.awk <<'EOF'
1646 BEGIN {
1647         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1648
1649         len = length(optstr);
1650         for (i = 1; i <= len; i++) {
1651                 c = substr(optstr, i, 1);
1652                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1653                 if (a == ":") {
1654                         arg[c] = 1;
1655                         i++;
1656                 }
1657                 opt[c] = 1;
1658         }
1659 }
1660 {
1661         expect = 0;
1662         str = $0;
1663         if (substr(str, 1, 1) != "-") {
1664                 printf("'%s'\n", str);
1665                 next;
1666         }
1667         len = length($0);
1668         for (i = 2; i <= len; i++) {
1669                 c = substr(str, i, 1);
1670                 if (!opt[c]) {
1671                         printf("-%s\n", substr(str, i));
1672                         next;
1673                 }
1674                 printf("-%s\n", c);
1675                 if (arg[c]) {
1676                         if (i < len)
1677                                 printf("'%s'\n", substr(str, i + 1));
1678                         else
1679                                 expect = 1;
1680                         next;
1681                 }
1682         }
1683 }
1684 END {
1685         if (expect)
1686                 print "?";
1687 }
1688 EOF
1689
1690 : process the command line options
1691 set X `for arg in "$@"; do echo "X$arg"; done |
1692         sed -e s/X// | awk -f options.awk`
1693 eval "set $*"
1694 shift
1695 rm -f options.awk
1696
1697 : set up default values
1698 fastread=''
1699 reuseval=false
1700 config_sh=''
1701 alldone=''
1702 error=''
1703 silent=''
1704 extractsh=''
1705 knowitall=''
1706 rm -f optdef.sh posthint.sh
1707 cat >optdef.sh <<EOS
1708 $startsh
1709 EOS
1710
1711
1712 : option parsing
1713 while test $# -gt 0; do
1714         case "$1" in
1715         -d) shift; fastread=yes;;
1716         -e) shift; alldone=cont;;
1717         -f)
1718                 shift
1719                 cd ..
1720                 if test -r "$1"; then
1721                         config_sh="$1"
1722                 else
1723                         echo "$me: cannot read config file $1." >&2
1724                         error=true
1725                 fi
1726                 cd UU
1727                 shift;;
1728         --help|\
1729         -h) shift; error=true;;
1730         -r) shift; reuseval=true;;
1731         -s) shift; silent=true; realsilent=true;;
1732         -E) shift; alldone=exit;;
1733         -K) shift; knowitall=true;;
1734         -O) shift;;
1735         -S) shift; silent=true; extractsh=true;;
1736         -D)
1737                 shift
1738                 case "$1" in
1739                 *=)
1740                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1741                         echo "$me: ignoring -D $1" >&2
1742                         ;;
1743                 *=*) echo "$1" | \
1744                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1745                 *) echo "$1='define'" >> optdef.sh;;
1746                 esac
1747                 shift
1748                 ;;
1749         -U)
1750                 shift
1751                 case "$1" in
1752                 *=) echo "$1" >> optdef.sh;;
1753                 *=*)
1754                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1755                         echo "$me: ignoring -U $1" >&2
1756                         ;;
1757                 *) echo "$1='undef'" >> optdef.sh;;
1758                 esac
1759                 shift
1760                 ;;
1761         -A)
1762             shift
1763             xxx=''
1764             yyy="$1"
1765             zzz=''
1766             uuu=undef
1767             case "$yyy" in
1768             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1769                  case "$zzz" in
1770                  *:*) zzz='' ;;
1771                  *)   xxx=append
1772                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1773                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1774                  esac
1775                  ;;
1776             esac
1777             case "$xxx" in
1778             '')  case "$yyy" in
1779                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1780                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1781                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1782                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1783                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1784                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1785                  esac
1786                  ;;
1787             esac
1788             case "$xxx" in
1789             append)
1790                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1791             clear)
1792                 echo "$yyy=''"                  >> posthint.sh ;;
1793             define)
1794                 case "$zzz" in
1795                 '') zzz=define ;;
1796                 esac
1797                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1798             eval)
1799                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1800             prepend)
1801                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1802             undef)
1803                 case "$zzz" in
1804                 '') zzz="$uuu" ;;
1805                 esac
1806                 echo "$yyy=$zzz"                >> posthint.sh ;;
1807             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1808             esac
1809             shift
1810             ;;
1811         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1812             exit 0;;
1813         --) break;;
1814         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1815         *) break;;
1816         esac
1817 done
1818
1819 case "$error" in
1820 true)
1821         cat >&2 <<EOM
1822 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1823                  [-U symbol] [-U symbol=] [-A command:symbol...]
1824   -d : use defaults for all answers.
1825   -e : go on without questioning past the production of config.sh.
1826   -f : specify an alternate default configuration file.
1827   -h : print this help message and exit (with an error status).
1828   -r : reuse C symbols value if possible (skips costly nm extraction).
1829   -s : silent mode, only echoes questions and essential information.
1830   -D : define symbol to have some value:
1831          -D symbol         symbol gets the value 'define'
1832          -D symbol=value   symbol gets the value 'value'
1833        common used examples (see INSTALL for more info):
1834          -Duse64bitint            use 64bit integers
1835          -Duse64bitall            use 64bit integers and pointers
1836          -Dusethreads             use thread support
1837          -Dinc_version_list=none  do not include older perl trees in @INC
1838          -DEBUGGING=none          DEBUGGING options
1839          -Dcc=gcc                 choose your compiler
1840          -Dprefix=/opt/perl5      choose your destination
1841   -E : stop at the end of questions, after having produced config.sh.
1842   -K : do not use unless you know what you are doing.
1843   -O : ignored for backward compatibility
1844   -S : perform variable substitutions on all .SH files (can mix with -f)
1845   -U : undefine symbol:
1846          -U symbol    symbol gets the value 'undef'
1847          -U symbol=   symbol gets completely empty
1848        e.g.:  -Uversiononly
1849   -A : manipulate symbol after the platform specific hints have been applied:
1850          -A append:symbol=value   append value to symbol
1851          -A symbol=value          like append:, but with a separating space
1852          -A define:symbol=value   define symbol to have value
1853          -A clear:symbol          define symbol to be ''
1854          -A define:symbol         define symbol to be 'define'
1855          -A eval:symbol=value     define symbol to be eval of value
1856          -A prepend:symbol=value  prepend value to symbol
1857          -A undef:symbol          define symbol to be 'undef'
1858          -A undef:symbol=         define symbol to be ''
1859        e.g.:  -A prepend:libswanted='cl pthread '
1860               -A ccflags=-DSOME_MACRO
1861   -V : print version number and exit (with a zero status).
1862 EOM
1863         exit 1
1864         ;;
1865 esac
1866
1867 : Sanity checks
1868 case "$fastread$alldone" in
1869 yescont|yesexit) ;;
1870 *)
1871         case "$extractsh" in
1872         true) ;;
1873         *)
1874                 if test ! -t 0; then
1875                         echo "Say 'sh Configure', not 'sh <Configure'"
1876                         exit 1
1877                 fi
1878                 ;;
1879         esac
1880         ;;
1881 esac
1882
1883 exec 4>&1
1884 case "$silent" in
1885 true) exec 1>/dev/null;;
1886 esac
1887
1888 : run the defines and the undefines, if any, but leave the file out there...
1889 touch optdef.sh
1890 grep '\\' optdef.sh >/dev/null 2>&1
1891 if test $? = 0; then
1892     echo "Configure does not support \\ in -D arguments"
1893     exit 1
1894 fi
1895 . ./optdef.sh
1896 : create the posthint manipulation script and leave the file out there...
1897 touch posthint.sh
1898
1899 : set package name
1900 package='perl5'
1901 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1902 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1903 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1904 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1905 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1906 esac
1907
1908 : Some greps do not return status, grrr.
1909 echo "grimblepritz" >grimble
1910 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1911         contains=contains
1912 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1913         contains=grep
1914 else
1915         contains=contains
1916 fi
1917 rm -f grimble
1918 : the following should work in any shell
1919 case "$contains" in
1920 contains*)
1921         echo " "
1922         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1923         cat >contains <<'EOSS'
1924 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1925 EOSS
1926 chmod +x contains
1927 esac
1928
1929 : Find the path to the source tree
1930 case "$src" in
1931 '') case "$0" in
1932     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1933          case "$src" in
1934          /*)    ;;
1935          .)     ;;
1936          *)     src=`cd ../$src && pwd` ;;
1937          esac
1938          ;;
1939     *)   src='.';;
1940     esac;;
1941 esac
1942 case "$src" in
1943 '')     src=/
1944         rsrc=/
1945         ;;
1946 /*)     rsrc="$src";;
1947 *)      rsrc="../$src";;
1948 esac
1949 if test -f $rsrc/Configure && \
1950         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1951 then
1952    : found it, so we are ok.
1953 else
1954         rsrc=''
1955         for src in . .. ../.. ../../.. ../../../..; do
1956                 if test -f ../$src/Configure && \
1957                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1958                 then
1959                         rsrc=../$src
1960                         break
1961                 fi
1962         done
1963 fi
1964 case "$rsrc" in
1965 '')
1966         cat <<EOM >&4
1967
1968 Sorry, I can't seem to locate the source dir for $package.  Please start
1969 Configure with an explicit path -- i.e. /some/path/Configure.
1970
1971 EOM
1972         exit 1
1973         ;;
1974 ../.)   rsrc='..';;
1975 *)
1976         echo " "
1977         echo "Sources for $package found in \"$src\"." >&4
1978         ;;
1979 esac
1980
1981 : script used to extract .SH files with variable substitutions
1982 cat >extract <<'EOS'
1983 PERL_CONFIG_SH=true
1984 echo "Doing variable substitutions on .SH files..."
1985 if test -f MANIFEST; then
1986         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1987 else
1988         echo "(Looking for .SH files under the source directory.)"
1989         set x `(cd "$src"; find . -name "*.SH" -print)`
1990 fi
1991 shift
1992 case $# in
1993 0) set x `(cd "$src"; echo *.SH)`; shift;;
1994 esac
1995 if test ! -f "$src/$1"; then
1996         shift
1997 fi
1998 mkdir_p='
1999 name=$1;
2000 create="";
2001 while test $name; do
2002         if test ! -d "$name"; then
2003                 create="$name $create";
2004                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2005                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2006         else
2007                 name="";
2008         fi;
2009 done;
2010 for file in $create; do
2011         mkdir $file;
2012 done
2013 '
2014 for file in $*; do
2015         case "$src" in
2016         ".")
2017                 case "$file" in
2018                 */*)
2019                         dir=`expr X$file : 'X\(.*\)/'`
2020                         file=`expr X$file : 'X.*/\(.*\)'`
2021                         (cd "$dir" && . ./$file)
2022                         ;;
2023                 *)
2024                         . ./$file
2025                         ;;
2026                 esac
2027                 ;;
2028         *)
2029                 case "$file" in
2030                 */*)
2031                         dir=`expr X$file : 'X\(.*\)/'`
2032                         file=`expr X$file : 'X.*/\(.*\)'`
2033                         (set x $dir; shift; eval $mkdir_p)
2034                         sh <"$src/$dir/$file"
2035                         ;;
2036                 *)
2037                         sh <"$src/$file"
2038                         ;;
2039                 esac
2040                 ;;
2041         esac
2042 done
2043 if test -f "$src/config_h.SH"; then
2044         if test ! -f config.h; then
2045         : oops, they left it out of MANIFEST, probably, so do it anyway.
2046         . "$src/config_h.SH"
2047         fi
2048 fi
2049 EOS
2050
2051 : extract files and exit if asked to do so
2052 case "$extractsh" in
2053 true)
2054         case "$realsilent" in
2055         true) ;;
2056         *) exec 1>&4;;
2057         esac
2058         case "$config_sh" in
2059         '') config_sh='config.sh';;
2060         esac
2061         echo " "
2062         echo "Fetching answers from $config_sh..."
2063         cd ..
2064         . $config_sh
2065         . UU/optdef.sh
2066         echo " "
2067         . UU/extract
2068         rm -rf UU
2069         echo "Extraction done."
2070         exit 0
2071         ;;
2072 esac
2073
2074 : Eunice requires " " instead of "", can you believe it
2075 echo " "
2076 : Here we go...
2077 echo "Beginning of configuration questions for $package."
2078
2079 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2080
2081 : first determine how to suppress newline on echo command
2082 echo " "
2083 echo "Checking echo to see how to suppress newlines..."
2084 (echo "hi there\c" ; echo " ") >.echotmp
2085 if $contains c .echotmp >/dev/null 2>&1 ; then
2086         echo "...using -n."
2087         n='-n'
2088         c=''
2089 else
2090         cat <<'EOM'
2091 ...using \c
2092 EOM
2093         n=''
2094         c='\c'
2095 fi
2096 echo $n "The star should be here-->$c"
2097 echo '*'
2098 rm -f .echotmp
2099
2100 : Now test for existence of everything in MANIFEST
2101 echo " "
2102 if test -f "$rsrc/MANIFEST"; then
2103         echo "First let's make sure your kit is complete.  Checking..." >&4
2104         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2105                 (split -l 50 2>/dev/null || split -50)
2106         rm -f missing
2107         tmppwd=`pwd`
2108         for filelist in x??; do
2109                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2110                         >/dev/null 2>>"$tmppwd/missing")
2111         done
2112         if test -s missing; then
2113                 cat missing >&4
2114                 cat >&4 <<'EOM'
2115
2116 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2117
2118 You have the option of continuing the configuration process, despite the
2119 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2120 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2121 and contact the author (perlbug@perl.org).
2122
2123 EOM
2124                 echo $n "Continue? [n] $c" >&4
2125                 read ans
2126                 case "$ans" in
2127                 y*)
2128                         echo "Continuing..." >&4
2129                         rm -f missing
2130                         ;;
2131                 *)
2132                         echo "ABORTING..." >&4
2133                         kill $$
2134                         ;;
2135                 esac
2136         else
2137                 echo "Looks good..."
2138         fi
2139 else
2140         echo "There is no MANIFEST file.  I hope your kit is complete !"
2141 fi
2142 rm -f missing x??
2143
2144 : Find the appropriate value for a newline for tr
2145 if test -n "$DJGPP"; then
2146        trnl='\012'
2147 fi
2148 if test X"$trnl" = X; then
2149         case "`echo foo | tr '\n' x 2>/dev/null`" in
2150         foox) trnl='\n' ;;
2151         esac
2152 fi
2153 if test X"$trnl" = X; then
2154         case "`echo foo | tr '\012' x 2>/dev/null`" in
2155         foox) trnl='\012' ;;
2156         esac
2157 fi
2158 if test X"$trnl" = X; then
2159        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2160        fooxy) trnl='\n\r' ;;
2161        esac
2162 fi
2163 if test X"$trnl" = X; then
2164         cat <<EOM >&2
2165
2166 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2167
2168 EOM
2169         exit 1
2170 fi
2171
2172 : compute the number of columns on the terminal for proper question formatting
2173 case "$COLUMNS" in
2174 '') COLUMNS='80';;
2175 esac
2176
2177 : set up the echo used in my read
2178 myecho="case \"\$xxxm\" in
2179 '') echo $n \"\$rp $c\" >&4;;
2180 *) case \"\$rp\" in
2181         '') echo $n \"[\$xxxm] $c\";;
2182         *)
2183                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2184                         echo \"\$rp\" >&4
2185                         echo $n \"[\$xxxm] $c\" >&4
2186                 else
2187                         echo $n \"\$rp [\$xxxm] $c\" >&4
2188                 fi
2189                 ;;
2190         esac;;
2191 esac"
2192
2193 : now set up to do reads with possible shell escape and default assignment
2194 cat <<EOSC >myread
2195 $startsh
2196 xxxm=\$dflt
2197 $myecho
2198 ans='!'
2199 case "\$fastread" in
2200 yes) case "\$dflt" in
2201         '') ;;
2202         *) ans='';
2203                 case "\$silent-\$rp" in
2204                 true-) ;;
2205                 *) echo " " >&4;;
2206                 esac;;
2207         esac;;
2208 *) case "\$silent" in
2209         true) case "\$rp" in
2210                 '') ans='';;
2211                 esac;;
2212         esac;;
2213 esac
2214 while expr "X\$ans" : "X!" >/dev/null; do
2215         read answ
2216         set x \$xxxm
2217         shift
2218         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2219         case  "\$answ" in
2220         "!")
2221                 sh 1>&4
2222                 echo " "
2223                 $myecho
2224                 ;;
2225         !*)
2226                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2227                 shift
2228                 sh 1>&4 -c "\$*"
2229                 echo " "
2230                 $myecho
2231                 ;;
2232         "\$ans")
2233                 case "\$ans" in
2234                 \\&*)
2235                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2236                         shift
2237                         case "\$1" in
2238                         -d)
2239                                 fastread=yes
2240                                 echo "(OK, I'll run with -d after this question.)" >&4
2241                                 ;;
2242                         -*)
2243                                 echo "*** Sorry, \$1 not supported yet." >&4
2244                                 ;;
2245                         esac
2246                         $myecho
2247                         ans=!
2248                         ;;
2249                 esac;;
2250         *)
2251                 case "\$aok" in
2252                 y)
2253                         echo "*** Substitution done -- please confirm."
2254                         xxxm="\$ans"
2255                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2256                         xxxm="\$ans"
2257                         ans=!
2258                         ;;
2259                 *)
2260                         echo "*** Error -- try again."
2261                         ans=!
2262                         ;;
2263                 esac
2264                 $myecho
2265                 ;;
2266         esac
2267         case "\$ans\$xxxm\$nostick" in
2268         '')
2269                 ans=!
2270                 $myecho
2271                 ;;
2272         esac
2273 done
2274 case "\$ans" in
2275 '') ans="\$xxxm";;
2276 esac
2277 EOSC
2278
2279 : create .config dir to save info across Configure sessions
2280 test -d ../.config || mkdir ../.config
2281 cat >../.config/README <<EOF
2282 This directory created by Configure to save information that should
2283 persist across sessions for $package.
2284
2285 You may safely delete it if you wish.
2286 EOF
2287
2288 : See if we are using a devel version and want that
2289 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2290 case "$usedevel" in
2291 $define|true|[yY]*)
2292     usedevel="$define" ;;
2293 *) case "$xversion" in
2294    *[13579])
2295         cat >&4 <<EOH
2296 *** WHOA THERE!!! ***
2297
2298     This is an UNSTABLE DEVELOPMENT release.
2299     The version of this $package distribution is $xversion, that is, odd,
2300     (as opposed to even) and that signifies a development release.
2301     If you want a maintenance release, you want an even-numbered version.
2302
2303     Do ***NOT*** install this into production use.
2304     Data corruption and crashes are possible.
2305
2306     It is most seriously suggested that you do not continue any further
2307     unless you want to help in developing and debugging Perl.
2308
2309     If you *still* want to build perl, you can answer 'y' now,
2310     or pass -Dusedevel to Configure.
2311
2312 EOH
2313         rp='Do you really want to continue?'
2314         dflt='n'
2315         . ./myread
2316         case "$ans" in
2317         [yY]) echo >&4 "Okay, continuing."
2318               usedevel="$define" ;;
2319         *) echo >&4 "Okay, bye."
2320            exit 1
2321            ;;
2322         esac
2323         ;;
2324     esac
2325     usedevel="$undef"
2326     ;;
2327 esac
2328 case "$usedevel" in
2329 $define|true|[yY]*)
2330         case "$versiononly" in
2331         '') versiononly="$define" ;;
2332         esac
2333         case "$installusrbinperl" in
2334         '') installusrbinperl="$undef" ;;
2335         esac
2336         ;;
2337 esac
2338
2339 : general instructions
2340 needman=true
2341 firsttime=true
2342 user=`(logname) 2>/dev/null`
2343 case "$user" in
2344 '') user=`whoami 2>&1`;;
2345 esac
2346 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2347         firsttime=false
2348         echo " "
2349         rp='Would you like to see the instructions?'
2350         dflt=n
2351         . ./myread
2352         case "$ans" in
2353         [yY]*) ;;
2354         *) needman=false;;
2355         esac
2356 fi
2357 if $needman; then
2358         cat <<EOH
2359
2360 This installation shell script will examine your system and ask you questions
2361 to determine how the perl5 package should be installed. If you get
2362 stuck on a question, you may use a ! shell escape to start a subshell or
2363 execute a command.  Many of the questions will have default answers in square
2364 brackets; typing carriage return will give you the default.
2365
2366 On some of the questions which ask for file or directory names you are allowed
2367 to use the ~name construct to specify the login directory belonging to "name",
2368 even if you don't have a shell which knows about that.  Questions where this is
2369 allowed will be marked "(~name ok)".
2370
2371 EOH
2372         rp=''
2373         dflt='Type carriage return to continue'
2374         . ./myread
2375         cat <<'EOH'
2376
2377 The prompter used in this script allows you to use shell variables and
2378 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2379 in the default answer, as if the default line was a set of arguments given to a
2380 script shell.  This means you may also use $* to repeat the whole default line,
2381 so you do not have to re-type everything to add something to the default.
2382
2383 Every time there is a substitution, you will have to confirm.  If there is an
2384 error (e.g. an unmatched backtick), the default answer will remain unchanged
2385 and you will be prompted again.
2386
2387 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2388 the questions and use the computed defaults (or the previous answers if there
2389 was already a config.sh file). Type 'Configure -h' for a list of options.
2390 You may also start interactively and then answer '& -d' at any prompt to turn
2391 on the non-interactive behaviour for the remainder of the execution.
2392
2393 EOH
2394         . ./myread
2395         cat <<EOH
2396
2397 Much effort has been expended to ensure that this shell script will run on any
2398 Unix system.  If despite that it blows up on yours, your best bet is to edit
2399 Configure and run it again.  If you can't run Configure for some reason,
2400 you'll have to generate a config.sh file by hand.  Whatever problems you
2401 have, let me (perlbug@perl.org) know how I blew it.
2402
2403 This installation script affects things in two ways:
2404
2405 1) it may do direct variable substitutions on some of the files included
2406    in this kit.
2407 2) it builds a config.h file for inclusion in C programs.  You may edit
2408    any of these files as the need arises after running this script.
2409
2410 If you make a mistake on a question, there is no easy way to back up to it
2411 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2412 files.  Configure will offer to let you do this before it runs the SH files.
2413
2414 EOH
2415         dflt='Type carriage return to continue'
2416         . ./myread
2417         case "$firsttime" in
2418         true) echo $user >>../.config/instruct;;
2419         esac
2420 fi
2421
2422 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2423 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2424 if test "X$sysroot" = X; then
2425     sysroot=""
2426 else
2427     case "$cc" in
2428         *gcc*|*g++*)
2429             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2430             # _sysroot is used in places where we need --sysroot=foo
2431             # but using the rest of the flags could cause issues.
2432             _sysroot="--sysroot=$sysroot";
2433             case "$ccflags" in
2434                 *sysroot*) ;;
2435                 'undef'|*)
2436                 ccflags="$ccflags $_sysroot"
2437             esac
2438             case "$ldflags" in
2439                 *sysroot*) ;;
2440                 'undef'|*)
2441                 ldflags="$ldflags $_sysroot"
2442             esac
2443             case "$cppflags" in
2444                 *sysroot*) ;;
2445                 'undef'|*)
2446                 cppflags="$cppflags $_sysroot"
2447             esac
2448             # lddlflags updated below in lddlflags section;
2449             # same with cccdlflags
2450             ;;
2451     esac
2452
2453     # Adjust some defaults to also use $sysroot
2454     for var in xlibpth loclibpth locincpth glibpth; do
2455         eval xxx=\$$var
2456         eval $var=''
2457         for path in $xxx; do
2458             eval $var=\"\$$var $sysroot$path\"
2459         done
2460     done
2461
2462 fi
2463
2464 : find out where common programs are
2465 echo " "
2466 echo "Locating common programs..." >&4
2467 cat <<EOSC >loc
2468 $startsh
2469 case \$# in
2470 0) exit 1;;
2471 esac
2472 thing=\$1
2473 shift
2474 dflt=\$1
2475 shift
2476 for dir in \$*; do
2477         case "\$thing" in
2478         .)
2479         if test -d \$dir/\$thing; then
2480                 echo \$dir
2481                 exit 0
2482         fi
2483         ;;
2484         *)
2485         for thisthing in \$dir/\$thing; do
2486                 : just loop through to pick last item
2487         done
2488         if test -f \$thisthing; then
2489                 echo \$thisthing
2490                 exit 0
2491         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2492                 echo \$thisthing
2493                 exit 0
2494         elif test -f \$dir/\$thing.exe; then
2495                 if test -n "$DJGPP"; then
2496                         echo \$dir/\$thing.exe
2497                 elif test "$eunicefix" != ":"; then
2498                         : on Eunice apparently
2499                         echo \$dir/\$thing
2500                 fi
2501                 exit 0
2502         fi
2503         ;;
2504         esac
2505 done
2506 echo \$dflt
2507 exit 1
2508 EOSC
2509 chmod +x loc
2510 $eunicefix loc
2511 loclist="
2512 awk
2513 cat
2514 chmod
2515 comm
2516 cp
2517 echo
2518 expr
2519 grep
2520 ls
2521 mkdir
2522 rm
2523 sed
2524 sort
2525 touch
2526 tr
2527 uniq
2528 "
2529 trylist="
2530 ar
2531 bison
2532 byacc
2533 cpp
2534 csh
2535 date
2536 egrep
2537 gmake
2538 gzip
2539 less
2540 ln
2541 make
2542 more
2543 nm
2544 nroff
2545 perl
2546 pg
2547 test
2548 uname
2549 zip
2550 "
2551 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2552 pth="$pth $sysroot/lib $sysroot/usr/lib"
2553 for file in $loclist; do
2554         eval xxx=\$$file
2555         case "$xxx" in
2556         /*|?:[\\/]*)
2557                 if test -f "$xxx"; then
2558                         : ok
2559                 else
2560                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2561                         xxx=`./loc $file $file $pth`
2562                 fi
2563                 ;;
2564         '') xxx=`./loc $file $file $pth`;;
2565         *) xxx=`./loc $xxx $xxx $pth`;;
2566         esac
2567         eval $file=$xxx$_exe
2568         eval _$file=$xxx
2569         case "$xxx" in
2570         /*)
2571                 echo $file is in $xxx.
2572                 ;;
2573         ?:[\\/]*)
2574                 echo $file is in $xxx.
2575                 ;;
2576         *)
2577                 echo "I don't know where '$file' is, and my life depends on it." >&4
2578                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2579                 exit 1
2580                 ;;
2581         esac
2582 done
2583 echo " "
2584 echo "Don't worry if any of the following aren't found..."
2585 say=offhand
2586 for file in $trylist; do
2587         eval xxx=\$$file
2588         case "$xxx" in
2589         /*|?:[\\/]*)
2590                 if test -f "$xxx"; then
2591                         : ok
2592                 else
2593                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2594                         xxx=`./loc $file $file $pth`
2595                 fi
2596                 ;;
2597         '') xxx=`./loc $file $file $pth`;;
2598         *) xxx=`./loc $xxx $xxx $pth`;;
2599         esac
2600         eval $file=$xxx$_exe
2601         eval _$file=$xxx
2602         case "$xxx" in
2603         /*)
2604                 echo $file is in $xxx.
2605                 ;;
2606         ?:[\\/]*)
2607                 echo $file is in $xxx.
2608                 ;;
2609         *)
2610                 echo "I don't see $file out there, $say."
2611                 say=either
2612                 ;;
2613         esac
2614 done
2615 case "$egrep" in
2616 egrep)
2617         echo "Substituting grep for egrep."
2618         egrep=$grep
2619         _egrep=$grep
2620         ;;
2621 esac
2622 case "$less" in
2623 '')     ;;
2624 *)      if $less -R </dev/null >/dev/null 2>&1; then
2625                echo "Substituting less -R for less."
2626                less="$less -R"
2627                _less=$less
2628         fi
2629         ;;
2630 esac
2631 case "$ln" in
2632 ln)
2633         echo "Substituting cp for ln."
2634         ln=$cp
2635         _ln=$cp
2636         ;;
2637 esac
2638 case "$make" in
2639 make)
2640         case "$gmake" in
2641         gmake)
2642         echo "I can't find make or gmake, and my life depends on it." >&4
2643         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2644         exit 1
2645         ;;
2646         esac
2647         ;;
2648 esac
2649 case "$gmake" in
2650 gmake)  ;;
2651 *)      # We can't have osname yet.
2652         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2653                 # Assume that gmake, if found, is definitely GNU make
2654                 # and prefer it over the system make.
2655                 echo "Substituting gmake for make."
2656                 make=$gmake
2657                 _make=$gmake
2658         fi
2659         ;;
2660 esac
2661 case "$test" in
2662 test)
2663         echo "Hopefully test is built into your sh."
2664         ;;
2665 *)
2666         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2667                 echo "Using the test built into your sh."
2668                 test=test
2669                 _test=test
2670         fi
2671         ;;
2672 esac
2673 case "$echo" in
2674 echo)
2675         echo "Hopefully echo is built into your sh."
2676         ;;
2677 '') ;;
2678 *)
2679         echo " "
2680 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2681         $echo $n "hi there$c" >foo1
2682         echo $n "hi there$c" >foo2
2683         if cmp foo1 foo2 >/dev/null 2>&1; then
2684                 echo "They are compatible.  In fact, they may be identical."
2685         else
2686                 case "$n" in
2687                 '-n') n='' c='\c';;
2688                 *) n='-n' c='';;
2689                 esac
2690                 cat <<FOO
2691 They are not compatible!  You are probably running ksh on a non-USG system.
2692 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2693 have echo built in and we may have to run some Bourne shell scripts.  That
2694 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2695
2696 FOO
2697                 $echo $n "The star should be here-->$c"
2698                 $echo "*"
2699         fi
2700         $rm -f foo1 foo2
2701         ;;
2702 esac
2703
2704 # This question was auctioned at YAPC::Europe-2007 in Vienna
2705 # I never promised you could answer it. I only auctioned the question.
2706 cat <<FOO
2707 The following message is sponsored by
2708
2709   Dresden.pm<--The stars should be here.
2710
2711 Dear Perl user, system administrator or package
2712 maintainer, the Perl community sends greetings to
2713 you. Do you (emblematical) greet back [Y/n]? n
2714
2715 FOO
2716
2717 : Check what type of C compiler we use
2718 cat <<EOS >trygcc
2719 $startsh
2720 EOS
2721 cat <<'EOSC' >>trygcc
2722 case "$cc" in
2723 '') ;;
2724 *)  $rm -f try try.*
2725     $cat >try.c <<EOM
2726 int main(int argc, char *argv[]) {
2727   return 0;
2728 }
2729 EOM
2730     if $cc -o try $ccflags $ldflags try.c; then
2731        :
2732     else
2733         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2734         despair=yes
2735         trygcc=yes
2736         case "$cc" in
2737         *gcc*) trygcc=no ;;
2738         esac
2739         # Skip this test because it gives a false match on output like:
2740         #    ./trygcc: line 23: cc: command not found
2741         # case "`$cc -v -c try.c 2>&1`" in
2742         # *gcc*) trygcc=no ;;
2743         # esac
2744         if $test X"$trygcc" = Xyes; then
2745             if gcc -o try -c try.c; then
2746                 echo " "
2747                 echo "You seem to have a working gcc, though." >&4
2748                 # Switching compilers may undo the work of hints files.
2749                 # The most common problem is -D_REENTRANT for threads.
2750                 # This heuristic catches that case, but gets false positives
2751                 # if -Dusethreads was not actually specified.  Better to
2752                 # bail out here with a useful message than fail
2753                 # mysteriously later. Should we perhaps just try to
2754                 # re-invoke Configure -Dcc=gcc config_args ?
2755                 if $test -f usethreads.cbu; then
2756                         $cat >&4 <<EOM
2757
2758 *** However, any setting of the C compiler flags (e.g. for thread support)
2759 *** will be lost.  It may be necessary for you to restart Configure and
2760 *** add -Dcc=gcc to your Configure command line.
2761
2762 EOM
2763                         rp="Would you like to go ahead and try gcc anyway?"
2764                         dflt=n
2765                 else
2766                         rp="Would you like to use it?"
2767                         dflt=y
2768                 fi
2769                 if $test -f myread; then
2770                     . ./myread
2771                 else
2772                     if $test -f UU/myread; then
2773                         . ./UU/myread
2774                     else
2775                         echo "Cannot find myread, sorry.  Aborting." >&2
2776                         exit 1
2777                     fi
2778                 fi
2779                 case "$ans" in
2780                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2781                 esac
2782             fi
2783         fi
2784     fi
2785     $rm -f try try.*
2786     ;;
2787 esac
2788 EOSC
2789
2790 cat <<EOS >checkcc
2791 $startsh
2792 EOS
2793 cat <<'EOSC' >>checkcc
2794 case "$cc" in
2795 '') ;;
2796 *)  $rm -f try try.*
2797     $cat >try.c <<EOM
2798 int main(int argc, char *argv[]) {
2799   return 0;
2800 }
2801 EOM
2802     if $cc -o try $ccflags $ldflags try.c; then
2803        :
2804     else
2805         if $test X"$despair" = Xyes; then
2806            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2807         fi
2808         $cat >&4 <<EOM
2809 You need to find a working C compiler.
2810 Either (purchase and) install the C compiler supplied by your OS vendor,
2811 or for a free C compiler try http://gcc.gnu.org/
2812 I cannot continue any further, aborting.
2813 EOM
2814         exit 1
2815     fi
2816     $rm -f try try.*
2817     ;;
2818 esac
2819 EOSC
2820
2821 : determine whether symbolic links are supported
2822 echo " "
2823 $touch blurfl
2824 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2825         echo "Symbolic links are supported." >&4
2826         lns="$ln -s"
2827 else
2828         echo "Symbolic links are NOT supported." >&4
2829         lns="$ln"
2830 fi
2831 $rm -f blurfl sym
2832
2833 : determine whether symbolic links are supported
2834 echo " "
2835 case "$lns" in
2836 *"ln"*" -s")
2837         echo "Checking how to test for symbolic links..." >&4
2838         $lns blurfl sym
2839         if $test "X$issymlink" = X; then
2840                 case "$newsh" in
2841                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2842                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2843                 esac
2844                 if test $? = 0; then
2845                         issymlink="test -h"
2846                 else
2847                         echo "Your builtin 'test -h' may be broken." >&4
2848                         case "$test" in
2849                         /*)     ;;
2850                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2851                                 for p in $pth
2852                                 do
2853                                         if test -f "$p/$test"; then
2854                                                 test="$p/$test"
2855                                                 break
2856                                         fi
2857                                 done
2858                                 ;;
2859                         esac
2860                         case "$test" in
2861                         /*)
2862                                 echo "Trying external '$test -h'." >&4
2863                                 issymlink="$test -h"
2864                                 if $test ! -h sym >/dev/null 2>&1; then
2865                                         echo "External '$test -h' is broken, too." >&4
2866                                         issymlink=''
2867                                 fi
2868                                 ;;
2869                         *)      issymlink='' ;;
2870                         esac
2871                 fi
2872         fi
2873         if $test "X$issymlink" = X; then
2874                 if $test -L sym 2>/dev/null; then
2875                         issymlink="$test -L"
2876                         echo "The builtin '$test -L' worked." >&4
2877                 fi
2878         fi
2879         if $test "X$issymlink" != X; then
2880                 echo "You can test for symbolic links with '$issymlink'." >&4
2881         else
2882                 echo "I do not know how you can test for symbolic links." >&4
2883         fi
2884         $rm -f blurfl sym
2885         ;;
2886 *)      echo "No symbolic links, so not testing for their testing..." >&4
2887         ;;
2888 esac
2889
2890 : Make symlinks util
2891 case "$mksymlinks" in
2892 $define|true|[yY]*)
2893         case "$src" in
2894         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2895                 exit 1
2896                 ;;
2897         *)      case "$lns:$issymlink" in
2898                 *"ln"*" -s:"*"test -"?)
2899                         echo "Creating the symbolic links..." >&4
2900                         cd ..
2901                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2902                         awk 'NF == 1 {
2903                                 dir=".";
2904                                 file=$1 "";
2905                              }
2906                              NF == 2 {
2907                                 dir=$1 "";
2908                                 file=$2 "";
2909                              }
2910                              {
2911                                  print "# dir = ", dir, "file = ", file
2912                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2913                              } END {
2914                                  for (d in mf) {
2915                                      if (d != ".") { print("mkdir -p "d) }
2916                                      print("ln -sf "mf[d]" "d);
2917                                  }
2918                              }' source="$src" > UU/mksymlinks.$$
2919                         sh UU/mksymlinks.$$
2920                         rm UU/mksymlinks.$$
2921                         # Sanity check 1.
2922                         if test ! -d t/base; then
2923                                 echo "Failed to create the subdirectories.  Aborting." >&4
2924                                 exit 1
2925                         fi
2926                         # Sanity check 2.
2927                         if test ! -f t/base/lex.t; then
2928                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2929                                 exit 1
2930                         fi
2931                         if test ! -f win32/win32.c; then
2932                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2933                                 exit 1
2934                         fi
2935                         cd UU
2936                         ;;
2937                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2938                         ;;
2939                 esac
2940                 ;;
2941         esac
2942         ;;
2943 esac
2944
2945 : Check for Cross-Compilation
2946 if $test "X$targethost" = "X"; then
2947     targethost=""
2948 fi
2949 if $test "X$targetenv" = "X"; then
2950     targetenv=""
2951 fi
2952 case "$usecrosscompile" in
2953 $define|true|[yY]*)
2954         $echo "Cross-compiling..."
2955         croak=''
2956         case "$cc" in
2957         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2958             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2959             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2960             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2961             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2962             # leave out ld, choosing it is more complex
2963             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2964             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2965             # We are in a weird spot. Just before us, some values
2966             # were 'saved', to be restored after the hints are
2967             # run.  This means that the changes we made to ar,
2968             # nm and ranlib will get reverted.
2969             # To avoid that, we hijack the saving mechanism and
2970             # have it save our new values.
2971             for file in ar nm ranlib; do
2972                 eval xxx=\$$file
2973                 eval $file=$xxx$_exe
2974                 eval _$file=$xxx
2975             done
2976         ;;
2977         esac
2978         case "$targetarch" in
2979         '') echo "Targetarch not defined." >&4; croak=y ;;
2980         *)  echo "Using targetarch $targetarch." >&4 ;;
2981         esac
2982         case "$targethost" in
2983         '') echo "Targethost not defined." >&4; croak=n ;;
2984         *)  echo "Using targethost $targethost." >&4
2985         esac
2986         locincpth=' '
2987         loclibpth=' '
2988         case "$croak" in
2989         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2990         esac
2991     : compile a host miniperl and generate_uudmap, unless we got passed them
2992     if $test "X$hostperl" = X; then
2993       echo "Building host miniperl and generate_uudmap binaries" >&4
2994       before_host=`pwd`
2995       cd ..
2996       cd $src
2997       src=`pwd`
2998       rm -rf $src/host
2999       mkdir $src/host
3000       cd $src/host
3001       $src/Configure -des -Dusedevel -Dmksymlinks
3002       $make miniperl
3003       case "$hostgenerate" in
3004       '') $make generate_uudmap
3005           hostgenerate=$src/host/generate_uudmap
3006           ;;
3007        "$undef") hostgenerate=''
3008           ;;
3009       esac
3010       hostperl=$src/host/miniperl
3011       cd $before_host
3012     fi
3013     hostosname=`$hostperl -le 'print $^O'`
3014     ;;
3015 *)
3016     usecrosscompile="$undef"
3017     ;;
3018 esac
3019
3020 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3021 case "$targethost" in
3022     '') echo "Checking for cross-compile" >&4
3023     case "$usecrosscompile$multiarch" in
3024        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3025          if [ -f Makefile ]; then
3026            echo " "
3027            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3028          else
3029            echo "Configure done."
3030          fi
3031        exit 0
3032        ;;
3033      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3034         run=''
3035         to=:
3036         from=:
3037         ;;
3038     esac
3039     ;;
3040     *) echo "Using targethost $targethost." >&4
3041         case "$src" in
3042         /*) run=$src/Cross/run
3043             targetmkdir=$src/Cross/mkdir
3044             to=$src/Cross/to
3045             from=$src/Cross/from
3046             ;;
3047         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3048             run=$pwd/Cross/run
3049             targetmkdir=$pwd/Cross/mkdir
3050             to=$pwd/Cross/to
3051             from=$pwd/Cross/from
3052             ;;
3053         esac
3054         case "$targetrun" in
3055         '') targetrun=ssh ;;
3056         esac
3057         case "$targetto" in
3058         '') targetto=scp ;;
3059         esac
3060         case "$targetfrom" in
3061         '') targetfrom=scp ;;
3062         esac
3063         run=$run-$targetrun
3064         to=$to-$targetto
3065         from=$from-$targetfrom
3066         case "$targetdir" in
3067         '')  targetdir=/tmp
3068              echo "Guessing targetdir $targetdir." >&4
3069              ;;
3070         esac
3071         case "$targetuser" in
3072         '')  targetuser=root
3073              echo "Guessing targetuser $targetuser." >&4
3074              ;;
3075         esac
3076         case "$targetport" in
3077         '')  targetport=22
3078              echo "Guessing targetport $targetport." >&4
3079              ;;
3080         esac
3081         case "$targetfrom" in
3082         scp)    q=-q ;;
3083         *)      q='' ;;
3084         esac
3085         case "$targetrun" in
3086         ssh|rsh)
3087             cat >$run <<EOF
3088 #!/bin/sh
3089 env=''
3090 case "\$1" in
3091 -cwd)
3092   shift
3093   cwd=\$1
3094   shift
3095   ;;
3096 esac
3097 case "\$1" in
3098 -env)
3099   shift
3100   env=\$1
3101   shift
3102   ;;
3103 esac
3104 case "\$cwd" in
3105 '') cwd=$targetdir ;;
3106 esac
3107 exe=\$1
3108 shift
3109 $to \$exe
3110 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3111 EOF
3112             ;;
3113         adb)
3114             $touch $run
3115             ;;
3116         *)  echo "Unknown targetrun '$targetrun'" >&4
3117             exit 1
3118             ;;
3119         esac
3120         case "$targetmkdir" in
3121         */Cross/mkdir)
3122             cat >$targetmkdir <<EOF
3123 #!/bin/sh
3124 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3125 EOF
3126             $chmod a+rx $targetmkdir
3127             ;;
3128         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3129             exit 1
3130             ;;
3131         esac
3132         case "$targetto" in
3133         scp|rcp)
3134             cat >$to <<EOF
3135 #!/bin/sh
3136 for f in \$@
3137 do
3138   case "\$f" in
3139   /*)
3140     $targetmkdir \`dirname \$f\`
3141     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3142     ;;
3143   *)
3144     $targetmkdir $targetdir/\`dirname \$f\`
3145     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3146     ;;
3147   esac
3148 done
3149 exit 0
3150 EOF
3151             ;;
3152         cp) cat >$to <<EOF
3153 #!/bin/sh
3154 for f in \$@
3155 do
3156   case "\$f" in
3157   /*)
3158     $mkdir -p $targetdir/\`dirname \$f\`
3159     $cp \$f $targetdir/\$f || exit 1
3160     ;;
3161   *)
3162     $targetmkdir $targetdir/\`dirname \$f\`
3163     $cp \$f $targetdir/\$f || exit 1
3164     ;;
3165   esac
3166 done
3167 exit 0
3168 EOF
3169             ;;
3170         *)  echo "Unknown targetto '$targetto'" >&4
3171             exit 1
3172             ;;
3173         esac
3174         case "$targetfrom" in
3175         scp|rcp)
3176           cat >$from <<EOF
3177 #!/bin/sh
3178 for f in \$@
3179 do
3180   $rm -f \$f
3181   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3182 done
3183 exit 0
3184 EOF
3185             ;;
3186         cp) cat >$from <<EOF
3187 #!/bin/sh
3188 for f in \$@
3189 do
3190   $rm -f \$f
3191   cp $targetdir/\$f . || exit 1
3192 done
3193 exit 0
3194 EOF
3195             ;;
3196         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3197             exit 1
3198             ;;
3199         esac
3200         if $test ! -f $run; then
3201             echo "Target 'run' script '$run' not found." >&4
3202         else
3203             $chmod a+rx $run
3204         fi
3205         if $test ! -f $to; then
3206             echo "Target 'to' script '$to' not found." >&4
3207         else
3208             $chmod a+rx $to
3209         fi
3210         if $test ! -f $from; then
3211             echo "Target 'from' script '$from' not found." >&4
3212         else
3213             $chmod a+rx $from
3214         fi
3215         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3216             exit 1
3217         fi
3218         cat >&4 <<EOF
3219 Using '$run' for remote execution,
3220 and '$from' and '$to'
3221 for remote file transfer.
3222 EOF
3223         ;;
3224 *)      run=''
3225         to=:
3226         from=:
3227         usecrosscompile="$undef"
3228         targetarch=''
3229         ;;
3230 esac
3231
3232 : see whether [:lower:] and [:upper:] are supported character classes
3233 echo " "
3234 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3235 ABYZ-abyz)
3236         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3237         up='[:upper:]'
3238         low='[:lower:]'
3239         ;;
3240 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3241         # (0xd9 and 0xe2), therefore that is a nice testing point.
3242         if test "X$up" = X -o "X$low" = X; then
3243             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3244             rs) up='[A-Z]'
3245                 low='[a-z]'
3246                 ;;
3247             esac
3248         fi
3249         if test "X$up" = X -o "X$low" = X; then
3250             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3251             rs) up='A-Z'
3252                 low='a-z'
3253                 ;;
3254             esac
3255         fi
3256         if test "X$up" = X -o "X$low" = X; then
3257             case "`echo RS | od -x 2>/dev/null`" in
3258             *D9E2*|*d9e2*)
3259                 echo "Hey, this might be EBCDIC." >&4
3260                 if test "X$up" = X -o "X$low" = X; then
3261                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3262                     rs) up='[A-IJ-RS-Z]'
3263                         low='[a-ij-rs-z]'
3264                         ;;
3265                     esac
3266                 fi
3267                 if test "X$up" = X -o "X$low" = X; then
3268                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3269                     rs) up='A-IJ-RS-Z'
3270                         low='a-ij-rs-z'
3271                         ;;
3272                     esac
3273                 fi
3274                 ;;
3275             esac
3276         fi
3277 esac
3278 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3279 rs)
3280     echo "Using $up and $low to convert case." >&4
3281     ;;
3282 *)
3283     echo "I don't know how to translate letters from upper to lower case." >&4
3284     echo "Your tr is not acting any way I know of." >&4
3285     exit 1
3286     ;;
3287 esac
3288 : set up the translation script tr, must be called with ./tr of course
3289 cat >tr <<EOSC
3290 $startsh
3291 case "\$1\$2" in
3292 '[A-Z][a-z]') exec $tr '$up' '$low';;
3293 '[a-z][A-Z]') exec $tr '$low' '$up';;
3294 esac
3295 exec $tr "\$@"
3296 EOSC
3297 chmod +x tr
3298 $eunicefix tr
3299
3300 : Try to determine whether config.sh was made on this system
3301 case "$config_sh" in
3302 '')
3303 myuname=`$uname -a 2>/dev/null`
3304 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3305 # Downcase everything to avoid ambiguity.
3306 # Remove slashes and single quotes so we can use parts of this in
3307 # directory and file names.
3308 # Remove newlines so myuname is sane to use elsewhere.
3309 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3310 # because the A-Z/a-z are not consecutive.
3311 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3312         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3313 newmyuname="$myuname"
3314 dflt=n
3315 case "$knowitall" in
3316 '')
3317         if test -f ../config.sh; then
3318                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3319                         eval "`grep myuname= ../config.sh`"
3320                 fi
3321                 if test "X$myuname" = "X$newmyuname"; then
3322                         dflt=y
3323                 fi
3324         fi
3325         ;;
3326 *) dflt=y;;
3327 esac
3328
3329 : Get old answers from old config file if Configure was run on the
3330 : same system, otherwise use the hints.
3331 hint=default
3332 cd ..
3333 if test -f config.sh; then
3334         echo " "
3335         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3336         . UU/myread
3337         case "$ans" in
3338         n*|N*) echo "OK, I'll ignore it."
3339                 mv config.sh config.sh.old
3340                 myuname="$newmyuname"
3341                 ;;
3342         *)  echo "Fetching default answers from your old config.sh file..." >&4
3343                 tmp_n="$n"
3344                 tmp_c="$c"
3345                 tmp_sh="$sh"
3346                 . ./config.sh
3347                 cp config.sh UU
3348                 n="$tmp_n"
3349                 c="$tmp_c"
3350                 : Older versions did not always set $sh.  Catch re-use of such
3351                 : an old config.sh.
3352                 case "$sh" in
3353                 '') sh="$tmp_sh" ;;
3354                 esac
3355                 hint=previous
3356                 ;;
3357         esac
3358 fi
3359 . ./UU/checkcc
3360 if test ! -f config.sh; then
3361         $cat <<EOM
3362
3363 First time through, eh?  I have some defaults handy for some systems
3364 that need some extra help getting the Configure answers right:
3365
3366 EOM
3367         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3368         dflt=''
3369         : Half the following guesses are probably wrong... If you have better
3370         : tests or hints, please send them to perlbug@perl.org
3371         : The metaconfig authors would also appreciate a copy...
3372         $test -f /irix && osname=irix
3373         $test -f /xenix && osname=sco_xenix
3374         $test -f /dynix && osname=dynix
3375         $test -f /dnix && osname=dnix
3376         $test -f /lynx.os && osname=lynxos
3377         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3378         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3379         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3380         $test -f /bin/mips && /bin/mips && osname=mips
3381         $test -d /usr/apollo/bin && osname=apollo
3382         $test -f /etc/saf/_sactab && osname=svr4
3383         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3384         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3385         $test -f /sys/utilities/MultiView && osname=amigaos
3386         if $test -d /MachTen -o -d /MachTen_Folder; then
3387                 osname=machten
3388                 if $test -x /sbin/version; then
3389                         osvers=`/sbin/version | $awk '{print $2}' |
3390                         $sed -e 's/[A-Za-z]$//'`
3391                 elif $test -x /usr/etc/version; then
3392                         osvers=`/usr/etc/version | $awk '{print $2}' |
3393                         $sed -e 's/[A-Za-z]$//'`
3394                 else
3395                         osvers="$2.$3"
3396                 fi
3397         fi
3398
3399         $test -f /sys/posix.dll &&
3400                 $test -f /usr/bin/what &&
3401                 set X `/usr/bin/what /sys/posix.dll` &&
3402                 $test "$3" = UWIN &&
3403                 osname=uwin &&
3404                 osvers="$5"
3405
3406         if $test -f $uname; then
3407                 set X $myuname
3408                 shift
3409
3410                 case "$5" in
3411                 fps*) osname=fps ;;
3412                 mips*)
3413                         case "$4" in
3414                         umips) osname=umips ;;
3415                         *) osname=mips ;;
3416                         esac;;
3417                 [23]100) osname=mips ;;
3418                 i386*)
3419                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3420                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3421                                 osname='sco'
3422                                 osvers=$tmp
3423                         elif $test -f /etc/kconfig; then
3424                                 osname=isc
3425                                 if test "$lns" = "$ln -s"; then
3426                                         osvers=4
3427                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3428                                         osvers=3
3429                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3430                                         osvers=2
3431                                 fi
3432                         fi
3433                         tmp=''
3434                         ;;
3435                 pc*)
3436                         if test -n "$DJGPP"; then
3437                                 osname=dos
3438                                 osvers=djgpp
3439                         fi
3440                         ;;
3441                 esac
3442
3443                 case "$1" in
3444                 aix) osname=aix
3445                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3446                         case "$tmp" in
3447                         # oslevel can fail with:
3448                         # oslevel: Unable to acquire lock.
3449                         *not\ found) osvers="$4"."$3" ;;
3450                         '<3240'|'<>3240') osvers=3.2.0 ;;
3451                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3452                         '=3250'|'>3250') osvers=3.2.5 ;;
3453                         *) osvers=$tmp;;
3454                         esac
3455                         ;;
3456                 bitrig) osname=bitrig
3457                         osvers="$3"
3458                         ;;
3459                 bsd386) osname=bsd386
3460                         osvers=`$uname -r`
3461                         ;;
3462                 cygwin*) osname=cygwin
3463                         osvers="$3"
3464                         ;;
3465                 *dc.osx) osname=dcosx
3466                         osvers="$3"
3467                         ;;
3468                 dnix) osname=dnix
3469                         osvers="$3"
3470                         ;;
3471                 domainos) osname=apollo
3472                         osvers="$3"
3473                         ;;
3474                 dgux)   osname=dgux
3475                         osvers="$3"
3476                         ;;
3477                 dragonfly) osname=dragonfly
3478                         osvers="$3"
3479                         ;;
3480                 dynixptx*) osname=dynixptx
3481                         osvers=`echo "$4"|sed 's/^v//'`
3482                         ;;
3483                 freebsd) osname=freebsd
3484                         osvers="$3" ;;
3485                 genix)  osname=genix ;;
3486                 gnu)    osname=gnu
3487                         osvers="$3" ;;
3488                 hp*)    osname=hpux
3489                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3490                         ;;
3491                 irix*)  osname=irix
3492                         case "$3" in
3493                         4*) osvers=4 ;;
3494                         5*) osvers=5 ;;
3495                         *)      osvers="$3" ;;
3496                         esac
3497                         ;;
3498                 linux)  osname=linux
3499                         case "$3" in
3500                         *)      osvers="$3" ;;
3501                         esac
3502                         $test -f /system/lib/libandroid.so && osname=linux-android
3503                         ;;
3504                 MiNT)   osname=mint
3505                         ;;
3506                 minix)  osname=minix
3507                         osvers=`$uname -r`
3508                         ;;
3509                 netbsd*) osname=netbsd
3510                         osvers="$3"
3511                         ;;
3512                 news-os) osvers="$3"
3513                         case "$3" in
3514                         4*) osname=newsos4 ;;
3515                         *) osname=newsos ;;
3516                         esac
3517                         ;;
3518                 nonstop-ux) osname=nonstopux ;;
3519                 openbsd) osname=openbsd
3520                         osvers="$3"
3521                         ;;
3522                 os2)    osname=os2
3523                         osvers="$4"
3524                         ;;
3525                 POSIX-BC | posix-bc ) osname=posix-bc
3526                         osvers="$3"
3527                         ;;
3528                 powerux | power_ux | powermax_os | powermaxos | \
3529                 powerunix | power_unix) osname=powerux
3530                         osvers="$3"
3531                         ;;
3532                 qnx) osname=qnx
3533                         osvers="$4"
3534                         ;;
3535                 solaris) osname=solaris
3536                         case "$3" in
3537                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3538                         *)      osvers="$3" ;;
3539                         esac
3540                         ;;
3541                 sunos) osname=sunos
3542                         case "$3" in
3543                         5*) osname=solaris
3544                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3545                         *)      osvers="$3" ;;
3546                         esac
3547                         ;;
3548                 titanos) osname=titanos
3549                         case "$3" in
3550                         1*) osvers=1 ;;
3551                         2*) osvers=2 ;;
3552                         3*) osvers=3 ;;
3553                         4*) osvers=4 ;;
3554                         *)      osvers="$3" ;;
3555                         esac
3556                         ;;
3557                 ultrix) osname=ultrix
3558                         osvers="$3"
3559                         ;;
3560                 osf1|mls+)      case "$5" in
3561                                 alpha)
3562                                         osname=dec_osf
3563                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3564                                         case "$osvers" in
3565                                         [1-9].[0-9]*) ;;
3566                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3567                                         esac
3568                                         ;;
3569                         hp*)    osname=hp_osf1  ;;
3570                         mips)   osname=mips_osf1 ;;
3571                         esac
3572                         ;;
3573                 # UnixWare 7.1.2 is known as Open UNIX 8
3574                 openunix|unixware) osname=svr5
3575                         osvers="$4"
3576                         ;;
3577                 uts)    osname=uts
3578                         osvers="$3"
3579                         ;;
3580                 vos) osvers="$3"
3581                         ;;
3582                 $2) case "$osname" in
3583                         *isc*) ;;
3584                         *freebsd*) ;;
3585                         svr*)
3586                                 : svr4.x or possibly later
3587                                 case "svr$3" in
3588                                 ${osname}*)
3589                                         osname=svr$3
3590                                         osvers=$4
3591                                         ;;
3592                                 esac
3593                                 case "$osname" in
3594                                 svr4.0)
3595                                         : Check for ESIX
3596                                         if test -f /stand/boot ; then
3597                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3598                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3599                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3600                                                         if test -n "$isesix"; then
3601                                                                 osname=esix4
3602                                                         fi
3603                                                 fi
3604                                         fi
3605                                         ;;
3606                                 esac
3607                                 ;;
3608                         *)      if test -f /etc/systemid; then
3609                                         osname=sco
3610                                         set `echo $3 | $sed 's/\./ /g'` $4
3611                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3612                                                 osvers=$1.$2.$3
3613                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3614                                                 osvers=$1.$2
3615                                         elif $test -f $src/hints/sco_$1.sh; then
3616                                                 osvers=$1
3617                                         fi
3618                                 else
3619                                         case "$osname" in
3620                                         '') : Still unknown.  Probably a generic Sys V.
3621                                                 osname="sysv"
3622                                                 osvers="$3"
3623                                                 ;;
3624                                         esac
3625                                 fi
3626                                 ;;
3627                         esac
3628                         ;;
3629                 *)      case "$osname" in
3630                         '') : Still unknown.  Probably a generic BSD.
3631                                 osname="$1"
3632                                 osvers="$3"
3633                                 ;;
3634                         esac
3635                         ;;
3636                 esac
3637         else
3638                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3639                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3640                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3641                                 osname=news_os
3642                         fi
3643                         $rm -f UU/kernel.what
3644                 elif test -d c:/. -o -n "$is_os2" ; then
3645                         set X $myuname
3646                         osname=os2
3647                         osvers="$5"
3648                 fi
3649         fi
3650
3651         case "$targetarch" in
3652         '') ;;
3653         *)  hostarch=$osname
3654             case "$targetarch" in
3655                 nto*|*-nto-*)
3656                     # Will load qnx.sh, which should change osname to nto
3657                     osname=qnx
3658                     osvers=''
3659                     ;;
3660                 *linux-android*)
3661                     # Catch arm-linux-androideabi, mipsel-linux-android,
3662                     # and i686-linux-android
3663                     osname=linux-android
3664                     osvers=''
3665                     ;;
3666                 *linux*)
3667                     # Something like arm-linux-gnueabihf is really just
3668                     # plain linux.
3669                     osname=linux
3670                     osvers=''
3671                     ;;
3672                 *solaris*|*sunos*)
3673                     osname=solaris
3674                     # XXX perhaps we should just assume
3675                     # osvers to be 2, or maybe take the value
3676                     # from targetarch. Using $run before the
3677                     # hints are run is somewhat icky.
3678                     set X `$run $uname -a 2>/dev/null`
3679                     shift
3680                     case "$3" in
3681                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3682                         *)  osvers="$3" ;;
3683                     esac
3684                     ;;
3685                 *)
3686                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3687                     osvers=''
3688                 ;;
3689             esac
3690             ;;
3691         esac
3692
3693         : Now look for a hint file osname_osvers, unless one has been
3694         : specified already.
3695         case "$hintfile" in
3696         ''|' ')
3697                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3698                 : Also try without trailing minor version numbers.
3699                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3700                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3701                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3702                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3703                 case "$file" in
3704                 '') dflt=none ;;
3705                 *)  case "$osvers" in
3706                         '') dflt=$file
3707                                 ;;
3708                         *)  if $test -f $src/hints/$file.sh ; then
3709                                         dflt=$file
3710                                 elif $test -f $src/hints/$xfile.sh ; then
3711                                         dflt=$xfile
3712                                 elif $test -f $src/hints/$xxfile.sh ; then
3713                                         dflt=$xxfile
3714                                 elif $test -f $src/hints/$xxxfile.sh ; then
3715                                         dflt=$xxxfile
3716                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3717                                         dflt=$xxxxfile
3718                                 elif $test -f "$src/hints/${osname}.sh" ; then
3719                                         dflt="${osname}"
3720                                 else
3721                                         dflt=none
3722                                 fi
3723                                 ;;
3724                         esac
3725                         ;;
3726                 esac
3727                 if $test -f Policy.sh ; then
3728                         case "$dflt" in
3729                         *Policy*) ;;
3730                         none) dflt="Policy" ;;
3731                         *) dflt="Policy $dflt" ;;
3732                         esac
3733                 fi
3734                 ;;
3735         *)
3736                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3737                 ;;
3738         esac
3739
3740         if $test -f Policy.sh ; then
3741                 $cat <<EOM
3742
3743 There's also a Policy hint file available, which should make the
3744 site-specific (policy) questions easier to answer.
3745 EOM
3746
3747         fi
3748
3749         $cat <<EOM
3750
3751 You may give one or more space-separated answers, or "none" if appropriate.
3752 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3753 previous run of Configure, you may specify it as well as or instead of
3754 OS-specific hints.  If hints are provided for your OS, you should use them:
3755 although Perl can probably be built without hints on many platforms, using
3756 hints often improve performance and may enable features that Configure can't
3757 set up on its own. If there are no hints that match your OS, specify "none";
3758 DO NOT give a wrong version or a wrong OS.
3759
3760 EOM
3761
3762         rp="Which of these apply, if any?"
3763         . UU/myread
3764         tans=$ans
3765         for file in $tans; do
3766                 if $test X$file = XPolicy -a -f Policy.sh; then
3767                         . Policy.sh
3768                         $cat Policy.sh >> UU/config.sh
3769                 elif $test -f $src/hints/$file.sh; then
3770                         . $src/hints/$file.sh
3771                         $cat $src/hints/$file.sh >> UU/config.sh
3772                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3773                         : nothing
3774                 else
3775                         : Give one chance to correct a possible typo.
3776                         echo "$file.sh does not exist"
3777                         dflt=$file
3778                         rp="hint to use instead?"
3779                         . UU/myread
3780                         for file in $ans; do
3781                                 if $test -f "$src/hints/$file.sh"; then
3782                                         . $src/hints/$file.sh
3783                                         $cat $src/hints/$file.sh >> UU/config.sh
3784                                 elif $test X$ans = X -o X$ans = Xnone ; then
3785                                         : nothing
3786                                 else
3787                                         echo "$file.sh does not exist -- ignored."
3788                                 fi
3789                         done
3790                 fi
3791         done
3792
3793         hint=recommended
3794         : Remember our hint file for later.
3795         if $test -f "$src/hints/$file.sh" ; then
3796                 hintfile="$file"
3797         else
3798                 hintfile=''
3799         fi
3800 fi
3801 cd UU
3802 ;;
3803 *)
3804         echo " "
3805         echo "Fetching default answers from $config_sh..." >&4
3806         tmp_n="$n"
3807         tmp_c="$c"
3808         cd ..
3809         cp $config_sh config.sh 2>/dev/null
3810         chmod +w config.sh
3811         . ./config.sh
3812         cd UU
3813         cp ../config.sh .
3814         n="$tmp_n"
3815         c="$tmp_c"
3816         hint=previous
3817         ;;
3818 esac
3819 . ./optdef.sh
3820
3821 : Restore computed paths
3822 for file in $loclist $trylist; do
3823         eval $file="\$_$file"
3824 done
3825
3826 cat << EOM
3827
3828 Configure uses the operating system name and version to set some defaults.
3829 The default value is probably right if the name rings a bell. Otherwise,
3830 since spelling matters for me, either accept the default or answer "none"
3831 to leave it blank.
3832
3833 EOM
3834 case "$osname" in
3835         ''|' ')
3836                 case "$hintfile" in
3837                 ''|' '|none) dflt=none ;;
3838                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3839                 esac
3840                 ;;
3841         *) dflt="$osname" ;;
3842 esac
3843 rp="Operating system name?"
3844 . ./myread
3845 case "$ans" in
3846 none)  osname='' ;;
3847 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3848 esac
3849 echo " "
3850 case "$osvers" in
3851         ''|' ')
3852                 case "$hintfile" in
3853                 ''|' '|none) dflt=none ;;
3854                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3855                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3856                         case "$dflt" in
3857                         ''|' ') dflt=none ;;
3858                         esac
3859                         ;;
3860                 esac
3861                 ;;
3862         *) dflt="$osvers" ;;
3863 esac
3864 rp="Operating system version?"
3865 . ./myread
3866 case "$ans" in
3867 none)  osvers='' ;;
3868 *) osvers="$ans" ;;
3869 esac
3870
3871
3872 . ./posthint.sh
3873
3874 : who configured the system
3875 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3876 case "$cf_by" in
3877 "")
3878         cf_by=`(logname) 2>/dev/null`
3879         case "$cf_by" in
3880         "")
3881                 cf_by=`(whoami) 2>/dev/null`
3882                 case "$cf_by" in
3883                 "") cf_by=unknown ;;
3884                 esac ;;
3885         esac ;;
3886 esac
3887
3888 : decide how portable to be.  Allow command line overrides.
3889 case "$d_portable" in
3890 "$undef") ;;
3891 *)      d_portable="$define" ;;
3892 esac
3893
3894 : set up shell script to do ~ expansion
3895 cat >filexp <<EOSS
3896 $startsh
3897 : expand filename
3898 case "\$1" in
3899  \~/*|\~)
3900         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3901         ;;
3902  \~*)
3903         if $test -f /bin/csh; then
3904                 /bin/csh -f -c "glob \$1"
3905                 failed=\$?
3906                 echo ""
3907                 exit \$failed
3908         else
3909                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3910                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3911                 if $test ! -d "\$dir"; then
3912                         me=\`basename \$0\`
3913                         echo "\$me: can't locate home directory for: \$name" >&2
3914                         exit 1
3915                 fi
3916                 case "\$1" in
3917                 */*)
3918                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3919                         ;;
3920                 *)
3921                         echo \$dir
3922                         ;;
3923                 esac
3924         fi
3925         ;;
3926 *)
3927         echo \$1
3928         ;;
3929 esac
3930 EOSS
3931 chmod +x filexp
3932 $eunicefix filexp
3933
3934 : now set up to get a file name
3935 cat <<EOS >getfile
3936 $startsh
3937 EOS
3938 cat <<'EOSC' >>getfile
3939 tilde=''
3940 fullpath=''
3941 already=''
3942 skip=''
3943 none_ok=''
3944 exp_file=''
3945 nopath_ok=''
3946 orig_rp="$rp"
3947 orig_dflt="$dflt"
3948 case "$gfpth" in
3949 '') gfpth='.' ;;
3950 esac
3951
3952 case "$fn" in
3953 *\(*)
3954         : getfile will accept an answer from the comma-separated list
3955         : enclosed in parentheses even if it does not meet other criteria.
3956         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3957         fn=`echo $fn | sed 's/(.*)//'`
3958         ;;
3959 esac
3960
3961 case "$fn" in
3962 *:*)
3963         loc_file=`expr $fn : '.*:\(.*\)'`
3964         fn=`expr $fn : '\(.*\):.*'`
3965         ;;
3966 esac
3967
3968 case "$fn" in
3969 *~*) tilde=true;;
3970 esac
3971 case "$fn" in
3972 */*) fullpath=true;;
3973 esac
3974 case "$fn" in
3975 *+*) skip=true;;
3976 esac
3977 case "$fn" in
3978 *n*) none_ok=true;;
3979 esac
3980 case "$fn" in
3981 *e*) exp_file=true;;
3982 esac
3983 case "$fn" in
3984 *p*) nopath_ok=true;;
3985 esac
3986
3987 case "$fn" in
3988 *f*) type='File';;
3989 *d*) type='Directory';;
3990 *l*) type='Locate';;
3991 esac
3992
3993 what="$type"
3994 case "$what" in
3995 Locate) what='File';;
3996 esac
3997
3998 case "$exp_file" in
3999 '')
4000         case "$d_portable" in
4001         "$define") ;;
4002         *) exp_file=true;;
4003         esac
4004         ;;
4005 esac
4006
4007 cd ..
4008 while test "$type"; do
4009         redo=''
4010         rp="$orig_rp"
4011         dflt="$orig_dflt"
4012         case "$tilde" in
4013         true) rp="$rp (~name ok)";;
4014         esac
4015         . UU/myread
4016         if test -f UU/getfile.ok && \
4017                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4018         then
4019                 value="$ans"
4020                 ansexp="$ans"
4021                 break
4022         fi
4023         case "$ans" in
4024         none)
4025                 value=''
4026                 ansexp=''
4027                 case "$none_ok" in
4028                 true) type='';;
4029                 esac
4030                 ;;
4031         *)
4032                 case "$tilde" in
4033                 '') value="$ans"
4034                         ansexp="$ans";;
4035                 *)
4036                         value=`UU/filexp $ans`
4037                         case $? in
4038                         0)
4039                                 if test "$ans" != "$value"; then
4040                                         echo "(That expands to $value on this system.)"
4041                                 fi
4042                                 ;;
4043                         *) value="$ans";;
4044                         esac
4045                         ansexp="$value"
4046                         case "$exp_file" in
4047                         '') value="$ans";;
4048                         esac
4049                         ;;
4050                 esac
4051                 case "$fullpath" in
4052                 true)
4053                         case "$ansexp" in
4054                         /*) value="$ansexp" ;;
4055                         [a-zA-Z]:/*) value="$ansexp" ;;
4056                         *)
4057                                 redo=true
4058                                 case "$already" in
4059                                 true)
4060                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4061                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4062                                         ;;
4063                                 *)
4064                                 echo "Please give a full path name, starting with slash." >&4
4065                                         case "$tilde" in
4066                                         true)
4067                                 echo "Note that using ~name is ok provided it expands well." >&4
4068                                                 already=true
4069                                                 ;;
4070                                         esac
4071                                 esac
4072                                 ;;
4073                         esac
4074                         ;;
4075                 esac
4076                 case "$redo" in
4077                 '')
4078                         case "$type" in
4079                         File)
4080                                 for fp in $gfpth; do
4081                                         if test "X$fp" = X.; then
4082                                             pf="$ansexp"
4083                                         else    
4084                                             pf="$fp/$ansexp"
4085                                         fi
4086                                         if test -f "$pf"; then
4087                                                 type=''
4088                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4089                                         then
4090                                                 echo "($value is not a plain file, but that's ok.)"
4091                                                 type=''
4092                                         fi
4093                                         if test X"$type" = X; then
4094                                             value="$pf"
4095                                             break
4096                                         fi
4097                                 done
4098                                 ;;
4099                         Directory)
4100                                 for fp in $gfpth; do
4101                                         if test "X$fp" = X.; then
4102                                             dir="$ans"
4103                                             direxp="$ansexp"
4104                                         else    
4105                                             dir="$fp/$ansexp"
4106                                             direxp="$fp/$ansexp"
4107                                         fi
4108                                         if test -d "$direxp"; then
4109                                                 type=''
4110                                                 value="$dir"
4111                                                 break
4112                                         fi
4113                                 done
4114                                 ;;
4115                         Locate)
4116                                 if test -d "$ansexp"; then
4117                                         echo "(Looking for $loc_file in directory $value.)"
4118                                         value="$value/$loc_file"
4119                                         ansexp="$ansexp/$loc_file"
4120                                 fi
4121                                 if test -f "$ansexp"; then
4122                                         type=''
4123                                 fi
4124                                 case "$nopath_ok" in
4125                                 true)   case "$value" in
4126                                         */*) ;;
4127                                         *)      echo "Assuming $value will be in people's path."
4128                                                 type=''
4129                                                 ;;
4130                                         esac
4131                                         ;;
4132                                 esac
4133                                 ;;
4134                         esac
4135
4136                         case "$skip" in
4137                         true) type='';
4138                         esac
4139
4140                         case "$type" in
4141                         '') ;;
4142                         *)
4143                                 if test "$fastread" = yes; then
4144                                         dflt=y
4145                                 else
4146                                         dflt=n
4147                                 fi
4148                                 rp="$what $value doesn't exist.  Use that name anyway?"
4149                                 . UU/myread
4150                                 dflt=''
4151                                 case "$ans" in
4152                                 y*) type='';;
4153                                 *) echo " ";;
4154                                 esac
4155                                 ;;
4156                         esac
4157                         ;;
4158                 esac
4159                 ;;
4160         esac
4161 done
4162 cd UU
4163 ans="$value"
4164 rp="$orig_rp"
4165 dflt="$orig_dflt"
4166 rm -f getfile.ok
4167 test "X$gfpthkeep" != Xy && gfpth=""
4168 EOSC
4169
4170 : determine root of directory hierarchy where package will be installed.
4171 case "$prefix" in
4172 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4173         ;;
4174 *)      dflt="$prefix"
4175         ;;
4176 esac
4177 $cat <<EOM
4178
4179 By default, $package will be installed in $dflt/bin, manual pages
4180 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4181 installation directories. Typically this is something like /usr/local.
4182 If you wish to have binaries under /usr/bin but other parts of the
4183 installation under /usr/local, that's ok: you will be prompted
4184 separately for each of the installation directories, the prefix being
4185 only used to set the defaults.
4186
4187 EOM
4188 fn=d~
4189 rp='Installation prefix to use?'
4190 . ./getfile
4191 oldprefix=''
4192 case "$prefix" in
4193 '')     ;;
4194 *)      case "$ans" in
4195         "$prefix") ;;
4196         *) oldprefix="$prefix";;
4197         esac
4198         ;;
4199 esac
4200
4201 case "$ans" in
4202 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4203         ;;
4204 *)      prefix="$ans"
4205 esac
4206
4207 case "$ansexp" in
4208 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4209         ;;
4210 *)      prefixexp="$ansexp"
4211 esac
4212
4213 : allow them to override the AFS root
4214 case "$afsroot" in
4215 '')     afsroot=/afs ;;
4216 *)      afsroot=$afsroot ;;
4217 esac
4218
4219 : is AFS running?
4220 echo " "
4221 case "$afs" in
4222 $define|true)   afs=true ;;
4223 $undef|false)   afs=false ;;
4224 *)      if $test -d $afsroot; then
4225                 afs=true
4226         else
4227                 afs=false
4228         fi
4229         ;;
4230 esac
4231 if $afs; then
4232         echo "AFS may be running... I'll be extra cautious then..." >&4
4233 else
4234         echo "AFS does not seem to be running..." >&4
4235 fi
4236
4237 : determine installation prefix for where package is to be installed.
4238 if $afs; then
4239 $cat <<EOM
4240
4241 Since you are running AFS, I need to distinguish the directory in which
4242 files will reside from the directory in which they are installed (and from
4243 which they are presumably copied to the former directory by occult means).
4244
4245 EOM
4246         case "$installprefix" in
4247         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4248         *) dflt="$installprefix";;
4249         esac
4250 else
4251 $cat <<EOM
4252
4253 In some special cases, particularly when building $package for distribution,
4254 it is convenient to distinguish the directory in which files should be
4255 installed from the directory ($prefix) in which they will
4256 eventually reside.  For most users, these two directories are the same.
4257
4258 EOM
4259         case "$installprefix" in
4260         '') dflt=$prefix ;;
4261         *) dflt=$installprefix;;
4262         esac
4263 fi
4264 fn=d~
4265 rp='What installation prefix should I use for installing files?'
4266 . ./getfile
4267 installprefix="$ans"
4268 installprefixexp="$ansexp"
4269
4270 : Perform the prefixexp/installprefixexp correction if necessary
4271 cat <<EOS >installprefix
4272 $startsh
4273 EOS
4274 cat <<'EOSC' >>installprefix
4275 : Change installation prefix, if necessary.
4276 if $test X"$prefix" != X"$installprefix"; then
4277     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4278 else
4279     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4280 fi
4281 EOSC
4282 chmod +x installprefix
4283 $eunicefix installprefix
4284
4285 : Set variables such as privlib and privlibexp from the output of ./getfile
4286 : performing the prefixexp/installprefixexp correction if necessary.
4287 cat <<EOS >setprefixvar
4288 $startsh
4289 EOS
4290 cat <<'EOSC' >>setprefixvar
4291 eval "${prefixvar}=\"\$ans\""
4292 eval "${prefixvar}exp=\"\$ansexp\""
4293 . ./installprefix
4294 EOSC
4295 chmod +x setprefixvar
4296 $eunicefix setprefixvar
4297
4298 : set up the script used to warn in case of inconsistency
4299 cat <<EOS >whoa
4300 $startsh
4301 EOS
4302 cat <<'EOSC' >>whoa
4303 dflt=y
4304 case "$hint" in
4305     recommended)
4306         case "$hintfile" in
4307         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4308                 ;;
4309         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4310                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4311                 ;;
4312         esac
4313         ;;
4314     *)  echo " "
4315         echo "*** WHOA THERE!!! ***" >&4
4316         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4317         ;;
4318 esac
4319 rp="    Keep the $hint value?"
4320 . ./myread
4321 case "$ans" in
4322 y) td=$was; tu=$was;;
4323 esac
4324 EOSC
4325
4326 : function used to set '$1' to '$val'
4327 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4328 case "$val$was" in
4329 $define$undef) . ./whoa; eval "$var=\$td";;
4330 $undef$define) . ./whoa; eval "$var=\$tu";;
4331 *) eval "$var=$val";;
4332 esac'
4333
4334 : get the patchlevel
4335 echo " "
4336 echo "Getting the current patchlevel..." >&4
4337 if $test -r $rsrc/patchlevel.h;then
4338         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4339         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4340         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4341         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4342         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4343         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4344         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4345 else
4346         revision=0
4347         patchlevel=0
4348         subversion=0
4349         api_revision=0
4350         api_version=0
4351         api_subversion=0
4352         perl_patchlevel=0
4353         $echo "(You do not have patchlevel.h.  Eek.)"
4354 fi
4355 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4356 version_patchlevel_string="version $patchlevel subversion $subversion"
4357 case "$perl_patchlevel" in
4358 0|'') ;;
4359 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4360     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4361     ;;
4362 esac
4363
4364 $echo "(You have $package $version_patchlevel_string.)"
4365
4366 case "$osname" in
4367 dos|vms)
4368         : XXX Should be a Configure test for double-dots in filenames.
4369         version=`echo $revision $patchlevel $subversion | \
4370                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4371         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4372                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4373         ;;
4374 *)
4375         version=`echo $revision $patchlevel $subversion | \
4376                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4377         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4378                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4379         ;;
4380 esac
4381 : Special case the 5.005_xx maintenance series, which used 5.005
4382 : without any subversion label as a subdirectory in $sitelib
4383 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4384         api_versionstring='5.005'
4385 fi
4386
4387 : Do we want threads support and if so, what type
4388 case "$usethreads" in
4389 $define|true|[yY]*)     dflt='y';;
4390 *)     # Catch case where user specified ithreads or 5005threads but
4391        # forgot -Dusethreads (A.D. 4/2002)
4392        case "$useithreads$use5005threads" in
4393        *$define*)       dflt='y';;
4394        *)               dflt='n';;
4395        esac
4396        ;;
4397 esac
4398 cat <<EOM
4399
4400 Perl can be built to offer a form of threading support on some systems
4401 To do so, Configure can be run with -Dusethreads.
4402
4403 Note that Perl built with threading support runs slightly slower
4404 and uses slightly more memory than plain Perl.
4405
4406 If this doesn't make any sense to you, just accept the default '$dflt'.
4407 EOM
4408 rp='Build a threading Perl?'
4409 . ./myread
4410 case "$ans" in
4411 y|Y)    val="$define" ;;
4412 *)      val="$undef" ;;
4413 esac
4414 set usethreads
4415 eval $setvar
4416
4417 if $test $patchlevel -lt 9; then
4418     case "$usethreads" in
4419     $define)
4420         : Default to ithreads unless overridden on command line or with
4421         : old config.sh
4422         dflt='y'
4423         case "$use5005threads" in
4424                 $define|true|[yY]*)
4425                         echo "5.005 threads are no longer supported"
4426                         exit 1
4427                 ;;
4428         esac
4429         case "$useithreads" in
4430                 $undef|false|[nN]*) dflt='n';;
4431         esac
4432         rp='Use the newer interpreter-based ithreads?'
4433         . ./myread
4434         case "$ans" in
4435         y|Y)    val="$define" ;;
4436         *)      val="$undef" ;;
4437         esac
4438         set useithreads
4439         eval $setvar
4440         : Now set use5005threads to the opposite value.
4441         case "$useithreads" in
4442         $define) val="$undef" ;;
4443         *) val="$define" ;;
4444         esac
4445         set use5005threads
4446         eval $setvar
4447         ;;
4448     *)
4449         useithreads="$undef"
4450         use5005threads="$undef"
4451         ;;
4452     esac
4453
4454     case "$useithreads$use5005threads" in
4455     "$define$define")
4456         $cat >&4 <<EOM
4457
4458 You cannot have both the ithreads and the 5.005 threads enabled
4459 at the same time.  Disabling the 5.005 threads since they are
4460 much less stable than the ithreads.
4461
4462 EOM
4463         use5005threads="$undef"
4464         ;;
4465     esac
4466
4467 else
4468 : perl-5.9.x and later
4469
4470     if test X"$usethreads" = "X$define"; then
4471         case "$use5005threads" in
4472             $define|true|[yY]*)
4473                 $cat >&4 <<EOM
4474
4475 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4476
4477 EOM
4478             ;;
4479         esac
4480     fi
4481
4482     use5005threads="$undef"
4483     useithreads="$usethreads"
4484 fi
4485
4486 case "$d_oldpthreads" in
4487 '')     : Configure tests would be welcome here.  For now, assume undef.
4488         val="$undef" ;;
4489 *)      val="$d_oldpthreads" ;;
4490 esac
4491 set d_oldpthreads
4492 eval $setvar
4493
4494
4495 : Look for a hint-file generated 'call-back-unit'.  If the
4496 : user has specified that a threading perl is to be built,
4497 : we may need to set or change some other defaults.
4498 if $test -f usethreads.cbu; then
4499     echo "Your platform has some specific hints regarding threaded builds, using them..."
4500     . ./usethreads.cbu
4501 else
4502     case "$usethreads" in
4503         "$define"|true|[yY]*)
4504                 $cat <<EOM
4505 (Your platform does not have any specific hints for threaded builds.
4506  Assuming POSIX threads, then.)
4507 EOM
4508         ;;
4509     esac
4510 fi
4511
4512 : Check if multiplicity is required
4513 cat <<EOM
4514
4515 Perl can be built so that multiple Perl interpreters can coexist
4516 within the same Perl executable.
4517 EOM
4518
4519 case "$useithreads" in
4520 $define)
4521         cat <<EOM
4522 This multiple interpreter support is required for interpreter-based threads.
4523 EOM
4524         val="$define"
4525         ;;
4526 *)      case "$usemultiplicity" in
4527         $define|true|[yY]*)     dflt='y';;
4528         *) dflt='n';;
4529         esac
4530         echo " "
4531         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4532         rp='Build Perl for multiplicity?'
4533         . ./myread
4534         case "$ans" in
4535         y|Y)    val="$define" ;;
4536         *)      val="$undef" ;;
4537         esac
4538         ;;
4539 esac
4540 set usemultiplicity
4541 eval $setvar
4542
4543 : Check if morebits is requested
4544 case "$usemorebits" in
4545 "$define"|true|[yY]*)
4546         use64bitint="$define"
4547         uselongdouble="$define"
4548         usemorebits="$define"
4549         ;;
4550 *)      usemorebits="$undef"
4551         ;;
4552 esac
4553
4554 : Determine the C compiler to be used
4555 echo " "
4556 case "$cc" in
4557 '') dflt=cc;;
4558 *) dflt="$cc";;
4559 esac
4560 rp="Use which C compiler?"
4561 . ./myread
4562 cc="$ans"
4563
4564 : See whether they have no cc but they do have gcc
4565 . ./trygcc
4566 if $test -f cc.cbu; then
4567     . ./cc.cbu
4568 fi
4569 . ./checkcc
4570
4571 : make some quick guesses about what we are up against
4572 echo " "
4573 $echo $n "Hmm...  $c"
4574 echo exit 1 >bsd
4575 echo exit 1 >usg
4576 echo exit 1 >v7
4577 echo exit 1 >osf1
4578 echo exit 1 >eunice
4579 echo exit 1 >xenix
4580 echo exit 1 >venix
4581 echo exit 1 >os2
4582 d_bsd="$undef"
4583 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4584 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4585 then
4586         echo "Looks kind of like an OSF/1 system, but we'll see..."
4587         echo exit 0 >osf1
4588 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4589         xxx=`./loc addbib blurfl $pth`
4590         if $test -f $xxx; then
4591         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4592                 echo exit 0 >bsd
4593                 echo exit 0 >usg
4594         else
4595                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4596                         echo "Looks kind of like an extended USG system, but we'll see..."
4597                 else
4598                         echo "Looks kind of like a USG system, but we'll see..."
4599                 fi
4600                 echo exit 0 >usg
4601         fi
4602 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4603         echo "Looks kind of like a BSD system, but we'll see..."
4604         d_bsd="$define"
4605         echo exit 0 >bsd
4606 else
4607         echo "Looks kind of like a Version 7 system, but we'll see..."
4608         echo exit 0 >v7
4609 fi
4610 case "$eunicefix" in
4611 *unixtovms*)
4612         $cat <<'EOI'
4613 There is, however, a strange, musty smell in the air that reminds me of
4614 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4615 EOI
4616         echo exit 0 >eunice
4617         d_eunice="$define"
4618 : it so happens the Eunice I know will not run shell scripts in Unix format
4619         ;;
4620 *)
4621         echo " "
4622         echo "Congratulations.  You aren't running Eunice."
4623         d_eunice="$undef"
4624         ;;
4625 esac
4626 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4627 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4628 : semicolon as a patch separator
4629 case "$p_" in
4630 :) ;;
4631 *)
4632         $cat <<'EOI'
4633 I have the feeling something is not exactly right, however...don't tell me...
4634 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4635 (Or you may be running DOS with DJGPP.)
4636 EOI
4637         echo exit 0 >os2
4638         ;;
4639 esac
4640 if test -f /xenix; then
4641         echo "Actually, this looks more like a XENIX system..."
4642         echo exit 0 >xenix
4643         d_xenix="$define"
4644 else
4645         echo " "
4646         echo "It's not Xenix..."
4647         d_xenix="$undef"
4648 fi
4649 chmod +x xenix
4650 $eunicefix xenix
4651 if test -f /venix; then
4652         echo "Actually, this looks more like a VENIX system..."
4653         echo exit 0 >venix
4654 else
4655         echo " "
4656         if ./xenix; then
4657                 : null
4658         else
4659                 echo "Nor is it Venix..."
4660         fi
4661 fi
4662 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4663 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4664 $rm -f foo
4665
4666 : Check if we are using GNU gcc and what its version is
4667 echo " "
4668 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4669 $cat >try.c <<EOM
4670 #include <stdio.h>
4671 int main() {
4672 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4673 #ifdef __VERSION__
4674         printf("%s\n", __VERSION__);
4675 #else
4676         printf("%s\n", "1");
4677 #endif
4678 #endif
4679         return(0);
4680 }
4681 EOM
4682 if $cc -o try $ccflags $ldflags try.c; then
4683         gccversion=`$run ./try`
4684         case "$gccversion" in
4685         '') echo "You are not using GNU cc." ;;
4686         *)  echo "You are using GNU cc $gccversion."
4687             ccname=gcc
4688             ;;
4689         esac
4690 else
4691         echo " "
4692         echo "*** WHOA THERE!!! ***" >&4
4693         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4694         case "$knowitall" in
4695         '')
4696         echo "    You'd better start hunting for one and let me know about it." >&4
4697                 exit 1
4698                 ;;
4699         esac
4700 fi
4701 $rm -f try try.*
4702 case "$gccversion" in
4703 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4704 esac
4705 case "$gccversion" in
4706 '') gccosandvers='' ;;
4707 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4708    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4709    gccshortvers=''
4710    case "$gccosandvers" in
4711    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4712    $osname$osvers) ;; # looking good
4713    $osname*) cat <<EOM >&4
4714
4715 *** WHOA THERE!!! ***
4716
4717     Your gcc has not been compiled for the exact release of
4718     your operating system ($gccosandvers versus $osname$osvers).
4719
4720     In general it is a good idea to keep gcc synchronized with
4721     the operating system because otherwise serious problems
4722     may ensue when trying to compile software, like Perl.
4723
4724     I'm trying to be optimistic here, though, and will continue.
4725     If later during the configuration and build icky compilation
4726     problems appear (headerfile conflicts being the most common
4727     manifestation), I suggest reinstalling the gcc to match
4728     your operating system release.
4729
4730 EOM
4731       ;;
4732    *) gccosandvers='' ;; # failed to parse, better be silent
4733    esac
4734    ;;
4735 esac
4736 case "$ccname" in
4737 '') ccname="$cc" ;;
4738 esac
4739
4740 # gcc 3.* complain about adding -Idirectories that they already know about,
4741 # so we will take those off from locincpth.
4742 case "$gccversion" in
4743 3*)
4744     echo "main(){}">try.c
4745     for incdir in $locincpth; do
4746        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4747              grep '^c[cp]p*[01]: warning: changing search order '`
4748        if test "X$warn" != X; then
4749            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4750        fi
4751     done
4752     $rm -f try try.*
4753 esac
4754
4755 # gcc 4.9 by default does some optimizations that break perl.
4756 # see ticket 121505.
4757 #
4758 # The -fwrapv disables those optimizations (and probably others,) so
4759 # for gcc 4.9 (and later, since the optimizations probably won't go
4760 # away), add -fwrapv unless the user requests -fno-wrapv, which
4761 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4762 # which turns the overflows -fwrapv ignores into runtime errors.
4763 case "$gccversion" in
4764 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4765     case "$ccflags" in
4766     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4767     *) ccflags="$ccflags -fwrapv" ;;
4768     esac
4769 esac
4770
4771 : What should the include directory be ?
4772 : Use sysroot if set, so findhdr looks in the right place.
4773 echo " "
4774 $echo $n "Hmm...  $c"
4775 dflt="$sysroot/usr/include"
4776 incpath=''
4777 mips_type=''
4778 if $test -f /bin/mips && /bin/mips; then
4779         echo "Looks like a MIPS system..."
4780         $cat >usr.c <<'EOCP'
4781 #ifdef SYSTYPE_BSD43
4782 /bsd43
4783 #endif
4784 EOCP
4785         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4786                 dflt='/bsd43/usr/include'
4787                 incpath='/bsd43'
4788                 mips_type='BSD 4.3'
4789         else
4790                 mips_type='System V'
4791         fi
4792         $rm -f usr.c usr.out
4793         echo "and you're compiling with the $mips_type compiler and libraries."
4794         xxx_prompt=y
4795         echo "exit 0" >mips
4796 else
4797         echo "Doesn't look like a MIPS system."
4798         xxx_prompt=n
4799         echo "exit 1" >mips
4800 fi
4801 chmod +x mips
4802 $eunicefix mips
4803 case "$usrinc" in
4804 '') ;;
4805 *) dflt="$usrinc";;
4806 esac
4807 case "$xxx_prompt" in
4808 y)      fn=d/
4809         echo " "
4810         rp='Where are the include files you want to use?'
4811         . ./getfile
4812         usrinc="$ans"
4813         ;;
4814 *)      usrinc="$dflt"
4815         ;;
4816 esac
4817
4818 : see how we invoke the C preprocessor
4819 echo " "
4820 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4821 cat <<'EOT' >testcpp.c
4822 #define ABC abc
4823 #define XYZ xyz
4824 ABC.XYZ
4825 EOT
4826 cd ..
4827 if test ! -f cppstdin; then
4828         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4829                 # AIX cc -E doesn't show the absolute headerfile
4830                 # locations but we'll cheat by using the -M flag.
4831                 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
4832         else
4833                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4834         fi
4835 else
4836         echo "Keeping your $hint cppstdin wrapper."
4837 fi
4838 chmod 755 cppstdin
4839 wrapper=`pwd`/cppstdin
4840 ok='false'
4841 cd UU
4842
4843 if $test "X$cppstdin" != "X" && \
4844         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4845         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4846 then
4847         echo "You used to use $cppstdin $cppminus so we'll use that again."
4848         case "$cpprun" in
4849         '') echo "But let's see if we can live without a wrapper..." ;;
4850         *)
4851                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4852                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4853                 then
4854                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4855                         ok='true'
4856                 else
4857                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4858                 fi
4859                 ;;
4860         esac
4861 else
4862         case "$cppstdin" in
4863         '') ;;
4864         *)
4865                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4866                 ;;
4867         esac
4868 fi
4869
4870 if $ok; then
4871         : nothing
4872 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4873         $cc -E <testcpp.c >testcpp.out 2>&1; \
4874         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875         echo "Yup, it does."
4876         x_cpp="$cc $cppflags -E"
4877         x_minus='';
4878 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4879         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4880         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4881         echo "Yup, it does."
4882         x_cpp="$cc $cppflags -E"
4883         x_minus='-';
4884 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4885         $cc -P <testcpp.c >testcpp.out 2>&1; \
4886         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4887         echo "Yipee, that works!"
4888         x_cpp="$cc $cppflags -P"
4889         x_minus='';
4890 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4891         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4892         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4893         echo "At long last!"
4894         x_cpp="$cc $cppflags -P"
4895         x_minus='-';
4896 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4897         $cpp <testcpp.c >testcpp.out 2>&1; \
4898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899         echo "It works!"
4900         x_cpp="$cpp $cppflags"
4901         x_minus='';
4902 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4903         $cpp - <testcpp.c >testcpp.out 2>&1; \
4904         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4905         echo "Hooray, it works!  I was beginning to wonder."
4906         x_cpp="$cpp $cppflags"
4907         x_minus='-';
4908 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4909         $wrapper <testcpp.c >testcpp.out 2>&1; \
4910         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4911         x_cpp="$wrapper"
4912         x_minus=''
4913         echo "Eureka!"
4914 else
4915         dflt=''
4916         rp="No dice.  I can't find a C preprocessor.  Name one:"
4917         . ./myread
4918         x_cpp="$ans"
4919         x_minus=''
4920         $x_cpp <testcpp.c >testcpp.out 2>&1
4921         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4922                 echo "OK, that will do." >&4
4923         else
4924 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4925                 exit 1
4926         fi
4927 fi
4928
4929 case "$ok" in
4930 false)
4931         cppstdin="$x_cpp"
4932         cppminus="$x_minus"
4933         cpprun="$x_cpp"
4934         cpplast="$x_minus"
4935         set X $x_cpp
4936         shift
4937         case "$1" in
4938         "$cpp")
4939                 echo "Perhaps can we force $cc -E using a wrapper..."
4940                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4941                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4942                 then
4943                         echo "Yup, we can."
4944                         cppstdin="$wrapper"
4945                         cppminus='';
4946                 else
4947                         echo "Nope, we'll have to live without it..."
4948                 fi
4949                 ;;
4950         esac
4951         case "$cpprun" in
4952         "$wrapper")
4953                 cpprun=''
4954                 cpplast=''
4955                 ;;
4956         esac
4957         ;;
4958 esac
4959
4960 case "$cppstdin" in
4961 "$wrapper"|'cppstdin') ;;
4962 *) $rm -f $wrapper;;
4963 esac
4964 $rm -f testcpp.c testcpp.out
4965
4966 : Adjust cppfilter for path component separator
4967 case "$osname" in
4968 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4969 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4970 *)   cppfilter='' ;;
4971 esac
4972
4973 : Use gcc to determine libpth and incpth
4974 # If using gcc or clang, we can get better values for libpth, incpth
4975 # and usrinc directly from the compiler.
4976 # Note that ccname for clang is also gcc.
4977 case "$ccname" in
4978     gcc)
4979         $echo 'extern int foo;' > try.c
4980         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4981         shift
4982         if $test $# -gt 0; then
4983             incpth="$incpth $*"
4984             incpth="`$echo $incpth|$sed 's/^ //'`"
4985             for i in $*; do
4986                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4987                 if $test -d $j; then
4988                     libpth="$libpth $j"
4989                 fi
4990             done
4991             libpth="`$echo $libpth|$sed 's/^ //'`"
4992             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4993                 if $test -d $xxx; then
4994                     case " $libpth " in
4995                     *" $xxx "*) ;;
4996                     *) libpth="$libpth $xxx";;
4997                     esac
4998                 fi
4999             done
5000         fi
5001         $rm -f try.c
5002         case "$usrinc" in
5003         '') for i in $incpth; do
5004                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5005                     usrinc="$i"
5006                     break
5007                 fi
5008             done
5009             ;;
5010         esac
5011
5012         case "$usecrosscompile" in
5013         $define|true|[yY]*)
5014             case "$incpth" in
5015                 '') echo "Incpth not defined." >&4; croak=y ;;
5016                 *)  echo "Using incpth '$incpth'." >&4 ;;
5017             esac
5018             case "$libpth" in
5019                 '') echo "Libpth not defined." >&4; croak=y ;;
5020                 *)  echo "Using libpth '$libpth'." >&4 ;;
5021             esac
5022             case "$usrinc" in
5023                 '') echo "Usrinc not defined." >&4; croak=y ;;
5024                 *)  echo "Using usrinc $usrinc." >&4 ;;
5025             esac
5026             case "$croak" in
5027                 y)
5028                 if test "X$sysroot" = X; then
5029                     echo "Cannot continue, aborting." >&4; exit 1
5030                 else
5031                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5032                 fi
5033                 ;;
5034             esac
5035             ;;
5036         esac
5037     ;;
5038 esac
5039
5040 : Default value for incpth is just usrinc
5041 case "$incpth" in
5042 '') incpth="$usrinc";;
5043 esac
5044
5045 : Set private lib path
5046 case "$plibpth" in
5047 '') if ./mips; then
5048         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5049     fi;;
5050 esac
5051 case "$libpth" in
5052 ' ') dlist='';;
5053 '') dlist="$loclibpth $plibpth $glibpth";;
5054 *) dlist="$libpth";;
5055 esac
5056
5057 : Now check and see which directories actually exist, avoiding duplicates
5058 for xxx in $dlist
5059 do
5060     if $test -d $xxx; then
5061                 case " $libpth " in
5062                 *" $xxx "*) ;;
5063                 *) libpth="$libpth $xxx";;
5064                 esac
5065     fi
5066 done
5067 $cat <<'EOM'
5068
5069 Some systems have incompatible or broken versions of libraries.  Among
5070 the directories listed in the question below, please remove any you
5071 know not to be holding relevant libraries, and add any that are needed.
5072 Say "none" for none.
5073
5074 EOM
5075
5076 if test "X$sysroot" != X; then
5077     $cat <<EOM
5078 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5079
5080 EOM
5081 fi
5082
5083 case "$libpth" in
5084 '') dflt='none';;
5085 *)
5086         set X $libpth
5087         shift
5088         dflt=${1+"$@"}
5089         ;;
5090 esac
5091 rp="Directories to use for library searches?"
5092 . ./myread
5093 case "$ans" in
5094 none) libpth=' ';;
5095 *) libpth="$ans";;
5096 esac
5097
5098 : compute shared library extension
5099 case "$so" in
5100 '')
5101         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5102                 dflt='sl'
5103         else
5104                 dflt='so'
5105         fi
5106         ;;
5107 *) dflt="$so";;
5108 esac
5109 $cat <<EOM
5110
5111 On some systems, shared libraries may be available.  Answer 'none' if
5112 you want to suppress searching of shared libraries for the remainder
5113 of this configuration.
5114
5115 EOM
5116 rp='What is the file extension used for shared libraries?'
5117 . ./myread
5118 so="$ans"
5119
5120 : Does target system insist that shared library basenames are unique
5121 $cat << EOM
5122
5123 Some dynamic loaders assume that the *basename* of shared library filenames
5124 are globally unique.  We'll default this to undef as we assume your system
5125 is not this weird. Set to defined if you're on one of them.
5126
5127 EOM
5128
5129 dflt='n'
5130 rp='Make shared library basenames unique?'
5131 . ./myread
5132 case "$ans" in
5133 y|Y) val="$define" ;;
5134 *)   val="$undef"  ;;
5135 esac
5136 set d_libname_unique
5137 eval $setvar
5138
5139 : Define several unixisms.
5140 : Hints files or command line option can be used to override them.
5141 : The convoluted testing is in case hints files set either the old
5142 : or the new name.
5143 case "$_exe" in
5144 '')     case "$exe_ext" in
5145         '')     ;;
5146         *)      _exe="$exe_ext" ;;
5147         esac
5148         ;;
5149 esac
5150 case "$_a" in
5151 '')     case "$lib_ext" in
5152     '') _a='.a';;
5153         *)      _a="$lib_ext" ;;
5154         esac
5155         ;;
5156 esac
5157 case "$_o" in
5158 '') case "$obj_ext" in
5159         '')     _o='.o';;
5160         *)      _o="$obj_ext";;
5161         esac
5162         ;;
5163 esac
5164 case "$p_" in
5165 '') case "$path_sep" in
5166         '')     p_=':';;
5167         *)      p_="$path_sep";;
5168         esac
5169         ;;
5170 esac
5171 exe_ext=$_exe
5172 lib_ext=$_a
5173 obj_ext=$_o
5174 path_sep=$p_
5175
5176 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5177
5178 : Which makefile gets called first.  This is used by make depend.
5179 case "$firstmakefile" in
5180 '') firstmakefile='makefile';;
5181 esac
5182
5183 : Check is we will use socks
5184 case "$usesocks" in
5185 $define|true|[yY]*)     dflt='y';;
5186 *) dflt='n';;
5187 esac
5188 cat <<EOM
5189
5190 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5191 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5192 to use the PerlIO abstraction layer, this will be implicitly selected.
5193
5194 If this doesn't make any sense to you, just accept the default '$dflt'.
5195 EOM
5196 rp='Build Perl for SOCKS?'
5197 . ./myread
5198 case "$ans" in
5199 y|Y)    val="$define" ;;
5200 *)      val="$undef" ;;
5201 esac
5202 set usesocks
5203 eval $setvar
5204
5205 : Check for uselongdouble support
5206 case "$ccflags" in
5207 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5208 esac
5209
5210 case "$uselongdouble" in
5211 $define|true|[yY]*)     dflt='y';;
5212 *) dflt='n';;
5213 esac
5214 cat <<EOM
5215
5216 Perl can be built to take advantage of long doubles which
5217 (if available) may give more accuracy and range for floating point numbers.
5218
5219 If this doesn't make any sense to you, just accept the default '$dflt'.
5220 EOM
5221 rp='Try to use long doubles if available?'
5222 . ./myread
5223 case "$ans" in
5224 y|Y)    val="$define"   ;;
5225 *)      val="$undef"    ;;
5226 esac
5227 set uselongdouble
5228 eval $setvar
5229
5230 case "$uselongdouble" in
5231 true|[yY]*) uselongdouble="$define" ;;
5232 esac
5233
5234 : Look for a hint-file generated 'call-back-unit'.  If the
5235 : user has specified that long doubles should be used,
5236 : we may need to set or change some other defaults.
5237 if $test -f uselongdouble.cbu; then
5238     echo "Your platform has some specific hints regarding long doubles, using them..."
5239     . ./uselongdouble.cbu
5240 else
5241     case "$uselongdouble" in
5242         $define)
5243                 $cat <<EOM
5244 (Your platform does not have any specific hints for long doubles.)
5245 EOM
5246         ;;
5247     esac
5248 fi
5249
5250 : Check if quadmath is requested
5251 case "$usequadmath" in
5252 "$define"|true|[yY]*) usequadmath="$define" ;;
5253 *)                    usequadmath="$undef"  ;;
5254 esac
5255
5256 : Fail if both uselongdouble and usequadmath are requested
5257 case "$usequadmath:$uselongdouble" in
5258 define:define)
5259         $cat <<EOM >&4
5260
5261 *** You requested the use of the quadmath library and use
5262 *** of long doubles.
5263 ***
5264 *** Please select one or the other.
5265 EOM
5266         exit 1
5267         ;;
5268 esac
5269
5270 : Looking for optional libraries
5271 echo " "
5272 echo "Checking for optional libraries..." >&4
5273 case "$libs" in
5274 ' '|'') dflt='';;
5275 *) dflt="$libs";;
5276 esac
5277 case "$libswanted" in
5278 '') libswanted='c_s';;
5279 esac
5280 case "$usesocks" in
5281 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5282 esac
5283 case "$usecbacktrace" in
5284 "$define") libswanted="$libswanted bfd" ;;
5285 esac
5286 case "$usequadmath" in
5287 "$define") libswanted="$libswanted quadmath" ;;
5288 esac
5289 libsfound=''
5290 libsfiles=''
5291 libsdirs=''
5292 libspath=''
5293 for thisdir in $libpth $xlibpth; do
5294   test -d $thisdir && libspath="$libspath $thisdir"
5295 done
5296 for thislib in $libswanted; do
5297         for thisdir in $libspath; do
5298             xxx=''
5299             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5300                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5301                 $test -f "$xxx" && eval $libscheck
5302                 $test -f "$xxx" && libstyle=shared
5303                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5304                 $test -f "$xxx" && eval $libscheck
5305                 $test -f "$xxx" && libstyle=shared
5306             fi
5307             if test ! -f "$xxx"; then
5308                 xxx=$thisdir/lib$thislib.$so
5309                 $test -f "$xxx" && eval $libscheck
5310                 $test -f "$xxx" && libstyle=shared
5311             fi
5312             if test ! -f "$xxx"; then
5313                 xxx=$thisdir/lib$thislib$_a
5314                 $test -f "$xxx" && eval $libscheck
5315                 $test -f "$xxx" && libstyle=static
5316             fi
5317             if test ! -f "$xxx"; then
5318                 xxx=$thisdir/$thislib$_a
5319                 $test -f "$xxx" && eval $libscheck
5320                 $test -f "$xxx" && libstyle=static
5321             fi
5322             if test ! -f "$xxx"; then
5323                 xxx=$thisdir/lib${thislib}_s$_a
5324                 $test -f "$xxx" && eval $libscheck
5325                 $test -f "$xxx" && libstyle=static
5326                 $test -f "$xxx" && thislib=${thislib}_s
5327             fi
5328             if test ! -f "$xxx"; then
5329                 xxx=$thisdir/Slib$thislib$_a
5330                 $test -f "$xxx" && eval $libscheck
5331                 $test -f "$xxx" && libstyle=static
5332             fi
5333             if $test -f "$xxx"; then
5334                 case "$libstyle" in
5335                 shared) echo "Found -l$thislib (shared)." ;;
5336                 static) echo "Found -l$thislib." ;;
5337                 *)      echo "Found -l$thislib ($libstyle)." ;;
5338                 esac
5339                 case " $dflt " in
5340                 *"-l$thislib "*);;
5341                 *) dflt="$dflt -l$thislib"
5342                    libsfound="$libsfound $xxx"
5343                    yyy=`basename $xxx`
5344                    libsfiles="$libsfiles $yyy"
5345                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5346                    case " $libsdirs " in
5347                    *" $yyy "*) ;;
5348                    *) libsdirs="$libsdirs $yyy" ;;
5349                    esac
5350                    ;;
5351                 esac
5352                 break
5353             fi
5354         done
5355         if $test ! -f "$xxx"; then
5356             echo "No -l$thislib."
5357         fi
5358 done
5359 set X $dflt
5360 shift
5361 dflt="$*"
5362 case "$libs" in
5363 '') dflt="$dflt";;
5364 *) dflt="$libs";;
5365 esac
5366 case "$dflt" in
5367 ' '|'') dflt='none';;
5368 esac
5369
5370 $cat <<EOM
5371
5372 In order to compile $package on your machine, a number of libraries
5373 are usually needed.  Include any other special libraries here as well.
5374 Say "none" for none.  The default list is almost always right.
5375 EOM
5376
5377 echo " "
5378 rp="What libraries to use?"
5379 . ./myread
5380 case "$ans" in
5381 none) libs=' ';;
5382 *) libs="$ans";;
5383 esac
5384
5385 : determine optimization, if desired, or use for debug flag also
5386 case "$optimize" in
5387 ' '|$undef) dflt='none';;
5388 '') dflt='-O';;
5389 *) dflt="$optimize";;
5390 esac
5391 $cat <<EOH
5392
5393 By default, $package compiles with the -O flag to use the optimizer.
5394 Alternately, you might want to use the symbolic debugger, which uses
5395 the -g flag (on traditional Unix systems).  Either flag can be
5396 specified here.  To use neither flag, specify the word "none".
5397
5398 EOH
5399 rp="What optimizer/debugger flag should be used?"
5400 . ./myread
5401 optimize="$ans"
5402 case "$optimize" in
5403 'none') optimize=" ";;
5404 esac
5405
5406 : Check what DEBUGGING is required from the command line
5407 : -DEBUGGING      or -DDEBUGGING or
5408 : -DEBUGGING=both                       = -g + -DDEBUGGING
5409 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5410 : -DEBUGGING=none or -UDEBUGGING        =
5411 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5412 case "$EBUGGING" in
5413 '')     ;;
5414 *)      DEBUGGING=$EBUGGING ;;
5415 esac
5416
5417 case "$DEBUGGING" in
5418 -g|both|$define)
5419     case "$optimize" in
5420         *-g*) ;;
5421         *)    optimize="$optimize -g" ;;
5422     esac ;;
5423 none|$undef)
5424     case "$optimize" in
5425         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5426                 shift
5427                 optimize="$*"
5428                 ;;
5429     esac ;;
5430 esac
5431
5432 dflt=''
5433 case "$DEBUGGING" in
5434 both|$define) dflt='-DDEBUGGING'
5435 esac
5436
5437 : argument order is deliberate, as the flag will start with - which set could
5438 : think is an option
5439 checkccflag='check=$1; flag=$2; callback=$3;
5440 echo " ";
5441 echo "Checking if your compiler accepts $flag" 2>&1;
5442 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5443 echo "int main(void) { return 0; }" > gcctest.c;
5444 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5445     echo "Yes, it does." 2>&1;
5446     if $test -s gcctest.out ; then
5447         echo "But your platform does not like it:";
5448         cat gcctest.out;
5449     else
5450         case "$ccflags" in
5451         *$check*)
5452             echo "Leaving current flags $ccflags alone." 2>&1
5453             ;;
5454         *) dflt="$dflt $flag";
5455             eval $callback
5456             ;;
5457         esac
5458     fi
5459 else
5460     echo "Nope, it does not, but that is ok." 2>&1;
5461 fi
5462 '
5463
5464 : We will not override a previous value, but we might want to
5465 : augment a hint file
5466 case "$hint" in
5467 default|recommended)
5468         case "$gccversion" in
5469         1*) dflt="$dflt -fpcc-struct-return" ;;
5470         esac
5471         case "$optimize:$DEBUGGING" in
5472         *-g*:old) dflt="$dflt -DDEBUGGING";;
5473         esac
5474         case "$gccversion" in
5475         2*) if $test -d /etc/conf/kconfig.d &&
5476                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5477                 then
5478                         # Interactive Systems (ISC) POSIX mode.
5479                         dflt="$dflt -posix"
5480                 fi
5481                 ;;
5482         esac
5483         case "$gccversion" in
5484         1*) ;;
5485         2.[0-8]*) ;;
5486         ?*)     set strict-aliasing -fno-strict-aliasing
5487                 eval $checkccflag
5488                 ;;
5489         esac
5490         # For gcc, adding -pipe speeds up compilations for some, but apparently
5491         # some assemblers can't read from stdin.  (It also slows down compilations
5492         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5493         case "$gccversion" in
5494         ?*)     set pipe -pipe
5495                 eval $checkccflag
5496                 ;;
5497         esac
5498
5499         # on x86_64 (at least) we require an extra library (libssp) in the
5500         # link command line. This library is not named, so I infer that it is
5501         # an implementation detail that may change. Hence the safest approach
5502         # is to add the flag to the flags passed to the compiler at link time,
5503         # as that way the compiler can do the right implementation dependant
5504         # thing. (NWC)
5505         case "$osname" in
5506         amigaos) ;; # -fstack-protector builds but doesn't work
5507         *)      case "$gccversion" in
5508                 ?*)     set stack-protector-strong -fstack-protector-strong
5509                         eval $checkccflag
5510                         case "$dflt" in
5511                         *-fstack-protector-strong*) ;; # It got added.
5512                         *) # Try the plain/older -fstack-protector.
5513                            set stack-protector -fstack-protector
5514                            eval $checkccflag
5515                            ;;
5516                         esac
5517                         ;;
5518                 esac
5519                 ;;
5520         esac
5521         ;;
5522 esac
5523
5524 case "$mips_type" in
5525 *BSD*|'') inclwanted="$locincpth $usrinc";;
5526 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5527 esac
5528 for thisincl in $inclwanted; do
5529         if $test -d $thisincl; then
5530                 if $test x$thisincl != x$usrinc; then
5531                         case "$dflt" in
5532                         *" -I$thisincl "*);;
5533                         *) dflt="$dflt -I$thisincl ";;
5534                         esac
5535                 fi
5536         fi
5537 done
5538
5539 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5540         xxx=true;
5541 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5542         xxx=true;
5543 else
5544         xxx=false;
5545 fi;
5546 if $xxx; then
5547         case "$dflt" in
5548         *$2*);;
5549         *) dflt="$dflt -D$2";;
5550         esac;
5551 fi'
5552
5553 set signal.h LANGUAGE_C; eval $inctest
5554
5555 case "$usesocks" in
5556 $define)
5557         ccflags="$ccflags -DSOCKS"
5558         ;;
5559 esac
5560
5561 case "$hint" in
5562 default|recommended) dflt="$ccflags $dflt" ;;
5563 *) dflt="$ccflags";;
5564 esac
5565
5566 case "$dflt" in
5567 ''|' ') dflt=none;;
5568 esac
5569
5570 $cat <<EOH
5571
5572 Your C compiler may want other flags.  For this question you should include
5573 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5574 but you should NOT include libraries or ld flags like -lwhatever.  If you
5575 want $package to honor its debug switch, you should include -DDEBUGGING here.
5576 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5577
5578 To use no flags, specify the word "none".
5579
5580 EOH
5581 set X $dflt
5582 shift
5583 dflt=${1+"$@"}
5584 rp="Any additional cc flags?"
5585 . ./myread
5586 case "$ans" in
5587 none) ccflags='';;
5588 *) ccflags="$ans";;
5589 esac
5590
5591 : the following weeds options from ccflags that are of no interest to cpp
5592 case "$cppflags" in
5593 '') cppflags="$ccflags" ;;
5594 *)  set X $ccflags; shift
5595     case " $cppflags " in
5596     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5597     *) cppflags="$cppflags $ccflags" ;;
5598     esac
5599     ;;
5600 esac
5601 case "$gccversion" in
5602 1*) cppflags="$cppflags -D__GNUC__"
5603 esac
5604 case "$mips_type" in
5605 '');;
5606 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5607 esac
5608 case "$cppflags" in
5609 '');;
5610 *)
5611         echo " "
5612         echo "Let me guess what the preprocessor flags are..." >&4
5613         set X $cppflags
5614         shift
5615         cppflags=''
5616         $cat >cpp.c <<'EOM'
5617 #define BLURFL foo
5618
5619 BLURFL xx LFRULB
5620 EOM
5621         previous=''
5622         for flag in $*
5623         do
5624                 case "$flag" in
5625                 -*) ftry="$flag";;
5626                 *) ftry="$previous $flag";;
5627                 esac
5628                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5629                         >cpp1.out 2>/dev/null && \
5630                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5631                         >cpp2.out 2>/dev/null && \
5632                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5633                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5634                 then
5635                         cppflags="$cppflags $ftry"
5636                         previous=''
5637                 else
5638                         previous="$flag"
5639                 fi
5640         done
5641         set X $cppflags
5642         shift
5643         cppflags=${1+"$@"}
5644         case "$cppflags" in
5645         *-*)  echo "They appear to be: $cppflags";;
5646         esac
5647         $rm -f cpp.c cpp?.out
5648         ;;
5649 esac
5650
5651 : flags used in final linking phase
5652 case "$ldflags" in
5653 '') if ./venix; then
5654                 dflt='-i -z'
5655         else
5656                 dflt=''
5657         fi
5658         case "$ccflags" in
5659         *-posix*) dflt="$dflt -posix" ;;
5660         esac
5661         ;;
5662 *) dflt="$ldflags";;
5663 esac
5664 # See note above about -fstack-protector
5665 case "$ccflags" in
5666 *-fstack-protector-strong*)
5667         case "$dflt" in
5668         *-fstack-protector-strong*) ;; # Don't add it again
5669         *) dflt="$dflt -fstack-protector-strong" ;;
5670         esac
5671         ;;
5672 *-fstack-protector*)
5673         case "$dflt" in
5674         *-fstack-protector*) ;; # Don't add it again
5675         *) dflt="$dflt -fstack-protector" ;;
5676         esac
5677         ;;
5678 esac
5679
5680 : Try to guess additional flags to pick up local libraries.
5681 for thislibdir in $libpth; do
5682         case " $loclibpth " in
5683         *" $thislibdir "*)
5684                 case "$dflt " in
5685                 *"-L$thislibdir "*) ;;
5686                 *)  dflt="$dflt -L$thislibdir" ;;
5687                 esac
5688                 ;;
5689         esac
5690 done
5691
5692 case "$dflt" in
5693 '') dflt='none' ;;
5694 esac
5695
5696 $cat <<EOH
5697
5698 Your C linker may need flags.  For this question you should
5699 include -L/whatever and any other flags used by the C linker, but you
5700 should NOT include libraries like -lwhatever.
5701
5702 Make sure you include the appropriate -L/path flags if your C linker
5703 does not normally search all of the directories you specified above,
5704 namely
5705         $libpth
5706 To use no flags, specify the word "none".
5707
5708 EOH
5709
5710 rp="Any additional ld flags (NOT including libraries)?"
5711 . ./myread
5712 case "$ans" in
5713 none) ldflags='';;
5714 *) ldflags="$ans";;
5715 esac
5716 rmlist="$rmlist pdp11"
5717
5718 : coherency check
5719 echo " "
5720 echo "Checking your choice of C compiler and flags for coherency..." >&4
5721 $cat > try.c <<'EOF'
5722 #include <stdio.h>
5723 int main() { printf("Ok\n"); return(0); }
5724 EOF
5725 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5726 shift
5727 $cat >try.msg <<'EOM'
5728 I've tried to compile and run the following simple program:
5729
5730 EOM
5731 $cat try.c >> try.msg
5732
5733 $cat >> try.msg <<EOM
5734
5735 I used the command:
5736
5737         $*
5738         $run ./try
5739
5740 and I got the following output:
5741
5742 EOM
5743 dflt=y
5744 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5745         if $sh -c "$run ./try " >>try.msg 2>&1; then
5746                 xxx=`$run ./try`
5747                 case "$xxx" in
5748                 "Ok") dflt=n ;;
5749                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5750                 esac
5751         else
5752                 echo "The program compiled OK, but exited with status $?." >>try.msg
5753                 rp="You have a problem.  Shall I abort Configure"
5754                 dflt=y
5755         fi
5756 else
5757         echo "I can't compile the test program." >>try.msg
5758         rp="You have a BIG problem.  Shall I abort Configure"
5759         dflt=y
5760 fi
5761 case "$dflt" in
5762 y)
5763         $cat try.msg >&4
5764         case "$knowitall" in
5765         '')
5766                 echo "(The supplied flags or libraries might be incorrect.)"
5767                 ;;
5768         *) dflt=n;;
5769         esac
5770         echo " "
5771         . ./myread
5772         case "$ans" in
5773         n*|N*) ;;
5774         *)      echo "Ok.  Stopping Configure." >&4
5775                 exit 1
5776                 ;;
5777         esac
5778         ;;
5779 n) echo "OK, that should do.";;
5780 esac
5781 $rm_try gcctest gcctest.out
5782
5783 : define a shorthand compile call
5784 compile='
5785 mc_file=$1;
5786 shift;
5787 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5788 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5789 exit 1;
5790 fi;
5791 esac;
5792 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5793 : define a shorthand compile call for compilations that should be ok.
5794 compile_ok='
5795 mc_file=$1;
5796 shift;
5797 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5798
5799 : stub, used only to satisfy other units
5800 i_stdlib='define'
5801
5802 : check for lengths of integral types
5803 echo " "
5804 case "$intsize" in
5805 '')
5806         echo "Checking to see how big your integers are..." >&4
5807         $cat >try.c <<EOCP
5808 #include <stdio.h>
5809 #$i_stdlib I_STDLIB
5810 #ifdef I_STDLIB
5811 #include <stdlib.h>
5812 #endif
5813 int main()
5814 {
5815         printf("intsize=%d;\n", (int)sizeof(int));
5816         printf("longsize=%d;\n", (int)sizeof(long));
5817         printf("shortsize=%d;\n", (int)sizeof(short));
5818         exit(0);
5819 }
5820 EOCP
5821         set try
5822         if eval $compile_ok && $run ./try > /dev/null; then
5823                 eval `$run ./try`
5824                 echo "Your integers are $intsize bytes long."
5825                 echo "Your long integers are $longsize bytes long."
5826                 echo "Your short integers are $shortsize bytes long."
5827         else
5828                 $cat >&4 <<EOM
5829 !
5830 Help! I can't compile and run the intsize test program: please enlighten me!
5831 (This is probably a misconfiguration in your system or libraries, and
5832 you really ought to fix it.  Still, I'll try anyway.)
5833 !
5834 EOM
5835                 dflt=4
5836                 rp="What is the size of an integer (in bytes)?"
5837                 . ./myread
5838                 intsize="$ans"
5839                 dflt=$intsize
5840                 rp="What is the size of a long integer (in bytes)?"
5841                 . ./myread
5842                 longsize="$ans"
5843                 dflt=2
5844                 rp="What is the size of a short integer (in bytes)?"
5845                 . ./myread
5846                 shortsize="$ans"
5847         fi
5848         ;;
5849 esac
5850 $rm_try
5851
5852 : check for long long
5853 echo " "
5854 echo "Checking to see if you have long long..." >&4
5855 echo 'int main() { long long x = 7; return 0; }' > try.c
5856 set try
5857 if eval $compile; then
5858         val="$define"
5859         echo "You have long long."
5860 else
5861         val="$undef"
5862         echo "You do not have long long."
5863 fi
5864 $rm_try
5865 set d_longlong
5866 eval $setvar
5867
5868 : check for length of long long
5869 case "${d_longlong}${longlongsize}" in
5870 $define)
5871         echo " "
5872         echo "Checking to see how big your long longs are..." >&4
5873         $cat >try.c <<'EOCP'
5874 #include <stdio.h>
5875 int main()
5876 {
5877     printf("%d\n", (int)sizeof(long long));
5878     return(0);
5879 }
5880 EOCP
5881         set try
5882         if eval $compile_ok; then
5883                 longlongsize=`$run ./try`
5884                 echo "Your long longs are $longlongsize bytes long."
5885         else
5886                 dflt='8'
5887                 echo " "
5888                 echo "(I can't seem to compile the test program.  Guessing...)"
5889                 rp="What is the size of a long long (in bytes)?"
5890                 . ./myread
5891                 longlongsize="$ans"
5892         fi
5893         if $test "X$longsize" = "X$longlongsize"; then
5894                 echo "(That isn't any different from an ordinary long.)"
5895         fi
5896         ;;
5897 esac
5898 $rm_try
5899
5900 : determine filename position in cpp output
5901 echo " "
5902 echo "Computing filename position in cpp output for #include directives..." >&4
5903 case "$osname" in
5904 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5905 esac
5906 case "$fieldn" in
5907 '')
5908 case "$osname" in
5909 vos) testaccess=-e ;;
5910 *)   testaccess=-r ;;
5911 esac
5912 echo '#include <stdio.h>' > foo.c
5913 $cat >fieldn <<EOF
5914 $startsh
5915 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5916 $grep '^[       ]*#.*stdio\.h' | \
5917 while read cline; do
5918         pos=1
5919         set \$cline
5920         while $test \$# -gt 0; do
5921                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5922                         echo "\$pos"
5923                         exit 0
5924                 fi
5925                 shift
5926                 pos=\`expr \$pos + 1\`
5927         done
5928 done
5929 EOF
5930 chmod +x fieldn
5931 fieldn=`./fieldn`
5932 $rm -f foo.c fieldn
5933 ;;
5934 esac
5935 case $fieldn in
5936 '') pos='???';;
5937 1) pos=first;;
5938 2) pos=second;;
5939 3) pos=third;;
5940 *) pos="${fieldn}th";;
5941 esac
5942 echo "Your cpp writes the filename in the $pos field of the line."
5943
5944 : locate header file
5945 $cat >findhdr <<EOF
5946 $startsh
5947 wanted=\$1
5948 name=''
5949 for usrincdir in $incpth
5950 do
5951         if test -f \$usrincdir/\$wanted; then
5952                 echo "\$usrincdir/\$wanted"
5953                 exit 0
5954         fi
5955 done
5956 awkprg='{ print \$$fieldn }'
5957 echo "#include <\$wanted>" > foo\$\$.c
5958 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5959 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5960 while read cline; do
5961         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5962         case "\$name" in
5963         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5964         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5965         *) exit 2;;
5966         esac;
5967 done;
5968 #
5969 # status = 0: grep returned 0 lines, case statement not executed
5970 # status = 1: headerfile found
5971 # status = 2: while loop executed, no headerfile found
5972 #
5973 status=\$?
5974 $rm -f foo\$\$.c;
5975 if test \$status -eq 1; then
5976         exit 0;
5977 fi
5978 exit 1
5979 EOF
5980 chmod +x findhdr
5981
5982 : define an alternate in-header-list? function
5983 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5984 cont=true; xxf="echo \"<\$1> found.\" >&4";
5985 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5986 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5987 esac;
5988 case $# in 4) instead=instead;; *) instead="at last";; esac;
5989 while $test "$cont"; do
5990         xxx=`./findhdr $1`
5991         var=$2; eval "was=\$$2";
5992         if $test "$xxx" && $test -r "$xxx";
5993         then eval $xxf;
5994         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5995                 cont="";
5996         else eval $xxnf;
5997         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5998         set $yyy; shift; shift; yyy=$@;
5999         case $# in 0) cont="";;
6000         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6001                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6002         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6003                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6004         esac;
6005 done;
6006 while $test "$yyy";
6007 do set $yyy; var=$2; eval "was=\$$2";
6008         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6009         set $yyy; shift; shift; yyy=$@;
6010 done'
6011
6012 : see if inttypes.h is available
6013 : we want a real compile instead of Inhdr because some systems
6014 : have an inttypes.h which includes non-existent headers
6015 echo " "
6016 $cat >try.c <<EOCP
6017 #include <inttypes.h>
6018 int main() {
6019         static int32_t foo32 = 0x12345678;
6020 }
6021 EOCP
6022 set try
6023 if eval $compile; then
6024         echo "<inttypes.h> found." >&4
6025         val="$define"
6026 else
6027         echo "<inttypes.h> NOT found." >&4
6028         val="$undef"
6029 fi
6030 $rm_try
6031 set i_inttypes
6032 eval $setvar
6033
6034 : check for int64_t
6035 echo " "
6036 echo "Checking to see if you have int64_t..." >&4
6037 $cat >try.c <<EOCP
6038 #include <sys/types.h>
6039 #$i_inttypes I_INTTYPES
6040 #ifdef I_INTTYPES
6041 #include <inttypes.h>
6042 #endif
6043 int main() { int64_t x = 7; }
6044 EOCP
6045 set try
6046 if eval $compile; then
6047         val="$define"
6048         echo "You have int64_t."
6049 else
6050         val="$undef"
6051         echo "You do not have int64_t."
6052 fi
6053 $rm_try
6054 set d_int64_t
6055 eval $setvar
6056
6057 : Check if 64bit ints have a quad type
6058 echo " "
6059 echo "Checking which 64-bit integer type we could use..." >&4
6060
6061 case "$intsize" in
6062 8) val=int
6063    set quadtype
6064    eval $setvar
6065    val='"unsigned int"'
6066    set uquadtype
6067    eval $setvar
6068    quadkind=1
6069    ;;
6070 *) case "$longsize" in
6071    8) val=long
6072       set quadtype
6073       eval $setvar
6074       val='"unsigned long"'
6075       set uquadtype
6076       eval $setvar
6077       quadkind=2
6078       ;;
6079    *) case "$d_longlong:$longlongsize" in
6080       define:8)
6081         val='"long long"'
6082         set quadtype
6083         eval $setvar
6084         val='"unsigned long long"'
6085         set uquadtype
6086         eval $setvar
6087         quadkind=3
6088         ;;
6089       *) case "$d_int64_t" in
6090          define)
6091            val=int64_t
6092            set quadtype
6093            eval $setvar
6094            val=uint64_t
6095            set uquadtype
6096            eval $setvar
6097            quadkind=4
6098            ;;
6099          esac
6100          ;;
6101       esac
6102       ;;
6103    esac
6104    ;;
6105 esac
6106
6107 case "$quadtype" in
6108 '')     echo "Alas, no 64-bit integer types in sight." >&4
6109         d_quad="$undef"
6110         ;;
6111 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6112         d_quad="$define"
6113         ;;
6114 esac
6115
6116 : Do we want 64bit support
6117 case "$uselonglong" in
6118 "$define"|true|[yY]*)
6119         cat <<EOM >&4
6120
6121 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6122 EOM
6123         use64bitint="$define"
6124         ;;
6125 esac
6126 case "$use64bits" in
6127 "$define"|true|[yY]*)
6128         cat <<EOM >&4
6129
6130 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6131 EOM
6132         use64bitint="$define"
6133         ;;
6134 esac
6135 case "$use64bitints" in
6136 "$define"|true|[yY]*)
6137         cat <<EOM >&4
6138
6139 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6140 EOM
6141         use64bitint="$define"
6142         ;;
6143 esac
6144 case "$use64bitsint" in
6145 "$define"|true|[yY]*)
6146         cat <<EOM >&4
6147
6148 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6149 EOM
6150         use64bitint="$define"
6151         ;;
6152 esac
6153 case "$uselonglongs" in
6154 "$define"|true|[yY]*)
6155         cat <<EOM >&4
6156
6157 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6158 EOM
6159         use64bitint="$define"
6160         ;;
6161 esac
6162 case "$use64bitsall" in
6163 "$define"|true|[yY]*)
6164         cat <<EOM >&4
6165
6166 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6167 EOM
6168         use64bitall="$define"
6169         ;;
6170 esac
6171
6172 case "$ccflags" in
6173 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6174 esac
6175 case "$use64bitall" in
6176 "$define"|true|[yY]*) use64bitint="$define" ;;
6177 esac
6178
6179 case "$longsize" in
6180 8) cat <<EOM
6181
6182 You have natively 64-bit long integers.
6183 EOM
6184    val="$define"
6185    ;;
6186 *) case "$use64bitint" in
6187    "$define"|true|[yY]*) dflt='y';;
6188    *) dflt='n';;
6189    esac
6190    case "$d_quad" in
6191    "$define") ;;
6192    *) dflt='n' ;;
6193    esac
6194    cat <<EOM
6195
6196 Perl can be built to take advantage of 64-bit integer types
6197 on some systems.  To do so, Configure can be run with -Duse64bitint.
6198 Choosing this option will most probably introduce binary incompatibilities.
6199
6200 If this doesn't make any sense to you, just accept the default '$dflt'.
6201 (The default has been chosen based on your configuration.)
6202 EOM
6203    rp='Try to use 64-bit integers, if available?'
6204    . ./myread
6205    case "$ans" in
6206    [yY]*) val="$define" ;;
6207    *)     val="$undef"  ;;
6208    esac
6209    ;;
6210 esac
6211 set use64bitint
6212 eval $setvar
6213
6214 case "$use64bitall" in
6215 "$define"|true|[yY]*) dflt='y' ;;
6216 *) case "$longsize" in
6217    8) dflt='y' ;;
6218    *) dflt='n' ;;
6219    esac
6220    ;;
6221 esac
6222 cat <<EOM
6223
6224 You may also choose to try maximal 64-bitness.  It means using as much
6225 64-bitness as possible on the platform.  This in turn means even more
6226 binary incompatibilities.  On the other hand, your platform may not
6227 have any more 64-bitness available than what you already have chosen.
6228
6229 If this doesn't make any sense to you, just accept the default '$dflt'.
6230 (The default has been chosen based on your configuration.)
6231 EOM
6232 rp='Try to use maximal 64-bit support, if available?'
6233 . ./myread
6234 case "$ans" in
6235 [yY]*) val="$define" ;;
6236 *)     val="$undef"  ;;
6237 esac
6238 set use64bitall
6239 eval $setvar
6240 case "$use64bitall" in
6241 "$define")
6242         case "$use64bitint" in
6243         "$undef")
6244                 cat <<EOM
6245
6246 Since you have chosen a maximally 64-bit build, I'm also turning on
6247 the use of 64-bit integers.
6248 EOM
6249                 use64bitint="$define" ;;
6250         esac
6251         ;;
6252 esac
6253
6254 : Look for a hint-file generated 'call-back-unit'.  If the
6255 : user has specified that a 64-bit perl is to be built,
6256 : we may need to set or change some other defaults.
6257 if $test -f use64bitint.cbu; then
6258         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6259         . ./use64bitint.cbu
6260 fi
6261 case "$use64bitint" in
6262 "$define"|true|[yY]*)
6263         : This test was common to all the OpenBSD forks, and seems harmless for
6264         : other platforms:
6265         echo " "
6266         echo "Checking if your C library has broken 64-bit functions..." >&4
6267         cat >try.c <<EOCP
6268 #include <stdio.h>
6269 typedef $uquadtype myULL;
6270 int main (void)
6271 {
6272     struct {
6273         double d;
6274         myULL  u;
6275     } *p, test[] = {
6276         {4294967303.15, 4294967303ULL},
6277         {4294967294.2,  4294967294ULL},
6278         {4294967295.7,  4294967295ULL},
6279         {0.0, 0ULL}
6280     };
6281     for (p = test; p->u; p++) {
6282         myULL x = (myULL)p->d;
6283         if (x != p->u) {
6284             printf("buggy\n");
6285             return 0;
6286         }
6287     }
6288     printf("ok\n");
6289     return 0;
6290 }
6291 EOCP
6292         set try
6293         if eval $compile_ok; then
6294             libcquad=`$run ./try`
6295             echo "Your C library's 64-bit functions are $libcquad."
6296         else
6297             echo "(I can't seem to compile the test program.)"
6298             echo "Assuming that your C library's 64-bit functions are ok."
6299             libcquad="ok"
6300         fi
6301         $rm_try
6302
6303         case "$libcquad" in
6304             buggy*)
6305                 cat >&4 <<EOM
6306
6307 *** You have a C library with broken 64-bit functions.
6308 *** 64-bit support does not work reliably in this configuration.
6309 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6310 *** Cannot continue, aborting.
6311
6312 EOM
6313                 exit 1
6314                 ;;
6315         esac
6316         case "$longsize" in
6317         4) case "$archname64" in
6318            '') archname64=64int ;;
6319            esac
6320            ;;
6321         esac
6322         ;;
6323 esac
6324
6325 : Look for a hint-file generated 'call-back-unit'.  If the
6326 : user has specified that a maximally 64-bit perl is to be built,
6327 : we may need to set or change some other defaults.
6328 if $test -f use64bitall.cbu; then
6329         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6330         . ./use64bitall.cbu
6331 fi
6332 case "$use64bitall" in
6333 "$define"|true|[yY]*)
6334         case "$longsize" in
6335         4) case "$archname64" in
6336            ''|64int) archname64=64all ;;
6337            esac
6338            ;;
6339         esac
6340         ;;
6341 esac
6342
6343 case "$d_quad:$use64bitint" in
6344 $undef:$define)
6345         cat >&4 <<EOF
6346
6347 *** You have chosen to use 64-bit integers,
6348 *** but none can be found.
6349 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6350 *** Cannot continue, aborting.
6351
6352 EOF
6353         exit 1
6354         ;;
6355 esac
6356
6357 : Check if we are using the GNU C library
6358 echo " "
6359 echo "Checking for GNU C Library..." >&4
6360 cat >try.c <<'EOCP'
6361 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6362    alone are insufficient to distinguish different versions, such as
6363    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6364    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6365 */
6366 #include <stdio.h>
6367 int main(void)
6368 {
6369 #ifdef __GLIBC__
6370 #   ifdef __GLIBC_MINOR__
6371 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6372 #           include <gnu/libc-version.h>
6373             printf("%s\n",  gnu_get_libc_version());
6374 #       else
6375             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6376 #       endif
6377 #   else
6378         printf("%d\n",  __GLIBC__);
6379 #   endif
6380     return 0;
6381 #else
6382     return 1;
6383 #endif
6384 }
6385 EOCP
6386 set try
6387 if eval $compile_ok && $run ./try > glibc.ver; then
6388         val="$define"
6389         gnulibc_version=`$cat glibc.ver`
6390         echo "You are using the GNU C Library version $gnulibc_version"
6391 else
6392         val="$undef"
6393         gnulibc_version=''
6394         echo "You are not using the GNU C Library"
6395 fi
6396 $rm_try glibc.ver
6397 set d_gnulibc
6398 eval $setvar
6399
6400 : see if nm is to be used to determine whether a symbol is defined or not
6401 case "$usenm" in
6402 '')
6403         dflt=''
6404         case "$d_gnulibc" in
6405         "$define")
6406                 echo " "
6407                 echo "nm probably won't work on the GNU C Library." >&4
6408                 dflt=n
6409                 ;;
6410         esac
6411         case "$dflt" in
6412         '')
6413                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6414                         echo " "
6415                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6416                         echo "'nm' won't be sufficient on this system." >&4
6417                         dflt=n
6418                 fi
6419                 ;;
6420         esac
6421         case "$dflt" in
6422         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6423                 if $test $dflt -gt 20; then
6424                         dflt=y
6425                 else
6426                         dflt=n
6427                 fi
6428                 ;;
6429         esac
6430         ;;
6431 *)
6432         case "$usenm" in
6433         true|$define) dflt=y;;
6434         *) dflt=n;;
6435         esac
6436         ;;
6437 esac
6438 $cat <<EOM
6439
6440 I can use $nm to extract the symbols from your C libraries. This
6441 is a time consuming task which may generate huge output on the disk (up
6442 to 3 megabytes) but that should make the symbols extraction faster. The
6443 alternative is to skip the 'nm' extraction part and to compile a small
6444 test program instead to determine whether each symbol is present. If
6445 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6446 this may be the best solution.
6447
6448 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6449
6450 EOM
6451 rp="Shall I use $nm to extract C symbols from the libraries?"
6452 . ./myread
6453 case "$ans" in
6454 [Nn]*) usenm=false;;
6455 *) usenm=true;;
6456 esac
6457
6458 runnm=$usenm
6459 case "$reuseval" in
6460 true) runnm=false;;
6461 esac
6462
6463 : nm options which may be necessary
6464 case "$nm_opt" in
6465 '') if $test -f /mach_boot; then
6466                 nm_opt=''       # Mach
6467         elif $test -d /usr/ccs/lib; then
6468                 nm_opt='-p'     # Solaris (and SunOS?)
6469         elif $test -f /dgux; then
6470                 nm_opt='-p'     # DG-UX
6471         elif $test -f /lib64/rld; then
6472                 nm_opt='-p'     # 64-bit Irix
6473         else
6474                 nm_opt=''
6475         fi;;
6476 esac
6477
6478 : nm options which may be necessary for shared libraries but illegal
6479 : for archive libraries.  Thank you, Linux.
6480 case "$nm_so_opt" in
6481 '')     case "$myuname" in
6482         *linux*|gnu*)
6483                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6484                         nm_so_opt='--dynamic'
6485                 fi
6486                 ;;
6487         esac
6488         ;;
6489 esac
6490
6491 : Figure out where the libc is located
6492 case "$runnm" in
6493 true)
6494 : get list of predefined functions in a handy place
6495 echo " "
6496 case "$libc" in
6497 '') libc=unknown
6498         case "$libs" in
6499         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6500         esac
6501         ;;
6502 esac
6503 case "$libs" in
6504 '') ;;
6505 *)  for thislib in $libs; do
6506         case "$thislib" in
6507         -lc|-lc_s)
6508                 : Handle C library specially below.
6509                 ;;
6510         -l*)
6511                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6512                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6515                         :
6516                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6519                         :
6520                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6521                         :
6522                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6523                         :
6524                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6525                         :
6526                 else
6527                         try=''
6528                 fi
6529                 libnames="$libnames $try"
6530                 ;;
6531         *) libnames="$libnames $thislib" ;;
6532         esac
6533         done
6534         ;;
6535 esac
6536 xxx=normal
6537 case "$libc" in
6538 unknown)
6539         set /lib/libc.$so
6540         for xxx in $libpth; do
6541                 $test -r $1 || set $xxx/libc.$so
6542                 : The messy sed command sorts on library version numbers.
6543                 $test -r $1 || \
6544                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6545                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6546                                 h
6547                                 s/[0-9][0-9]*/0000&/g
6548                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6549                                 G
6550                                 s/\n/ /' | \
6551                          $sort | $sed -e 's/^.* //'`
6552                 eval set \$$#
6553         done
6554         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6555         $test -r $1 || set $sysroot/lib/libsys_s$_a
6556         ;;
6557 *)
6558         set blurfl
6559         ;;
6560 esac
6561 if $test -r "$1"; then
6562         echo "Your (shared) C library seems to be in $1."
6563         libc="$1"
6564 elif $test -r /lib/libc && $test -r /lib/clib; then
6565         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6566         xxx=apollo
6567         libc='/lib/clib /lib/libc'
6568         if $test -r /lib/syslib; then
6569                 echo "(Your math library is in /lib/syslib.)"
6570                 libc="$libc /lib/syslib"
6571         fi
6572 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6573         echo "Your C library seems to be in $libc, as you said before."
6574 elif $test -r $incpath/usr/lib/libc$_a; then
6575         libc=$incpath/usr/lib/libc$_a;
6576         echo "Your C library seems to be in $libc.  That's fine."
6577 elif $test -r /lib/libc$_a; then
6578         libc=/lib/libc$_a;
6579         echo "Your C library seems to be in $libc.  You're normal."
6580 else
6581         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6582                 :
6583         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6584                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6585         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6586                 :
6587         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6588                 :
6589         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6590                 :
6591         else
6592                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6593         fi
6594         if $test -r "$tans"; then
6595                 echo "Your C library seems to be in $tans, of all places."
6596                 libc=$tans
6597         else
6598                 libc='blurfl'
6599         fi
6600 fi
6601 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6602         dflt="$libc"
6603         cat <<EOM
6604
6605 If the guess above is wrong (which it might be if you're using a strange
6606 compiler, or your machine supports multiple models), you can override it here.
6607
6608 EOM
6609 else
6610         dflt=''
6611         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6612         cat >&4 <<EOM
6613 I can't seem to find your C library.  I've looked in the following places:
6614
6615 EOM
6616         $sed 's/^/      /' libpath
6617         cat <<EOM
6618
6619 None of these seems to contain your C library. I need to get its name...
6620
6621 EOM
6622 fi
6623 fn=f
6624 rp='Where is your C library?'
6625 . ./getfile
6626 libc="$ans"
6627
6628 echo " "
6629 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6630 set X `cat libnames`
6631 shift
6632 xxx=files
6633 case $# in 1) xxx=file; esac
6634 echo "Extracting names from the following $xxx for later perusal:" >&4
6635 echo " "
6636 $sed 's/^/      /' libnames >&4
6637 echo " "
6638 $echo $n "This may take a while...$c" >&4
6639
6640 for file in $*; do
6641         case $file in
6642         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6643         *) $nm $nm_opt $file 2>/dev/null;;
6644         esac
6645 done >libc.tmp
6646
6647 $echo $n ".$c"
6648 $grep fprintf libc.tmp > libc.ptf
6649 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6650 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6651 xxx='[ADTSIWi]'
6652 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6677                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
6702         eval $xscan;\
6703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6704                 eval $xrun
6705 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6706         eval $xscan;\
6707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6708                 eval $xrun
6709 else
6710         $nm -p $* 2>/dev/null >libc.tmp
6711         $grep fprintf libc.tmp > libc.ptf
6712         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6713                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6714         then
6715                 nm_opt='-p'
6716                 eval $xrun
6717         else
6718                 echo " "
6719                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6720                 com=''
6721                 if $ar t $libc > libc.tmp && \
6722                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6723                 then
6724                         for thisname in $libnames $libc; do
6725                                 $ar t $thisname >>libc.tmp
6726                         done
6727                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6728                         echo "Ok." >&4
6729                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6730                         for thisname in $libnames $libc; do
6731                                 $ar tv $thisname >>libc.tmp
6732                                 emximp -o tmp.imp $thisname \
6733                                     2>/dev/null && \
6734                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6735                                     < tmp.imp >>libc.tmp
6736                                 $rm -f tmp.imp
6737                         done
6738                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6739                         echo "Ok." >&4
6740                 else
6741                         echo "$ar didn't seem to work right." >&4
6742                         echo "Maybe this is a Cray...trying bld instead..." >&4
6743                         if  bld t $libc | \
6744                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6745                                 $test -s libc.list
6746                         then
6747                                 for thisname in $libnames; do
6748                                         bld t $libnames | \
6749                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6750                                         $ar t $thisname >>libc.tmp
6751                                 done
6752                                 echo "Ok." >&4
6753                         else
6754                                 echo "That didn't work either.  Giving up." >&4
6755                                 exit 1
6756                         fi
6757                 fi
6758         fi
6759 fi
6760 nm_extract="$com"
6761 case "$PASE" in
6762 define)
6763     echo " "
6764     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6765     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6766     ;;
6767 *)  if $test -f /lib/syscalls.exp; then
6768         echo " "
6769         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6770         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6771                 /lib/syscalls.exp >>libc.list
6772     fi
6773     ;;
6774 esac
6775 ;;
6776 esac
6777 $rm -f libnames libpath
6778
6779 : Check if we are using C++
6780 echo " "
6781 echo "Checking for C++..." >&4
6782 $cat >try.c <<'EOCP'
6783 #include <stdio.h>
6784 int main(void)
6785 {
6786 #ifdef __cplusplus
6787     return 0;
6788 #else
6789     return 1;
6790 #endif
6791 }
6792 EOCP
6793 set try
6794 if eval $compile_ok && $run ./try; then
6795         val="$define"
6796         echo "You are using a C++ compiler."
6797 else
6798         val="$undef"
6799         echo "You are not using a C++ compiler."
6800 fi
6801 $rm_try cplusplus$$
6802 set d_cplusplus
6803 eval $setvar
6804
6805 : is a C symbol defined?
6806 csym='tlook=$1;
6807 case "$3" in
6808 -v) tf=libc.tmp; tdc="";;
6809 -a) tf=libc.tmp; tdc="[]";;
6810 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6811 esac;
6812 case "$d_cplusplus" in
6813     $define)    extern_C="extern \"C\"" ;;
6814     *)          extern_C="extern"       ;;
6815 esac;
6816 tx=yes;
6817 case "$reuseval-$4" in
6818 true-) ;;
6819 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6820 esac;
6821 case "$tx" in
6822 yes)
6823         tval=false;
6824         if $test "$runnm" = true; then
6825                 if $contains $tlook $tf >/dev/null 2>&1; then
6826                         tval=true;
6827                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6828                         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;
6829                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6830                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6831                         $rm_try;
6832                 fi;
6833         else
6834                 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;
6835                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6836                 $rm_try;
6837         fi;
6838         ;;
6839 *)
6840         case "$tval" in
6841         $define) tval=true;;
6842         *) tval=false;;
6843         esac;
6844         ;;
6845 esac;
6846 eval "$2=$tval"'
6847
6848 : define an is-in-libc? function
6849 inlibc='echo " "; td=$define; tu=$undef;
6850 sym=$1; var=$2; eval "was=\$$2";
6851 tx=yes;
6852 case "$reuseval$was" in
6853 true) ;;
6854 true*) tx=no;;
6855 esac;
6856 case "$tx" in
6857 yes)
6858         set $sym tres -f;
6859         eval $csym;
6860         case "$tres" in
6861         true)
6862                 echo "$sym() found." >&4;
6863                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6864         *)
6865                 echo "$sym() NOT found." >&4;
6866                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6867         esac;;
6868 *)
6869         case "$was" in
6870         $define) echo "$sym() found." >&4;;
6871         *) echo "$sym() NOT found." >&4;;
6872         esac;;
6873 esac'
6874
6875 : check for length of double
6876 echo " "
6877 case "$doublesize" in
6878 '')
6879         echo "Checking to see how big your double precision numbers are..." >&4
6880         $cat >try.c <<EOCP
6881 #include <stdio.h>
6882 #$i_stdlib I_STDLIB
6883 #ifdef I_STDLIB
6884 #include <stdlib.h>
6885 #endif
6886 int main()
6887 {
6888     printf("%d\n", (int)sizeof(double));
6889     exit(0);
6890 }
6891 EOCP
6892         set try
6893         if eval $compile_ok; then
6894                 doublesize=`$run ./try`
6895                 echo "Your double is $doublesize bytes long."
6896         else
6897                 dflt='8'
6898                 echo "(I can't seem to compile the test program.  Guessing...)"
6899                 rp="What is the size of a double precision number (in bytes)?"
6900                 . ./myread
6901                 doublesize="$ans"
6902         fi
6903         ;;
6904 esac
6905 $rm_try
6906
6907 : check for long doubles
6908 echo " "
6909 echo "Checking to see if you have long double..." >&4
6910 echo 'int main() { long double x = 7.0; }' > try.c
6911 set try
6912 if eval $compile; then
6913         val="$define"
6914         echo "You have long double."
6915 else
6916         val="$undef"
6917         echo "You do not have long double."
6918 fi
6919 $rm_try
6920 set d_longdbl
6921 eval $setvar
6922
6923 : see if ldexpl exists
6924 set ldexpl d_ldexpl
6925 eval $inlibc
6926
6927 : check for length of long double
6928 case "${d_longdbl}${longdblsize}" in
6929 $define)
6930         echo " "
6931         echo "Checking to see how big your long doubles are..." >&4
6932         $cat >try.c <<'EOCP'
6933 #include <stdio.h>
6934 int main()
6935 {
6936         printf("%d\n", sizeof(long double));
6937 }
6938 EOCP
6939         set try
6940         set try
6941         if eval $compile; then
6942                 longdblsize=`$run ./try`
6943                 echo "Your long doubles are $longdblsize bytes long."
6944         else
6945                 dflt='8'
6946                 echo " "
6947                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6948                 rp="What is the size of a long double (in bytes)?"
6949                 . ./myread
6950                 longdblsize="$ans"
6951         fi
6952         if $test "X$doublesize" = "X$longdblsize"; then
6953                 echo "That isn't any different from an ordinary double."
6954                 echo "I'll keep your setting anyway, but you may see some"
6955                 echo "harmless compilation warnings."
6956         fi
6957         ;;
6958 esac
6959 $rm_try
6960
6961 $echo "Checking the kind of long doubles you have..." >&4
6962 case "$d_longdbl" in
6963 define)
6964 $cat <<EOP >try.c
6965 #$i_stdlib I_STDLIB
6966 #define LONGDBLSIZE $longdblsize
6967 #define DOUBLESIZE $doublesize
6968 #include <float.h>
6969 #ifdef I_STDLIB
6970 #include <stdlib.h>
6971 #endif
6972 #include <stdio.h>
6973 static const long double d = -0.1L;
6974 int main() {
6975   unsigned const char* b = (unsigned const char*)(&d);
6976 #if DOUBLESIZE == LONGDBLSIZE
6977   printf("0\n"); /* if it floats like double */
6978   exit(0);
6979 #endif
6980 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6981   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6982     /* IEEE 754 128-bit little-endian */
6983     printf("1\n");
6984     exit(0);
6985   }
6986   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6987     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6988     printf("2\n");
6989     exit(0);
6990   }
6991 #endif
6992 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6993  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6994  * cannot be trusted. */
6995 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6996   if (b[0] == 0xCD && b[9] == 0xBF) {
6997     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6998      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6999      * Also known as "extended precision". */
7000     printf("3\n");
7001     exit(0);
7002   }
7003   if (b[0] == 0xBF && b[9] == 0xCD) {
7004     /* Is there ever big-endian 80-bit, really?
7005      *
7006      * The Motorola 68881 had another "extended precision" format:
7007      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7008      * for total of 96 bits of bytes.  The zero bits were unused.
7009      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7010      * If it ever becomes relevant, this format should be allocated
7011      * a new doublekind code since it's quite different from the Intel x87.
7012      */
7013     printf("4\n");
7014     exit(0);
7015   }
7016 #endif
7017 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7018   /* software "double double", the 106 is 53+53.
7019    * but irix thinks it is 107. */
7020   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7021     /* double double 128-bit fully little-endian,
7022      * little-endian doubles in little-endian order,
7023      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7024     printf("5\n");
7025     exit(0);
7026   }
7027   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7028     /* double double 128-bit fully big-endian,
7029      * big-endian doubles in big-endian order,
7030      * e.g. PPC/Power and MIPS:
7031      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7032     printf("6\n");
7033     exit(0);
7034   }
7035   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7036     /* double double 128-bit mixed endian.
7037      * little-endian doubles in big-endian order,
7038      * e.g. ppc64el,
7039      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7040     printf("7\n");
7041     exit(0);
7042   }
7043   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7044     /* double double 128-bit mixed endian,
7045      * big-endian doubles in little-endian order,
7046      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7047     printf("8\n");
7048     exit(0);
7049   }
7050 #endif
7051 /* We are largely making this up because it may well be
7052  * that the VAX format H was never made available to C,
7053  * only to Fortran. */
7054 #if LONGDBLSIZE == 16 && defined(__vax__)
7055   if (b[0] == 0xFD && b[15] == 0x99) {
7056     /* VAX format H, PDP-11 mixed endian. */
7057     printf("9\n");
7058     exit(0);
7059   }
7060 #endif
7061   printf("-1\n"); /* unknown */
7062   exit(0);
7063 }
7064 EOP
7065 set try
7066 if eval $compile; then
7067     longdblkind=`$run ./try`
7068 else
7069     longdblkind=-1
7070 fi
7071 ;;
7072 *) longdblkind=0 ;;
7073 esac
7074 case "$longdblkind" in
7075 0) echo "Your long doubles are doubles." >&4 ;;
7076 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7077 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7078 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7079 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7080 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7081 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7082 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7083 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7084 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7085 *) echo "Cannot figure out your long double." >&4 ;;
7086 esac
7087 d_long_double_style_ieee=$undef
7088 d_long_double_style_ieee_std=$undef
7089 d_long_double_style_ieee_extended=$undef
7090 d_long_double_style_ieee_doubledouble=$undef
7091 d_long_double_style_vax=$undef
7092 case "$longdblkind" in
7093 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7094 esac
7095 case "$longdblkind" in
7096 1|2) d_long_double_style_ieee_std=$define ;;
7097 esac
7098 case "$longdblkind" in
7099 3|4) d_long_double_style_ieee_extended=$define ;;
7100 esac
7101 case "$longdblkind" in
7102 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7103 esac
7104 case "$longdblkind" in
7105 9) d_long_double_style_vax=$define ;;
7106 esac
7107 $rm_try
7108
7109 : determine the architecture name
7110 echo " "
7111 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7112         tarch=`arch`"-$osname"
7113 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7114         if uname -m > tmparch 2>&1 ; then
7115                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7116                         -e 's/$/'"-$osname/" tmparch`
7117         else
7118                 tarch="$osname"
7119         fi
7120         $rm -f tmparch
7121 else
7122         tarch="$osname"
7123 fi
7124 case "$myarchname" in
7125 ''|"$tarch") ;;
7126 *)
7127         echo "(Your architecture name used to be $myarchname.)"
7128         archname=''
7129         ;;
7130 esac
7131 case "$targetarch" in
7132 '') ;;
7133 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7134 esac
7135 myarchname="$tarch"
7136 case "$archname" in
7137 '') dflt="$tarch";;
7138 *) dflt="$archname";;
7139 esac
7140 rp='What is your architecture name'
7141 . ./myread
7142 archname="$ans"
7143
7144 : optionally add API version to the architecture for versioned archlibs
7145 case "$useversionedarchname" in
7146 $define|true|[yY]*) dflt='y';;
7147 *)                  dflt='n';;
7148 esac
7149 rp='Add the Perl API version to your archname?'
7150 . ./myread
7151 case "$ans" in
7152 y|Y)    useversionedarchname="$define" ;;
7153 *)      useversionedarchname="$undef" ;;
7154 esac
7155 case "$useversionedarchname" in
7156 $define)
7157         case "$archname" in
7158         *-$api_versionstring)
7159                 echo "...and architecture name already has -$api_versionstring" >&4
7160                 ;;
7161         *)
7162                 archname="$archname-$api_versionstring"
7163                 echo "...setting architecture name to $archname." >&4
7164                 ;;
7165         esac
7166         ;;
7167 esac
7168
7169 case "$usethreads" in
7170 $define)
7171         echo "Threads selected." >&4
7172         case "$archname" in
7173         *-thread*) echo "...and architecture name already has -thread." >&4
7174                 ;;
7175         *)      archname="$archname-thread"
7176                 echo "...setting architecture name to $archname." >&4
7177                 ;;
7178         esac
7179         ;;
7180 esac
7181 case "$usemultiplicity" in
7182 $define)
7183         echo "Multiplicity selected." >&4
7184         case "$archname" in
7185         *-multi*) echo "...and architecture name already has -multi." >&4
7186                 ;;
7187         *)      archname="$archname-multi"
7188                 echo "...setting architecture name to $archname." >&4
7189                 ;;
7190         esac
7191         ;;
7192 esac
7193 case "$use64bitint$use64bitall" in
7194 *"$define"*)
7195         case "$archname64" in
7196         '')
7197                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7198                 ;;
7199         *)
7200                 case "$use64bitint" in
7201                 "$define") echo "64 bit integers selected." >&4 ;;
7202                 esac
7203                 case "$use64bitall" in
7204                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7205                 esac
7206                 case "$archname" in
7207                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7208                         ;;
7209                 *)      archname="$archname-$archname64"
7210                         echo "...setting architecture name to $archname." >&4
7211                         ;;
7212                 esac
7213                 ;;
7214         esac
7215 esac
7216 case "$uselongdouble" in
7217 $define)
7218         echo "Long doubles selected." >&4
7219         case "$longdblsize" in
7220         $doublesize)
7221                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7222                 ;;
7223         *)
7224                 case "$archname" in
7225                 *-ld*) echo "...and architecture name already has -ld." >&4
7226                         ;;
7227                 *)      archname="$archname-ld"
7228                         echo "...setting architecture name to $archname." >&4
7229                         ;;
7230                 esac
7231                 ;;
7232         esac
7233         ;;
7234 esac
7235 case "$usequadmath" in
7236 $define)
7237         echo "quadmath selected." >&4
7238         case "$archname" in
7239         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7240                 ;;
7241         *)      archname="$archname-quadmath"
7242                 echo "...setting architecture name to $archname." >&4
7243                 ;;
7244         esac
7245         ;;
7246 esac
7247 if $test -f archname.cbu; then
7248         echo "Your platform has some specific hints for architecture name, using them..."
7249         . ./archname.cbu
7250 fi
7251
7252 : set the prefixit variable, to compute a suitable default value
7253 prefixit='case "$3" in
7254 ""|none)
7255         case "$oldprefix" in
7256         "") eval "$1=\"\$$2\"";;
7257         *)
7258                 case "$3" in
7259                 "") eval "$1=";;
7260                 none)
7261                         eval "tp=\"\$$2\"";
7262                         case "$tp" in
7263                         ""|" "|none) eval "$1=\"\$$2\"";;
7264                         *) eval "$1=";;
7265                         esac;;
7266                 esac;;
7267         esac;;
7268 *)
7269         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7270         case "$tp" in
7271         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7272         /*-$oldprefix/*|\~*-$oldprefix/*)
7273                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7274         *) eval "$1=\"\$$2\"";;
7275         esac;;
7276 esac'
7277
7278 : determine installation style
7279 : For now, try to deduce it from prefix unless it is already set.
7280 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7281 case "$installstyle" in
7282 '')     case "$prefix" in
7283                 *perl*) dflt='lib';;
7284                 *) dflt='lib/perl5' ;;
7285         esac
7286         ;;
7287 *)      dflt="$installstyle" ;;
7288 esac
7289 : Probably not worth prompting for this since we prompt for all
7290 : the directories individually, and the prompt would be too long and
7291 : confusing anyway.
7292 installstyle=$dflt
7293
7294 : determine where public executables go
7295 echo " "
7296 set dflt bin bin
7297 eval $prefixit
7298 fn=d~
7299 rp='Pathname where the public executables will reside?'
7300 . ./getfile
7301 if $test "X$ansexp" != "X$binexp"; then
7302         installbin=''
7303 fi
7304 prefixvar=bin
7305 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7306 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7307 :     this via initialinstalllocation
7308 . ./setprefixvar
7309
7310 case "$userelocatableinc" in
7311 $define|true|[yY]*)     dflt='y' ;;
7312 *)                      dflt='n' ;;
7313 esac
7314 cat <<EOM
7315
7316 Would you like to build Perl so that the installation is relocatable, so that
7317 library paths in @INC are determined relative to the path of the perl binary?
7318 This is not advised for system Perl installs, or if you need to run setid
7319 scripts or scripts under taint mode.
7320
7321 If this doesn't make any sense to you, just accept the default '$dflt'.
7322 EOM
7323 rp='Use relocatable @INC?'
7324 . ./myread
7325 case "$ans" in
7326 y|Y)    val="$define" ;;
7327 *)      val="$undef"  ;;
7328 esac
7329 set userelocatableinc
7330 eval $setvar
7331
7332 initialinstalllocation="$binexp"
7333 : Default prefix is now "up one level from where the binaries are"
7334 case "$userelocatableinc" in
7335 $define|true|[yY]*)
7336     bin=".../"
7337     binexp=".../"
7338     prefix=".../.."
7339     prefixexp=".../.."
7340     installprefixexp=".../.."
7341     ;;
7342 esac
7343
7344 : determine where private library files go
7345 : Usual default is /usr/local/lib/perl5/$version.
7346 : Also allow things like /opt/perl/lib/$version, since
7347 : /opt/perl/lib/perl5... would be redundant.
7348 : The default "style" setting is made in installstyle.U
7349 case "$installstyle" in
7350 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7351 *)       set dflt privlib lib/$version ;;
7352 esac
7353 eval $prefixit
7354 $cat <<EOM
7355
7356 There are some auxiliary files for $package that need to be put into a
7357 private library directory that is accessible by everyone.
7358
7359 EOM
7360 fn=$binexp
7361 fn=d~+
7362 rp='Pathname where the private library files will reside?'
7363 . ./getfile
7364 prefixvar=privlib
7365 . ./setprefixvar
7366
7367 : set the prefixup variable, to restore leading tilda escape
7368 prefixup='case "$prefixexp" in
7369 "$prefix") ;;
7370 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7371 esac'
7372
7373 : determine where public architecture dependent libraries go
7374 set archlib archlib
7375 eval $prefixit
7376 : privlib default is /usr/local/lib/$package/$version
7377 : archlib default is /usr/local/lib/$package/$version/$archname
7378 : privlib may have an optional trailing /share.
7379 tdflt=`echo $privlib | $sed 's,/share$,,'`
7380 tdflt=$tdflt/$archname
7381 case "$archlib" in
7382 '')     dflt=$tdflt
7383         ;;
7384 *)      dflt="$archlib"
7385     ;;
7386 esac
7387 $cat <<EOM
7388
7389 $spackage contains architecture-dependent library files.  If you are
7390 sharing libraries in a heterogeneous environment, you might store
7391 these files in a separate location.  Otherwise, you can just include
7392 them with the rest of the public library files.
7393
7394 EOM
7395 fn=$binexp
7396 fn=d+~
7397 rp='Where do you want to put the public architecture-dependent libraries?'
7398 . ./getfile
7399 prefixvar=archlib
7400 . ./setprefixvar
7401 if $test X"$archlib" = X"$privlib"; then
7402         d_archlib="$undef"
7403 else
7404         d_archlib="$define"
7405 fi
7406
7407 : see if setuid scripts can be secure
7408 $cat <<EOM
7409
7410 Some kernels have a bug that prevents setuid #! scripts from being
7411 secure.  Some sites have disabled setuid #! scripts because of this.
7412
7413 First let's decide if your kernel supports secure setuid #! scripts.
7414 (If setuid #! scripts would be secure but have been disabled anyway,
7415 don't say that they are secure if asked.)
7416
7417 EOM
7418
7419 val="$undef"
7420 if $test -d /dev/fd; then
7421         echo "#!$ls" >reflect
7422         chmod +x,u+s reflect
7423         ./reflect >flect 2>&1
7424         if $contains "/dev/fd" flect >/dev/null; then
7425                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7426                 val="$define"
7427         else
7428                 $cat <<EOM
7429 If you are not sure if they are secure, I can check but I'll need a
7430 username and password different from the one you are using right now.
7431 If you don't have such a username or don't want me to test, simply
7432 enter 'none'.
7433
7434 EOM
7435                 rp='Other username to test security of setuid scripts with?'
7436                 dflt='none'
7437                 . ./myread
7438                 case "$ans" in
7439                 n|none)
7440                         case "$d_suidsafe" in
7441                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7442                                 dflt=n;;
7443                         "$undef")
7444                                 echo "Well, the $hint value is *not* secure." >&4
7445                                 dflt=n;;
7446                         *)      echo "Well, the $hint value *is* secure." >&4
7447                                 dflt=y;;
7448                         esac
7449                         ;;
7450                 *)
7451                         $rm -f reflect flect
7452                         echo "#!$ls" >reflect
7453                         chmod +x,u+s reflect
7454                         echo >flect
7455                         chmod a+w flect
7456                         echo '"su" will (probably) prompt you for '"$ans's password."
7457                         su $ans -c './reflect >flect'
7458                         if $contains "/dev/fd" flect >/dev/null; then
7459                                 echo "Okay, it looks like setuid scripts are secure." >&4
7460                                 dflt=y
7461                         else
7462                                 echo "I don't think setuid scripts are secure." >&4
7463                                 dflt=n
7464                         fi
7465                         ;;
7466                 esac
7467                 rp='Does your kernel have *secure* setuid scripts?'
7468                 . ./myread
7469                 case "$ans" in
7470                 [yY]*)  val="$define";;
7471                 *)      val="$undef";;
7472                 esac
7473         fi
7474 else
7475         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7476         echo "(That's for file descriptors, not floppy disks.)"
7477         val="$undef"
7478 fi
7479 set d_suidsafe
7480 eval $setvar
7481
7482 $rm -f reflect flect
7483
7484 : now see if they want to do setuid emulation
7485 if $test $patchlevel -lt 11; then
7486 echo " "
7487 val="$undef"
7488 case "$d_suidsafe" in
7489 "$define")
7490         val="$undef"
7491         echo "No need to emulate SUID scripts since they are secure here." >&4
7492         ;;
7493 *)
7494         $cat <<EOM
7495 Some systems have disabled setuid scripts, especially systems where
7496 setuid scripts cannot be secure.  On systems where setuid scripts have
7497 been disabled, the setuid/setgid bits on scripts are currently
7498 useless.  It is possible for $package to detect those bits and emulate
7499 setuid/setgid in a secure fashion.  This emulation will only work if
7500 setuid scripts have been disabled in your kernel.
7501
7502 EOM
7503         case "$d_dosuid" in
7504         "$define") dflt=y ;;
7505         *) dflt=n ;;
7506         esac
7507         rp="Do you want to do setuid/setgid emulation?"
7508         . ./myread
7509         case "$ans" in
7510         [yY]*)  val="$define";;
7511         *)      val="$undef";;
7512         esac
7513         ;;
7514 esac
7515 set d_dosuid
7516 eval $setvar
7517 else
7518     case "$d_dosuid" in
7519         "$define")
7520         cat >&4 <<EOH
7521
7522 SUID emulation has been removed for 5.12
7523 Please re-run Configure without -Dd_dosuid
7524
7525 EOH
7526         exit 1;
7527         ;;
7528     esac
7529     d_dosuid=undef
7530 fi
7531
7532 : Find perl5.005 or later.
7533 echo "Looking for a previously installed perl5.005 or later... "
7534 case "$perl5" in
7535 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7536                 : Check if this perl is recent and can load a simple module
7537                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7538                         perl5=$tdir/perl
7539                         break;
7540                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7541                         perl5=$tdir/perl5
7542                         break;
7543                 fi
7544         done
7545         ;;
7546 *)      perl5="$perl5"
7547         ;;
7548 esac
7549 case "$perl5" in
7550 '')     echo "None found.  That's ok.";;
7551 *)      echo "Using $perl5." ;;
7552 esac
7553
7554 : Set the siteprefix variables
7555 $cat <<EOM
7556
7557 After $package is installed, you may wish to install various
7558 add-on modules and utilities.  Typically, these add-ons will
7559 be installed under $prefix with the rest
7560 of this package.  However, you may wish to install such add-ons
7561 elsewhere under a different prefix.
7562
7563 If you do not wish to put everything under a single prefix, that's
7564 ok.  You will be prompted for the individual locations; this siteprefix
7565 is only used to suggest the defaults.
7566
7567 The default should be fine for most people.
7568
7569 EOM
7570 fn=d~+
7571 rp='Installation prefix to use for add-on modules and utilities?'
7572 : XXX Here might be another good place for an installstyle setting.
7573 case "$siteprefix" in
7574 '') dflt=$prefix ;;
7575 *)  dflt=$siteprefix ;;
7576 esac
7577 . ./getfile
7578 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7579 oldsiteprefix=''
7580 case "$siteprefix" in
7581 '') ;;
7582 *)      case "$ans" in
7583         "$prefix") ;;
7584         *) oldsiteprefix="$prefix";;
7585         esac
7586         ;;
7587 esac
7588 siteprefix="$ans"
7589 siteprefixexp="$ansexp"
7590
7591 : determine where site specific libraries go.
7592 : Usual default is /usr/local/lib/perl5/site_perl/$version
7593 : The default "style" setting is made in installstyle.U
7594 : XXX No longer works with Prefixit stuff.
7595 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7596 case "$sitelib" in
7597 '') case "$installstyle" in
7598         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7599         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7600         esac
7601         ;;
7602 *)      dflt="$sitelib"
7603         ;;
7604 esac
7605 $cat <<EOM
7606
7607 The installation process will create a directory for
7608 site-specific extensions and modules.  Most users find it convenient
7609 to place all site-specific files in this directory rather than in the
7610 main distribution directory.
7611
7612 EOM
7613 fn=d~+
7614 rp='Pathname for the site-specific library files?'
7615 . ./getfile
7616 prefixvar=sitelib
7617 . ./setprefixvar
7618 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7619
7620 : Determine list of previous versions to include in @INC
7621 $cat > getverlist <<EOPL
7622 #!$perl5 -w
7623 use File::Basename;
7624 \$api_versionstring = "$api_versionstring";
7625 \$version = "$version";
7626 \$stem = "$sitelib_stem";
7627 \$archname = "$archname";
7628 EOPL
7629         $cat >> getverlist <<'EOPL'
7630 # The list found is store twice for each entry: the original name, and
7631 # the binary broken down version as pack "sss", so sorting is easy and
7632 # unambiguous. This will work for all versions that have a maximum of
7633 # three digit groups, separate by '.'s or '_'s. Names are extended with
7634 # ".0.0" to ensure at least three elements for the pack.
7635 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7636
7637 # Can't have leading @ because metaconfig interprets it as a command!
7638 ;@inc_version_list=();
7639 # XXX Redo to do opendir/readdir?
7640 if (-d $stem) {
7641     chdir($stem);
7642     ;@candidates = map {
7643         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7644     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7645 }
7646 else {
7647     ;@candidates = ();
7648 }
7649
7650 ($pversion, $aversion, $vsn5005) = map {
7651     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7652 foreach $d (@candidates) {
7653     if ($d->[1] lt $pversion) {
7654         if ($d->[1] ge $aversion) {
7655             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7656         }
7657         elsif ($d->[1] ge $vsn5005) {
7658             unshift(@inc_version_list, grep { -d } $d->[0]);
7659         }
7660     }
7661     else {
7662         # Skip newer version.  I.e. don't look in
7663         # 5.7.0 if we're installing 5.6.1.
7664     }
7665 }
7666
7667 if (@inc_version_list) {
7668     print join(' ', @inc_version_list);
7669 }
7670 else {
7671     # Blank space to preserve value for next Configure run.
7672     print " ";
7673 }
7674 EOPL
7675 chmod +x getverlist
7676 case "$inc_version_list" in
7677 '')     if test -x "$perl5$exe_ext"; then
7678                 dflt=`$perl5 getverlist`
7679         else
7680                 dflt='none'
7681         fi
7682         ;;
7683 $undef) dflt='none' ;;
7684 *)  eval dflt=\"$inc_version_list\" ;;
7685 esac
7686 case "$dflt" in
7687 ''|' ') dflt=none ;;
7688 esac
7689 case "$dflt" in
7690 5.005) dflt=none ;;
7691 esac
7692 $cat <<EOM
7693
7694 In order to ease the process of upgrading, this version of perl
7695 can be configured to use modules built and installed with earlier
7696 versions of perl that were installed under $prefix.  Specify here
7697 the list of earlier versions that this version of perl should check.
7698 If Configure detected no earlier versions of perl installed under
7699 $prefix, then the list will be empty.  Answer 'none' to tell perl
7700 to not search earlier versions.
7701
7702 The default should almost always be sensible, so if you're not sure,
7703 just accept the default.
7704 EOM
7705
7706 rp='List of earlier versions to include in @INC?'
7707 . ./myread
7708 case "$ans" in
7709 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7710 *) inc_version_list="$ans" ;;
7711 esac
7712 case "$inc_version_list" in
7713 ''|' ')
7714         inc_version_list_init='0'
7715         d_inc_version_list="$undef"
7716         ;;
7717 *)      inc_version_list_init=`echo $inc_version_list |
7718                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7719         d_inc_version_list="$define"
7720         ;;
7721 esac
7722 $rm -f getverlist
7723
7724 : see if malloc/malloc.h has to be included
7725 set malloc/malloc.h i_mallocmalloc
7726 eval $inhdr
7727
7728 : see if this is a malloc.h system
7729 : we want a real compile instead of Inhdr because some systems have a
7730 : malloc.h that just gives a compile error saying to use stdlib.h instead
7731 echo " "
7732 $cat >try.c <<EOCP
7733 #include <stdlib.h>
7734 #include <malloc.h>
7735 #$i_mallocmalloc I_MALLOCMALLOC
7736 #ifdef I_MALLOCMALLOC
7737 # include <malloc/malloc.h>
7738 #endif
7739
7740 int main () { return 0; }
7741 EOCP
7742 set try
7743 if eval $compile; then
7744     echo "<malloc.h> found." >&4
7745     val="$define"
7746 else
7747     echo "<malloc.h> NOT found." >&4
7748     val="$undef"
7749 fi
7750 $rm_try
7751 set i_malloc
7752 eval $setvar
7753
7754 : check for length of pointer
7755 echo " "
7756 case "$ptrsize" in
7757 '')
7758         echo "Checking to see how big your pointers are..." >&4
7759         $cat >try.c <<EOCP
7760 #include <stdio.h>
7761 #$i_stdlib I_STDLIB
7762 #ifdef I_STDLIB
7763 #include <stdlib.h>
7764 #endif
7765 int main()
7766 {
7767     printf("%d\n", (int)sizeof(void *));
7768     exit(0);
7769 }
7770 EOCP
7771         set try
7772         if eval $compile_ok; then
7773                 ptrsize=`$run ./try`
7774                 echo "Your pointers are $ptrsize bytes long."
7775         else
7776                 dflt='4'
7777                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7778                 rp="What is the size of a pointer (in bytes)?"
7779                 . ./myread
7780                 ptrsize="$ans"
7781         fi
7782         ;;
7783 esac
7784 $rm_try
7785 case "$use64bitall" in
7786 "$define"|true|[yY]*)
7787         case "$ptrsize" in
7788         4)      cat <<EOM >&4
7789
7790 *** You have chosen a maximally 64-bit build,
7791 *** but your pointers are only 4 bytes wide.
7792 *** Please rerun Configure without -Duse64bitall.
7793 EOM
7794                 case "$d_quad" in
7795                 define)
7796                         cat <<EOM >&4
7797 *** Since you have quads, you could possibly try with -Duse64bitint.
7798 EOM
7799                         ;;
7800                 esac
7801                 cat <<EOM >&4
7802 *** Cannot continue, aborting.
7803
7804 EOM
7805
7806                 exit 1
7807                 ;;
7808         esac
7809         ;;
7810 esac
7811
7812 : determine whether to use malloc wrapping
7813 echo " "
7814 case "$usemallocwrap" in
7815 [yY]*|true|$define)     dflt='y' ;;
7816 [nN]*|false|$undef)     dflt='n' ;;
7817 *)      case "$usedevel" in
7818         [yY]*|true|$define)     dflt='y' ;;
7819         *) dflt='n' ;;
7820         esac
7821         ;;
7822 esac
7823 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7824 . ./myread
7825 usemallocwrap="$ans"
7826 case "$ans" in
7827 y*|true)
7828         usemallocwrap="$define" ;;
7829 *)
7830         usemallocwrap="$undef" ;;
7831 esac
7832
7833 : determine which malloc to compile in
7834 echo " "
7835 case "$usemymalloc" in
7836 [yY]*|true|$define)     dflt='y' ;;
7837 [nN]*|false|$undef)     dflt='n' ;;
7838 *)      case "$ptrsize" in
7839         4) dflt='y' ;;
7840         *) dflt='n' ;;
7841         esac
7842         if test "$useithreads" = "$define"; then dflt='n'; fi
7843         ;;
7844 esac
7845 rp="Do you wish to attempt to use the malloc that comes with $package?"
7846 . ./myread
7847 usemymalloc="$ans"
7848 case "$ans" in
7849 y*|true)
7850         usemymalloc='y'
7851         mallocsrc='malloc.c'
7852         mallocobj="malloc$_o"
7853         d_mymalloc="$define"
7854         case "$libs" in
7855         *-lmalloc*)
7856                 : Remove malloc from list of libraries to use
7857                 echo "Removing unneeded -lmalloc from library list" >&4
7858                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7859                 shift
7860                 libs="$*"
7861                 echo "libs = $libs" >&4
7862                 ;;
7863         esac
7864         ;;
7865 *)
7866         usemymalloc='n'
7867         mallocsrc=''
7868         mallocobj=''
7869         d_mymalloc="$undef"
7870         ;;
7871 esac
7872
7873 : compute the return types of malloc and free
7874 echo " "
7875 $cat >malloc.c <<END
7876 #$i_malloc I_MALLOC
7877 #$i_stdlib I_STDLIB
7878 #include <stdio.h>
7879 #include <sys/types.h>
7880 #ifdef I_MALLOC
7881 #include <malloc.h>
7882 #endif
7883 #ifdef I_STDLIB
7884 #include <stdlib.h>
7885 #endif
7886 #ifdef TRY_MALLOC
7887 void *malloc();
7888 #endif
7889 #ifdef TRY_FREE
7890 void free();
7891 #endif
7892 END
7893 case "$malloctype" in
7894 '')
7895         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7896                 malloctype='void *'
7897         else
7898                 malloctype='char *'
7899         fi
7900         ;;
7901 esac
7902 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7903
7904 case "$freetype" in
7905 '')
7906         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7907                 freetype='void'
7908         else
7909                 freetype='int'
7910         fi
7911         ;;
7912 esac
7913 echo "Your system uses $freetype free(), it would seem." >&4
7914 $rm -f malloc.[co]
7915 : determine where site specific architecture-dependent libraries go.
7916 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7917 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7918 : sitelib may have an optional trailing /share.
7919 case "$sitearch" in
7920 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7921         dflt="$dflt/$archname"
7922         ;;
7923 *)      dflt="$sitearch"
7924         ;;
7925 esac
7926 set sitearch sitearch none
7927 eval $prefixit
7928 $cat <<EOM
7929
7930 The installation process will also create a directory for
7931 architecture-dependent site-specific extensions and modules.
7932
7933 EOM
7934 fn=d~+
7935 rp='Pathname for the site-specific architecture-dependent library files?'
7936 . ./getfile
7937 prefixvar=sitearch
7938 . ./setprefixvar
7939 if $test X"$sitearch" = X"$sitelib"; then
7940         d_sitearch="$undef"
7941 else
7942         d_sitearch="$define"
7943 fi
7944
7945 : Set the vendorprefix variables
7946 $cat <<EOM
7947
7948 The installation process will also create a directory for
7949 vendor-supplied add-ons.  Vendors who supply perl with their system
7950 may find it convenient to place all vendor-supplied files in this
7951 directory rather than in the main distribution directory.  This will
7952 ease upgrades between binary-compatible maintenance versions of perl.
7953
7954 Of course you may also use these directories in whatever way you see
7955 fit.  For example, you might use them to access modules shared over a
7956 company-wide network.
7957
7958 The default answer should be fine for most people.
7959 This causes further questions about vendor add-ons to be skipped
7960 and no vendor-specific directories will be configured for perl.
7961
7962 EOM
7963 rp='Do you want to configure vendor-specific add-on directories?'
7964 case "$usevendorprefix" in
7965 define|true|[yY]*) dflt=y ;;
7966 *)      : User may have set vendorprefix directly on Configure command line.
7967         case "$vendorprefix" in
7968         ''|' ') dflt=n ;;
7969         *)      dflt=y ;;
7970         esac
7971         ;;
7972 esac
7973 . ./myread
7974 case "$ans" in
7975 [yY]*)  fn=d~+
7976         rp='Installation prefix to use for vendor-supplied add-ons?'
7977         case "$vendorprefix" in
7978         '') dflt="$prefix" ;;
7979         *)  dflt=$vendorprefix ;;
7980         esac
7981         . ./getfile
7982         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7983         oldvendorprefix=''
7984         case "$vendorprefix" in
7985         '') ;;
7986         *)      case "$ans" in
7987                 "$prefix") ;;
7988                 *) oldvendorprefix="$prefix";;
7989                 esac
7990                 ;;
7991         esac
7992         usevendorprefix="$define"
7993         vendorprefix="$ans"
7994         vendorprefixexp="$ansexp"
7995         ;;
7996 *)      usevendorprefix="$undef"
7997         vendorprefix=''
7998         vendorprefixexp=''
7999         ;;
8000 esac
8001
8002 : Set the vendorlib variables
8003 case "$vendorprefix" in
8004 '')     d_vendorlib="$undef"
8005         vendorlib=''
8006         vendorlibexp=''
8007         ;;
8008 *)      d_vendorlib="$define"
8009         : determine where vendor-supplied modules go.
8010         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8011         case "$vendorlib" in
8012         '')
8013                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8014                 case "$installstyle" in
8015                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8016                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8017                 esac
8018                 ;;
8019         *)      dflt="$vendorlib"
8020                 ;;
8021         esac
8022         fn=d~+
8023         rp='Pathname for the vendor-supplied library files?'
8024         . ./getfile
8025         vendorlib="$ans"
8026         vendorlibexp="$ansexp"
8027         ;;
8028 esac
8029 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8030 prefixvar=vendorlib
8031 . ./installprefix
8032
8033 : Set the vendorarch variables
8034 case "$vendorprefix" in
8035 '')     d_vendorarch="$undef"
8036         vendorarch=''
8037         vendorarchexp=''
8038         ;;
8039 *)      d_vendorarch="$define"
8040         : determine where vendor-supplied architecture-dependent libraries go.
8041         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8042         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8043         : vendorlib may have an optional trailing /share.
8044         case "$vendorarch" in
8045         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8046                 dflt="$dflt/$archname"
8047                 ;;
8048         *)      dflt="$vendorarch" ;;
8049         esac
8050         fn=d~+
8051         rp='Pathname for vendor-supplied architecture-dependent files?'
8052         . ./getfile
8053         vendorarch="$ans"
8054         vendorarchexp="$ansexp"
8055         ;;
8056 esac
8057 prefixvar=vendorarch
8058 . ./installprefix
8059 if $test X"$vendorarch" = X"$vendorlib"; then
8060         d_vendorarch="$undef"
8061 else
8062         d_vendorarch="$define"
8063 fi
8064
8065 : Final catch-all directories to search
8066 $cat <<EOM
8067
8068 Lastly, you can have perl look in other directories for extensions and
8069 modules in addition to those already specified.
8070 These directories will be searched after
8071         $sitearch
8072         $sitelib
8073 EOM
8074 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8075 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8076 echo ' '
8077 case "$otherlibdirs" in
8078 ''|' ') dflt='none' ;;
8079 *)      dflt="$otherlibdirs" ;;
8080 esac
8081 $cat <<EOM
8082 Enter a colon-separated set of extra paths to include in perl's @INC
8083 search path, or enter 'none' for no extra paths.
8084
8085 EOM
8086
8087 rp='Colon-separated list of additional directories for perl to search?'
8088 . ./myread
8089 case "$ans" in
8090 ' '|''|none)    otherlibdirs=' ' ;;
8091 *)      otherlibdirs="$ans" ;;
8092 esac
8093 case "$otherlibdirs" in
8094 ' ') val=$undef ;;
8095 *)      val=$define ;;
8096 esac
8097 set d_perl_otherlibdirs
8098 eval $setvar
8099
8100 : DTrace support
8101 dflt_dtrace='/usr/sbin/dtrace'
8102 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8103
8104 cat <<EOM
8105
8106 Perl can be built to support DTrace on platforms that support it.
8107 DTrace is a diagnosis and performance analysis tool from Sun.
8108
8109 If this doesn't make any sense to you, just accept the default.
8110 EOM
8111
8112 while $test 1 ; do
8113         case "$usedtrace" in
8114         $define|true|[yY]*)
8115                 dflt='y'
8116                 ;;
8117         $undef|false|[nN]*)
8118                 dflt='n'
8119                 dflt_dtrace=""
8120                 ;;
8121         ?*)
8122                 dflt='y'
8123                 dflt_dtrace=$usedtrace
8124                 ;;
8125         *)
8126                 dflt='n'
8127                 ;;
8128         esac
8129
8130         rp='Support DTrace if available?'
8131         . ./myread
8132         case "$ans" in
8133         y|Y)    val="$define" ;;
8134         *)      val="$undef" ;;
8135         esac
8136         set usedtrace
8137         eval $setvar
8138
8139         test "X$usedtrace" != "X$define" && break
8140
8141         echo " "
8142         rp='Where is the dtrace executable?'
8143         dflt=$dflt_dtrace
8144         . ./getfile
8145         val="$ans"
8146         set dtrace
8147         eval $setvar
8148
8149         if $test -f $dtrace
8150         then
8151                 if $dtrace -h -s ../perldtrace.d \
8152                         -o perldtrace.tmp >/dev/null 2>&1 \
8153                         && rm -f perldtrace.tmp
8154                 then
8155                         echo " "
8156                         echo "Good: your $dtrace knows about the -h flag."
8157                 else
8158                         cat >&2 <<EOM
8159
8160 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8161 ***
8162 *** Your installed dtrace doesn't support the -h switch to compile a D
8163 *** program into a C header. Can't continue.
8164
8165 EOM
8166                         exit 1
8167                 fi
8168                 break;
8169         fi
8170
8171         case "$fastread" in
8172         yes)
8173                 cat >&2 <<EOM
8174
8175 *** $me:  Fatal Error:  $dtrace not found.
8176 *** Can't continue.
8177
8178 EOM
8179                 exit 1
8180                 ;;
8181         *)
8182                 echo "*** $dtrace was not found."
8183                 echo " "
8184                 ;;
8185         esac
8186 done
8187
8188 : See if we want extra modules installed
8189 echo " "
8190 case "$extras" in
8191 '') dflt='n';;
8192 *) dflt='y';;
8193 esac
8194 cat <<EOM
8195 Perl can be built with extra modules or bundles of modules which
8196 will be fetched from the CPAN and installed alongside Perl.
8197
8198 Notice that you will need access to the CPAN; either via the Internet,
8199 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8200 be asked later to configure the CPAN.pm module which will in turn do
8201 the installation of the rest of the extra modules or bundles.)
8202
8203 Notice also that if the modules require any external software such as
8204 libraries and headers (the libz library and the zlib.h header for the
8205 Compress::Zlib module, for example) you MUST have any such software
8206 already installed, this configuration process will NOT install such
8207 things for you.
8208
8209 If this doesn't make any sense to you, just accept the default '$dflt'.
8210 EOM
8211 rp='Install any extra modules (y or n)?'
8212 . ./myread
8213 case "$ans" in
8214 y|Y)
8215         cat <<EOM
8216
8217 Please list any extra modules or bundles to be installed from CPAN,
8218 with spaces between the names.  The names can be in any format the
8219 'install' command of CPAN.pm will understand.  (Answer 'none',
8220 without the quotes, to install no extra modules or bundles.)
8221 EOM
8222         rp='Extras?'
8223         dflt="$extras"
8224         . ./myread
8225         extras="$ans"
8226 esac
8227 case "$extras" in
8228 ''|'none')
8229         val=''
8230         $rm -f ../extras.lst
8231         ;;
8232 *)      echo "(Saving the list of extras for later...)"
8233         echo "$extras" > ../extras.lst
8234         val="'$extras'"
8235         ;;
8236 esac
8237 set extras
8238 eval $setvar
8239 echo " "
8240
8241 : determine where html pages for programs go
8242 set html1dir html1dir none
8243 eval $prefixit
8244 $cat <<EOM
8245
8246 If you wish to install html files for programs in $spackage, indicate
8247 the appropriate directory here.  To skip installing html files,
8248 answer "none".
8249 EOM
8250 case "$html1dir" in
8251 ''|none|$undef|' ') dflt=none ;;
8252 *) dflt=$html1dir ;;
8253 esac
8254 fn=dn+~
8255 rp="Directory for the main $spackage html pages?"
8256 . ./getfile
8257 prefixvar=html1dir
8258 . ./setprefixvar
8259 : Use ' ' for none so value is preserved next time through Configure
8260 $test X"$html1dir" = "X" && html1dir=' '
8261
8262 : determine where html pages for libraries and modules go
8263 set html3dir html3dir none
8264 eval $prefixit
8265 $cat <<EOM
8266
8267 If you wish to install html files for modules associated with $spackage,
8268 indicate the appropriate directory here.  To skip installing html files,
8269 answer "none".
8270 EOM
8271 : There is no obvious default.  If they have specified html1dir, then
8272 : try to key off that, possibly changing .../html1 into .../html3.
8273 case "$html3dir" in
8274 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8275 *) dflt=$html3dir ;;
8276 esac
8277 fn=dn+~
8278 rp="Directory for the $spackage module html pages?"
8279 . ./getfile
8280 prefixvar=html3dir
8281 . ./setprefixvar
8282 : Use ' ' for none so value is preserved next time through Configure
8283 $test X"$html3dir" = "X" && html3dir=' '
8284
8285 : determine whether to install perl also as /usr/bin/perl
8286
8287 echo " "
8288 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8289         $cat <<EOM
8290 Many scripts expect perl to be installed as /usr/bin/perl.
8291
8292 If you want to, I can install the perl you are about to compile
8293 as /usr/bin/perl (in addition to $bin/perl).
8294 EOM
8295         if test -f /usr/bin/perl; then
8296             $cat <<EOM
8297
8298 However, please note that because you already have a /usr/bin/perl,
8299 overwriting that with a new Perl would very probably cause problems.
8300 Therefore I'm assuming you don't want to do that (unless you insist).
8301
8302 EOM
8303             case "$installusrbinperl" in
8304             "$define"|[yY]*)    dflt='y';;
8305             *)                  dflt='n';;
8306             esac
8307         else
8308             $cat <<EOM
8309
8310 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8311
8312 EOM
8313             case "$installusrbinperl" in
8314             "$undef"|[nN]*)     dflt='n';;
8315             *)                  dflt='y';;
8316             esac
8317         fi
8318         rp="Do you want to install perl as /usr/bin/perl?"
8319         . ./myread
8320         case "$ans" in
8321         [yY]*)  val="$define";;
8322         *)      val="$undef" ;;
8323         esac
8324 else
8325         val="$undef"
8326 fi
8327 set installusrbinperl
8328 eval $setvar
8329
8330 : see if dlopen exists
8331 xxx_runnm="$runnm"
8332 xxx_ccflags="$ccflags"
8333 runnm=false
8334 : with g++ one needs -shared to get is-in-libc to work for dlopen
8335 case "$gccversion" in
8336 '')     ;;
8337 *Clang*)        ;;
8338 *)      case "$d_cplusplus" in
8339         "$define") ccflags="$ccflags -shared" ;;
8340         esac
8341         ;;
8342 esac
8343 set dlopen d_dlopen
8344 eval $inlibc
8345 runnm="$xxx_runnm"
8346 ccflags="$xxx_ccflags"
8347
8348 : see if this is a unistd.h system
8349 set unistd.h i_unistd
8350 eval $inhdr
8351
8352 : determine which dynamic loading, if any, to compile in
8353 echo " "
8354 dldir="ext/DynaLoader"
8355 case "$usedl" in
8356     $define|y|true)
8357         dflt='y'
8358         usedl="$define"
8359         ;;
8360     $undef|n|false)
8361         dflt='n'
8362         usedl="$undef"
8363         ;;
8364     *)
8365         dflt='n'
8366         case "$d_dlopen" in
8367             $define) dflt='y' ;;
8368         esac
8369         : Does a dl_xxx.xs file exist for this operating system
8370         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8371         ;;
8372 esac
8373 rp="Do you wish to use dynamic loading?"
8374 . ./myread
8375 usedl="$ans"
8376 bin_ELF="$undef"
8377 case "$ans" in
8378     y*) usedl="$define"
8379         case "$dlsrc" in
8380             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8381                     dflt="$dldir/dl_${osname}.xs"
8382                 elif $test "$d_dlopen" = "$define" ; then
8383                     dflt="$dldir/dl_dlopen.xs"
8384                 else
8385                     dflt=''
8386                 fi
8387                 ;;
8388             *)  dflt="$dldir/$dlsrc"
8389                 ;;
8390         esac
8391         echo "The following dynamic loading files are available:"
8392         : Can not go over to $dldir because getfile has path hard-coded in.
8393         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8394         rp="Source file to use for dynamic loading"
8395         fn="fne"
8396         gfpth="$src"
8397         . ./getfile
8398         usedl="$define"
8399         : emulate basename
8400         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8401
8402         $cat << EOM
8403
8404 Some systems may require passing special flags to $cc -c to
8405 compile modules that will be used to create a shared library.
8406 To use no flags, say "none".
8407
8408 EOM
8409         case "$cccdlflags" in
8410             '') case "$gccversion" in
8411                 '') case "$osname" in
8412                         hpux)   dflt='+z' ;;
8413                         irix*)  dflt='-KPIC' ;;
8414                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8415                         sunos)  dflt='-pic' ;;
8416                         *)      dflt='none' ;;
8417                     esac
8418                     ;;
8419                 *)  case "$osname" in
8420                         darwin) dflt='none' ;;
8421                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8422                         *)      dflt='-fpic' ;;
8423                     esac ;;
8424                 esac ;;
8425             ' ') dflt='none' ;;
8426             *)   dflt="$cccdlflags" ;;
8427         esac
8428
8429         case "$dflt" in
8430             none) dflt='' ;;
8431         esac
8432
8433         # If -Dsysroot was specified, now's the time to add it
8434         # to cccdlflags
8435         if test "X$sysroot" != X; then
8436             case "$gccversion" in
8437                 '') ;;
8438                 *)  case "$dflt" in
8439                         *sysroot*) ;;
8440                         'undef'|*)
8441                             dflt="$dflt --sysroot=$sysroot" ;;
8442                     esac
8443                     ;;
8444             esac
8445         fi
8446
8447         case "$dflt" in
8448             '') dflt='none';;
8449         esac
8450
8451         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8452         . ./myread
8453         case "$ans" in
8454             none) cccdlflags=' ' ;;
8455             *)    cccdlflags="$ans" ;;
8456         esac
8457
8458         cat << EOM
8459
8460 Some systems use ld to create libraries that can be dynamically loaded,
8461 while other systems (such as those using ELF) use $cc.
8462
8463 EOM
8464
8465 : Determine if this is ELF
8466         $cat >try.c <<EOM
8467 /* Test for whether ELF binaries are produced */
8468 #include <fcntl.h>
8469 #$i_stdlib I_STDLIB
8470 #ifdef I_STDLIB
8471 #include <stdlib.h>
8472 #endif
8473 #$i_unistd I_UNISTD
8474 #ifdef I_UNISTD
8475 #include <unistd.h>
8476 #endif
8477 int main() {
8478     char b[4];
8479     int i = open("a.out",O_RDONLY);
8480     if(i == -1)
8481         exit(1); /* fail */
8482     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8483         exit(0); /* succeed (yes, it is ELF) */
8484     exit(1); /* fail */
8485 }
8486 EOM
8487         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8488             bin_ELF="$define"
8489         fi
8490         $rm_try
8491
8492         case "$ld" in
8493             '') if $test $bin_ELF = "$define"; then
8494                     cat <<EOM
8495 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8496 EOM
8497                     dflt="$cc"
8498                 else
8499                     echo "I'll use ld to build dynamic libraries."
8500                     dflt='ld'
8501                 fi
8502                 ;;
8503             *)  dflt="$ld"
8504                 ;;
8505         esac
8506
8507         rp="What command should be used to create dynamic libraries?"
8508         . ./myread
8509         ld="$ans"
8510
8511         cat << EOM
8512
8513 Some systems may require passing special flags to $ld to create a
8514 library that can be dynamically loaded.  If your ld flags include
8515 -L/other/path options to locate libraries outside your loader's normal
8516 search path, you may need to specify those -L options here as well.  To
8517 use no flags, say "none".
8518
8519 EOM
8520         case "$lddlflags" in
8521             '') case "$osname" in
8522                     haiku) dflt='-shared' ;;
8523                     hpux) dflt='-b';
8524                           case "$gccversion" in
8525                               '') dflt="$dflt +vnocompatwarnings" ;;
8526                           esac
8527                           ;;
8528                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8529                     solaris) # See [perl #66604].
8530                             # On Solaris 11, gcc -m64 on amd64
8531                             # appears not to understand -G.  gcc versions at
8532                             # least as old as 3.4.3 support -shared, so just
8533                             # use that with Solaris 11 and later, but keep
8534                             # the old behavior for older Solaris versions.
8535                             case "$gccversion" in
8536                                 '') dflt='-G' ;;
8537                                 *)  case "$osvers" in
8538                                         2.?|2.10) dflt='-G' ;;
8539                                         *) dflt='-shared' ;;
8540                                     esac
8541                                     ;;
8542                             esac
8543                             ;;
8544                     sunos) dflt='-assert nodefinitions' ;;
8545                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8546                     *)     dflt='none' ;;
8547                 esac
8548                 ;;
8549             *) dflt="$lddlflags" ;;
8550         esac
8551
8552         : Only do this for gcc, since, for example, qcc has no concept
8553         : of --sysroot.
8554         if $test "X$sysroot" != X; then
8555             case "$gccversion" in
8556                 '') ;;
8557                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8558             esac
8559         fi
8560
8561         : Try to guess additional flags to pick up local libraries.
8562         : Be careful not to append to a plain 'none'
8563         case "$dflt" in
8564             none) dflt='' ;;
8565         esac
8566         for thisflag in $ldflags; do
8567             case "$thisflag" in
8568                 -L*|-R*|-Wl,-R*)
8569                     case " $dflt " in
8570                         *" $thisflag "*) ;;
8571                         *) dflt="$dflt $thisflag" ;;
8572                     esac
8573                     ;;
8574             esac
8575         done
8576
8577         case "$dflt" in
8578             ''|' ') dflt='none' ;;
8579         esac
8580
8581         case "$ldflags" in
8582             *-fstack-protector-strong*)
8583                 case "$dflt" in
8584                     *-fstack-protector-strong*) ;; # Don't add it again
8585                     *) dflt="$dflt -fstack-protector-strong" ;;
8586                 esac
8587                 ;;
8588             *-fstack-protector*)
8589                 case "$dflt" in
8590                     *-fstack-protector*) ;; # Don't add it again
8591                     *) dflt="$dflt -fstack-protector" ;;
8592                 esac
8593                 ;;
8594         esac
8595
8596         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8597         . ./myread
8598         case "$ans" in
8599             none) lddlflags=' ' ;;
8600             *) lddlflags="$ans" ;;
8601         esac
8602
8603         cat <<EOM
8604
8605 Some systems may require passing special flags to $cc to indicate that
8606 the resulting executable will use dynamic linking.  To use no flags,
8607 say "none".
8608
8609 EOM
8610         case "$ccdlflags" in
8611             '') case "$osname" in
8612                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8613                     sunos)             dflt='none'   ;;
8614                     *)                 dflt='none'   ;;
8615                 esac ;;
8616             ' ') dflt='none' ;;
8617             *)   dflt="$ccdlflags" ;;
8618         esac
8619         rp="Any special flags to pass to $cc to use dynamic linking?"
8620         . ./myread
8621         case "$ans" in
8622             none) ccdlflags=' ' ;;
8623             *)    ccdlflags="$ans" ;;
8624         esac
8625         ;;
8626
8627     *)  usedl="$undef"
8628         ld='ld'
8629         dlsrc='dl_none.xs'
8630         lddlflags=''
8631         ccdlflags=''
8632         ;;
8633 esac
8634
8635 ld_can_script="$undef"
8636 case "$bin_ELF$usedl" in
8637     $define$define)
8638         # Abuse try.h and a.out names for neat cleanup
8639         $cat >try.c <<EOM
8640 void foo() {}
8641 void bar() {}
8642 EOM
8643         $cat >try.h <<EOM
8644 LIBTEST_42 {
8645  global:
8646   foo;
8647  local: *;
8648  };
8649 EOM
8650         if $cc $cccdlflags $ccdlflags $ccflags \
8651                $ldflags $lddlflags -o a.out try.c \
8652                -Wl,--version-script=try.h >/dev/null 2>&1 \
8653            &&  $test -s a.out ; then
8654             echo "ld supports scripting" >&4
8655             ld_can_script="$define"
8656         else
8657             echo "ld does not support scripting" >&4
8658         fi
8659         $rm_try
8660         ;;
8661 esac
8662
8663 : Do we want a shared libperl?
8664 also=''
8665 case "$usedl" in
8666 $undef)
8667         # No dynamic loading being used, so don't bother even to prompt.
8668         useshrplib='false'
8669         ;;
8670 *)      case "$useshrplib" in
8671         '')     case "$osname" in
8672                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8673                         dflt=y
8674                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8675                         ;;
8676                 *)      dflt=n
8677                         ;;
8678                 esac
8679                 ;;
8680         $define|true|[Yy]*)
8681                 dflt=y
8682                 ;;
8683         *)      dflt=n
8684                 ;;
8685         esac
8686         $cat << EOM
8687
8688 The perl executable is normally obtained by linking perlmain.c with
8689 libperl${_a}, any static extensions (usually just DynaLoader), and
8690 any other libraries needed on this system (such as -lm, etc.).  Since
8691 your system supports dynamic loading, it is probably possible to build
8692 a shared libperl.$so.  If you will have more than one executable linked
8693 to libperl.$so, this will significantly reduce the size of each
8694 executable, but it may have a noticeable effect on performance.  The
8695 default is probably sensible for your system.
8696 $also
8697
8698 EOM
8699         rp="Build a shared libperl.$so (y/n)"
8700         . ./myread
8701         case "$ans" in
8702         true|$define|[Yy]*)
8703                 useshrplib='true'  ;;
8704         *)      useshrplib='false' ;;
8705         esac
8706         ;;
8707 esac
8708
8709 case "$useshrplib" in
8710 true)
8711         case "$userelocatableinc" in
8712         true|define)
8713                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8714                 echo "See INSTALL for an explanation why that won't work." >&4
8715                 exit 4
8716                 ;;
8717         esac
8718         case "$libperl" in
8719         '')
8720                 # Figure out a good name for libperl.so.  Since it gets stored in
8721                 # a version-specific architecture-dependent library, the version
8722                 # number isn't really that important, except for making cc/ld happy.
8723                 #
8724                 # A name such as libperl.so.10.1
8725                 majmin="libperl.$so.$patchlevel.$subversion"
8726                 # A name such as libperl.so.100
8727                 majonly=`echo $patchlevel $subversion |
8728                         $awk '{printf "%d%02d", $1, $2}'`
8729                 majonly=libperl.$so.$majonly
8730                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8731                 # rely on figuring it out from the naming of libc.
8732                 case "${osname}${osvers}" in
8733                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8734                         dflt=libperl.$so
8735                         ;;
8736                 cygwin*) # ld links now against the dll directly
8737                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8738                         majonly=`echo $patchlevel $subversion |
8739                                 $awk '{printf "%03d%03d", $1, $2}'`
8740                         majonly=cygperl5.$majonly.$so
8741                         dflt=$majmin
8742                         ;;
8743                 *)      # Try to guess based on whether libc has major.minor.
8744                         case "$libc" in
8745                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8746                         *libc.$so.[0-9]*) dflt=$majonly ;;
8747                         *)      dflt=libperl.$so ;;
8748                         esac
8749                         ;;
8750                 esac
8751                 ;;
8752         *)      dflt=$libperl
8753                 ;;
8754         esac
8755         cat << EOM
8756
8757 I need to select a good name for the shared libperl.  If your system uses
8758 library names with major and minor numbers, then you might want something
8759 like $majmin.  Alternatively, if your system uses a single version
8760 number for shared libraries, then you might want to use $majonly.
8761 Or, your system might be quite happy with a simple libperl.$so.
8762
8763 Since the shared libperl will get installed into a version-specific
8764 architecture-dependent directory, the version number of the shared perl
8765 library probably isn't important, so the default should be o.k.
8766
8767 EOM
8768         rp='What name do you want to give to the shared libperl?'
8769         . ./myread
8770         libperl=$ans
8771         echo "Ok, I'll use $libperl"
8772         ;;
8773 *)
8774         libperl="libperl${_a}"
8775         ;;
8776 esac
8777
8778 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8779 case "$shrpdir" in
8780 '') ;;
8781 *)      $cat >&4 <<EOM
8782 WARNING:  Use of the shrpdir variable for the installation location of
8783 the shared $libperl is not supported.  It was never documented and
8784 will not work in this version.  Let me (perlbug@perl.org)
8785 know of any problems this may cause.
8786
8787 EOM
8788         case "$shrpdir" in
8789         "$archlibexp/CORE")
8790                 $cat >&4 <<EOM
8791 But your current setting of $shrpdir is
8792 the default anyway, so it's harmless.
8793 EOM
8794                 ;;
8795         *)
8796                 $cat >&4 <<EOM
8797 Further, your current attempted setting of $shrpdir
8798 conflicts with the value of $archlibexp/CORE
8799 that installperl will use.
8800 EOM
8801                 ;;
8802         esac
8803         ;;
8804 esac
8805
8806 # How will the perl executable find the installed shared $libperl?
8807 # Add $xxx to ccdlflags.
8808 # If we can't figure out a command-line option, use $shrpenv to
8809 # set env LD_RUN_PATH.  The main perl makefile uses this.
8810 shrpdir=$archlibexp/CORE
8811 xxx=''
8812 tmp_shrpenv=''
8813 if "$useshrplib"; then
8814     case "$osname" in
8815         aix)
8816                 # We'll set it in Makefile.SH...
8817                 ;;
8818         solaris)
8819                 xxx="-R $shrpdir"
8820                 ;;
8821         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8822                 xxx="-Wl,-R$shrpdir"
8823                 ;;
8824         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8825                 xxx="-Wl,-rpath,$shrpdir"
8826                 ;;
8827         hpux*)
8828                 # hpux doesn't like the default, either.
8829                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8830                 ;;
8831         cygwin)
8832                 # cygwin needs only ldlibpth
8833                 ;;
8834         *)
8835                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8836                 ;;
8837         esac
8838         case "$xxx" in
8839         '') ;;
8840         *)
8841                 # Only add $xxx if it isn't already in ccdlflags.
8842                 case " $ccdlflags " in
8843                 *" $xxx "*)     ;;
8844                 *)      ccdlflags="$ccdlflags $xxx"
8845                         cat <<EOM >&4
8846
8847 Adding $xxx to the flags
8848 passed to $ld so that the perl executable will find the
8849 installed shared $libperl.
8850
8851 EOM
8852                         ;;
8853                 esac
8854                 ;;
8855         esac
8856 fi
8857 # Fix ccdlflags in AIX for building external extensions.
8858 # (For building Perl itself bare -bE:perl.exp is needed,
8859 #  Makefile.SH takes care of this.)
8860 case "$osname" in
8861 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8862 esac
8863 # Respect a hint or command-line value.
8864 case "$shrpenv" in
8865 '') shrpenv="$tmp_shrpenv" ;;
8866 esac
8867 case "$ldlibpthname" in
8868 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8869 none)   ldlibpthname='' ;;
8870 esac
8871
8872 : determine where manual pages are on this system
8873 echo " "
8874 case "$sysman" in
8875 '')
8876         syspath='/usr/share/man/man1 /usr/man/man1'
8877         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8878         syspath="$syspath /usr/man/u_man/man1"
8879         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8880         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8881         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8882         sysman=`./loc . /usr/man/man1 $syspath`
8883         ;;
8884 esac
8885 if $test -d "$sysman"; then
8886         echo "System manual is in $sysman." >&4
8887 else
8888         echo "Could not find manual pages in source form." >&4
8889 fi
8890
8891 : determine where manual pages go
8892 set man1dir man1dir none
8893 eval $prefixit
8894 $cat <<EOM
8895
8896 $spackage has manual pages available in source form.
8897 EOM
8898 case "$nroff" in
8899 nroff)
8900         echo "However, you don't have nroff, so they're probably useless to you."
8901         case "$man1dir" in
8902         '') man1dir="none";;
8903         esac;;
8904 esac
8905 echo "If you don't want the manual sources installed, answer 'none'."
8906 case "$man1dir" in
8907 ' ') dflt=none
8908         ;;
8909 '')
8910         lookpath="$prefixexp/share/man/man1"
8911         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8912         lookpath="$lookpath $prefixexp/man/p_man/man1"
8913         lookpath="$lookpath $prefixexp/man/u_man/man1"
8914         lookpath="$lookpath $prefixexp/man/man.1"
8915         case "$sysman" in
8916         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8917         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8918         esac
8919         set dflt
8920         eval $prefixup
8921         ;;
8922 *)  dflt="$man1dir"
8923         ;;
8924 esac
8925 echo " "
8926 fn=dn+~
8927 rp="Where do the main $spackage manual pages (source) go?"
8928 . ./getfile
8929 if $test "X$man1direxp" != "X$ansexp"; then
8930         installman1dir=''
8931 fi
8932 prefixvar=man1dir
8933 . ./setprefixvar
8934
8935 case "$man1dir" in
8936 '')     man1dir=' '
8937         installman1dir='';;
8938 esac
8939
8940 : What suffix to use on installed man pages
8941
8942 case "$man1dir" in
8943 ' ')
8944         man1ext='0'
8945         ;;
8946 *)
8947         rp="What suffix should be used for the main $spackage man pages?"
8948         case "$man1ext" in
8949         '')     case "$man1dir" in
8950                 *1)  dflt=1 ;;
8951                 *1p) dflt=1p ;;
8952                 *1pm) dflt=1pm ;;
8953                 *l) dflt=l;;
8954                 *n) dflt=n;;
8955                 *o) dflt=o;;
8956                 *p) dflt=p;;
8957                 *C) dflt=C;;
8958                 *L) dflt=L;;
8959                 *L1) dflt=L1;;
8960                 *) dflt=1;;
8961                 esac
8962                 ;;
8963         *)      dflt="$man1ext";;
8964         esac
8965         . ./myread
8966         man1ext="$ans"
8967         ;;
8968 esac
8969
8970 : see if we can have long filenames
8971 echo " "
8972 first=123456789abcdef
8973 $rm -f $first
8974 if (echo hi >$first) 2>/dev/null; then
8975         if $test -f 123456789abcde; then
8976                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8977                 val="$undef"
8978         else
8979                 echo 'You can have filenames longer than 14 characters.'>&4
8980                 val="$define"
8981         fi
8982 else
8983         $cat <<'EOM'
8984 You can't have filenames longer than 14 chars.
8985 You can't even think about them!
8986 EOM
8987         val="$undef"
8988 fi
8989 set d_flexfnam
8990 eval $setvar
8991 $rm -rf 123456789abcde*
8992
8993 : determine where library module manual pages go
8994 set man3dir man3dir none
8995 eval $prefixit
8996 $cat <<EOM
8997
8998 $spackage has manual pages for many of the library modules.
8999 EOM
9000
9001 case "$nroff" in
9002 nroff)
9003         $cat <<'EOM'
9004 However, you don't have nroff, so they're probably useless to you.
9005 EOM
9006         case "$man3dir" in
9007         '') man3dir="none";;
9008         esac;;
9009 esac
9010
9011 case "$d_flexfnam" in
9012 undef)
9013         $cat <<'EOM'
9014 However, your system can't handle the long file names like File::Basename.3.
9015 EOM
9016         case "$man3dir" in
9017         '') man3dir="none";;
9018         esac;;
9019 esac
9020
9021 echo "If you don't want the manual sources installed, answer 'none'."
9022 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9023 case "$man3dir" in
9024 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9025         if $test -d "$privlib/man/man3"; then
9026                 cat <<EOM >&4
9027
9028 WARNING:  Previous versions of perl installed man3 pages into
9029 $privlib/man/man3.  This version will suggest a
9030 new default of $dflt.
9031 EOM
9032                 tdflt=$dflt
9033                 dflt='n'
9034                 rp='Do you wish to preserve the old behavior?(y/n)'
9035                 . ./myread
9036                 case "$ans" in
9037                 y*) dflt="$privlib/man/man3" ;;
9038                 *)  dflt=$tdflt ;;
9039                 esac
9040     fi
9041         ;;
9042 *)      dflt="$man3dir" ;;
9043 esac
9044 case "$dflt" in
9045 ' ') dflt=none ;;
9046 esac
9047 echo " "
9048 fn=dn+~
9049 rp="Where do the $package library man pages (source) go?"
9050 . ./getfile
9051 prefixvar=man3dir
9052 . ./setprefixvar
9053
9054 case "$man3dir" in
9055 '')     man3dir=' '
9056         installman3dir='';;
9057 esac
9058
9059 : What suffix to use on installed man pages
9060 case "$man3dir" in
9061 ' ')
9062         man3ext='0'
9063         ;;
9064 *)
9065         rp="What suffix should be used for the $package library man pages?"
9066         case "$man3ext" in
9067         '')     case "$man3dir" in
9068                 *3)  dflt=3 ;;
9069                 *3p) dflt=3p ;;
9070                 *3pm) dflt=3pm ;;
9071                 *l) dflt=l;;
9072                 *n) dflt=n;;
9073                 *o) dflt=o;;
9074                 *p) dflt=p;;
9075                 *C) dflt=C;;
9076                 *L) dflt=L;;
9077                 *L3) dflt=L3;;
9078                 *) dflt=3;;
9079                 esac
9080                 ;;
9081         *)      dflt="$man3ext";;
9082         esac
9083         . ./myread
9084         man3ext="$ans"
9085         ;;
9086 esac
9087
9088 : see if we have to deal with yellow pages, now NIS.
9089 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9090         case "$hostcat" in
9091         nidump*) ;;
9092         *)
9093                 case "$hostcat" in
9094                 *ypcat*) dflt=y;;
9095                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9096                                 dflt=y
9097                         else
9098                                 dflt=n
9099                         fi;;
9100                 *) dflt=n;;
9101                 esac
9102                 echo " "
9103                 rp='Are you getting the hosts file via yellow pages?'
9104                 . ./myread
9105                 case "$ans" in
9106                 y*) hostcat='ypcat hosts';;
9107                 *) hostcat='cat /etc/hosts';;
9108                 esac
9109                 ;;
9110         esac
9111 fi
9112 case "$hostcat" in
9113 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9114 esac
9115 case "$groupcat" in
9116 '') test -f /etc/group && groupcat='cat /etc/group';;
9117 esac
9118 case "$passcat" in
9119 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9120 esac
9121
9122 : now get the host name
9123 echo " "
9124 echo "Figuring out host name..." >&4
9125 case "$myhostname" in
9126 '') cont=true
9127         echo 'Maybe "hostname" will work...'
9128         if tans=`sh -c hostname 2>&1` ; then
9129                 myhostname=$tans
9130                 phostname=hostname
9131                 cont=''
9132         fi
9133         ;;
9134 *) cont='';;
9135 esac
9136 if $test "$cont"; then
9137         if ./xenix; then
9138                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9139                 if tans=`cat /etc/systemid 2>&1` ; then
9140                         myhostname=$tans
9141                         phostname='cat /etc/systemid'
9142                         echo "Whadyaknow.  Xenix always was a bit strange..."
9143                         cont=''
9144                 fi
9145         elif $test -r /etc/systemid; then
9146                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9147         fi
9148 fi
9149 if $test "$cont"; then
9150         echo 'No, maybe "uuname -l" will work...'
9151         if tans=`sh -c 'uuname -l' 2>&1` ; then
9152                 myhostname=$tans
9153                 phostname='uuname -l'
9154         else
9155                 echo 'Strange.  Maybe "uname -n" will work...'
9156                 if tans=`sh -c 'uname -n' 2>&1` ; then
9157                         myhostname=$tans
9158                         phostname='uname -n'
9159                 else
9160                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9161                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9162                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9163                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9164                         else
9165                                 case "$myhostname" in
9166                                 '') echo "Does this machine have an identity crisis or something?"
9167                                         phostname='';;
9168                                 *)
9169                                         echo "Well, you said $myhostname before..."
9170                                         phostname='echo $myhostname';;
9171                                 esac
9172                         fi
9173                 fi
9174         fi
9175 fi
9176 case "$myhostname" in
9177 '') myhostname=noname ;;
9178 esac
9179 : you do not want to know about this
9180 set $myhostname
9181 myhostname=$1
9182
9183 : verify guess
9184 if $test "$myhostname" ; then
9185         dflt=y
9186         rp='Your host name appears to be "'$myhostname'".'" Right?"
9187         . ./myread
9188         case "$ans" in
9189         y*) ;;
9190         *) myhostname='';;
9191         esac
9192 fi
9193
9194 : bad guess or no guess
9195 while $test "X$myhostname" = X ; do
9196         dflt=''
9197         rp="Please type the (one word) name of your host:"
9198         . ./myread
9199         myhostname="$ans"
9200 done
9201
9202 : translate upper to lower if necessary
9203 case "$myhostname" in
9204 *[A-Z]*)
9205         echo "(Normalizing case in your host name)"
9206         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9207         ;;
9208 esac
9209
9210 case "$myhostname" in
9211 *.*)
9212         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9213         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9214         echo "(Trimming domain name from host name--host name is now $myhostname)"
9215         ;;
9216 *) case "$mydomain" in
9217         '')
9218                 {
9219                         test "X$hostcat" = "Xypcat hosts" &&
9220                         ypmatch "$myhostname" hosts 2>/dev/null |\
9221                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9222                         $test -s hosts
9223                 } || {
9224                         test "X$hostcat" != "X" &&
9225                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9226                                         /[       ]$myhostname[  . ]/p" > hosts
9227                 }
9228                 tmp_re="[       . ]"
9229                 if $test -f hosts; then
9230                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9231                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9232                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9233                                 hosts | $sort | $uniq | \
9234                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9235                         case `$echo X$dflt` in
9236                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9237                                 dflt=.
9238                                 ;;
9239                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9240                                 ;;
9241                         esac
9242                 else
9243                         echo "(I cannot locate a hosts database anywhere)"
9244                         dflt=.
9245                 fi
9246                 case "$dflt" in
9247                 .)
9248                         tans=`./loc resolv.conf X /etc /usr/etc`
9249                         if $test -f "$tans"; then
9250                                 echo "(Attempting domain name extraction from $tans)"
9251                                 dflt=.`$sed -n -e 's/   / /g' \
9252                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9253                                   -e 1q 2>/dev/null`
9254                                 case "$dflt" in
9255                                 .) dflt=.`$sed -n -e 's/        / /g' \
9256                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9257                                      -e 1q 2>/dev/null`
9258                                         ;;
9259                                 esac
9260                         fi
9261                         ;;
9262                 esac
9263                 case "$dflt" in
9264                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9265                         dflt=.`sh -c domainname 2>/dev/null`
9266                         case "$dflt" in
9267                         '') dflt='.';;
9268                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9269                         esac
9270                         ;;
9271                 esac
9272                 case "$dflt$osname" in
9273                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9274                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9275                         ;;
9276                 esac
9277                 case "$dflt" in
9278                 .) echo "(Lost all hope -- silly guess then)"
9279                         dflt='.nonet'
9280                         ;;
9281                 esac
9282                 $rm -f hosts
9283                 ;;
9284         *) dflt="$mydomain";;
9285         esac;;
9286 esac
9287 echo " "
9288 rp="What is your domain name?"
9289 . ./myread
9290 tans="$ans"
9291 case "$ans" in
9292 '') ;;
9293 .*) ;;
9294 *) tans=".$tans";;
9295 esac
9296 mydomain="$tans"
9297
9298 : translate upper to lower if necessary
9299 case "$mydomain" in
9300 *[A-Z]*)
9301         echo "(Normalizing case in your domain name)"
9302         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9303         ;;
9304 esac
9305
9306 : a little sanity check here
9307 case "$phostname" in
9308 '') ;;
9309 *)
9310         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9311         $myhostname$mydomain|$myhostname) ;;
9312         *)
9313                 case "$phostname" in
9314                 sed*)
9315                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9316                         ;;
9317                 *)
9318                         echo "(That doesn't agree with your $phostname command, by the way.)"
9319                         ;;
9320                 esac
9321         ;;
9322         esac
9323         ;;
9324 esac
9325
9326 : determine the e-mail address of the user who is running us
9327 $cat <<EOM
9328
9329 I need to get your e-mail address in Internet format if possible, i.e.
9330 something like user@host.domain. Please answer accurately since I have
9331 no easy means to double check it. The default value provided below
9332 is most probably close to reality but may not be valid from outside
9333 your organization...
9334
9335 EOM
9336 cont=x
9337 while test "$cont"; do
9338         case "$MAILDOMAIN" in
9339         '')
9340                 if $test -s /etc/mailname; then
9341                         maildomain=`$cat /etc/mailname`
9342                 else
9343                         maildomain="$myhostname$mydomain"
9344                 fi
9345                 ;;
9346         *)  maildomain="$MAILDOMAIN";;
9347         esac
9348         case "$cf_email" in
9349         '') dflt="$cf_by@$maildomain";;
9350         *)  dflt="$cf_email";;
9351         esac
9352         rp='What is your e-mail address?'
9353         . ./myread
9354         cf_email="$ans"
9355         case "$cf_email" in
9356         *@*.*) cont='' ;;
9357         *)
9358                 rp='Address does not look like an Internet one.  Use it anyway?'
9359                 case "$fastread" in
9360                 yes) dflt=y ;;
9361                 *) dflt=n ;;
9362                 esac
9363                 . ./myread
9364                 case "$ans" in
9365                 y*) cont='' ;;
9366                 *) echo " " ;;
9367                 esac
9368                 ;;
9369         esac
9370 done
9371
9372 : Ask e-mail of administrator
9373 $cat <<EOM
9374
9375 If you or somebody else will be maintaining perl at your site, please
9376 fill in the correct e-mail address here so that they may be contacted
9377 if necessary. Currently, the "perlbug" program included with perl
9378 will send mail to this address in addition to perlbug@perl.org. You may
9379 enter "none" for no administrator.
9380
9381 EOM
9382 case "$perladmin" in
9383 '') dflt="$cf_email";;
9384 *) dflt="$perladmin";;
9385 esac
9386 rp='Perl administrator e-mail address'
9387 . ./myread
9388 perladmin="$ans"
9389
9390 : determine whether to use a version number suffix for installed binaries
9391 echo " "
9392 $cat <<EOM
9393 Do you want to use a version number suffix for installed binaries? This
9394 will install 'perl$version' instead of 'perl', and likewise for other
9395 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9396 to be installed side-by-side. Unless you are a developer, you probably
9397 do *not* want to do this.
9398 EOM
9399 case "$versiononly" in
9400 "$define"|[Yy]*|true) dflt='y' ;;
9401 *) dflt='n';
9402 esac
9403 rp="Do you want to use a version number suffix for installed binaries?"
9404 . ./myread
9405 case "$ans" in
9406 [yY]*)  val="$define";;
9407 *)      val="$undef" ;;
9408 esac
9409 set versiononly
9410 eval $setvar
9411
9412 case "$versiononly" in
9413 "$define") inc_version_list=''
9414            inc_version_list_init=0
9415            ;;
9416 esac
9417
9418 : figure out how to guarantee perl startup
9419 : XXX Note that this currently takes advantage of the bug that binexp ignores
9420 :     the Configure -Dinstallprefix setting, which in turn means that under
9421 :     relocatable @INC, initialinstalllocation is what binexp started as.
9422 case "$startperl" in
9423 '')
9424         case "$sharpbang" in
9425         *!)
9426                 $cat <<EOH
9427
9428 I can use the #! construct to start perl on your system. This will
9429 make startup of perl scripts faster, but may cause problems if you
9430 want to share those scripts and perl is not in a standard place
9431 ($initialinstalllocation/perl) on all your platforms. The alternative
9432 is to force a shell by starting the script with a single ':' character.
9433
9434 EOH
9435                 case "$versiononly" in
9436                 "$define")      dflt="$initialinstalllocation/perl$version";;
9437                 *)              dflt="$initialinstalllocation/perl";;
9438                 esac
9439                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9440                 . ./myread
9441                 case "$ans" in
9442                 none)   startperl=": # use perl";;
9443                 *)      startperl="#!$ans"
9444                         if $test 30 -lt `echo "$ans" | wc -c`; then
9445                                 $cat >&4 <<EOM
9446
9447 WARNING:  Some systems limit the #! command to 32 characters.
9448 If you experience difficulty running Perl scripts with #!, try
9449 installing Perl in a directory with a shorter pathname.
9450
9451 EOM
9452                         fi ;;
9453                 esac
9454                 ;;
9455         *) startperl=": # use perl"
9456                 ;;
9457         esac
9458         ;;
9459 esac
9460 echo "I'll use $startperl to start perl scripts."
9461
9462 : figure best path for perl in scripts
9463 case "$perlpath" in
9464 '')
9465         case "$versiononly" in
9466         "$define")      perlpath="$initialinstalllocation/perl$version";;
9467         *)              perlpath="$initialinstalllocation/perl";;
9468         esac
9469         case "$startperl" in
9470         *!*) ;;
9471         *)
9472                 $cat <<EOH
9473
9474 I will use the "eval 'exec'" idiom to start Perl on your system.
9475 I can use the full path of your Perl binary for this purpose, but
9476 doing so may cause problems if you want to share those scripts and
9477 Perl is not always in a standard place ($initialinstalllocation/perl).
9478
9479 EOH
9480                 dflt="$initialinstalllocation/perl"
9481                 rp="What path shall I use in \"eval 'exec'\"?"
9482                 . ./myread
9483                 perlpath="$ans"
9484                 ;;
9485         esac
9486         ;;
9487 esac
9488 case "$startperl" in
9489 *!*)    ;;
9490 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9491 esac
9492
9493 : determine where public executable scripts go
9494 set scriptdir scriptdir
9495 eval $prefixit
9496 case "$scriptdir" in
9497 '')
9498         dflt="$bin"
9499         : guess some guesses
9500         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9501         $test -d /usr/share/bin     && dflt=/usr/share/bin
9502         $test -d /usr/local/script  && dflt=/usr/local/script
9503         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9504         $test -d $prefixexp/script  && dflt=$prefixexp/script
9505         set dflt
9506         eval $prefixup
9507         ;;
9508 *)  dflt="$scriptdir"
9509         ;;
9510 esac
9511 $cat <<EOM
9512
9513 Some installations have a separate directory just for executable scripts so
9514 that they can mount it across multiple architectures but keep the scripts in
9515 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9516 Or you might just lump your scripts in with all your other executables.
9517
9518 EOM
9519 fn=d~
9520 rp='Where do you keep publicly executable scripts?'
9521 . ./getfile
9522 if $test "X$ansexp" != "X$scriptdirexp"; then
9523         installscript=''
9524 fi
9525 installscriptdir=''
9526 prefixvar=scriptdir
9527 . ./setprefixvar
9528 : A little fix up for an irregularly named variable.
9529 installscript="$installscriptdir"
9530
9531 : determine where add-on public executables go
9532 case "$sitebin" in
9533 '')     dflt=$siteprefix/bin ;;
9534 *)      dflt=$sitebin ;;
9535 esac
9536 fn=d~
9537 rp='Pathname where the add-on public executables should be installed?'
9538 . ./getfile
9539 prefixvar=sitebin
9540 . ./setprefixvar
9541
9542 : determine where add-on html pages go
9543 : There is no standard location, so try to copy the previously-selected
9544 : directory structure for the core html pages.
9545 case "$sitehtml1dir" in
9546 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9547 *)     dflt=$sitehtml1dir ;;
9548 esac
9549 case "$dflt" in
9550 ''|' ') dflt=none ;;
9551 esac
9552 fn=dn+~
9553 rp='Pathname where the site-specific html pages should be installed?'
9554 . ./getfile
9555 prefixvar=sitehtml1dir
9556 . ./setprefixvar
9557
9558 : determine where add-on library html pages go
9559 : There is no standard location, so try to copy the previously-selected
9560 : directory structure for the core html pages.
9561 case "$sitehtml3dir" in
9562 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9563 *)     dflt=$sitehtml3dir ;;
9564 esac
9565 case "$dflt" in
9566 ''|' ') dflt=none ;;
9567 esac
9568 fn=dn+~
9569 rp='Pathname where the site-specific library html pages should be installed?'
9570 . ./getfile
9571 prefixvar=sitehtml3dir
9572 . ./setprefixvar
9573
9574 : determine where add-on manual pages go
9575 case "$siteman1dir" in
9576 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9577 *)      dflt=$siteman1dir ;;
9578 esac
9579 case "$dflt" in
9580 ''|' ') dflt=none ;;
9581 esac
9582 fn=dn+~
9583 rp='Pathname where the site-specific manual pages should be installed?'
9584 . ./getfile
9585 prefixvar=siteman1dir
9586 . ./setprefixvar
9587
9588 : determine where add-on library man pages go
9589 case "$siteman3dir" in
9590 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9591 *)      dflt=$siteman3dir ;;
9592 esac
9593 case "$dflt" in
9594 ''|' ') dflt=none ;;
9595 esac
9596 fn=dn+~
9597 rp='Pathname where the site-specific library manual pages should be installed?'
9598 . ./getfile
9599 prefixvar=siteman3dir
9600 . ./setprefixvar
9601
9602 : determine where add-on public executable scripts go
9603 case "$sitescript" in
9604 '')     dflt=$siteprefix/script
9605         $test -d $dflt || dflt=$sitebin ;;
9606 *)  dflt="$sitescript" ;;
9607 esac
9608 fn=d~+
9609 rp='Pathname where add-on public executable scripts should be installed?'
9610 . ./getfile
9611 prefixvar=sitescript
9612 . ./setprefixvar
9613
9614 : see if backtrace exists
9615 set backtrace d_backtrace
9616 eval $inlibc
9617
9618 : add flags if using c backtrace
9619 case "$usecbacktrace" in
9620   "") usecbacktrace=$undef ;;
9621   [yY]*|true|$define)
9622     case "$d_backtrace" in
9623       [yY]*|true|$define)
9624         case " $ccflags " in
9625           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9626           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9627           esac
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 : see if getpgrp exists
11257 set getpgrp d_getpgrp
11258 eval $inlibc
11259
11260 case "$d_getpgrp" in
11261 "$define")
11262         echo " "
11263         echo "Checking to see which flavor of getpgrp is in use..."
11264         $cat >try.c <<EOP
11265 #$i_unistd I_UNISTD
11266 #include <sys/types.h>
11267 #ifdef I_UNISTD
11268 #  include <unistd.h>
11269 #endif
11270 #$i_stdlib I_STDLIB
11271 #ifdef I_STDLIB
11272 #include <stdlib.h>
11273 #endif
11274 int main()
11275 {
11276         if (getuid() == 0) {
11277                 printf("(I see you are running Configure as super-user...)\n");
11278                 setuid(1);
11279         }
11280 #ifdef TRY_BSD_PGRP
11281         if (getpgrp(1) == 0)
11282                 exit(0);
11283 #else
11284         if (getpgrp() > 0)
11285                 exit(0);
11286 #endif
11287         exit(1);
11288 }
11289 EOP
11290         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11291                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11292                 val="$define"
11293         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11294                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11295                 val="$undef"
11296         else
11297                 echo "I can't seem to compile and run the test program."
11298                 if ./usg; then
11299                         xxx="a USG one, i.e. you use getpgrp()."
11300                 else
11301                         # SVR4 systems can appear rather BSD-ish.
11302                         case "$i_unistd" in
11303                         $undef)
11304                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11305                                 val="$define"
11306                                 ;;
11307                         $define)
11308                                 xxx="probably a USG one, i.e. you use getpgrp()."
11309                                 val="$undef"
11310                                 ;;
11311                         esac
11312                 fi
11313                 echo "Assuming your getpgrp is $xxx" >&4
11314         fi
11315         ;;
11316 *) val="$undef";;
11317 esac
11318 set d_bsdgetpgrp
11319 eval $setvar
11320 $rm_try
11321
11322 : see if setpgrp exists
11323 set setpgrp d_setpgrp
11324 eval $inlibc
11325
11326 case "$d_setpgrp" in
11327 "$define")
11328         echo " "
11329         echo "Checking to see which flavor of setpgrp is in use..."
11330         $cat >try.c <<EOP
11331 #$i_unistd I_UNISTD
11332 #include <sys/types.h>
11333 #ifdef I_UNISTD
11334 #  include <unistd.h>
11335 #endif
11336 #$i_stdlib I_STDLIB
11337 #ifdef I_STDLIB
11338 #include <stdlib.h>
11339 #endif
11340 int main()
11341 {
11342         if (getuid() == 0) {
11343                 printf("(I see you are running Configure as super-user...)\n");
11344                 setuid(1);
11345         }
11346 #ifdef TRY_BSD_PGRP
11347         if (-1 == setpgrp(1, 1))
11348                 exit(0);
11349 #else
11350         if (setpgrp() != -1)
11351                 exit(0);
11352 #endif
11353         exit(1);
11354 }
11355 EOP
11356         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11357                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11358                 val="$define"
11359         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11360                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11361                 val="$undef"
11362         else
11363                 echo "(I can't seem to compile and run the test program.)"
11364                 if ./usg; then
11365                         xxx="a USG one, i.e. you use setpgrp()."
11366                 else
11367                         # SVR4 systems can appear rather BSD-ish.
11368                         case "$i_unistd" in
11369                         $undef)
11370                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11371                                 val="$define"
11372                                 ;;
11373                         $define)
11374                                 xxx="probably a USG one, i.e. you use setpgrp()."
11375                                 val="$undef"
11376                                 ;;
11377                         esac
11378                 fi
11379                 echo "Assuming your setpgrp is $xxx" >&4
11380         fi
11381         ;;
11382 *) val="$undef";;
11383 esac
11384 set d_bsdsetpgrp
11385 eval $setvar
11386 $rm_try
11387
11388 : Look for GCC-style __builtin_add_overflow
11389 case "$d_builtin_add_overflow" in
11390 '')
11391     echo " "
11392     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11393     $cat >try.c <<'EOCP'
11394 int main(void) {
11395     const unsigned int uint_max = ~0u;
11396     int target_int = 0;
11397     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11398         return 1;
11399     }
11400     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11401         return 1;
11402     }
11403     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11404         return 1;
11405     }
11406     return 0;
11407 }
11408 EOCP
11409     set try
11410     if eval $compile && $run ./try; then
11411         echo "Your C compiler supports __builtin_add_overflow."
11412         val="$define"
11413     else
11414         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11415         val="$undef"
11416     fi
11417     ;;
11418 *) val="$d_builtin_add_overflow" ;;
11419 esac
11420
11421 set d_builtin_add_overflow
11422 eval $setvar
11423 $rm_try
11424
11425 : Look for GCC-style __builtin_sub_overflow
11426 case "$d_builtin_sub_overflow" in
11427 '')
11428     echo " "
11429     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11430     $cat >try.c <<'EOCP'
11431 int main(void) {
11432     const unsigned int uint_max = ~0u;
11433     int target_int = 0;
11434     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11435         return 1;
11436     }
11437     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11438         return 1;
11439     }
11440     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11441         return 1;
11442     }
11443     return 0;
11444 }
11445 EOCP
11446     set try
11447     if eval $compile && $run ./try; then
11448         echo "Your C compiler supports __builtin_sub_overflow."
11449         val="$define"
11450     else
11451         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11452         val="$undef"
11453     fi
11454     ;;
11455 *) val="$d_builtin_sub_overflow" ;;
11456 esac
11457
11458 set d_builtin_sub_overflow
11459 eval $setvar
11460 $rm_try
11461
11462 : Look for GCC-style __builtin_mul_overflow
11463 case "$d_builtin_mul_overflow" in
11464 '')
11465     echo " "
11466     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11467     $cat >try.c <<'EOCP'
11468 int main(void) {
11469     const unsigned int uint_max = ~0u;
11470     int target_int = 0;
11471     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11472         return 1;
11473     }
11474     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11475         return 1;
11476     }
11477     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11478         return 1;
11479     }
11480     return 0;
11481 }
11482 EOCP
11483     set try
11484     if eval $compile && $run ./try; then
11485         echo "Your C compiler supports __builtin_mul_overflow."
11486         val="$define"
11487     else
11488         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11489         val="$undef"
11490     fi
11491     ;;
11492 *) val="$d_builtin_mul_overflow" ;;
11493 esac
11494
11495 set d_builtin_mul_overflow
11496 eval $setvar
11497 $rm_try
11498
11499 : Look for GCC-style __builtin_choose_expr
11500 case "$d_builtin_choose_expr" in
11501 '')
11502     echo " "
11503     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11504     $cat >try.c <<'EOCP'
11505 #include <assert.h>
11506 #include <stdlib.h>
11507 #include <stdio.h>
11508
11509 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11510
11511 int main(void) {
11512     assert( SYRINX(1) == 2112 );
11513     assert( SYRINX(1) != 5150 );
11514     assert( SYRINX(0) == 5150 );
11515     assert( SYRINX(0) != 2112 );
11516     puts( "All good!" );
11517     exit(0);
11518 }
11519
11520 EOCP
11521     set try
11522     if eval $compile && $run ./try; then
11523         echo "Your C compiler supports __builtin_choose_expr."
11524         val="$define"
11525     else
11526         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11527         val="$undef"
11528     fi
11529 ;;
11530 *) val="$d_builtin_choose_expr" ;;
11531 esac
11532
11533 set d_builtin_choose_expr
11534 eval $setvar
11535 $rm_try
11536
11537 : Look for GCC-style __builtin_expect
11538 case "$d_builtin_expect" in
11539 '')
11540     echo " "
11541     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11542     $cat >try.c <<'EOCP'
11543 int main(void) {
11544     int n = 50;
11545     if ( __builtin_expect(n, 0) ) n = 1;
11546     /* Remember shell exit code truth is 0, C truth is non-zero */
11547     return !(n == 1);
11548 }
11549 EOCP
11550     set try
11551     if eval $compile && $run ./try; then
11552         echo "Your C compiler supports __builtin_expect."
11553         val="$define"
11554     else
11555         echo "Your C compiler doesn't seem to understand __builtin_expect."
11556         val="$undef"
11557     fi
11558     ;;
11559 *) val="$d_builtin_expect" ;;
11560 esac
11561
11562 set d_builtin_expect
11563 eval $setvar
11564 $rm_try
11565
11566 : see if the Compiler supports C99 variadic macros
11567 echo "Checking for C99 variadic macros." >&4
11568 $cat >try.c <<EOCP
11569 #include <stdio.h>
11570 #include <stdarg.h>
11571
11572 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11573
11574 int main() {
11575   char buf[20];
11576   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11577   puts(buf);
11578   return 0;
11579 }
11580 EOCP
11581 set try
11582 if eval $compile && $run ./try 2>&1 >/dev/null; then
11583     case "`$run ./try`" in
11584         "123 456 789")
11585         echo "You have C99 variadic macros." >&4
11586         d_c99_variadic_macros="$define"
11587         ;;
11588         *)
11589         echo "You don't have functional C99 variadic macros." >&4
11590         d_c99_variadic_macros="$undef"
11591         ;;
11592     esac
11593 else
11594     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11595     d_c99_variadic_macros="$undef"
11596 fi
11597 $rm_try
11598
11599 : see if signal is declared as pointer to function returning int or void
11600 echo " "
11601 xxx=`./findhdr signal.h`
11602 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11603 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11604         echo "You have int (*signal())() instead of void." >&4
11605         val="$undef"
11606 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11607         echo "You have void (*signal())()." >&4
11608         val="$define"
11609 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11610         echo "You have int (*signal())() instead of void." >&4
11611         val="$undef"
11612 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11613         echo "You have void (*signal())()." >&4
11614         val="$define"
11615 else
11616         case "$d_voidsig" in
11617         '')
11618         echo "I can't determine whether signal handler returns void or int..." >&4
11619                 dflt=void
11620                 rp="What type does your signal handler return?"
11621                 . ./myread
11622                 case "$ans" in
11623                 v*) val="$define";;
11624                 *) val="$undef";;
11625                 esac;;
11626         "$define")
11627                 echo "As you already told me, signal handler returns void." >&4
11628                 val="$define"
11629                 ;;
11630         *)      echo "As you already told me, signal handler returns int." >&4
11631                 val="$undef"
11632                 ;;
11633         esac
11634 fi
11635 set d_voidsig
11636 eval $setvar
11637 case "$d_voidsig" in
11638 "$define") signal_t="void";;
11639 *) signal_t="int";;
11640 esac
11641 $rm -f $$.tmp
11642
11643 : check for ability to cast large floats to 32-bit ints.
11644 echo " "
11645 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11646 if $test "$intsize" -ge 4; then
11647         xxx=int
11648 else
11649         xxx=long
11650 fi
11651 $cat >try.c <<EOCP
11652 #include <stdio.h>
11653 #$i_stdlib I_STDLIB
11654 #ifdef I_STDLIB
11655 #include <stdlib.h>
11656 #endif
11657 #include <sys/types.h>
11658 #include <signal.h>
11659 $signal_t blech(int s) { exit(3); }
11660 int main()
11661 {
11662         $xxx i32;
11663         double f, g;
11664         int result = 0;
11665         char str[16];
11666         signal(SIGFPE, blech);
11667
11668         /* Don't let compiler optimize the test away.  Store the number
11669            in a writable string for gcc to pass to sscanf under HP-UX.
11670         */
11671         sprintf(str, "2147483647");
11672         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11673         g = 10 * f;
11674         i32  = ($xxx) g;
11675
11676         /* x86 processors will probably give 0x8000 0000, which is a
11677            sign change.  We don't want that.  We want to mimic SPARC
11678            behavior here, which is to preserve the sign and give
11679            back 0x7fff ffff.
11680         */
11681         if (i32 != ($xxx) f)
11682                 result |= 1;
11683         exit(result);
11684 }
11685 EOCP
11686 set try
11687 if eval $compile_ok; then
11688         $run ./try 2>/dev/null
11689         yyy=$?
11690 else
11691         echo "(I can't seem to compile the test program--assuming it can't)"
11692         yyy=1
11693 fi
11694 case "$yyy" in
11695 0)      val="$define"
11696         echo "Yup, it can."
11697         ;;
11698 *)      val="$undef"
11699         echo "Nope, it can't."
11700         ;;
11701 esac
11702 set d_casti32
11703 eval $setvar
11704 $rm_try
11705
11706 : check for ability to cast negative floats to unsigned
11707 echo " "
11708 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11709 $cat >try.c <<EOCP
11710 #include <stdio.h>
11711 #$i_stdlib I_STDLIB
11712 #ifdef I_STDLIB
11713 #include <stdlib.h>
11714 #endif
11715 #include <sys/types.h>
11716 #include <signal.h>
11717 $signal_t blech(int s) { exit(7); }
11718 $signal_t blech_in_list(int s) { exit(4); }
11719 unsigned long dummy_long(unsigned long p) { return p; }
11720 unsigned int dummy_int(unsigned int p) { return p; }
11721 unsigned short dummy_short(unsigned short p) { return p; }
11722 int main()
11723 {
11724         double f;
11725         unsigned long along;
11726         unsigned int aint;
11727         unsigned short ashort;
11728         int result = 0;
11729         char str[16];
11730
11731         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11732            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11733            optimized the whole file away
11734         */
11735         /* Store the number in a writable string for gcc to pass to
11736            sscanf under HP-UX.
11737         */
11738         sprintf(str, "-123");
11739         sscanf(str, "%lf", &f);  /* f = -123.; */
11740
11741         signal(SIGFPE, blech);
11742         along = (unsigned long)f;
11743         aint = (unsigned int)f;
11744         ashort = (unsigned short)f;
11745         if (along != (unsigned long)-123)
11746                 result |= 1;
11747         if (aint != (unsigned int)-123)
11748                 result |= 1;
11749         if (ashort != (unsigned short)-123)
11750                 result |= 1;
11751         sprintf(str, "1073741824.");
11752         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11753         f = f + f;
11754         along = 0;
11755         along = (unsigned long)f;
11756         if (along != 0x80000000)
11757                 result |= 2;
11758         f -= 1.;
11759         along = 0;
11760         along = (unsigned long)f;
11761         if (along != 0x7fffffff)
11762                 result |= 1;
11763         f += 2.;
11764         along = 0;
11765         along = (unsigned long)f;
11766         if (along != 0x80000001)
11767                 result |= 2;
11768         if (result)
11769                 exit(result);
11770         signal(SIGFPE, blech_in_list);
11771         sprintf(str, "123.");
11772         sscanf(str, "%lf", &f);  /* f = 123.; */
11773         along = dummy_long((unsigned long)f);
11774         aint = dummy_int((unsigned int)f);
11775         ashort = dummy_short((unsigned short)f);
11776         if (along != (unsigned long)123)
11777                 result |= 4;
11778         if (aint != (unsigned int)123)
11779                 result |= 4;
11780         if (ashort != (unsigned short)123)
11781                 result |= 4;
11782         exit(result);
11783
11784 }
11785 EOCP
11786 set try
11787 if eval $compile_ok; then
11788         $run ./try 2>/dev/null
11789         castflags=$?
11790 else
11791         echo "(I can't seem to compile the test program--assuming it can't)"
11792         castflags=7
11793 fi
11794 case "$castflags" in
11795 0)      val="$define"
11796         echo "Yup, it can."
11797         ;;
11798 *)      val="$undef"
11799         echo "Nope, it can't."
11800         ;;
11801 esac
11802 set d_castneg
11803 eval $setvar
11804 $rm_try
11805
11806 : see if cbrt exists
11807 set cbrt d_cbrt
11808 eval $inlibc
11809
11810 : see if chown exists
11811 set chown d_chown
11812 eval $inlibc
11813
11814 : see if chroot exists
11815 set chroot d_chroot
11816 eval $inlibc
11817
11818 : see if chsize exists
11819 set chsize d_chsize
11820 eval $inlibc
11821
11822 : see if class exists
11823 set class d_class
11824 eval $inlibc
11825
11826 : see if clearenv exists
11827 set clearenv d_clearenv
11828 eval $inlibc
11829
11830 : Define hasstruct macro for Configure internal use
11831 hasstruct='varname=$1; struct=$2; shift; shift;
11832 while $test $# -ge 2; do
11833         case "$1" in
11834         $define) echo "#include <$2>";;
11835         esac ;
11836     shift 2;
11837 done > try.c;
11838 echo "int main () { struct $struct foo; }" >> try.c;
11839 set try;
11840 if eval $compile; then
11841         val="$define";
11842 else
11843         val="$undef";
11844 fi;
11845 set $varname;
11846 eval $setvar;
11847 $rm_try'
11848
11849 : see whether socket exists
11850 socketlib=''
11851 sockethdr=''
11852 echo " "
11853 $echo $n "Hmm... $c" >&4
11854 if set socket val -f d_socket; eval $csym; $val; then
11855     echo "Looks like you have Berkeley networking support." >&4
11856     d_socket="$define"
11857     if set setsockopt val -f; eval $csym; $val; then
11858         d_oldsock="$undef"
11859     else
11860         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11861         d_oldsock="$define"
11862     fi
11863 else
11864     if $contains socklib libc.list >/dev/null 2>&1; then
11865         echo "Looks like you have Berkeley networking support." >&4
11866         d_socket="$define"
11867         : we will have to assume that it supports the 4.2 BSD interface
11868         d_oldsock="$undef"
11869     else
11870         echo "You don't have Berkeley networking in libc$_a..." >&4
11871         if test "X$d_socket" = "X$define"; then
11872             echo "...but you seem to believe that you have sockets." >&4
11873         else
11874             for net in net socket
11875             do
11876                 if test -f $sysroot/usr/lib/lib$net$_a; then
11877                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11878                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11879                     if $contains socket libc.list >/dev/null 2>&1; then
11880                         d_socket="$define"
11881                         socketlib="-l$net"
11882                         case "$net" in
11883                         net)
11884                             echo "...but the Wollongong group seems to have hacked it in." >&4
11885                             sockethdr="-I$sysroot/usr/netinclude"
11886                             ;;
11887                         esac
11888                         echo "Found Berkeley sockets interface in lib$net." >&4
11889                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11890                             d_oldsock="$undef"
11891                         else
11892                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11893                             d_oldsock="$define"
11894                         fi
11895                         break
11896                     fi
11897                 fi
11898             done
11899             if test "X$d_socket" != "X$define"; then
11900                echo "or anywhere else I see." >&4
11901                d_socket="$undef"
11902                d_oldsock="$undef"
11903             fi
11904         fi
11905     fi
11906 fi
11907
11908 : see if socketpair exists
11909 set socketpair d_sockpair
11910 eval $inlibc
11911
11912
11913 echo " "
11914 echo "Checking the availability sa_len in the sock struct ..." >&4
11915 $cat >try.c <<EOF
11916 #include <sys/types.h>
11917 #include <sys/socket.h>
11918 int main() {
11919 struct sockaddr sa;
11920 return (sa.sa_len);
11921 }
11922 EOF
11923 val="$undef"
11924 set try; if eval $compile; then
11925     val="$define"
11926 fi
11927 set d_sockaddr_sa_len; eval $setvar
11928 $rm_try
11929
11930 echo " "
11931 echo "Checking the availability struct sockaddr_in6 ..." >&4
11932 $cat >try.c <<EOF
11933 #include <sys/types.h>
11934 #include <sys/socket.h>
11935 #include <netinet/in.h>
11936 int main() {
11937 struct sockaddr_in6 sin6;
11938 return (sin6.sin6_family);
11939 }
11940 EOF
11941 val="$undef"
11942 set try; if eval $compile; then
11943     val="$define"
11944 fi
11945 set d_sockaddr_in6; eval $setvar
11946 $rm_try
11947
11948 echo " "
11949 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11950 $cat >try.c <<EOF
11951 #include <sys/types.h>
11952 #include <sys/socket.h>
11953 #include <netinet/in.h>
11954 int main() {
11955 struct sockaddr_in6 sin6;
11956 return (sin6.sin6_scope_id);
11957 }
11958 EOF
11959 val="$undef"
11960 set try; if eval $compile; then
11961     val="$define"
11962 fi
11963 set d_sin6_scope_id; eval $setvar
11964 $rm_try
11965
11966 echo " "
11967 echo "Checking the availability struct ip_mreq ..." >&4
11968 $cat >try.c <<EOF
11969 #include <sys/types.h>
11970 #include <sys/socket.h>
11971 #include <netinet/in.h>
11972 int main() {
11973 struct ip_mreq mreq;
11974 return (mreq.imr_multiaddr.s_addr);
11975 }
11976 EOF
11977 val="$undef"
11978 set try; if eval $compile; then
11979        val="$define"
11980 fi
11981 set d_ip_mreq; eval $setvar
11982 $rm_try
11983
11984 echo " "
11985 echo "Checking the availability struct ip_mreq_source ..." >&4
11986 $cat >try.c <<EOF
11987 #include <sys/types.h>
11988 #include <sys/socket.h>
11989 #include <netinet/in.h>
11990 int main() {
11991 struct ip_mreq_source mreq;
11992 return (mreq.imr_multiaddr.s_addr);
11993 }
11994 EOF
11995 val="$undef"
11996 set try; if eval $compile; then
11997        val="$define"
11998 fi
11999 set d_ip_mreq_source; eval $setvar
12000 $rm_try
12001
12002 echo " "
12003 echo "Checking the availability struct ipv6_mreq ..." >&4
12004 $cat >try.c <<EOF
12005 #include <sys/types.h>
12006 #include <sys/socket.h>
12007 #include <netinet/in.h>
12008 int main() {
12009 struct ipv6_mreq mreq;
12010 return (mreq.ipv6mr_interface);
12011 }
12012 EOF
12013 val="$undef"
12014 set try; if eval $compile; then
12015     val="$define"
12016 fi
12017 set d_ipv6_mreq; eval $setvar
12018 $rm_try
12019
12020 echo " "
12021 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12022 $cat >try.c <<EOF
12023 #include <sys/types.h>
12024 #include <sys/socket.h>
12025 #include <netinet/in.h>
12026 int main() {
12027 struct ipv6_mreq_source mreq;
12028 return (mreq.imr_multiaddr.s_addr);
12029 }
12030 EOF
12031 val="$undef"
12032 set try; if eval $compile; then
12033        val="$define"
12034 fi
12035 set d_ipv6_mreq_source; eval $setvar
12036 $rm_try
12037
12038 echo " "
12039 echo "Checking the availability of certain socket constants..." >&4
12040 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12041     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12042     $cat >try.c <<EOF
12043 #include <sys/types.h>
12044 #include <sys/socket.h>
12045 int main() {
12046     int i = $ENUM;
12047 }
12048 EOF
12049     val="$undef"
12050     set try; if eval $compile; then
12051         val="$define"
12052     fi
12053     set d_${enum}; eval $setvar
12054     $rm_try
12055 done
12056
12057 : see if this is a sys/uio.h system
12058 set sys/uio.h i_sysuio
12059 eval $inhdr
12060
12061 : Check for cmsghdr support
12062 echo " "
12063 echo "Checking to see if your system supports struct cmsghdr..." >&4
12064 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12065 eval $hasstruct
12066 case "$d_cmsghdr_s" in
12067 "$define")      echo "Yes, it does."   ;;
12068 *)              echo "No, it doesn't." ;;
12069 esac
12070
12071 : see if copysign exists
12072 set copysign d_copysign
12073 eval $inlibc
12074
12075 : see if copysignl exists
12076 set copysignl d_copysignl
12077 eval $inlibc
12078
12079 : see if crypt exists
12080 echo " "
12081 set crypt d_crypt
12082 eval $inlibc
12083 case "$d_crypt" in
12084 $define) cryptlib='' ;;
12085 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12086                 echo 'crypt() found.' >&4
12087                 val="$define"
12088                 cryptlib=''
12089         else
12090                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12091                 if $test -z "$cryptlib"; then
12092                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12093                 else
12094                         cryptlib=-lcrypt
12095                 fi
12096                 if $test -z "$cryptlib"; then
12097                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12098                 else
12099                         cryptlib=-lcrypt
12100                 fi
12101                 if $test -z "$cryptlib"; then
12102                         cryptlib=`./loc libcrypt$_a "" $libpth`
12103                 else
12104                         cryptlib=-lcrypt
12105                 fi
12106                 if $test -z "$cryptlib"; then
12107                         echo 'crypt() NOT found.' >&4
12108                         val="$undef"
12109                 else
12110                         val="$define"
12111                 fi
12112         fi
12113         set d_crypt
12114         eval $setvar
12115         ;;
12116 esac
12117
12118 : see if this is a crypt.h system
12119 set crypt.h i_crypt
12120 eval $inhdr
12121
12122 : see if crypt_r exists
12123 set crypt_r d_crypt_r
12124 eval $inlibc
12125 case "$d_crypt_r" in
12126 "$define")
12127         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12128         case "$d_crypt_r_proto:$usethreads" in
12129         ":define")      d_crypt_r_proto=define
12130                 set d_crypt_r_proto crypt_r $hdrs
12131                 eval $hasproto ;;
12132         *)      ;;
12133         esac
12134         case "$d_crypt_r_proto" in
12135         define)
12136         case "$crypt_r_proto" in
12137         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12138         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12139         esac
12140         case "$crypt_r_proto" in
12141         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12142         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12143         esac
12144         case "$crypt_r_proto" in
12145         ''|0)   d_crypt_r=undef
12146                 crypt_r_proto=0
12147                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12148         * )     case "$crypt_r_proto" in
12149                 REENTRANT_PROTO*) ;;
12150                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12151                 esac
12152                 echo "Prototype: $try" ;;
12153         esac
12154         ;;
12155         *)      case "$usethreads" in
12156                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12157                 esac
12158                 d_crypt_r=undef
12159                 crypt_r_proto=0
12160                 ;;
12161         esac
12162         ;;
12163 *)      crypt_r_proto=0
12164         ;;
12165 esac
12166
12167 : get csh whereabouts
12168 case "$csh" in
12169 'csh') val="$undef" ;;
12170 *) val="$define" ;;
12171 esac
12172 set d_csh
12173 eval $setvar
12174 : Respect a hint or command line value for full_csh.
12175 case "$full_csh" in
12176 '') full_csh=$csh ;;
12177 esac
12178
12179 : see if ctermid exists
12180 set ctermid d_ctermid
12181 eval $inlibc
12182
12183 : see if ctermid_r exists
12184 set ctermid_r d_ctermid_r
12185 eval $inlibc
12186 case "$d_ctermid_r" in
12187 "$define")
12188         hdrs="$i_systypes sys/types.h define stdio.h "
12189         case "$d_ctermid_r_proto:$usethreads" in
12190         ":define")      d_ctermid_r_proto=define
12191                 set d_ctermid_r_proto ctermid_r $hdrs
12192                 eval $hasproto ;;
12193         *)      ;;
12194         esac
12195         case "$d_ctermid_r_proto" in
12196         define)
12197         case "$ctermid_r_proto" in
12198         ''|0) try='char* ctermid_r(char*);'
12199         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12200         esac
12201         case "$ctermid_r_proto" in
12202         ''|0)   d_ctermid_r=undef
12203                 ctermid_r_proto=0
12204                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12205         * )     case "$ctermid_r_proto" in
12206                 REENTRANT_PROTO*) ;;
12207                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12208                 esac
12209                 echo "Prototype: $try" ;;
12210         esac
12211         ;;
12212         *)      case "$usethreads" in
12213                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12214                 esac
12215                 d_ctermid_r=undef
12216                 ctermid_r_proto=0
12217                 ;;
12218         esac
12219         ;;
12220 *)      ctermid_r_proto=0
12221         ;;
12222 esac
12223
12224 : see if ctime_r exists
12225 set ctime_r d_ctime_r
12226 eval $inlibc
12227 case "$d_ctime_r" in
12228 "$define")
12229         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12230         case "$d_ctime_r_proto:$usethreads" in
12231         ":define")      d_ctime_r_proto=define
12232                 set d_ctime_r_proto ctime_r $hdrs
12233                 eval $hasproto ;;
12234         *)      ;;
12235         esac
12236         case "$d_ctime_r_proto" in
12237         define)
12238         case "$ctime_r_proto" in
12239         ''|0) try='char* ctime_r(const time_t*, char*);'
12240         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12241         esac
12242         case "$ctime_r_proto" in
12243         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12244         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12245         esac
12246         case "$ctime_r_proto" in
12247         ''|0) try='int ctime_r(const time_t*, char*);'
12248         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12249         esac
12250         case "$ctime_r_proto" in
12251         ''|0) try='int ctime_r(const time_t*, char*, int);'
12252         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12253         esac
12254         case "$ctime_r_proto" in
12255         ''|0)   d_ctime_r=undef
12256                 ctime_r_proto=0
12257                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12258         * )     case "$ctime_r_proto" in
12259                 REENTRANT_PROTO*) ;;
12260                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12261                 esac
12262                 echo "Prototype: $try" ;;
12263         esac
12264         ;;
12265         *)      case "$usethreads" in
12266                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12267                 esac
12268                 d_ctime_r=undef
12269                 ctime_r_proto=0
12270                 ;;
12271         esac
12272         ;;
12273 *)      ctime_r_proto=0
12274         ;;
12275 esac
12276
12277 : see if cuserid exists
12278 set cuserid d_cuserid
12279 eval $inlibc
12280
12281 : see if dbm.h is available
12282 : see if dbmclose exists
12283 set dbmclose d_dbmclose
12284 eval $inlibc
12285
12286 case "$d_dbmclose" in
12287 $define)
12288         set dbm.h i_dbm
12289         eval $inhdr
12290         case "$i_dbm" in
12291         $define)
12292                 val="$undef"
12293                 set i_rpcsvcdbm
12294                 eval $setvar
12295                 ;;
12296         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12297                 eval $inhdr
12298                 ;;
12299         esac
12300         ;;
12301 *)      echo "We won't be including <dbm.h>"
12302         val="$undef"
12303         set i_dbm
12304         eval $setvar
12305         val="$undef"
12306         set i_rpcsvcdbm
12307         eval $setvar
12308         ;;
12309 esac
12310
12311 : see if prototype for dbminit is available
12312 echo " "
12313 set d_dbminitproto dbminit $i_dbm dbm.h
12314 eval $hasproto
12315
12316 : see if difftime exists
12317 set difftime d_difftime
12318 eval $inlibc
12319
12320 : see if this is a dirent system
12321 echo " "
12322 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12323         val="$define"
12324         echo "<dirent.h> found." >&4
12325 else
12326         val="$undef"
12327         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12328                 echo "<sys/dir.h> found." >&4
12329                 echo " "
12330         else
12331                 xinc=`./findhdr sys/ndir.h`
12332         fi
12333         echo "<dirent.h> NOT found." >&4
12334 fi
12335 set i_dirent
12336 eval $setvar
12337
12338 : Look for type of directory structure.
12339 echo " "
12340 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12341
12342 case "$direntrytype" in
12343 ''|' ')
12344         case "$i_dirent" in
12345         $define) guess1='struct dirent' ;;
12346         *) guess1='struct direct'  ;;
12347         esac
12348         ;;
12349 *)      guess1="$direntrytype"
12350         ;;
12351 esac
12352
12353 case "$guess1" in
12354 'struct dirent') guess2='struct direct' ;;
12355 *) guess2='struct dirent' ;;
12356 esac
12357
12358 if $contains "$guess1" try.c >/dev/null 2>&1; then
12359         direntrytype="$guess1"
12360         echo "Your directory entries are $direntrytype." >&4
12361 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12362         direntrytype="$guess2"
12363         echo "Your directory entries seem to be $direntrytype." >&4
12364 else
12365         echo "I don't recognize your system's directory entries." >&4
12366         rp="What type is used for directory entries on this system?"
12367         dflt="$guess1"
12368         . ./myread
12369         direntrytype="$ans"
12370 fi
12371 $rm_try
12372
12373 : see if the directory entry stores field length
12374 echo " "
12375 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12376 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12377         echo "Good, your directory entry keeps length information in d_namlen." >&4
12378         val="$define"
12379 else
12380         echo "Your directory entry does not know about the d_namlen field." >&4
12381         val="$undef"
12382 fi
12383 set d_dirnamlen
12384 eval $setvar
12385 $rm_try
12386
12387 : Look for DIR.dd_fd
12388 case "$i_dirent" in
12389 "$define")
12390     echo "Checking to see if DIR has a dd_fd member variable" >&4
12391     $cat >try.c <<EOCP
12392 #$i_stdlib I_STDLIB
12393 #ifdef I_STDLIB
12394 #include <stdlib.h>
12395 #endif
12396 #include <dirent.h>
12397
12398 int main() {
12399     DIR dir;
12400     dir.dd_fd = 1;
12401     return 0;
12402 }
12403 EOCP
12404     val=$undef
12405     set try
12406     if eval $compile; then
12407         echo "Yes, it does."
12408         val="$define"
12409     else
12410         echo "No, it does not."
12411         val="$undef"
12412     fi
12413     ;;
12414 *)
12415     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12416     val="$undef"
12417     ;;
12418 esac
12419 set d_dir_dd_fd
12420 eval $setvar
12421 $rm_try
12422
12423 : see if this is an sysdir system
12424 set sys/dir.h i_sysdir
12425 eval $inhdr
12426
12427 : see if this is an sysndir system
12428 set sys/ndir.h i_sysndir
12429 eval $inhdr
12430
12431 : Look for dirfd
12432 echo " "
12433 $cat >dirfd.c <<EOM
12434 #include <stdio.h>
12435 #$i_stdlib I_STDLIB
12436 #ifdef I_STDLIB
12437 #include <stdlib.h>
12438 #endif
12439 #$i_dirent I_DIRENT             /**/
12440 #$i_sysdir I_SYS_DIR            /**/
12441 #$i_sysndir I_SYS_NDIR          /**/
12442 #$i_systypes I_SYS_TYPES        /**/
12443 #if defined(I_SYS_TYPES)
12444 #include <sys/types.h>
12445 #endif
12446 #if defined(I_DIRENT)
12447 #include <dirent.h>
12448 #else
12449 #ifdef I_SYS_NDIR
12450 #include <sys/ndir.h>
12451 #else
12452 #ifdef I_SYS_DIR
12453 #include <sys/dir.h>
12454 #endif
12455 #endif
12456 #endif
12457 int main() {
12458         DIR *dirp = opendir(".");
12459         if (dirfd(dirp) >= 0)
12460                 exit(0);
12461         else
12462                 exit(1);
12463 }
12464 EOM
12465 val=$undef
12466 set dirfd
12467 if eval $compile; then
12468         val="$define"
12469 fi
12470 case "$val" in
12471 $define)        echo "dirfd() found." >&4       ;;
12472 *)              echo "dirfd() NOT found." >&4   ;;
12473 esac
12474 set d_dirfd
12475 eval $setvar
12476 $rm -f dirfd*
12477
12478 : see if dladdr exists
12479 set dladdr d_dladdr
12480 eval $inlibc
12481
12482 : see if dlerror exists
12483 xxx_runnm="$runnm"
12484 runnm=false
12485 set dlerror d_dlerror
12486 eval $inlibc
12487 runnm="$xxx_runnm"
12488
12489 : see if dlfcn is available
12490 set dlfcn.h i_dlfcn
12491 eval $inhdr
12492
12493 : Check what extension to use for shared libs
12494 case "$usedl" in
12495 $define|y|true)
12496         $cat << EOM
12497
12498 On a few systems, the dynamically loaded modules that perl generates and uses
12499 will need a different extension than shared libs. The default will probably
12500 be appropriate.
12501
12502 EOM
12503         case "$dlext" in
12504         '')     dflt="$so" ;;
12505         *)      dflt="$dlext" ;;
12506         esac
12507         rp='What is the extension of dynamically loaded modules'
12508         . ./myread
12509         dlext="$ans"
12510         ;;
12511 *)
12512         dlext="none"
12513         ;;
12514 esac
12515
12516 : Check if dlsym need a leading underscore
12517 echo " "
12518 val="$undef"
12519
12520 case "$dlsrc" in
12521 dl_dlopen.xs)
12522         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12523         $cat >dyna.c <<'EOM'
12524 fred () { }
12525 EOM
12526
12527 $cat >fred.c<<EOM
12528
12529 #include <stdio.h>
12530 #$i_stdlib I_STDLIB
12531 #ifdef I_STDLIB
12532 #include <stdlib.h>
12533 #endif
12534 #$i_dlfcn I_DLFCN
12535 #ifdef I_DLFCN
12536 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12537 #else
12538 #include <sys/types.h>
12539 #include <nlist.h>
12540 #include <link.h>
12541 #endif
12542
12543 extern int fred() ;
12544
12545 int main()
12546 {
12547     void * handle ;
12548     void * symbol ;
12549 #ifndef RTLD_LAZY
12550     int mode = 1 ;
12551 #else
12552     int mode = RTLD_LAZY ;
12553 #endif
12554     handle = dlopen("./dyna.$dlext", mode) ;
12555     if (handle == NULL) {
12556         printf ("1\n") ;
12557         fflush (stdout) ;
12558         exit(0);
12559     }
12560     symbol = dlsym(handle, "fred") ;
12561     if (symbol == NULL) {
12562         /* try putting a leading underscore */
12563         symbol = dlsym(handle, "_fred") ;
12564         if (symbol == NULL) {
12565             printf ("2\n") ;
12566             fflush (stdout) ;
12567             exit(0);
12568         }
12569         printf ("3\n") ;
12570     }
12571     else
12572         printf ("4\n") ;
12573     fflush (stdout) ;
12574     exit(0);
12575 }
12576 EOM
12577         : Call the object file tmp-dyna.o in case dlext=o.
12578         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12579                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12580                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12581                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12582                 xxx=`$run ./fred`
12583                 case $xxx in
12584                 1)      echo "Test program failed using dlopen." >&4
12585                         echo "Perhaps you should not use dynamic loading." >&4;;
12586                 2)      echo "Test program failed using dlsym." >&4
12587                         echo "Perhaps you should not use dynamic loading." >&4;;
12588                 3)      echo "dlsym needs a leading underscore" >&4
12589                         val="$define" ;;
12590                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12591                 esac
12592         else
12593                 echo "I can't compile and run the test program." >&4
12594                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12595         fi
12596         ;;
12597 esac
12598
12599 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12600
12601 set d_dlsymun
12602 eval $setvar
12603
12604 : see if drand48_r exists
12605 set drand48_r d_drand48_r
12606 eval $inlibc
12607 case "$d_drand48_r" in
12608 "$define")
12609         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12610         case "$d_drand48_r_proto:$usethreads" in
12611         ":define")      d_drand48_r_proto=define
12612                 set d_drand48_r_proto drand48_r $hdrs
12613                 eval $hasproto ;;
12614         *)      ;;
12615         esac
12616         case "$d_drand48_r_proto" in
12617         define)
12618         case "$drand48_r_proto" in
12619         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12620         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12621         esac
12622         case "$drand48_r_proto" in
12623         ''|0)   d_drand48_r=undef
12624                 drand48_r_proto=0
12625                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12626         * )     case "$drand48_r_proto" in
12627                 REENTRANT_PROTO*) ;;
12628                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12629                 esac
12630                 echo "Prototype: $try" ;;
12631         esac
12632         ;;
12633         *)      case "$usethreads" in
12634                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12635                 esac
12636                 d_drand48_r=undef
12637                 drand48_r_proto=0
12638                 ;;
12639         esac
12640         ;;
12641 *)      drand48_r_proto=0
12642         ;;
12643 esac
12644
12645 : see if prototype for drand48 is available
12646 echo " "
12647 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12648 eval $hasproto
12649
12650 : see if dup2 exists
12651 set dup2 d_dup2
12652 eval $inlibc
12653
12654 : see if dup3 exists
12655 set dup3 d_dup3
12656 eval $inlibc
12657
12658 : see if this is an xlocale.h system
12659 set xlocale.h i_xlocale
12660 eval $inhdr
12661
12662 : see if newlocale exists
12663 set newlocale d_newlocale
12664 eval $inlibc
12665
12666 : see if freelocale exists
12667 set freelocale d_freelocale
12668 eval $inlibc
12669
12670 : see if uselocale exists
12671 set uselocale d_uselocale
12672 eval $inlibc
12673
12674 : see if duplocale exists
12675 set duplocale d_duplocale
12676 eval $inlibc
12677
12678 : see if querylocale exists
12679 set querylocale d_querylocale
12680 eval $inlibc
12681
12682 : see if eaccess exists
12683 set eaccess d_eaccess
12684 eval $inlibc
12685
12686 : see if endgrent exists
12687 set endgrent d_endgrent
12688 eval $inlibc
12689
12690 : see if this is an grp system
12691 set grp.h i_grp
12692 eval $inhdr
12693
12694 case "$i_grp" in
12695 $define)
12696         xxx=`./findhdr grp.h`
12697         $cppstdin $cppflags $cppminus < $xxx >$$.h
12698
12699         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12700                 val="$define"
12701         else
12702                 val="$undef"
12703         fi
12704         set d_grpasswd
12705         eval $setvar
12706
12707         $rm -f $$.h
12708         ;;
12709 *)
12710         val="$undef";
12711         set d_grpasswd; eval $setvar
12712         ;;
12713 esac
12714
12715 : see if endgrent_r exists
12716 set endgrent_r d_endgrent_r
12717 eval $inlibc
12718 case "$d_endgrent_r" in
12719 "$define")
12720         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12721         case "$d_endgrent_r_proto:$usethreads" in
12722         ":define")      d_endgrent_r_proto=define
12723                 set d_endgrent_r_proto endgrent_r $hdrs
12724                 eval $hasproto ;;
12725         *)      ;;
12726         esac
12727         case "$d_endgrent_r_proto" in
12728         define)
12729         case "$endgrent_r_proto" in
12730         ''|0) try='int endgrent_r(FILE**);'
12731         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12732         esac
12733         case "$endgrent_r_proto" in
12734         ''|0) try='void endgrent_r(FILE**);'
12735         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12736         esac
12737         case "$endgrent_r_proto" in
12738         ''|0)   d_endgrent_r=undef
12739                 endgrent_r_proto=0
12740                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12741         * )     case "$endgrent_r_proto" in
12742                 REENTRANT_PROTO*) ;;
12743                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12744                 esac
12745                 echo "Prototype: $try" ;;
12746         esac
12747         ;;
12748         *)      case "$usethreads" in
12749                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12750                 esac
12751                 d_endgrent_r=undef
12752                 endgrent_r_proto=0
12753                 ;;
12754         esac
12755         ;;
12756 *)      endgrent_r_proto=0
12757         ;;
12758 esac
12759
12760 : see if endhostent exists
12761 set endhostent d_endhent
12762 eval $inlibc
12763
12764 : see if this is a netdb.h system
12765 set netdb.h i_netdb
12766 eval $inhdr
12767
12768 : see if endhostent_r exists
12769 set endhostent_r d_endhostent_r
12770 eval $inlibc
12771 case "$d_endhostent_r" in
12772 "$define")
12773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12774         case "$d_endhostent_r_proto:$usethreads" in
12775         ":define")      d_endhostent_r_proto=define
12776                 set d_endhostent_r_proto endhostent_r $hdrs
12777                 eval $hasproto ;;
12778         *)      ;;
12779         esac
12780         case "$d_endhostent_r_proto" in
12781         define)
12782         case "$endhostent_r_proto" in
12783         ''|0) try='int endhostent_r(struct hostent_data*);'
12784         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12785         esac
12786         case "$endhostent_r_proto" in
12787         ''|0) try='void endhostent_r(struct hostent_data*);'
12788         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12789         esac
12790         case "$endhostent_r_proto" in
12791         ''|0)   d_endhostent_r=undef
12792                 endhostent_r_proto=0
12793                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12794         * )     case "$endhostent_r_proto" in
12795                 REENTRANT_PROTO*) ;;
12796                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12797                 esac
12798                 echo "Prototype: $try" ;;
12799         esac
12800         ;;
12801         *)      case "$usethreads" in
12802                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12803                 esac
12804                 d_endhostent_r=undef
12805                 endhostent_r_proto=0
12806                 ;;
12807         esac
12808         ;;
12809 *)      endhostent_r_proto=0
12810         ;;
12811 esac
12812
12813 : see if endnetent exists
12814 set endnetent d_endnent
12815 eval $inlibc
12816
12817 : see if endnetent_r exists
12818 set endnetent_r d_endnetent_r
12819 eval $inlibc
12820 case "$d_endnetent_r" in
12821 "$define")
12822         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12823         case "$d_endnetent_r_proto:$usethreads" in
12824         ":define")      d_endnetent_r_proto=define
12825                 set d_endnetent_r_proto endnetent_r $hdrs
12826                 eval $hasproto ;;
12827         *)      ;;
12828         esac
12829         case "$d_endnetent_r_proto" in
12830         define)
12831         case "$endnetent_r_proto" in
12832         ''|0) try='int endnetent_r(struct netent_data*);'
12833         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12834         esac
12835         case "$endnetent_r_proto" in
12836         ''|0) try='void endnetent_r(struct netent_data*);'
12837         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12838         esac
12839         case "$endnetent_r_proto" in
12840         ''|0)   d_endnetent_r=undef
12841                 endnetent_r_proto=0
12842                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12843         * )     case "$endnetent_r_proto" in
12844                 REENTRANT_PROTO*) ;;
12845                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12846                 esac
12847                 echo "Prototype: $try" ;;
12848         esac
12849         ;;
12850         *)      case "$usethreads" in
12851                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12852                 esac
12853                 d_endnetent_r=undef
12854                 endnetent_r_proto=0
12855                 ;;
12856         esac
12857         ;;
12858 *)      endnetent_r_proto=0
12859         ;;
12860 esac
12861
12862 : see if endprotoent exists
12863 set endprotoent d_endpent
12864 eval $inlibc
12865
12866 : see if endprotoent_r exists
12867 set endprotoent_r d_endprotoent_r
12868 eval $inlibc
12869 case "$d_endprotoent_r" in
12870 "$define")
12871         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12872         case "$d_endprotoent_r_proto:$usethreads" in
12873         ":define")      d_endprotoent_r_proto=define
12874                 set d_endprotoent_r_proto endprotoent_r $hdrs
12875                 eval $hasproto ;;
12876         *)      ;;
12877         esac
12878         case "$d_endprotoent_r_proto" in
12879         define)
12880         case "$endprotoent_r_proto" in
12881         ''|0) try='int endprotoent_r(struct protoent_data*);'
12882         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12883         esac
12884         case "$endprotoent_r_proto" in
12885         ''|0) try='void endprotoent_r(struct protoent_data*);'
12886         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12887         esac
12888         case "$endprotoent_r_proto" in
12889         ''|0)   d_endprotoent_r=undef
12890                 endprotoent_r_proto=0
12891                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12892         * )     case "$endprotoent_r_proto" in
12893                 REENTRANT_PROTO*) ;;
12894                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12895                 esac
12896                 echo "Prototype: $try" ;;
12897         esac
12898         ;;
12899         *)      case "$usethreads" in
12900                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12901                 esac
12902                 d_endprotoent_r=undef
12903                 endprotoent_r_proto=0
12904                 ;;
12905         esac
12906         ;;
12907 *)      endprotoent_r_proto=0
12908         ;;
12909 esac
12910
12911 : see if endpwent exists
12912 set endpwent d_endpwent
12913 eval $inlibc
12914
12915 : see if this is a pwd.h system
12916 set pwd.h i_pwd
12917 eval $inhdr
12918
12919 case "$i_pwd" in
12920 $define)
12921         xxx=`./findhdr pwd.h`
12922         $cppstdin $cppflags $cppminus < $xxx >$$.h
12923
12924         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12925                 val="$define"
12926         else
12927                 val="$undef"
12928         fi
12929         set d_pwquota
12930         eval $setvar
12931
12932         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12933                 val="$define"
12934         else
12935                 val="$undef"
12936         fi
12937         set d_pwage
12938         eval $setvar
12939
12940         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12941                 val="$define"
12942         else
12943                 val="$undef"
12944         fi
12945         set d_pwchange
12946         eval $setvar
12947
12948         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12949                 val="$define"
12950         else
12951                 val="$undef"
12952         fi
12953         set d_pwclass
12954         eval $setvar
12955
12956         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12957                 val="$define"
12958         else
12959                 val="$undef"
12960         fi
12961         set d_pwexpire
12962         eval $setvar
12963
12964         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12965                 val="$define"
12966         else
12967                 val="$undef"
12968         fi
12969         set d_pwcomment
12970         eval $setvar
12971
12972         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12973                 val="$define"
12974         else
12975                 val="$undef"
12976         fi
12977         set d_pwgecos
12978         eval $setvar
12979
12980         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12981                 val="$define"
12982         else
12983                 val="$undef"
12984         fi
12985         set d_pwpasswd
12986         eval $setvar
12987
12988         $rm -f $$.h
12989         ;;
12990 *)
12991         val="$undef";
12992         set d_pwquota; eval $setvar
12993         set d_pwage; eval $setvar
12994         set d_pwchange; eval $setvar
12995         set d_pwclass; eval $setvar
12996         set d_pwexpire; eval $setvar
12997         set d_pwcomment; eval $setvar
12998         set d_pwgecos; eval $setvar
12999         set d_pwpasswd; eval $setvar
13000         ;;
13001 esac
13002
13003 : see if endpwent_r exists
13004 set endpwent_r d_endpwent_r
13005 eval $inlibc
13006 case "$d_endpwent_r" in
13007 "$define")
13008         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13009         case "$d_endpwent_r_proto:$usethreads" in
13010         ":define")      d_endpwent_r_proto=define
13011                 set d_endpwent_r_proto endpwent_r $hdrs
13012                 eval $hasproto ;;
13013         *)      ;;
13014         esac
13015         case "$d_endpwent_r_proto" in
13016         define)
13017         case "$endpwent_r_proto" in
13018         ''|0) try='int endpwent_r(FILE**);'
13019         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13020         esac
13021         case "$endpwent_r_proto" in
13022         ''|0) try='void endpwent_r(FILE**);'
13023         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13024         esac
13025         case "$endpwent_r_proto" in
13026         ''|0)   d_endpwent_r=undef
13027                 endpwent_r_proto=0
13028                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13029         * )     case "$endpwent_r_proto" in
13030                 REENTRANT_PROTO*) ;;
13031                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13032                 esac
13033                 echo "Prototype: $try" ;;
13034         esac
13035         ;;
13036         *)      case "$usethreads" in
13037                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13038                 esac
13039                 d_endpwent_r=undef
13040                 endpwent_r_proto=0
13041                 ;;
13042         esac
13043         ;;
13044 *)      endpwent_r_proto=0
13045         ;;
13046 esac
13047
13048 : see if endservent exists
13049 set endservent d_endsent
13050 eval $inlibc
13051
13052 : see if endservent_r exists
13053 set endservent_r d_endservent_r
13054 eval $inlibc
13055 case "$d_endservent_r" in
13056 "$define")
13057         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13058         case "$d_endservent_r_proto:$usethreads" in
13059         ":define")      d_endservent_r_proto=define
13060                 set d_endservent_r_proto endservent_r $hdrs
13061                 eval $hasproto ;;
13062         *)      ;;
13063         esac
13064         case "$d_endservent_r_proto" in
13065         define)
13066         case "$endservent_r_proto" in
13067         ''|0) try='int endservent_r(struct servent_data*);'
13068         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13069         esac
13070         case "$endservent_r_proto" in
13071         ''|0) try='void endservent_r(struct servent_data*);'
13072         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13073         esac
13074         case "$endservent_r_proto" in
13075         ''|0)   d_endservent_r=undef
13076                 endservent_r_proto=0
13077                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13078         * )     case "$endservent_r_proto" in
13079                 REENTRANT_PROTO*) ;;
13080                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13081                 esac
13082                 echo "Prototype: $try" ;;
13083         esac
13084         ;;
13085         *)      case "$usethreads" in
13086                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13087                 esac
13088                 d_endservent_r=undef
13089                 endservent_r_proto=0
13090                 ;;
13091         esac
13092         ;;
13093 *)      endservent_r_proto=0
13094         ;;
13095 esac
13096
13097 : Locate the flags for 'open()'
13098 echo " "
13099 $cat >try.c <<EOCP
13100 #include <sys/types.h>
13101 #ifdef I_FCNTL
13102 #include <fcntl.h>
13103 #endif
13104 #ifdef I_SYS_FILE
13105 #include <sys/file.h>
13106 #endif
13107 #$i_stdlib I_STDLIB
13108 #ifdef I_STDLIB
13109 #include <stdlib.h>
13110 #endif
13111 int main() {
13112         if(O_RDONLY);
13113 #ifdef O_TRUNC
13114         exit(0);
13115 #else
13116         exit(1);
13117 #endif
13118 }
13119 EOCP
13120 : check sys/file.h first to get FREAD on Sun
13121 if $test `./findhdr sys/file.h` && \
13122                 set try -DI_SYS_FILE && eval $compile; then
13123         h_sysfile=true;
13124         echo "<sys/file.h> defines the O_* constants..." >&4
13125         if $run ./try; then
13126                 echo "and you have the 3 argument form of open()." >&4
13127                 val="$define"
13128         else
13129                 echo "but not the 3 argument form of open().  Oh, well." >&4
13130                 val="$undef"
13131         fi
13132 elif $test `./findhdr fcntl.h` && \
13133                 set try -DI_FCNTL && eval $compile; then
13134         h_fcntl=true;
13135         echo "<fcntl.h> defines the O_* constants..." >&4
13136         if $run ./try; then
13137                 echo "and you have the 3 argument form of open()." >&4
13138                 val="$define"
13139         else
13140                 echo "but not the 3 argument form of open().  Oh, well." >&4
13141                 val="$undef"
13142         fi
13143 else
13144         val="$undef"
13145         echo "I can't find the O_* constant definitions!  You got problems." >&4
13146 fi
13147 set d_open3
13148 eval $setvar
13149 $rm_try
13150
13151 : see if this is a sys/file.h system
13152 val=''
13153 set sys/file.h val
13154 eval $inhdr
13155
13156 : do we need to include sys/file.h ?
13157 case "$val" in
13158 "$define")
13159         echo " "
13160         if $h_sysfile; then
13161                 val="$define"
13162                 echo "We'll be including <sys/file.h>." >&4
13163         else
13164                 val="$undef"
13165                 echo "We won't be including <sys/file.h>." >&4
13166         fi
13167         ;;
13168 *)
13169         h_sysfile=false
13170         ;;
13171 esac
13172 set i_sysfile
13173 eval $setvar
13174
13175 : see if fcntl.h is there
13176 val=''
13177 set fcntl.h val
13178 eval $inhdr
13179
13180 : see if we can include fcntl.h
13181 case "$val" in
13182 "$define")
13183         echo " "
13184         if $h_fcntl; then
13185                 val="$define"
13186                 echo "We'll be including <fcntl.h>." >&4
13187         else
13188                 val="$undef"
13189                 if $h_sysfile; then
13190         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13191                 else
13192                         echo "We won't be including <fcntl.h>." >&4
13193                 fi
13194         fi
13195         ;;
13196 *)
13197         h_fcntl=false
13198         val="$undef"
13199         ;;
13200 esac
13201 set i_fcntl
13202 eval $setvar
13203
13204 : see if fork exists
13205 set fork d_fork
13206 eval $inlibc
13207
13208 : see if pipe exists
13209 set pipe d_pipe
13210 eval $inlibc
13211
13212 : check for non-blocking I/O stuff
13213 case "$h_sysfile" in
13214 true) echo "#include <sys/file.h>" > head.c;;
13215 *)
13216        case "$h_fcntl" in
13217        true) echo "#include <fcntl.h>" > head.c;;
13218        *) echo "#include <sys/fcntl.h>" > head.c;;
13219        esac
13220        ;;
13221 esac
13222 echo " "
13223 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13224 case "$o_nonblock" in
13225 '')
13226         $cat head.c > try.c
13227         $cat >>try.c <<EOCP
13228 #include <stdio.h>
13229 #$i_stdlib I_STDLIB
13230 #ifdef I_STDLIB
13231 #include <stdlib.h>
13232 #endif
13233 #$i_fcntl I_FCNTL
13234 #ifdef I_FCNTL
13235 #include <fcntl.h>
13236 #endif
13237 int main() {
13238 #ifdef O_NONBLOCK
13239         printf("O_NONBLOCK\n");
13240         exit(0);
13241 #endif
13242 #ifdef O_NDELAY
13243         printf("O_NDELAY\n");
13244         exit(0);
13245 #endif
13246 #ifdef FNDELAY
13247         printf("FNDELAY\n");
13248         exit(0);
13249 #endif
13250         exit(0);
13251 }
13252 EOCP
13253         set try
13254         if eval $compile_ok; then
13255                 o_nonblock=`$run ./try`
13256                 case "$o_nonblock" in
13257                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13258                 *) echo "Seems like we can use $o_nonblock.";;
13259                 esac
13260         else
13261                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13262         fi
13263         ;;
13264 *) echo "Using $hint value $o_nonblock.";;
13265 esac
13266 $rm_try
13267
13268 echo " "
13269 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13270 case "$eagain" in
13271 '')
13272         case "$d_fork:$d_pipe:$d_alarm" in
13273         define:define:define)
13274         $cat head.c > try.c
13275         $cat >>try.c <<EOCP
13276 #include <errno.h>
13277 #include <sys/types.h>
13278 #include <signal.h>
13279 #include <stdio.h>
13280 #$i_stdlib I_STDLIB
13281 #ifdef I_STDLIB
13282 #include <stdlib.h>
13283 #endif
13284 #$i_fcntl I_FCNTL
13285 #ifdef I_FCNTL
13286 #include <fcntl.h>
13287 #endif
13288 #define MY_O_NONBLOCK $o_nonblock
13289 #ifndef errno  /* XXX need better Configure test */
13290 extern int errno;
13291 #endif
13292 #$i_unistd I_UNISTD
13293 #ifdef I_UNISTD
13294 #include <unistd.h>
13295 #endif
13296 #include <string.h>
13297 $signal_t blech(int x) { exit(3); }
13298 EOCP
13299         $cat >> try.c <<'EOCP'
13300 int main()
13301 {
13302         int pd[2];
13303         int pu[2];
13304         char buf[1];
13305         char string[100];
13306         int ret;
13307
13308         ret = pipe(pd); /* Down: child -> parent */
13309         if (ret != 0)
13310                 exit(3);
13311         ret = pipe(pu); /* Up: parent -> child */
13312         if (ret != 0)
13313                 exit(3);
13314         if (0 != fork()) {
13315                 close(pd[1]);   /* Parent reads from pd[0] */
13316                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13317 #ifdef F_SETFL
13318                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13319                         exit(1);
13320 #else
13321                 exit(4);
13322 #endif
13323                 signal(SIGALRM, blech);
13324                 alarm(5);
13325                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13326                         exit(2);
13327                 sprintf(string, "%d\n", ret);
13328                 ret = write(2, string, strlen(string));
13329                 if (ret != strlen(string))
13330                         exit(3);
13331                 alarm(0);
13332 #ifdef EAGAIN
13333                 if (errno == EAGAIN) {
13334                         printf("EAGAIN\n");
13335                         goto ok;
13336                 }
13337 #endif
13338 #ifdef EWOULDBLOCK
13339                 if (errno == EWOULDBLOCK)
13340                         printf("EWOULDBLOCK\n");
13341 #endif
13342         ok:
13343                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13344                 if (ret != 1)
13345                         exit(3);
13346                 sleep(2);                               /* Give it time to close our pipe */
13347                 alarm(5);
13348                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13349                 alarm(0);
13350                 sprintf(string, "%d\n", ret);
13351                 ret = write(4, string, strlen(string));
13352                 if (ret != strlen(string))
13353                         exit(3);
13354                 exit(0);
13355         }
13356
13357         close(pd[0]);                   /* We write to pd[1] */
13358         close(pu[1]);                   /* We read from pu[0] */
13359         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13360         if (ret != 1)
13361                 exit(3);
13362         close(pd[1]);                   /* Pipe pd is now fully closed! */
13363         exit(0);                                /* Bye bye, thank you for playing! */
13364 }
13365 EOCP
13366         set try
13367         if eval $compile_ok; then
13368                 echo "$startsh" >mtry
13369                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13370                 chmod +x mtry
13371                 $run ./mtry >/dev/null 2>&1
13372                 case $? in
13373                 0) eagain=`$cat try.out`;;
13374                 1) echo "Could not perform non-blocking setting!";;
13375                 2) echo "I did a successful read() for something that was not there!";;
13376                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13377                 4) echo "Could not find F_SETFL!";;
13378                 *) echo "Something terribly wrong happened during testing.";;
13379                 esac
13380                 rd_nodata=`$cat try.ret`
13381                 echo "A read() system call with no data present returns $rd_nodata."
13382                 case "$rd_nodata" in
13383                 0|-1) ;;
13384                 *)
13385                         echo "(That's peculiar, fixing that to be -1.)"
13386                         rd_nodata=-1
13387                         ;;
13388                 esac
13389                 case "$eagain" in
13390                 '')
13391                         echo "Forcing errno EAGAIN on read() with no data available."
13392                         eagain=EAGAIN
13393                         ;;
13394                 *)
13395                         echo "Your read() sets errno to $eagain when no data is available."
13396                         ;;
13397                 esac
13398                 status=`$cat try.err`
13399                 case "$status" in
13400                 0) echo "And it correctly returns 0 to signal EOF.";;
13401                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13402                 *) echo "However, your read() returns '$status' on EOF??";;
13403                 esac
13404                 val="$define"
13405                 if test "$status" = "$rd_nodata"; then
13406                         echo "WARNING: you can't distinguish between EOF and no data!"
13407                         val="$undef"
13408                 fi
13409         else
13410                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13411                 eagain=EAGAIN
13412         fi
13413         ;;
13414         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13415                 eagain=EAGAIN
13416                 val="$define"
13417                 ;;
13418         esac
13419         set d_eofnblk
13420         eval $setvar
13421         ;;
13422 *)
13423         echo "Using $hint value $eagain."
13424         echo "Your read() returns $rd_nodata when no data is present."
13425         case "$d_eofnblk" in
13426         "$define") echo "And you can see EOF because read() returns 0.";;
13427         "$undef") echo "But you can't see EOF status from read() returned value.";;
13428         *)
13429                 echo "(Assuming you can't see EOF status from read anyway.)"
13430                 d_eofnblk=$undef
13431                 ;;
13432         esac
13433         ;;
13434 esac
13435 $rm_try head.c mtry
13436
13437 : see if erf exists
13438 set erf d_erf
13439 eval $inlibc
13440
13441 : see if erfc exists
13442 set erfc d_erfc
13443 eval $inlibc
13444
13445 : see if exp2 exists
13446 set exp2 d_exp2
13447 eval $inlibc
13448
13449 : see if expm1 exists
13450 set expm1 d_expm1
13451 eval $inlibc
13452
13453 : see if _ptr and _cnt from stdio act std
13454 echo " "
13455
13456 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13457         echo "(Looks like you have stdio.h from BSD.)"
13458         case "$stdio_ptr" in
13459         '') stdio_ptr='((fp)->_p)'
13460                 ptr_lval=$define
13461                 ;;
13462         *)      ptr_lval=$d_stdio_ptr_lval;;
13463         esac
13464         case "$stdio_cnt" in
13465         '') stdio_cnt='((fp)->_r)'
13466                 cnt_lval=$define
13467                 ;;
13468         *)      cnt_lval=$d_stdio_cnt_lval;;
13469         esac
13470         case "$stdio_base" in
13471         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13472         esac
13473         case "$stdio_bufsiz" in
13474         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13475         esac
13476 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13477         echo "(Looks like you have stdio.h from Linux.)"
13478         case "$stdio_ptr" in
13479         '') stdio_ptr='((fp)->_IO_read_ptr)'
13480                 ptr_lval=$define
13481                 ;;
13482         *)      ptr_lval=$d_stdio_ptr_lval;;
13483         esac
13484         case "$stdio_cnt" in
13485         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13486                 cnt_lval=$undef
13487                 ;;
13488         *)      cnt_lval=$d_stdio_cnt_lval;;
13489         esac
13490         case "$stdio_base" in
13491         '') stdio_base='((fp)->_IO_read_base)';;
13492         esac
13493         case "$stdio_bufsiz" in
13494         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13495         esac
13496 else
13497         case "$stdio_ptr" in
13498         '') stdio_ptr='((fp)->_ptr)'
13499                 ptr_lval=$define
13500                 ;;
13501         *)      ptr_lval=$d_stdio_ptr_lval;;
13502         esac
13503         case "$stdio_cnt" in
13504         '') stdio_cnt='((fp)->_cnt)'
13505                 cnt_lval=$define
13506                 ;;
13507         *)      cnt_lval=$d_stdio_cnt_lval;;
13508         esac
13509         case "$stdio_base" in
13510         '') stdio_base='((fp)->_base)';;
13511         esac
13512         case "$stdio_bufsiz" in
13513         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13514         esac
13515 fi
13516
13517 : test whether _ptr and _cnt really work
13518 echo "Checking how std your stdio is..." >&4
13519 $cat >try.c <<EOP
13520 #include <stdio.h>
13521 #$i_stdlib I_STDLIB
13522 #ifdef I_STDLIB
13523 #include <stdlib.h>
13524 #endif
13525 #define FILE_ptr(fp)    $stdio_ptr
13526 #define FILE_cnt(fp)    $stdio_cnt
13527 int main() {
13528         FILE *fp = fopen("try.c", "r");
13529         char c = getc(fp);
13530         if (
13531                 18 <= FILE_cnt(fp) &&
13532                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13533         )
13534                 exit(0);
13535         exit(1);
13536 }
13537 EOP
13538 val="$undef"
13539 set try
13540 if eval $compile && $to try.c; then
13541         if $run ./try; then
13542                 echo "Your stdio acts pretty std."
13543                 val="$define"
13544         else
13545                 echo "Your stdio isn't very std."
13546         fi
13547 else
13548         echo "Your stdio doesn't appear very std."
13549 fi
13550 $rm_try
13551
13552 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13553 # direct buffer manipulation no longer works.  The Configure tests
13554 # should be changed to correctly detect this, but until then,
13555 # the following check should at least let perl compile and run.
13556 # (This quick fix should be updated before 5.8.1.)
13557 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13558 # A. Dougherty, June 3, 2002.
13559 case "$d_gnulibc" in
13560 $define)
13561         case "$gnulibc_version" in
13562         2.[01]*)  ;;
13563         2.2) ;;
13564         2.2.[0-9]) ;;
13565         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13566                 val="$undef"
13567                 ;;
13568         esac
13569         ;;
13570 esac
13571 set d_stdstdio
13572 eval $setvar
13573
13574 : Can _ptr be used as an lvalue?
13575 case "$d_stdstdio$ptr_lval" in
13576 $define$define) val=$define ;;
13577 *) val=$undef ;;
13578 esac
13579 set d_stdio_ptr_lval
13580 eval $setvar
13581
13582 : Can _cnt be used as an lvalue?
13583 case "$d_stdstdio$cnt_lval" in
13584 $define$define) val=$define ;;
13585 *) val=$undef ;;
13586 esac
13587 set d_stdio_cnt_lval
13588 eval $setvar
13589
13590
13591 : test whether setting _ptr sets _cnt as a side effect
13592 d_stdio_ptr_lval_sets_cnt="$undef"
13593 d_stdio_ptr_lval_nochange_cnt="$undef"
13594 case "$d_stdio_ptr_lval$d_stdstdio" in
13595 $define$define)
13596         echo "Checking to see what happens if we set the stdio ptr..." >&4
13597 $cat >try.c <<EOP
13598 #include <stdio.h>
13599 /* Can we scream? */
13600 /* Eat dust sed :-) */
13601 /* In the buffer space, no one can hear you scream. */
13602 #$i_stdlib I_STDLIB
13603 #ifdef I_STDLIB
13604 #include <stdlib.h>
13605 #endif
13606 #define FILE_ptr(fp)    $stdio_ptr
13607 #define FILE_cnt(fp)    $stdio_cnt
13608 #include <sys/types.h>
13609 int main() {
13610         FILE *fp = fopen("try.c", "r");
13611         int c;
13612         char *ptr;
13613         size_t cnt;
13614         if (!fp) {
13615             puts("Fail even to read");
13616             exit(1);
13617         }
13618         c = getc(fp); /* Read away the first # */
13619         if (c == EOF) {
13620             puts("Fail even to read");
13621             exit(1);
13622         }
13623         if (!(
13624                 18 <= FILE_cnt(fp) &&
13625                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13626         )) {
13627                 puts("Fail even to read");
13628                 exit (1);
13629         }
13630         ptr = (char*) FILE_ptr(fp);
13631         cnt = (size_t)FILE_cnt(fp);
13632
13633         FILE_ptr(fp) += 42;
13634
13635         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13636                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13637                 exit (1);
13638         }
13639         if (FILE_cnt(fp) <= 20) {
13640                 printf ("Fail (<20 chars to test)");
13641                 exit (1);
13642         }
13643         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13644                 puts("Fail compare");
13645                 exit (1);
13646         }
13647         if (cnt == FILE_cnt(fp)) {
13648                 puts("Pass_unchanged");
13649                 exit (0);
13650         }
13651         if (FILE_cnt(fp) == (cnt - 42)) {
13652                 puts("Pass_changed");
13653                 exit (0);
13654         }
13655         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13656         return 1;
13657
13658 }
13659 EOP
13660         set try
13661         if eval $compile && $to try.c; then
13662                 case `$run ./try` in
13663                 Pass_changed)
13664                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13665                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13666                 Pass_unchanged)
13667                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13668                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13669                 Fail*)
13670                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13671                 *)
13672                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13673         esac
13674         else
13675                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13676         fi
13677         $rm_try
13678         ;;
13679 esac
13680
13681 : see if _base is also standard
13682 val="$undef"
13683 case "$d_stdstdio" in
13684 $define)
13685         $cat >try.c <<EOP
13686 #include <stdio.h>
13687 #$i_stdlib I_STDLIB
13688 #ifdef I_STDLIB
13689 #include <stdlib.h>
13690 #endif
13691 #define FILE_base(fp)   $stdio_base
13692 #define FILE_bufsiz(fp) $stdio_bufsiz
13693 int main() {
13694         FILE *fp = fopen("try.c", "r");
13695         char c = getc(fp);
13696         if (
13697                 19 <= FILE_bufsiz(fp) &&
13698                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13699         )
13700                 exit(0);
13701         exit(1);
13702 }
13703 EOP
13704         set try
13705         if eval $compile && $to try.c; then
13706                 if $run ./try; then
13707                         echo "And its _base field acts std."
13708                         val="$define"
13709                 else
13710                         echo "But its _base field isn't std."
13711                 fi
13712         else
13713                 echo "However, it seems to be lacking the _base field."
13714         fi
13715         $rm_try
13716         ;;
13717 esac
13718 set d_stdiobase
13719 eval $setvar
13720
13721 : see if fast_stdio exists
13722 val="$undef"
13723 case "$d_stdstdio:$d_stdio_ptr_lval" in
13724 "$define:$define")
13725         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13726         *$define*)
13727                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13728                 val="$define"
13729                 ;;
13730         esac
13731         ;;
13732 esac
13733 set d_faststdio
13734 eval $setvar
13735
13736 : see if fchdir exists
13737 set fchdir d_fchdir
13738 eval $inlibc
13739
13740 : see if fchmod exists
13741 set fchmod d_fchmod
13742 eval $inlibc
13743
13744 : check for openat, unlinkat, renameat, linkat, fchmodat
13745 set openat d_openat
13746 eval $inlibc
13747
13748 set unlinkat d_unlinkat
13749 eval $inlibc
13750
13751 set renameat d_renameat
13752 eval $inlibc
13753
13754 set linkat d_linkat
13755 eval $inlibc
13756
13757 set fchmodat d_fchmodat
13758 eval $inlibc
13759
13760 : see if fchown exists
13761 set fchown d_fchown
13762 eval $inlibc
13763
13764 : see if this is an fcntl system
13765 set fcntl d_fcntl
13766 eval $inlibc
13767
13768 : See if fcntl-based locking works.
13769 echo " "
13770 $cat >try.c <<EOCP
13771 #$i_stdlib I_STDLIB
13772 #ifdef I_STDLIB
13773 #include <stdlib.h>
13774 #endif
13775 #include <unistd.h>
13776 #include <fcntl.h>
13777 #include <signal.h>
13778 $signal_t blech(int x) { exit(3); }
13779 int main() {
13780 #if defined(F_SETLK) && defined(F_SETLKW)
13781      struct flock flock;
13782      int retval, fd;
13783      fd = open("try.c", O_RDONLY);
13784      flock.l_type = F_RDLCK;
13785      flock.l_whence = SEEK_SET;
13786      flock.l_start = flock.l_len = 0;
13787      signal(SIGALRM, blech);
13788      alarm(10);
13789      retval = fcntl(fd, F_SETLK, &flock);
13790      close(fd);
13791      (retval < 0 ? exit(2) : exit(0));
13792 #else
13793      exit(2);
13794 #endif
13795 }
13796 EOCP
13797 echo "Checking if fcntl-based file locking works... "
13798 case "$d_fcntl" in
13799 "$define")
13800         set try
13801         if eval $compile_ok; then
13802                 if $run ./try; then
13803                         echo "Yes, it seems to work."
13804                         val="$define"
13805                 else
13806                         echo "Nope, it didn't work."
13807                         val="$undef"
13808                         case "$?" in
13809                         3) $cat >&4 <<EOM
13810 ***
13811 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13812 *** This is (almost) impossible.
13813 *** If your NFS lock daemons are not feeling well, something like
13814 *** this may happen, please investigate.  Cannot continue, aborting.
13815 ***
13816 EOM
13817                                 exit 1
13818                                 ;;
13819                         esac
13820                 fi
13821         else
13822                 echo "I'm unable to compile the test program, so I'll assume not."
13823                 val="$undef"
13824         fi
13825         ;;
13826 *) val="$undef";
13827         echo "Nope, since you don't even have fcntl()."
13828         ;;
13829 esac
13830 set d_fcntl_can_lock
13831 eval $setvar
13832 $rm_try
13833
13834 : check for fd_set items
13835 $cat <<EOM
13836
13837 Checking to see how well your C compiler handles fd_set and friends ...
13838 EOM
13839 $cat >try.c <<EOCP
13840 #$i_stdlib I_STDLIB
13841 #ifdef I_STDLIB
13842 #include <stdlib.h>
13843 #endif
13844 #$i_systime I_SYS_TIME
13845 #$i_sysselct I_SYS_SELECT
13846 #$d_socket HAS_SOCKET
13847 #include <sys/types.h>
13848 #ifdef HAS_SOCKET
13849 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13850 #endif
13851 #ifdef I_SYS_TIME
13852 #include <sys/time.h>
13853 #endif
13854 #ifdef I_SYS_SELECT
13855 #include <sys/select.h>
13856 #endif
13857 int main() {
13858         fd_set fds;
13859
13860 #ifdef TRYBITS
13861         if(fds.fds_bits);
13862 #endif
13863
13864 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13865         exit(0);
13866 #else
13867         exit(1);
13868 #endif
13869 }
13870 EOCP
13871 set try -DTRYBITS
13872 if eval $compile; then
13873         d_fds_bits="$define"
13874         d_fd_set="$define"
13875         echo "Well, your system knows about the normal fd_set typedef..." >&4
13876         if $run ./try; then
13877                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13878                 d_fd_macros="$define"
13879         else
13880                 $cat >&4 <<'EOM'
13881 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13882 EOM
13883                 d_fd_macros="$undef"
13884         fi
13885 else
13886         $cat <<'EOM'
13887 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13888 EOM
13889         set try
13890         if eval $compile; then
13891                 d_fds_bits="$undef"
13892                 d_fd_set="$define"
13893                 echo "Well, your system has some sort of fd_set available..." >&4
13894                 if $run ./try; then
13895                         echo "and you have the normal fd_set macros." >&4
13896                         d_fd_macros="$define"
13897                 else
13898                         $cat <<'EOM'
13899 but not the normal fd_set macros!  Gross!  More work for me...
13900 EOM
13901                         d_fd_macros="$undef"
13902                 fi
13903         else
13904         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13905                 d_fd_set="$undef"
13906                 d_fds_bits="$undef"
13907                 d_fd_macros="$undef"
13908         fi
13909 fi
13910 $rm_try
13911
13912 : see if fdclose exists
13913 set fdclose d_fdclose
13914 eval $inlibc
13915
13916 : see if fdim exists
13917 set fdim d_fdim
13918 eval $inlibc
13919
13920 : see if fegetround exists
13921 set fegetround d_fegetround
13922 eval $inlibc
13923
13924 : see if fgetpos exists
13925 set fgetpos d_fgetpos
13926 eval $inlibc
13927
13928 : see if finite exists
13929 set finite d_finite
13930 eval $inlibc
13931
13932 : see if finitel exists
13933 set finitel d_finitel
13934 eval $inlibc
13935
13936 : see if flock exists
13937 set flock d_flock
13938 eval $inlibc
13939
13940 : see if prototype for flock is available
13941 echo " "
13942 set d_flockproto flock $i_sysfile sys/file.h
13943 eval $hasproto
13944
13945 : see if fma exists
13946 set fma d_fma
13947 eval $inlibc
13948
13949 : see if fmax exists
13950 set fmax d_fmax
13951 eval $inlibc
13952
13953 : see if fmin exists
13954 set fmin d_fmin
13955 eval $inlibc
13956
13957 : see if fp_class exists
13958 set fp_class d_fp_class
13959 eval $inlibc
13960
13961 : check for fpclassify
13962 echo "Checking to see if you have fpclassify..." >&4
13963 $cat >try.c <<EOCP
13964 #include <math.h>
13965 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13966 EOCP
13967 set try
13968 if eval $compile; then
13969         val="$define"
13970         echo "You have fpclassify."
13971 else
13972         val="$undef"
13973         echo "You do not have fpclassify."
13974 fi
13975 $rm_try
13976 set d_fpclassify
13977 eval $setvar
13978
13979 : see if fp_classify exists
13980 set fp_classify d_fp_classify
13981 eval $inlibc
13982
13983 : see if fp_classl exists
13984 set fp_classl d_fp_classl
13985 eval $inlibc
13986
13987 : see if pathconf exists
13988 set pathconf d_pathconf
13989 eval $inlibc
13990
13991 : see if fpathconf exists
13992 set fpathconf d_fpathconf
13993 eval $inlibc
13994
13995 : see if fpclass exists
13996 set fpclass d_fpclass
13997 eval $inlibc
13998
13999 : see if fpclassl exists
14000 set fpclassl d_fpclassl
14001 eval $inlibc
14002
14003 : see if fpgetround exists
14004 set fpgetround d_fpgetround
14005 eval $inlibc
14006
14007 : check for fpos64_t
14008 echo " "
14009 echo "Checking to see if you have fpos64_t..." >&4
14010 $cat >try.c <<EOCP
14011 #include <stdio.h>
14012 int main() { fpos64_t x = 7; }
14013 EOCP
14014 set try
14015 if eval $compile; then
14016         val="$define"
14017         echo "You have fpos64_t."
14018 else
14019         val="$undef"
14020         echo "You do not have fpos64_t."
14021         case "$fpossize" in
14022         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14023         esac
14024 fi
14025 $rm_try
14026 set d_fpos64_t
14027 eval $setvar
14028
14029 : see if frexpl exists
14030 set frexpl d_frexpl
14031 eval $inlibc
14032
14033 : see if this is a sys/param system
14034 set sys/param.h i_sysparam
14035 eval $inhdr
14036
14037 : see if this is a sys/mount.h system
14038 set sys/mount.h i_sysmount
14039 eval $inhdr
14040
14041 : Check for fs_data_s
14042 echo " "
14043 echo "Checking to see if your system supports struct fs_data..." >&4
14044 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14045 eval $hasstruct
14046 case "$d_fs_data_s" in
14047 "$define")      echo "Yes, it does."   ;;
14048 *)              echo "No, it doesn't." ;;
14049 esac
14050
14051 : see if fseeko exists
14052 set fseeko d_fseeko
14053 eval $inlibc
14054 case "$longsize" in
14055 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14056 esac
14057
14058 : see if fsetpos exists
14059 set fsetpos d_fsetpos
14060 eval $inlibc
14061
14062 : see if fstatfs exists
14063 set fstatfs d_fstatfs
14064 eval $inlibc
14065
14066 : see if statvfs exists
14067 set statvfs d_statvfs
14068 eval $inlibc
14069
14070 : see if fstatvfs exists
14071 set fstatvfs d_fstatvfs
14072 eval $inlibc
14073
14074 : see if fsync exists
14075 set fsync d_fsync
14076 eval $inlibc
14077
14078 : see if ftello exists
14079 set ftello d_ftello
14080 eval $inlibc
14081 case "$longsize" in
14082 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14083 esac
14084
14085 : check for a working futimes
14086 d_futimes="$undef"
14087 echo " "
14088 echo "Checking if you have a working futimes()" >&4
14089 $cat >try.c <<EOCP
14090 #include <stdio.h>
14091 #include <sys/time.h>
14092 #include <errno.h>
14093 #include <fcntl.h>
14094 #include <stdlib.h>
14095
14096 int main ()
14097 {
14098     int fd, rv;
14099     fd = open ("try.c", O_RDWR);
14100     if (-1 == fd) exit (1);
14101     rv = futimes (fd, NULL);
14102     exit (rv == -1 ? errno : 0);
14103 }
14104 EOCP
14105 set try
14106 if eval $compile; then
14107     `$run ./try`
14108     rc=$?
14109     case "$rc" in
14110         0)  echo "Yes, you have" >&4
14111             d_futimes="$define"
14112             ;;
14113         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14114             ;;
14115     esac
14116 else
14117     echo "No, it does not (probably harmless)" >&4
14118 fi
14119 $rm_try
14120
14121 : look for gai_strerror
14122 echo " "
14123 $cat >try.c <<'EOCP'
14124 #include <sys/types.h>
14125 #include <sys/socket.h>
14126 #include <netdb.h>
14127 int main ()
14128 {
14129     return (gai_strerror (0) ? 0 : 1);
14130     }
14131 EOCP
14132 set try
14133 val="$undef"
14134 if eval $compile; then
14135     `$run ./try`
14136     case "$?" in
14137         0)  echo "A working gai_strerror() found." >&4
14138             val="$define" ;;
14139         *)  echo "gai_strerror() found, but it doesn't work" >&4
14140             ;;
14141         esac
14142 else
14143     echo "gai_strerror() NOT found." >&4
14144     fi
14145 set d_gai_strerror
14146 eval $setvar
14147 $rm_try
14148
14149 : see if ndbm.h is available
14150 set ndbm.h i_ndbm
14151 eval $inhdr
14152 : Compatibility location for RedHat 7.1
14153 set gdbm/ndbm.h i_gdbmndbm
14154 eval $inhdr
14155 : Compatibility location for Debian 4.0
14156 set gdbm-ndbm.h i_gdbm_ndbm
14157 eval $inhdr
14158
14159 val="$undef"
14160 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14161         : see if dbm_open exists
14162         set dbm_open d_dbm_open
14163         eval $inlibc
14164         case "$d_dbm_open" in
14165         $undef)
14166                 i_ndbm="$undef"
14167                 i_gdbmndbm="$undef"
14168                 i_gdbm_ndbm="$undef"
14169                 echo "We won't be including <ndbm.h>"
14170                 val="$undef"
14171                 ;;
14172         *) val="$define"
14173            ;;
14174         esac
14175 fi
14176 set d_ndbm
14177 eval $setvar
14178
14179 ndbm_hdr_protochk='name=$1; hdr=$2;
14180 eval "ihdr=\$""i_$name";
14181 val="$undef";
14182 if $test "$ihdr" = "$define"; then
14183         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14184         case "$d_cplusplus" in
14185         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14186         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14187         esac;
14188         case "$val" in
14189         $define) $echo "Your <$hdr> seems to have prototypes";;
14190         *) $echo "Your <$hdr> does not seem to have prototypes";;
14191         esac;
14192 fi;
14193 set "d_${name}_h_uses_prototypes";
14194 eval $setvar'
14195
14196 set ndbm ndbm.h
14197 eval $ndbm_hdr_protochk
14198 set gdbmndbm gdbm/ndbm.h
14199 eval $ndbm_hdr_protochk
14200 set gdbm_ndbm gdbm-ndbm.h
14201 eval $ndbm_hdr_protochk
14202
14203 : see if getaddrinfo exists
14204 set getaddrinfo d_getaddrinfo
14205 eval $inlibc
14206
14207 : see if getcwd exists
14208 set getcwd d_getcwd
14209 eval $inlibc
14210
14211 : see if getespwnam exists
14212 set getespwnam d_getespwnam
14213 eval $inlibc
14214
14215 : see if getfsstat exists
14216 set getfsstat d_getfsstat
14217 eval $inlibc
14218
14219 : see if getgrent exists
14220 set getgrent d_getgrent
14221 eval $inlibc
14222
14223 : see if getgrent_r exists
14224 set getgrent_r d_getgrent_r
14225 eval $inlibc
14226 case "$d_getgrent_r" in
14227 "$define")
14228         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14229         case "$d_getgrent_r_proto:$usethreads" in
14230         ":define")      d_getgrent_r_proto=define
14231                 set d_getgrent_r_proto getgrent_r $hdrs
14232                 eval $hasproto ;;
14233         *)      ;;
14234         esac
14235         case "$d_getgrent_r_proto" in
14236         define)
14237         case "$getgrent_r_proto" in
14238         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14239         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14240         esac
14241         case "$getgrent_r_proto" in
14242         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14243         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14244         esac
14245         case "$getgrent_r_proto" in
14246         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14247         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14248         esac
14249         case "$getgrent_r_proto" in
14250         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14251         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14252         esac
14253         case "$getgrent_r_proto" in
14254         ''|0) try='int getgrent_r(struct group*, char*, int);'
14255         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14256         esac
14257         case "$getgrent_r_proto" in
14258         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14259         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14260         esac
14261         case "$getgrent_r_proto" in
14262         ''|0)   d_getgrent_r=undef
14263                 getgrent_r_proto=0
14264                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14265         * )     case "$getgrent_r_proto" in
14266                 REENTRANT_PROTO*) ;;
14267                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14268                 esac
14269                 echo "Prototype: $try" ;;
14270         esac
14271         ;;
14272         *)      case "$usethreads" in
14273                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14274                 esac
14275                 d_getgrent_r=undef
14276                 getgrent_r_proto=0
14277                 ;;
14278         esac
14279         ;;
14280 *)      getgrent_r_proto=0
14281         ;;
14282 esac
14283
14284 : see if getgrgid_r exists
14285 set getgrgid_r d_getgrgid_r
14286 eval $inlibc
14287 case "$d_getgrgid_r" in
14288 "$define")
14289         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14290         case "$d_getgrgid_r_proto:$usethreads" in
14291         ":define")      d_getgrgid_r_proto=define
14292                 set d_getgrgid_r_proto getgrgid_r $hdrs
14293                 eval $hasproto ;;
14294         *)      ;;
14295         esac
14296         case "$d_getgrgid_r_proto" in
14297         define)
14298         case "$getgrgid_r_proto" in
14299         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14300         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14301         esac
14302         case "$getgrgid_r_proto" in
14303         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14304         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14305         esac
14306         case "$getgrgid_r_proto" in
14307         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14308         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14309         esac
14310         case "$getgrgid_r_proto" in
14311         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14312         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14313         esac
14314         case "$getgrgid_r_proto" in
14315         ''|0)   d_getgrgid_r=undef
14316                 getgrgid_r_proto=0
14317                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14318         * )     case "$getgrgid_r_proto" in
14319                 REENTRANT_PROTO*) ;;
14320                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14321                 esac
14322                 echo "Prototype: $try" ;;
14323         esac
14324         ;;
14325         *)      case "$usethreads" in
14326                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14327                 esac
14328                 d_getgrgid_r=undef
14329                 getgrgid_r_proto=0
14330                 ;;
14331         esac
14332         ;;
14333 *)      getgrgid_r_proto=0
14334         ;;
14335 esac
14336
14337 : see if getgrnam_r exists
14338 set getgrnam_r d_getgrnam_r
14339 eval $inlibc
14340 case "$d_getgrnam_r" in
14341 "$define")
14342         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14343         case "$d_getgrnam_r_proto:$usethreads" in
14344         ":define")      d_getgrnam_r_proto=define
14345                 set d_getgrnam_r_proto getgrnam_r $hdrs
14346                 eval $hasproto ;;
14347         *)      ;;
14348         esac
14349         case "$d_getgrnam_r_proto" in
14350         define)
14351         case "$getgrnam_r_proto" in
14352         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14353         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14354         esac
14355         case "$getgrnam_r_proto" in
14356         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14357         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14358         esac
14359         case "$getgrnam_r_proto" in
14360         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14361         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14362         esac
14363         case "$getgrnam_r_proto" in
14364         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14365         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14366         esac
14367         case "$getgrnam_r_proto" in
14368         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14369         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14370         esac
14371         case "$getgrnam_r_proto" in
14372         ''|0)   d_getgrnam_r=undef
14373                 getgrnam_r_proto=0
14374                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14375         * )     case "$getgrnam_r_proto" in
14376                 REENTRANT_PROTO*) ;;
14377                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14378                 esac
14379                 echo "Prototype: $try" ;;
14380         esac
14381         ;;
14382         *)      case "$usethreads" in
14383                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14384                 esac
14385                 d_getgrnam_r=undef
14386                 getgrnam_r_proto=0
14387                 ;;
14388         esac
14389         ;;
14390 *)      getgrnam_r_proto=0
14391         ;;
14392 esac
14393
14394 : see if gethostbyaddr exists
14395 set gethostbyaddr d_gethbyaddr
14396 eval $inlibc
14397
14398 : see if gethostbyname exists
14399 set gethostbyname d_gethbyname
14400 eval $inlibc
14401
14402 : see if gethostent exists
14403 set gethostent d_gethent
14404 eval $inlibc
14405
14406 : see how we will look up host name
14407 echo " "
14408 call=''
14409 if set gethostname val -f d_gethname; eval $csym; $val; then
14410         echo 'gethostname() found.' >&4
14411         d_gethname="$define"
14412         call=gethostname
14413 fi
14414 if set uname val -f d_uname; eval $csym; $val; then
14415         if ./xenix; then
14416                 $cat <<'EOM'
14417 uname() was found, but you're running xenix, and older versions of xenix
14418 have a broken uname(). If you don't really know whether your xenix is old
14419 enough to have a broken system call, use the default answer.
14420
14421 EOM
14422                 dflt=y
14423                 case "$d_uname" in
14424                 "$define") dflt=n;;
14425                 esac
14426                 rp='Is your uname() broken?'
14427                 . ./myread
14428                 case "$ans" in
14429                 n*) d_uname="$define"; call=uname;;
14430                 esac
14431         else
14432                 echo 'uname() found.' >&4
14433                 d_uname="$define"
14434                 case "$call" in
14435                 '') call=uname ;;
14436                 esac
14437         fi
14438 fi
14439 case "$d_gethname" in
14440 '') d_gethname="$undef";;
14441 esac
14442 case "$d_uname" in
14443 '') d_uname="$undef";;
14444 esac
14445 case "$d_uname$d_gethname" in
14446 *define*)
14447         dflt=n
14448         cat <<EOM
14449
14450 Every now and then someone has a $call() that lies about the hostname
14451 but can't be fixed for political or economic reasons.  If you wish, I can
14452 pretend $call() isn't there and maybe compute hostname at run-time
14453 thanks to the '$phostname' command.
14454
14455 EOM
14456         rp="Shall I ignore $call() from now on?"
14457         . ./myread
14458         case "$ans" in
14459         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14460         esac;;
14461 esac
14462 case "$phostname" in
14463 '') aphostname='';;
14464 *) case "$aphostname" in
14465         /*) ;;
14466         *) set X $phostname
14467                 shift
14468                 file=$1
14469                 shift
14470                 file=`./loc $file $file $pth`
14471                 aphostname=`echo $file $*`
14472                 ;;
14473         esac
14474         ;;
14475 esac
14476 case "$d_uname$d_gethname" in
14477 *define*) ;;
14478 *)
14479         case "$phostname" in
14480         '')
14481                 echo "There will be no way for $package to get your hostname." >&4;;
14482         *)
14483         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14484                 ;;
14485         esac;;
14486 esac
14487 case "$d_phostname" in
14488 '') d_phostname="$undef";;
14489 esac
14490
14491 : see if gethostbyaddr_r exists
14492 set gethostbyaddr_r d_gethostbyaddr_r
14493 eval $inlibc
14494 case "$d_gethostbyaddr_r" in
14495 "$define")
14496         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14497         case "$d_gethostbyaddr_r_proto:$usethreads" in
14498         ":define")      d_gethostbyaddr_r_proto=define
14499                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14500                 eval $hasproto ;;
14501         *)      ;;
14502         esac
14503         case "$d_gethostbyaddr_r_proto" in
14504         define)
14505         case "$gethostbyaddr_r_proto" in
14506         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14507         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14508         esac
14509         case "$gethostbyaddr_r_proto" in
14510         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14511         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14512         esac
14513         case "$gethostbyaddr_r_proto" in
14514         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14515         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14516         esac
14517         case "$gethostbyaddr_r_proto" in
14518         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14519         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14520         esac
14521         case "$gethostbyaddr_r_proto" in
14522         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14523         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14524         esac
14525         case "$gethostbyaddr_r_proto" in
14526         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14527         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14528         esac
14529         case "$gethostbyaddr_r_proto" in
14530         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14531         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14532         esac
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14535         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14536         esac
14537         case "$gethostbyaddr_r_proto" in
14538         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14539         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14540         esac
14541         case "$gethostbyaddr_r_proto" in
14542         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14543         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14544         esac
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14547         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14548         esac
14549         case "$gethostbyaddr_r_proto" in
14550         ''|0)   d_gethostbyaddr_r=undef
14551                 gethostbyaddr_r_proto=0
14552                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14553         * )     case "$gethostbyaddr_r_proto" in
14554                 REENTRANT_PROTO*) ;;
14555                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14556                 esac
14557                 echo "Prototype: $try" ;;
14558         esac
14559         ;;
14560         *)      case "$usethreads" in
14561                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14562                 esac
14563                 d_gethostbyaddr_r=undef
14564                 gethostbyaddr_r_proto=0
14565                 ;;
14566         esac
14567         ;;
14568 *)      gethostbyaddr_r_proto=0
14569         ;;
14570 esac
14571
14572 : see if gethostbyname_r exists
14573 set gethostbyname_r d_gethostbyname_r
14574 eval $inlibc
14575 case "$d_gethostbyname_r" in
14576 "$define")
14577         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14578         case "$d_gethostbyname_r_proto:$usethreads" in
14579         ":define")      d_gethostbyname_r_proto=define
14580                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14581                 eval $hasproto ;;
14582         *)      ;;
14583         esac
14584         case "$d_gethostbyname_r_proto" in
14585         define)
14586         case "$gethostbyname_r_proto" in
14587         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14588         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14589         esac
14590         case "$gethostbyname_r_proto" in
14591         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14592         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14593         esac
14594         case "$gethostbyname_r_proto" in
14595         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14596         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14597         esac
14598         case "$gethostbyname_r_proto" in
14599         ''|0)   d_gethostbyname_r=undef
14600                 gethostbyname_r_proto=0
14601                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14602         * )     case "$gethostbyname_r_proto" in
14603                 REENTRANT_PROTO*) ;;
14604                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14605                 esac
14606                 echo "Prototype: $try" ;;
14607         esac
14608         ;;
14609         *)      case "$usethreads" in
14610                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14611                 esac
14612                 d_gethostbyname_r=undef
14613                 gethostbyname_r_proto=0
14614                 ;;
14615         esac
14616         ;;
14617 *)      gethostbyname_r_proto=0
14618         ;;
14619 esac
14620
14621 : see if gethostent_r exists
14622 set gethostent_r d_gethostent_r
14623 eval $inlibc
14624 case "$d_gethostent_r" in
14625 "$define")
14626         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14627         case "$d_gethostent_r_proto:$usethreads" in
14628         ":define")      d_gethostent_r_proto=define
14629                 set d_gethostent_r_proto gethostent_r $hdrs
14630                 eval $hasproto ;;
14631         *)      ;;
14632         esac
14633         case "$d_gethostent_r_proto" in
14634         define)
14635         case "$gethostent_r_proto" in
14636         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14637         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14638         esac
14639         case "$gethostent_r_proto" in
14640         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14641         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14642         esac
14643         case "$gethostent_r_proto" in
14644         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14645         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14646         esac
14647         case "$gethostent_r_proto" in
14648         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14649         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14650         esac
14651         case "$gethostent_r_proto" in
14652         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14653         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14654         esac
14655         case "$gethostent_r_proto" in
14656         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14657         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14658         esac
14659         case "$gethostent_r_proto" in
14660         ''|0)   d_gethostent_r=undef
14661                 gethostent_r_proto=0
14662                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14663         * )     case "$gethostent_r_proto" in
14664                 REENTRANT_PROTO*) ;;
14665                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14666                 esac
14667                 echo "Prototype: $try" ;;
14668         esac
14669         ;;
14670         *)      case "$usethreads" in
14671                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14672                 esac
14673                 d_gethostent_r=undef
14674                 gethostent_r_proto=0
14675                 ;;
14676         esac
14677         ;;
14678 *)      gethostent_r_proto=0
14679         ;;
14680 esac
14681
14682 : see if prototypes for various gethostxxx netdb.h functions are available
14683 echo " "
14684 set d_gethostprotos gethostent $i_netdb netdb.h
14685 eval $hasproto
14686
14687 : see if getitimer exists
14688 set getitimer d_getitimer
14689 eval $inlibc
14690
14691 : see if getlogin exists
14692 set getlogin d_getlogin
14693 eval $inlibc
14694
14695 : see if getlogin_r exists
14696 set getlogin_r d_getlogin_r
14697 eval $inlibc
14698 case "$d_getlogin_r" in
14699 "$define")
14700         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14701         case "$d_getlogin_r_proto:$usethreads" in
14702         ":define")      d_getlogin_r_proto=define
14703                 set d_getlogin_r_proto getlogin_r $hdrs
14704                 eval $hasproto ;;
14705         *)      ;;
14706         esac
14707         case "$d_getlogin_r_proto" in
14708         define)
14709         case "$getlogin_r_proto" in
14710         ''|0) try='int getlogin_r(char*, size_t);'
14711         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14712         esac
14713         case "$getlogin_r_proto" in
14714         ''|0) try='int getlogin_r(char*, int);'
14715         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14716         esac
14717         case "$getlogin_r_proto" in
14718         ''|0) try='char* getlogin_r(char*, size_t);'
14719         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14720         esac
14721         case "$getlogin_r_proto" in
14722         ''|0) try='char* getlogin_r(char*, int);'
14723         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14724         esac
14725         case "$getlogin_r_proto" in
14726         ''|0)   d_getlogin_r=undef
14727                 getlogin_r_proto=0
14728                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14729         * )     case "$getlogin_r_proto" in
14730                 REENTRANT_PROTO*) ;;
14731                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14732                 esac
14733                 echo "Prototype: $try" ;;
14734         esac
14735         ;;
14736         *)      case "$usethreads" in
14737                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14738                 esac
14739                 d_getlogin_r=undef
14740                 getlogin_r_proto=0
14741                 ;;
14742         esac
14743         ;;
14744 *)      getlogin_r_proto=0
14745         ;;
14746 esac
14747
14748 : see if getmnt exists
14749 set getmnt d_getmnt
14750 eval $inlibc
14751
14752 : see if getmntent exists
14753 set getmntent d_getmntent
14754 eval $inlibc
14755
14756 : see if getnameinfo exists
14757 set getnameinfo d_getnameinfo
14758 eval $inlibc
14759
14760 : see if getnetbyaddr exists
14761 set getnetbyaddr d_getnbyaddr
14762 eval $inlibc
14763
14764 : see if getnetbyname exists
14765 set getnetbyname d_getnbyname
14766 eval $inlibc
14767
14768 : see if getnetent exists
14769 set getnetent d_getnent
14770 eval $inlibc
14771
14772 : see if getnetbyaddr_r exists
14773 set getnetbyaddr_r d_getnetbyaddr_r
14774 eval $inlibc
14775 case "$d_getnetbyaddr_r" in
14776 "$define")
14777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14778         case "$d_getnetbyaddr_r_proto:$usethreads" in
14779         ":define")      d_getnetbyaddr_r_proto=define
14780                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14781                 eval $hasproto ;;
14782         *)      ;;
14783         esac
14784         case "$d_getnetbyaddr_r_proto" in
14785         define)
14786         case "$getnetbyaddr_r_proto" in
14787         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14788         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14789         esac
14790         case "$getnetbyaddr_r_proto" in
14791         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14792         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14793         esac
14794         case "$getnetbyaddr_r_proto" in
14795         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14796         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14797         esac
14798         case "$getnetbyaddr_r_proto" in
14799         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14800         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14801         esac
14802         case "$getnetbyaddr_r_proto" in
14803         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14804         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14805         esac
14806         case "$getnetbyaddr_r_proto" in
14807         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14808         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14809         esac
14810         case "$getnetbyaddr_r_proto" in
14811         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14812         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14813         esac
14814         case "$getnetbyaddr_r_proto" in
14815         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14816         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14817         esac
14818         case "$getnetbyaddr_r_proto" in
14819         ''|0)   d_getnetbyaddr_r=undef
14820                 getnetbyaddr_r_proto=0
14821                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14822         * )     case "$getnetbyaddr_r_proto" in
14823                 REENTRANT_PROTO*) ;;
14824                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14825                 esac
14826                 echo "Prototype: $try" ;;
14827         esac
14828         ;;
14829         *)      case "$usethreads" in
14830                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14831                 esac
14832                 d_getnetbyaddr_r=undef
14833                 getnetbyaddr_r_proto=0
14834                 ;;
14835         esac
14836         ;;
14837 *)      getnetbyaddr_r_proto=0
14838         ;;
14839 esac
14840
14841 : see if getnetbyname_r exists
14842 set getnetbyname_r d_getnetbyname_r
14843 eval $inlibc
14844 case "$d_getnetbyname_r" in
14845 "$define")
14846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14847         case "$d_getnetbyname_r_proto:$usethreads" in
14848         ":define")      d_getnetbyname_r_proto=define
14849                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14850                 eval $hasproto ;;
14851         *)      ;;
14852         esac
14853         case "$d_getnetbyname_r_proto" in
14854         define)
14855         case "$getnetbyname_r_proto" in
14856         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14857         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14858         esac
14859         case "$getnetbyname_r_proto" in
14860         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14861         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14862         esac
14863         case "$getnetbyname_r_proto" in
14864         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14865         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14866         esac
14867         case "$getnetbyname_r_proto" in
14868         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14869         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14870         esac
14871         case "$getnetbyname_r_proto" in
14872         ''|0)   d_getnetbyname_r=undef
14873                 getnetbyname_r_proto=0
14874                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14875         * )     case "$getnetbyname_r_proto" in
14876                 REENTRANT_PROTO*) ;;
14877                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14878                 esac
14879                 echo "Prototype: $try" ;;
14880         esac
14881         ;;
14882         *)      case "$usethreads" in
14883                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14884                 esac
14885                 d_getnetbyname_r=undef
14886                 getnetbyname_r_proto=0
14887                 ;;
14888         esac
14889         ;;
14890 *)      getnetbyname_r_proto=0
14891         ;;
14892 esac
14893
14894 : see if getnetent_r exists
14895 set getnetent_r d_getnetent_r
14896 eval $inlibc
14897 case "$d_getnetent_r" in
14898 "$define")
14899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14900         case "$d_getnetent_r_proto:$usethreads" in
14901         ":define")      d_getnetent_r_proto=define
14902                 set d_getnetent_r_proto getnetent_r $hdrs
14903                 eval $hasproto ;;
14904         *)      ;;
14905         esac
14906         case "$d_getnetent_r_proto" in
14907         define)
14908         case "$getnetent_r_proto" in
14909         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14910         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14911         esac
14912         case "$getnetent_r_proto" in
14913         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14914         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14915         esac
14916         case "$getnetent_r_proto" in
14917         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14918         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14919         esac
14920         case "$getnetent_r_proto" in
14921         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14922         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14923         esac
14924         case "$getnetent_r_proto" in
14925         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14926         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14927         esac
14928         case "$getnetent_r_proto" in
14929         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14930         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14931         esac
14932         case "$getnetent_r_proto" in
14933         ''|0)   d_getnetent_r=undef
14934                 getnetent_r_proto=0
14935                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14936         * )     case "$getnetent_r_proto" in
14937                 REENTRANT_PROTO*) ;;
14938                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14939                 esac
14940                 echo "Prototype: $try" ;;
14941         esac
14942         ;;
14943         *)      case "$usethreads" in
14944                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14945                 esac
14946                 d_getnetent_r=undef
14947                 getnetent_r_proto=0
14948                 ;;
14949         esac
14950         ;;
14951 *)      getnetent_r_proto=0
14952         ;;
14953 esac
14954
14955 : see if prototypes for various getnetxxx netdb.h functions are available
14956 echo " "
14957 set d_getnetprotos getnetent $i_netdb netdb.h
14958 eval $hasproto
14959
14960 : see if getpagesize exists
14961 set getpagesize d_getpagsz
14962 eval $inlibc
14963
14964 : Optional checks for getprotobyname and getprotobynumber
14965
14966 : see if getprotobyname exists
14967 set getprotobyname d_getpbyname
14968 eval $inlibc
14969
14970 : see if getprotobynumber exists
14971 set getprotobynumber d_getpbynumber
14972 eval $inlibc
14973
14974 : see if getprotoent exists
14975 set getprotoent d_getpent
14976 eval $inlibc
14977
14978 : see if getpgid exists
14979 set getpgid d_getpgid
14980 eval $inlibc
14981
14982 : see if getpgrp2 exists
14983 set getpgrp2 d_getpgrp2
14984 eval $inlibc
14985
14986 : see if getppid exists
14987 set getppid d_getppid
14988 eval $inlibc
14989
14990 : see if getpriority exists
14991 set getpriority d_getprior
14992 eval $inlibc
14993
14994 : see if getprotobyname_r exists
14995 set getprotobyname_r d_getprotobyname_r
14996 eval $inlibc
14997 case "$d_getprotobyname_r" in
14998 "$define")
14999         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15000         case "$d_getprotobyname_r_proto:$usethreads" in
15001         ":define")      d_getprotobyname_r_proto=define
15002                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15003                 eval $hasproto ;;
15004         *)      ;;
15005         esac
15006         case "$d_getprotobyname_r_proto" in
15007         define)
15008         case "$getprotobyname_r_proto" in
15009         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15010         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15011         esac
15012         case "$getprotobyname_r_proto" in
15013         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15014         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15015         esac
15016         case "$getprotobyname_r_proto" in
15017         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15018         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15019         esac
15020         case "$getprotobyname_r_proto" in
15021         ''|0)   d_getprotobyname_r=undef
15022                 getprotobyname_r_proto=0
15023                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15024         * )     case "$getprotobyname_r_proto" in
15025                 REENTRANT_PROTO*) ;;
15026                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15027                 esac
15028                 echo "Prototype: $try" ;;
15029         esac
15030         ;;
15031         *)      case "$usethreads" in
15032                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15033                 esac
15034                 d_getprotobyname_r=undef
15035                 getprotobyname_r_proto=0
15036                 ;;
15037         esac
15038         ;;
15039 *)      getprotobyname_r_proto=0
15040         ;;
15041 esac
15042
15043 : see if getprotobynumber_r exists
15044 set getprotobynumber_r d_getprotobynumber_r
15045 eval $inlibc
15046 case "$d_getprotobynumber_r" in
15047 "$define")
15048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15049         case "$d_getprotobynumber_r_proto:$usethreads" in
15050         ":define")      d_getprotobynumber_r_proto=define
15051                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15052                 eval $hasproto ;;
15053         *)      ;;
15054         esac
15055         case "$d_getprotobynumber_r_proto" in
15056         define)
15057         case "$getprotobynumber_r_proto" in
15058         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15059         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15060         esac
15061         case "$getprotobynumber_r_proto" in
15062         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15063         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15064         esac
15065         case "$getprotobynumber_r_proto" in
15066         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15067         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15068         esac
15069         case "$getprotobynumber_r_proto" in
15070         ''|0)   d_getprotobynumber_r=undef
15071                 getprotobynumber_r_proto=0
15072                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15073         * )     case "$getprotobynumber_r_proto" in
15074                 REENTRANT_PROTO*) ;;
15075                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15076                 esac
15077                 echo "Prototype: $try" ;;
15078         esac
15079         ;;
15080         *)      case "$usethreads" in
15081                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15082                 esac
15083                 d_getprotobynumber_r=undef
15084                 getprotobynumber_r_proto=0
15085                 ;;
15086         esac
15087         ;;
15088 *)      getprotobynumber_r_proto=0
15089         ;;
15090 esac
15091
15092 : see if getprotoent_r exists
15093 set getprotoent_r d_getprotoent_r
15094 eval $inlibc
15095 case "$d_getprotoent_r" in
15096 "$define")
15097         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15098         case "$d_getprotoent_r_proto:$usethreads" in
15099         ":define")      d_getprotoent_r_proto=define
15100                 set d_getprotoent_r_proto getprotoent_r $hdrs
15101                 eval $hasproto ;;
15102         *)      ;;
15103         esac
15104         case "$d_getprotoent_r_proto" in
15105         define)
15106         case "$getprotoent_r_proto" in
15107         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15108         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15109         esac
15110         case "$getprotoent_r_proto" in
15111         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15112         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15113         esac
15114         case "$getprotoent_r_proto" in
15115         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15116         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15117         esac
15118         case "$getprotoent_r_proto" in
15119         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15120         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15121         esac
15122         case "$getprotoent_r_proto" in
15123         ''|0)   d_getprotoent_r=undef
15124                 getprotoent_r_proto=0
15125                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15126         * )     case "$getprotoent_r_proto" in
15127                 REENTRANT_PROTO*) ;;
15128                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15129                 esac
15130                 echo "Prototype: $try" ;;
15131         esac
15132         ;;
15133         *)      case "$usethreads" in
15134                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15135                 esac
15136                 d_getprotoent_r=undef
15137                 getprotoent_r_proto=0
15138                 ;;
15139         esac
15140         ;;
15141 *)      getprotoent_r_proto=0
15142         ;;
15143 esac
15144
15145 : see if prototypes for various getprotoxxx netdb.h functions are available
15146 echo " "
15147 set d_getprotoprotos getprotoent $i_netdb netdb.h
15148 eval $hasproto
15149
15150 : see if getprpwnam exists
15151 set getprpwnam d_getprpwnam
15152 eval $inlibc
15153
15154 : see if getpwent exists
15155 set getpwent d_getpwent
15156 eval $inlibc
15157
15158 : see if getpwent_r exists
15159 set getpwent_r d_getpwent_r
15160 eval $inlibc
15161 case "$d_getpwent_r" in
15162 "$define")
15163         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15164         case "$d_getpwent_r_proto:$usethreads" in
15165         ":define")      d_getpwent_r_proto=define
15166                 set d_getpwent_r_proto getpwent_r $hdrs
15167                 eval $hasproto ;;
15168         *)      ;;
15169         esac
15170         case "$d_getpwent_r_proto" in
15171         define)
15172         case "$getpwent_r_proto" in
15173         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15174         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15175         esac
15176         case "$getpwent_r_proto" in
15177         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15178         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15179         esac
15180         case "$getpwent_r_proto" in
15181         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15182         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15183         esac
15184         case "$getpwent_r_proto" in
15185         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15186         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15187         esac
15188         case "$getpwent_r_proto" in
15189         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15190         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15191         esac
15192         case "$getpwent_r_proto" in
15193         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15194         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15195         esac
15196         case "$getpwent_r_proto" in
15197         ''|0)   d_getpwent_r=undef
15198                 getpwent_r_proto=0
15199                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15200         * )     case "$getpwent_r_proto" in
15201                 REENTRANT_PROTO*) ;;
15202                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15203                 esac
15204                 echo "Prototype: $try" ;;
15205         esac
15206         ;;
15207         *)      case "$usethreads" in
15208                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15209                 esac
15210                 d_getpwent_r=undef
15211                 getpwent_r_proto=0
15212                 ;;
15213         esac
15214         ;;
15215 *)      getpwent_r_proto=0
15216         ;;
15217 esac
15218
15219 : see if getpwnam_r exists
15220 set getpwnam_r d_getpwnam_r
15221 eval $inlibc
15222 case "$d_getpwnam_r" in
15223 "$define")
15224         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15225         case "$d_getpwnam_r_proto:$usethreads" in
15226         ":define")      d_getpwnam_r_proto=define
15227                 set d_getpwnam_r_proto getpwnam_r $hdrs
15228                 eval $hasproto ;;
15229         *)      ;;
15230         esac
15231         case "$d_getpwnam_r_proto" in
15232         define)
15233         case "$getpwnam_r_proto" in
15234         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15235         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15236         esac
15237         case "$getpwnam_r_proto" in
15238         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15239         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15240         esac
15241         case "$getpwnam_r_proto" in
15242         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15243         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15244         esac
15245         case "$getpwnam_r_proto" in
15246         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15247         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15248         esac
15249         case "$getpwnam_r_proto" in
15250         ''|0)   d_getpwnam_r=undef
15251                 getpwnam_r_proto=0
15252                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15253         * )     case "$getpwnam_r_proto" in
15254                 REENTRANT_PROTO*) ;;
15255                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15256                 esac
15257                 echo "Prototype: $try" ;;
15258         esac
15259         ;;
15260         *)      case "$usethreads" in
15261                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15262                 esac
15263                 d_getpwnam_r=undef
15264                 getpwnam_r_proto=0
15265                 ;;
15266         esac
15267         ;;
15268 *)      getpwnam_r_proto=0
15269         ;;
15270 esac
15271
15272 : see if getpwuid_r exists
15273 set getpwuid_r d_getpwuid_r
15274 eval $inlibc
15275 case "$d_getpwuid_r" in
15276 "$define")
15277         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15278         case "$d_getpwuid_r_proto:$usethreads" in
15279         ":define")      d_getpwuid_r_proto=define
15280                 set d_getpwuid_r_proto getpwuid_r $hdrs
15281                 eval $hasproto ;;
15282         *)      ;;
15283         esac
15284         case "$d_getpwuid_r_proto" in
15285         define)
15286         case "$getpwuid_r_proto" in
15287         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15288         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15289         esac
15290         case "$getpwuid_r_proto" in
15291         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15292         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15293         esac
15294         case "$getpwuid_r_proto" in
15295         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15296         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15297         esac
15298         case "$getpwuid_r_proto" in
15299         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15300         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15301         esac
15302         case "$getpwuid_r_proto" in
15303         ''|0)   d_getpwuid_r=undef
15304                 getpwuid_r_proto=0
15305                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15306         * )     case "$getpwuid_r_proto" in
15307                 REENTRANT_PROTO*) ;;
15308                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15309                 esac
15310                 echo "Prototype: $try" ;;
15311         esac
15312         ;;
15313         *)      case "$usethreads" in
15314                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15315                 esac
15316                 d_getpwuid_r=undef
15317                 getpwuid_r_proto=0
15318                 ;;
15319         esac
15320         ;;
15321 *)      getpwuid_r_proto=0
15322         ;;
15323 esac
15324
15325 : Optional checks for getsbyname and getsbyport
15326
15327 : see if getservbyname exists
15328 set getservbyname d_getsbyname
15329 eval $inlibc
15330
15331 : see if getservbyport exists
15332 set getservbyport d_getsbyport
15333 eval $inlibc
15334
15335 : see if getservent exists
15336 set getservent d_getsent
15337 eval $inlibc
15338
15339 : see if getservbyname_r exists
15340 set getservbyname_r d_getservbyname_r
15341 eval $inlibc
15342 case "$d_getservbyname_r" in
15343 "$define")
15344         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15345         case "$d_getservbyname_r_proto:$usethreads" in
15346         ":define")      d_getservbyname_r_proto=define
15347                 set d_getservbyname_r_proto getservbyname_r $hdrs
15348                 eval $hasproto ;;
15349         *)      ;;
15350         esac
15351         case "$d_getservbyname_r_proto" in
15352         define)
15353         case "$getservbyname_r_proto" in
15354         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15355         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15356         esac
15357         case "$getservbyname_r_proto" in
15358         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15359         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15360         esac
15361         case "$getservbyname_r_proto" in
15362         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15363         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15364         esac
15365         case "$getservbyname_r_proto" in
15366         ''|0)   d_getservbyname_r=undef
15367                 getservbyname_r_proto=0
15368                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15369         * )     case "$getservbyname_r_proto" in
15370                 REENTRANT_PROTO*) ;;
15371                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15372                 esac
15373                 echo "Prototype: $try" ;;
15374         esac
15375         ;;
15376         *)      case "$usethreads" in
15377                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15378                 esac
15379                 d_getservbyname_r=undef
15380                 getservbyname_r_proto=0
15381                 ;;
15382         esac
15383         ;;
15384 *)      getservbyname_r_proto=0
15385         ;;
15386 esac
15387
15388 : see if getservbyport_r exists
15389 set getservbyport_r d_getservbyport_r
15390 eval $inlibc
15391 case "$d_getservbyport_r" in
15392 "$define")
15393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15394         case "$d_getservbyport_r_proto:$usethreads" in
15395         ":define")      d_getservbyport_r_proto=define
15396                 set d_getservbyport_r_proto getservbyport_r $hdrs
15397                 eval $hasproto ;;
15398         *)      ;;
15399         esac
15400         case "$d_getservbyport_r_proto" in
15401         define)
15402         case "$getservbyport_r_proto" in
15403         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15404         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15405         esac
15406         case "$getservbyport_r_proto" in
15407         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15408         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15409         esac
15410         case "$getservbyport_r_proto" in
15411         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15412         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15413         esac
15414         case "$getservbyport_r_proto" in
15415         ''|0)   d_getservbyport_r=undef
15416                 getservbyport_r_proto=0
15417                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15418         * )     case "$getservbyport_r_proto" in
15419                 REENTRANT_PROTO*) ;;
15420                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15421                 esac
15422                 echo "Prototype: $try" ;;
15423         esac
15424         ;;
15425         *)      case "$usethreads" in
15426                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15427                 esac
15428                 d_getservbyport_r=undef
15429                 getservbyport_r_proto=0
15430                 ;;
15431         esac
15432         ;;
15433 *)      getservbyport_r_proto=0
15434         ;;
15435 esac
15436
15437 : see if getservent_r exists
15438 set getservent_r d_getservent_r
15439 eval $inlibc
15440 case "$d_getservent_r" in
15441 "$define")
15442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15443         case "$d_getservent_r_proto:$usethreads" in
15444         ":define")      d_getservent_r_proto=define
15445                 set d_getservent_r_proto getservent_r $hdrs
15446                 eval $hasproto ;;
15447         *)      ;;
15448         esac
15449         case "$d_getservent_r_proto" in
15450         define)
15451         case "$getservent_r_proto" in
15452         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15453         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15454         esac
15455         case "$getservent_r_proto" in
15456         ''|0) try='int getservent_r(struct servent*, char*, int);'
15457         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15458         esac
15459         case "$getservent_r_proto" in
15460         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15461         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15462         esac
15463         case "$getservent_r_proto" in
15464         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15465         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15466         esac
15467         case "$getservent_r_proto" in
15468         ''|0)   d_getservent_r=undef
15469                 getservent_r_proto=0
15470                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15471         * )     case "$getservent_r_proto" in
15472                 REENTRANT_PROTO*) ;;
15473                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15474                 esac
15475                 echo "Prototype: $try" ;;
15476         esac
15477         ;;
15478         *)      case "$usethreads" in
15479                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15480                 esac
15481                 d_getservent_r=undef
15482                 getservent_r_proto=0
15483                 ;;
15484         esac
15485         ;;
15486 *)      getservent_r_proto=0
15487         ;;
15488 esac
15489
15490 : see if prototypes for various getservxxx netdb.h functions are available
15491 echo " "
15492 set d_getservprotos getservent $i_netdb netdb.h
15493 eval $hasproto
15494
15495 : see if getspnam exists
15496 set getspnam d_getspnam
15497 eval $inlibc
15498
15499 : see if this is a shadow.h system
15500 set shadow.h i_shadow
15501 eval $inhdr
15502
15503 : see if getspnam_r exists
15504 set getspnam_r d_getspnam_r
15505 eval $inlibc
15506 case "$d_getspnam_r" in
15507 "$define")
15508         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15509         case "$d_getspnam_r_proto:$usethreads" in
15510         ":define")      d_getspnam_r_proto=define
15511                 set d_getspnam_r_proto getspnam_r $hdrs
15512                 eval $hasproto ;;
15513         *)      ;;
15514         esac
15515         case "$d_getspnam_r_proto" in
15516         define)
15517         case "$getspnam_r_proto" in
15518         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15519         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15520         esac
15521         case "$getspnam_r_proto" in
15522         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15523         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15524         esac
15525         case "$getspnam_r_proto" in
15526         ''|0)   d_getspnam_r=undef
15527                 getspnam_r_proto=0
15528                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15529         * )     case "$getspnam_r_proto" in
15530                 REENTRANT_PROTO*) ;;
15531                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15532                 esac
15533                 echo "Prototype: $try" ;;
15534         esac
15535         ;;
15536         *)      case "$usethreads" in
15537                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15538                 esac
15539                 d_getspnam_r=undef
15540                 getspnam_r_proto=0
15541                 ;;
15542         esac
15543         ;;
15544 *)      getspnam_r_proto=0
15545         ;;
15546 esac
15547
15548 : see if gettimeofday or ftime exists
15549 set gettimeofday d_gettimeod
15550 eval $inlibc
15551 case "$d_gettimeod" in
15552 "$undef")
15553         set ftime d_ftime 
15554         eval $inlibc
15555         ;;
15556 *)
15557         val="$undef"; set d_ftime; eval $setvar
15558         ;;
15559 esac
15560 case "$d_gettimeod$d_ftime" in
15561 "$undef$undef")
15562         echo " "
15563         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15564         ;;
15565 esac
15566
15567 : see if gmtime_r exists
15568 set gmtime_r d_gmtime_r
15569 eval $inlibc
15570 case "$d_gmtime_r" in
15571 "$define")
15572         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15573         case "$d_gmtime_r_proto:$usethreads" in
15574         ":define")      d_gmtime_r_proto=define
15575                 set d_gmtime_r_proto gmtime_r $hdrs
15576                 eval $hasproto ;;
15577         *)      ;;
15578         esac
15579         case "$d_gmtime_r_proto" in
15580         define)
15581         case "$gmtime_r_proto" in
15582         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15583         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15584         esac
15585         case "$gmtime_r_proto" in
15586         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15587         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15588         esac
15589         case "$gmtime_r_proto" in
15590         ''|0)   d_gmtime_r=undef
15591                 gmtime_r_proto=0
15592                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15593         * )     case "$gmtime_r_proto" in
15594                 REENTRANT_PROTO*) ;;
15595                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15596                 esac
15597                 echo "Prototype: $try" ;;
15598         esac
15599         ;;
15600         *)      case "$usethreads" in
15601                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15602                 esac
15603                 d_gmtime_r=undef
15604                 gmtime_r_proto=0
15605                 ;;
15606         esac
15607         ;;
15608 *)      gmtime_r_proto=0
15609         ;;
15610 esac
15611
15612 : see if hasmntopt exists
15613 set hasmntopt d_hasmntopt
15614 eval $inlibc
15615
15616 : see if this is a netinet/in.h or sys/in.h system
15617 set netinet/in.h i_niin sys/in.h i_sysin
15618 eval $inhdr
15619
15620 : see if arpa/inet.h has to be included
15621 set arpa/inet.h i_arpainet
15622 eval $inhdr
15623
15624 : see if htonl --and friends-- exists
15625 val=''
15626 set htonl val
15627 eval $inlibc
15628
15629 : Maybe they are macros.
15630 case "$val" in
15631 $undef)
15632         $cat >htonl.c <<EOM
15633 #include <stdio.h>
15634 #include <sys/types.h>
15635 #$i_niin I_NETINET_IN
15636 #$i_sysin I_SYS_IN
15637 #$i_arpainet I_ARPA_INET
15638 #ifdef I_NETINET_IN
15639 #include <netinet/in.h>
15640 #endif
15641 #ifdef I_SYS_IN
15642 #include <sys/in.h>
15643 #endif
15644 #ifdef I_ARPA_INET
15645 #include <arpa/inet.h>
15646 #endif
15647 #ifdef htonl
15648 printf("Defined as a macro.");
15649 #endif
15650 EOM
15651         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15652         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15653                 val="$define"
15654                 echo "But it seems to be defined as a macro." >&4
15655         fi
15656         $rm -f htonl.?
15657         ;;
15658 esac
15659 set d_htonl
15660 eval $setvar
15661
15662 : see if hypot exists
15663 set hypot d_hypot
15664 eval $inlibc
15665
15666 : see if ilogb exists
15667 set ilogb d_ilogb
15668 eval $inlibc
15669
15670 : see if ilogbl exists
15671 set ilogbl d_ilogbl
15672 eval $inlibc
15673
15674 : check whether inet_aton exists
15675 set inet_aton d_inetaton
15676 eval $inlibc
15677
15678 : see if inet_ntop exists
15679 set inet_ntop d_inetntop
15680 eval $inlibc
15681
15682 : see if inet_pton exists
15683 set inet_pton d_inetpton
15684 eval $inlibc
15685
15686 : Look for isascii
15687 echo " "
15688 $cat >isascii.c <<EOCP
15689 #include <stdio.h>
15690 #include <ctype.h>
15691 #$i_stdlib I_STDLIB
15692 #ifdef I_STDLIB
15693 #include <stdlib.h>
15694 #endif
15695 int main() {
15696         int c = 'A';
15697         if (isascii(c))
15698                 exit(0);
15699         else
15700                 exit(1);
15701 }
15702 EOCP
15703 set isascii
15704 if eval $compile; then
15705         echo "isascii() found." >&4
15706         val="$define"
15707 else
15708         echo "isascii() NOT found." >&4
15709         val="$undef"
15710 fi
15711 set d_isascii
15712 eval $setvar
15713 $rm -f isascii*
15714
15715 : Look for isblank
15716 echo " "
15717 $cat >isblank.c <<'EOCP'
15718 #include <stdio.h>
15719 #include <ctype.h>
15720 int main() {
15721         int c = ' ';
15722         if (isblank(c))
15723                 return 0 ;
15724         else
15725                 return 1 ;
15726 }
15727 EOCP
15728 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15729         echo "isblank() found." >&4
15730         val="$define"
15731 else
15732         echo "isblank() NOT found." >&4
15733         val="$undef"
15734 fi
15735 set d_isblank
15736 eval $setvar
15737 $rm -f isblank*
15738
15739 : check for isfinite
15740 echo "Checking to see if you have isfinite..." >&4
15741 $cat >try.c <<EOCP
15742 #include <math.h>
15743 int main() { return isfinite(0.0); }
15744 EOCP
15745 set try
15746 if eval $compile; then
15747         val="$define"
15748         echo "You have isfinite."
15749 else
15750         val="$undef"
15751         echo "You do not have isfinite."
15752 fi
15753 $rm_try
15754 set d_isfinite
15755 eval $setvar
15756
15757 : see if isfinitel exists
15758 set isfinitel d_isfinitel
15759 eval $inlibc
15760
15761 : check for isinf
15762 echo "Checking to see if you have isinf..." >&4
15763 $cat >try.c <<EOCP
15764 #include <math.h>
15765 int main() { return isinf(0.0); }
15766 EOCP
15767 set try
15768 if eval $compile; then
15769         val="$define"
15770         echo "You have isinf."
15771 else
15772         val="$undef"
15773         echo "You do not have isinf."
15774 fi
15775 $rm_try
15776 set d_isinf
15777 eval $setvar
15778
15779 : see if isinfl exists
15780 set isinfl d_isinfl
15781 eval $inlibc
15782
15783 : check for isless
15784 echo "Checking to see if you have isless..." >&4
15785 $cat >try.c <<EOCP
15786 #include <math.h>
15787 int main() { return isless(0.0); }
15788 EOCP
15789 set try
15790 if eval $compile; then
15791         val="$define"
15792         echo "You have isless."
15793 else
15794         val="$undef"
15795         echo "You do not have isless."
15796 fi
15797 $rm_try
15798 set d_isless
15799 eval $setvar
15800
15801 : check for isnan
15802 echo "Checking to see if you have isnan..." >&4
15803 $cat >try.c <<EOCP
15804 #include <math.h>
15805 int main() { return isnan(0.0); }
15806 EOCP
15807 set try
15808 if eval $compile; then
15809         val="$define"
15810         echo "You have isnan."
15811 else
15812         val="$undef"
15813         echo "You do not have isnan."
15814 fi
15815 $rm_try
15816 set d_isnan
15817 eval $setvar
15818
15819 : see if isnanl exists
15820 set isnanl d_isnanl
15821 eval $inlibc
15822
15823 : check for isnormal
15824 echo "Checking to see if you have isnormal..." >&4
15825 $cat >try.c <<EOCP
15826 #include <math.h>
15827 int main() { return isnormal(0.0); }
15828 EOCP
15829 set try
15830 if eval $compile; then
15831         val="$define"
15832         echo "You have isnormal."
15833 else
15834         val="$undef"
15835         echo "You do not have isnormal."
15836 fi
15837 $rm_try
15838 set d_isnormal
15839 eval $setvar
15840
15841 : see if j0 exists
15842 set j0 d_j0
15843 eval $inlibc
15844
15845 : see if j0l exists
15846 set j0l d_j0l
15847 eval $inlibc
15848
15849 : see if killpg exists
15850 set killpg d_killpg
15851 eval $inlibc
15852
15853 : see if localeconv exists
15854 set localeconv d_locconv
15855 eval $inlibc
15856
15857 : see if libc has the POSIX.1-2008 currency locale rules
15858 case "$d_locconv:$d_lc_monetary_2008" in
15859 $define:)
15860         $cat >try.c <<EOCP
15861 #include <locale.h>
15862 int main() {
15863         struct lconv *lc = localeconv();
15864         char int_p_cs_precedes = lc->int_p_cs_precedes;
15865         return 0;
15866 }
15867 EOCP
15868         set try
15869         if eval $compile; then
15870                 d_lc_monetary_2008="$define"
15871         else
15872                 d_lc_monetary_2008="$undef"
15873         fi;
15874         $rm_try
15875         ;;
15876 esac
15877
15878 : see if lchown exists
15879 echo " "
15880 $cat > try.c <<'EOCP'
15881 /* System header to define __stub macros and hopefully few prototypes,
15882     which can conflict with char lchown(); below.  */
15883 #include <assert.h>
15884 /* Override any gcc2 internal prototype to avoid an error.  */
15885 /* We use char because int might match the return type of a gcc2
15886    builtin and then its argument prototype would still apply.  */
15887 char lchown();
15888 int main() {
15889     /*  The GNU C library defines this for functions which it implements
15890         to always fail with ENOSYS.  Some functions are actually named
15891         something starting with __ and the normal name is an alias.  */
15892 #if defined (__stub_lchown) || defined (__stub___lchown)
15893 choke me
15894 #else
15895 lchown();
15896 #endif
15897 ; return 0; }
15898 EOCP
15899 set try
15900 if eval $compile; then
15901     $echo "lchown() found." >&4
15902     val="$define"
15903 else
15904     $echo "lchown() NOT found." >&4
15905     val="$undef"
15906 fi
15907 set d_lchown
15908 eval $setvar
15909
15910 : See if number of significant digits in a double precision number is known
15911 echo " "
15912 $cat >ldbl_dig.c <<EOM
15913 #include <limits.h>
15914 #include <float.h>
15915 #ifdef LDBL_DIG
15916 printf("Contains LDBL_DIG");
15917 #endif
15918 EOM
15919 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15920 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15921         echo "LDBL_DIG found." >&4
15922         val="$define"
15923 else
15924         echo "LDBL_DIG NOT found." >&4
15925         val="$undef"
15926 fi
15927 $rm -f ldbl_dig.?
15928 set d_ldbl_dig
15929 eval $setvar
15930
15931 : see if lgamma exists
15932 set lgamma d_lgamma
15933 eval $inlibc
15934
15935 : see if lgamma_r exists
15936 set lgamma_r d_lgamma_r
15937 eval $inlibc
15938
15939 : check to see if math.h defines _LIB_VERSION
15940 d_libm_lib_version="$undef"
15941 echo " "
15942 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15943 $cat >try.c <<EOCP
15944 #include <unistd.h>
15945 #include <math.h>
15946 int main (int argc, char *argv[])
15947 {
15948     printf ("%d\n", _LIB_VERSION);
15949     return (0);
15950     } /* main */
15951 EOCP
15952 set try
15953 if eval $compile; then
15954     foo=`$run ./try`
15955     echo "Yes, it does ($foo)" >&4
15956     d_libm_lib_version="$define"
15957 else
15958     echo "No, it does not (probably harmless)" >&4
15959     fi
15960 $rm_try
15961
15962 : see if link exists
15963 set link d_link
15964 eval $inlibc
15965
15966 : see if llrint exists
15967 set llrint d_llrint
15968 eval $inlibc
15969
15970 : see if llrintl exists
15971 set llrintl d_llrintl
15972 eval $inlibc
15973
15974 : see if llround exists
15975 set llround d_llround
15976 eval $inlibc
15977
15978 : see if llroundl exists
15979 set llroundl d_llroundl
15980 eval $inlibc
15981
15982 : see if localeconv_l exists
15983 set localeconv_l d_localeconv_l
15984 eval $inlibc
15985
15986 : see if localtime_r exists
15987 set localtime_r d_localtime_r
15988 eval $inlibc
15989 case "$d_localtime_r" in
15990 "$define")
15991         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15992         case "$d_localtime_r_proto:$usethreads" in
15993         ":define")      d_localtime_r_proto=define
15994                 set d_localtime_r_proto localtime_r $hdrs
15995                 eval $hasproto ;;
15996         *)      ;;
15997         esac
15998         case "$d_localtime_r_proto" in
15999         define)
16000         case "$localtime_r_proto" in
16001         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16002         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16003         esac
16004         case "$localtime_r_proto" in
16005         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16006         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16007         esac
16008         case "$localtime_r_proto" in
16009         ''|0)   d_localtime_r=undef
16010                 localtime_r_proto=0
16011                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16012         * )     case "$localtime_r_proto" in
16013                 REENTRANT_PROTO*) ;;
16014                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16015                 esac
16016                 echo "Prototype: $try" ;;
16017         esac
16018         ;;
16019         *)      case "$usethreads" in
16020                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16021                 esac
16022                 d_localtime_r=undef
16023                 localtime_r_proto=0
16024                 ;;
16025         esac
16026         ;;
16027 *)      localtime_r_proto=0
16028         ;;
16029 esac
16030
16031 : see if localtime_r calls tzset
16032 case "$localtime_r_proto" in
16033 REENTRANT_PROTO*)
16034         $cat >try.c <<EOCP
16035 /*  Does our libc's localtime_r call tzset ?
16036  *  return 0 if so, 1 otherwise.
16037  */
16038 #$i_systypes    I_SYS_TYPES
16039 #$i_unistd      I_UNISTD
16040 #$i_time        I_TIME
16041 #$i_stdlib      I_STDLIB
16042 #$i_malloc      I_MALLOC
16043 #ifdef I_SYS_TYPES
16044 #  include <sys/types.h>
16045 #endif
16046 #ifdef I_UNISTD
16047 #  include <unistd.h>
16048 #endif
16049 #ifdef I_TIME
16050 #  include <time.h>
16051 #endif
16052 #ifdef I_STDLIB
16053 #include <stdlib.h>
16054 #endif
16055 #include <string.h>
16056 #ifdef I_MALLOC
16057 #  include <malloc.h>
16058 #endif
16059 int main()
16060 {
16061     time_t t = time(0L);
16062     char w_tz[]="TZ" "=GMT+5",
16063          e_tz[]="TZ" "=GMT-5",
16064         *tz_e = (char*)malloc(16),
16065         *tz_w = (char*)malloc(16);
16066     struct tm tm_e, tm_w;
16067     memset(&tm_e,'\0',sizeof(struct tm));
16068     memset(&tm_w,'\0',sizeof(struct tm));
16069     strcpy(tz_e,e_tz);
16070     strcpy(tz_w,w_tz);
16071
16072     putenv(tz_e);
16073     localtime_r(&t, &tm_e);
16074
16075     putenv(tz_w);
16076     localtime_r(&t, &tm_w);
16077
16078     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16079         return 1;
16080     return 0;
16081 }
16082 EOCP
16083         set try
16084         if eval $compile; then
16085             if $run ./try; then
16086                 d_localtime_r_needs_tzset=undef;
16087             else
16088                 d_localtime_r_needs_tzset=define;
16089             fi;
16090         else
16091             d_localtime_r_needs_tzset=undef;
16092         fi;
16093      ;;
16094   *)
16095      d_localtime_r_needs_tzset=undef;
16096      ;;
16097 esac
16098 $rm_try
16099
16100 : see if lockf exists
16101 set lockf d_lockf
16102 eval $inlibc
16103
16104 : see if log1p exists
16105 set log1p d_log1p
16106 eval $inlibc
16107
16108 : see if log2 exists
16109 set log2 d_log2
16110 eval $inlibc
16111
16112 : see if logb exists
16113 set logb d_logb
16114 eval $inlibc
16115
16116 : see if lrint exists
16117 set lrint d_lrint
16118 eval $inlibc
16119
16120 : see if lrintl exists
16121 set lrintl d_lrintl
16122 eval $inlibc
16123
16124 : see if lround exists
16125 set lround d_lround
16126 eval $inlibc
16127
16128 : see if lroundl exists
16129 set lroundl d_lroundl
16130 eval $inlibc
16131
16132 : see if prototype for lseek is available
16133 echo " "
16134 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16135 eval $hasproto
16136
16137 : see if lstat exists
16138 set lstat d_lstat
16139 eval $inlibc
16140
16141 : see if madvise exists
16142 set madvise d_madvise
16143 eval $inlibc
16144
16145 : see if malloc_size exists
16146 set malloc_size d_malloc_size
16147 eval $inlibc
16148
16149 : see if malloc_size_good exists
16150 set malloc_good_size d_malloc_good_size
16151 eval $inlibc
16152
16153 : see if mblen exists
16154 set mblen d_mblen
16155 eval $inlibc
16156
16157 : see if mbrlen exists
16158 set mbrlen d_mbrlen
16159 eval $inlibc
16160
16161 : see if mbrtowc exists
16162 set mbrtowc d_mbrtowc
16163 eval $inlibc
16164
16165 : see if mbstowcs exists
16166 set mbstowcs d_mbstowcs
16167 eval $inlibc
16168
16169 : see if mbtowc exists
16170 set mbtowc d_mbtowc
16171 eval $inlibc
16172
16173 : see if memmem exists
16174 : We need both a prototype in string.h and the symbol in libc.
16175 echo " "
16176 d_memmem_proto=''
16177 xx1="#$d_gnulibc HAS_GNULIBC"
16178 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16179 xx3='#   define _GNU_SOURCE'
16180 xx4='#endif'
16181 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16182 eval $hasproto
16183 case "$d_memmem_proto" in
16184     define) # see if memmem exists
16185         set memmem d_memmem
16186         eval $inlibc
16187         ;;
16188     *)  val=$undef
16189         set d_memmem
16190         eval $setvar
16191         ;;
16192 esac
16193
16194 : see if memrchr exists
16195 : We need both a prototype in string.h and the symbol in libc.
16196 echo " "
16197 d_memrchr_proto=''
16198 xx1="#$d_gnulibc HAS_GNULIBC"
16199 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16200 xx3='#   define _GNU_SOURCE'
16201 xx4='#endif'
16202 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16203 eval $hasproto
16204 case "$d_memrchr_proto" in
16205     define) # see if memrchr exists
16206         set memrchr d_memrchr
16207         eval $inlibc
16208         ;;
16209     *)  val=$undef
16210         set d_memrchr
16211         eval $setvar
16212         ;;
16213 esac
16214
16215 : see if mkdir exists
16216 set mkdir d_mkdir
16217 eval $inlibc
16218
16219 : see if mkdtemp exists
16220 set mkdtemp d_mkdtemp
16221 eval $inlibc
16222
16223 : see if mkfifo exists
16224 set mkfifo d_mkfifo
16225 eval $inlibc
16226
16227 : see if mkostemp exists
16228 set mkostemp d_mkostemp
16229 eval $inlibc
16230
16231 : see if mkstemp exists
16232 set mkstemp d_mkstemp
16233 eval $inlibc
16234
16235 : see if mkstemps exists
16236 set mkstemps d_mkstemps
16237 eval $inlibc
16238
16239 : see if mktime exists
16240 set mktime d_mktime
16241 eval $inlibc
16242
16243 : see if sys/mman.h has to be included
16244 set sys/mman.h i_sysmman
16245 eval $inhdr
16246
16247 : see if mmap exists
16248 set mmap d_mmap
16249 eval $inlibc
16250 : see what shmat returns
16251 : default to something harmless
16252 mmaptype='void *'
16253 case "$i_sysmman$d_mmap" in
16254 "$define$define")
16255         $cat >mmap.c <<'END'
16256 #include <sys/mman.h>
16257 void *mmap();
16258 END
16259         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16260                 mmaptype='void *'
16261         else
16262                 mmaptype='caddr_t'
16263         fi
16264         echo "and it returns ($mmaptype)." >&4
16265         ;;
16266 esac
16267
16268 : see if sqrtl exists
16269 set sqrtl d_sqrtl
16270 eval $inlibc
16271
16272 : see if scalbnl exists
16273 set scalbnl d_scalbnl
16274 eval $inlibc
16275
16276 : see if truncl exists
16277 set truncl d_truncl
16278 eval $inlibc
16279
16280 : see if modfl exists
16281 set modfl d_modfl
16282 eval $inlibc
16283
16284 : see if prototype for modfl is available
16285 echo " "
16286 set d_modflproto modfl define math.h
16287 eval $hasproto
16288
16289 if $test "$uselongdouble" = "$define"; then
16290     message=""
16291     if $test "$d_sqrtl" != "$define"; then
16292         message="$message sqrtl"
16293     fi
16294     if $test "$d_modfl" != "$define"; then
16295         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16296             echo "You have both truncl and copysignl, so I can emulate modfl."
16297         else
16298             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16299                 echo "You have both aintl and copysignl, so I can emulate modfl."
16300             else
16301                 message="$message modfl"
16302             fi
16303         fi
16304     fi
16305     if $test "$d_frexpl" != "$define"; then
16306         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16307             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16308         else
16309             message="$message frexpl"
16310         fi
16311     fi
16312     if $test "$d_ldexpl" != "$define"; then
16313         message="$message ldexpl"
16314     fi
16315
16316     if $test "$message" != ""; then
16317         $cat <<EOM >&4
16318
16319 *** You requested the use of long doubles but you do not seem to have
16320 *** the following mathematical functions needed for long double support:
16321 ***    $message
16322 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16323 *** Cannot continue, aborting.
16324
16325 EOM
16326
16327         exit 1
16328     fi
16329 fi
16330
16331 : see if mprotect exists
16332 set mprotect d_mprotect
16333 eval $inlibc
16334
16335 : see if msgctl exists
16336 set msgctl d_msgctl
16337 eval $inlibc
16338
16339 : see if msgget exists
16340 set msgget d_msgget
16341 eval $inlibc
16342
16343 : see if msgsnd exists
16344 set msgsnd d_msgsnd
16345 eval $inlibc
16346
16347 : see if msgrcv exists
16348 set msgrcv d_msgrcv
16349 eval $inlibc
16350
16351 : see how much of the 'msg*(2)' library is present.
16352 h_msg=true
16353 echo " "
16354 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16355 *"$undef"*) h_msg=false;;
16356 esac
16357 case "$osname" in
16358 freebsd)
16359     case "`ipcs 2>&1`" in
16360     "SVID messages"*"not configured"*)
16361         echo "Your $osname does not have the msg*(2) configured." >&4
16362         h_msg=false
16363         val="$undef"
16364         set msgctl d_msgctl
16365         eval $setvar
16366         set msgget d_msgget
16367         eval $setvar
16368         set msgsnd d_msgsnd
16369         eval $setvar
16370         set msgrcv d_msgrcv
16371         eval $setvar
16372         ;;
16373     esac
16374     ;;
16375 esac
16376 : we could also check for sys/ipc.h ...
16377 if $h_msg && $test `./findhdr sys/msg.h`; then
16378         echo "You have the full msg*(2) library." >&4
16379         val="$define"
16380 else
16381         echo "You don't have the full msg*(2) library." >&4
16382         val="$undef"
16383 fi
16384 set d_msg
16385 eval $setvar
16386
16387 : Check for msghdr_s
16388 echo " "
16389 echo "Checking to see if your system supports struct msghdr..." >&4
16390 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16391 eval $hasstruct
16392 case "$d_msghdr_s" in
16393 "$define")      echo "Yes, it does."   ;;
16394 *)              echo "No, it doesn't." ;;
16395 esac
16396
16397 : see if msync exists
16398 set msync d_msync
16399 eval $inlibc
16400
16401 : see if munmap exists
16402 set munmap d_munmap
16403 eval $inlibc
16404
16405 : see if nan exists
16406 set nan d_nan
16407 eval $inlibc
16408
16409 : see if nanosleep exists
16410 set nanosleep d_nanosleep
16411 eval $inlibc
16412
16413 : see if nearbyint exists
16414 set nearbyint d_nearbyint
16415 eval $inlibc
16416
16417 : see if nextafter exists
16418 set nextafter d_nextafter
16419 eval $inlibc
16420
16421 : see if nexttoward exists
16422 set nexttoward d_nexttoward
16423 eval $inlibc
16424
16425 : see if nice exists
16426 set nice d_nice
16427 eval $inlibc
16428
16429 : see if this is a langinfo.h system
16430 set langinfo.h i_langinfo
16431 eval $inhdr
16432
16433 : see if nl_langinfo exists
16434 set nl_langinfo d_nl_langinfo
16435 eval $inlibc
16436
16437 : see if this is a quadmath.h system
16438 set quadmath.h i_quadmath
16439 eval $inhdr
16440
16441 : Check basic sizes
16442 echo " "
16443 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16444
16445 case "$use64bitint:$d_quad:$quadtype" in
16446 define:define:?*)
16447         ivtype="$quadtype"
16448         uvtype="$uquadtype"
16449         ivsize=8
16450         uvsize=8
16451         ;;
16452 *)      ivtype="long"
16453         uvtype="unsigned long"
16454         ivsize=$longsize
16455         uvsize=$longsize
16456         ;;
16457 esac
16458
16459 case "$uselongdouble:$d_longdbl" in
16460 define:define)
16461         nvtype="long double"
16462         nvsize=$longdblsize
16463         ;;
16464 *)      nvtype=double
16465         nvsize=$doublesize
16466         ;;
16467 esac
16468
16469 case "$usequadmath:$i_quadmath" in
16470 define:define)
16471   nvtype="__float128"
16472   nvsize=16
16473   case "$libs" in
16474   *quadmath*) ;;
16475   *) $cat <<EOM >&4
16476
16477 *** You requested the use of the quadmath library, but you
16478 *** do not seem to have the quadmath library installed.
16479 *** Cannot continue, aborting.
16480 EOM
16481     exit 1
16482     ;;
16483   esac
16484   ;;
16485 define:*) $cat <<EOM >&4
16486
16487 *** You requested the use of the quadmath library, but you
16488 *** do not seem to have the required header, <quadmath.h>.
16489 EOM
16490   case "$gccversion" in
16491   [23].*|4.[0-5]*)
16492    $cat <<EOM >&4
16493 *** Your gcc looks a bit old:
16494 *** $gccversion
16495 EOM
16496     ;;
16497   '')
16498    $cat <<EOM >&4
16499 *** You are not running a gcc.
16500 EOM
16501     ;;
16502   esac
16503   $cat <<EOM >&4
16504 *** For the quadmath library you need at least gcc 4.6.
16505 *** Cannot continue, aborting.
16506 EOM
16507   exit 1
16508   ;;
16509 esac
16510
16511 $echo "(IV will be "$ivtype", $ivsize bytes)"
16512 $echo "(UV will be "$uvtype", $uvsize bytes)"
16513 $echo "(NV will be "$nvtype", $nvsize bytes)"
16514
16515 $cat >try.c <<EOCP
16516 #$i_inttypes I_INTTYPES
16517 #ifdef I_INTTYPES
16518 #include <inttypes.h>
16519 #endif
16520 #include <stdio.h>
16521 int main() {
16522 #ifdef INT8
16523    int8_t i =  INT8_MAX;
16524   uint8_t u = UINT8_MAX;
16525   printf("int8_t\n");
16526 #endif
16527 #ifdef INT16
16528    int16_t i =  INT16_MAX;
16529   uint16_t u = UINT16_MAX;
16530   printf("int16_t\n");
16531 #endif
16532 #ifdef INT32
16533    int32_t i =  INT32_MAX;
16534   uint32_t u = UINT32_MAX;
16535   printf("int32_t\n");
16536 #endif
16537 }
16538 EOCP
16539
16540 i8type="signed char"
16541 u8type="unsigned char"
16542 i8size=1
16543 u8size=1
16544
16545 case "$i16type" in
16546 '')     case "$shortsize" in
16547         2)      i16type=short
16548                 u16type="unsigned short"
16549                 i16size=$shortsize
16550                 u16size=$shortsize
16551                 ;;
16552         esac
16553         ;;
16554 esac
16555 case "$i16type" in
16556 '')     set try -DINT16
16557         if eval $compile; then
16558                 case "`$run ./try`" in
16559                 int16_t)
16560                         i16type=int16_t
16561                         u16type=uint16_t
16562                         i16size=2
16563                         u16size=2
16564                         ;;
16565                 esac
16566         fi
16567         ;;
16568 esac
16569 case "$i16type" in
16570 '')     if $test $shortsize -ge 2; then
16571                 i16type=short
16572                 u16type="unsigned short"
16573                 i16size=$shortsize
16574                 u16size=$shortsize
16575         fi
16576         ;;
16577 esac
16578
16579 case "$i32type" in
16580 '')     case "$longsize" in
16581         4)      i32type=long
16582                 u32type="unsigned long"
16583                 i32size=$longsize
16584                 u32size=$longsize
16585                 ;;
16586         *)      case "$intsize" in
16587                 4)      i32type=int
16588                         u32type="unsigned int"
16589                         i32size=$intsize
16590                         u32size=$intsize
16591                         ;;
16592                 esac
16593                 ;;
16594         esac
16595         ;;
16596 esac
16597 case "$i32type" in
16598 '')     set try -DINT32
16599         if eval $compile; then
16600                 case "`$run ./try`" in
16601                 int32_t)
16602                         i32type=int32_t
16603                         u32type=uint32_t
16604                         i32size=4
16605                         u32size=4
16606                         ;;
16607                 esac
16608         fi
16609         ;;
16610 esac
16611 case "$i32type" in
16612 '')     if $test $intsize -ge 4; then
16613                 i32type=int
16614                 u32type="unsigned int"
16615                 i32size=$intsize
16616                 u32size=$intsize
16617         fi
16618         ;;
16619 esac
16620
16621 case "$i64type" in
16622 '')     case "$d_quad:$quadtype" in
16623         define:?*)
16624                 i64type="$quadtype"
16625                 u64type="$uquadtype"
16626                 i64size=8
16627                 u64size=8
16628                 ;;
16629         esac
16630         ;;
16631 esac
16632
16633 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16634 $cat <<EOP >try.c
16635 #include <stdio.h>
16636 #$i_stdlib I_STDLIB
16637 #ifdef I_STDLIB
16638 #include <stdlib.h>
16639 #endif
16640 #include <sys/types.h>
16641 #include <signal.h>
16642 #ifdef SIGFPE
16643 /* volatile so that the compiler has to store it out to memory */
16644 volatile int bletched = 0;
16645 $signal_t blech(int s) { bletched = 1; }
16646 #endif
16647 int main() {
16648     $uvtype u = 0;
16649     $nvtype d;
16650     int     n = 8 * $uvsize;
16651     int     i;
16652 #ifdef SIGFPE
16653     signal(SIGFPE, blech);
16654 #endif
16655
16656     for (i = 0; i < n; i++) {
16657       u = u << 1 | ($uvtype)1;
16658       d = ($nvtype)u;
16659       if (($uvtype)d != u)
16660         break;
16661       if (d <= 0)
16662         break;
16663       d = ($nvtype)(u - 1);
16664       if (($uvtype)d != (u - 1))
16665         break;
16666 #ifdef SIGFPE
16667       if (bletched)
16668         break;
16669 #endif
16670     }
16671     printf("%d\n", ((i == n) ? -n : i));
16672     exit(0);
16673 }
16674 EOP
16675 set try
16676
16677 d_nv_preserves_uv="$undef"
16678 if eval $compile; then
16679         nv_preserves_uv_bits="`$run ./try`"
16680 fi
16681 case "$nv_preserves_uv_bits" in
16682 \-[1-9]*)
16683         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16684         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16685         d_nv_preserves_uv="$define"
16686         ;;
16687 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16688         d_nv_preserves_uv="$undef" ;;
16689 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16690         nv_preserves_uv_bits="0" ;;
16691 esac
16692 $rm_try
16693
16694 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16695 $cat <<EOP >try.c
16696 #include <stdio.h>
16697
16698 typedef $nvtype NV;
16699
16700 int
16701 main() {
16702   NV value = 2;
16703   int count = 1;
16704
16705   while(count < 256) {
16706     /* volatile so that the compiler has to store it out to memory */
16707     volatile NV up = value + 1.0;
16708     volatile NV negated = -value;
16709     volatile NV down = negated - 1.0;
16710     volatile NV got_up = up - value;
16711     int up_good = got_up == 1.0;
16712     int got_down = down - negated;
16713     int down_good = got_down == -1.0;
16714
16715     if (down_good != up_good) {
16716       fprintf(stderr,
16717               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16718               up_good, (double) got_up, down_good, (double) got_down,
16719               count, (double) value);
16720       return 1;
16721     }
16722     if (!up_good) {
16723       while (1) {
16724         if (count > 8) {
16725           count -= 8;
16726           fputs("256.0", stdout);
16727         } else {
16728           count--;
16729           fputs("2.0", stdout);
16730         }
16731         if (!count) {
16732           puts("");
16733           return 0;
16734         }
16735         fputs("*", stdout);
16736       }
16737     }
16738     value *= 2;
16739     ++count;
16740   }
16741   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16742           count, (double) value);
16743   return 1;
16744 }
16745 EOP
16746 set try
16747
16748 nv_overflows_integers_at='0'
16749 if eval $compile; then
16750     xxx="`$run ./try`"
16751     case "$?" in
16752         0)
16753             case "$xxx" in
16754                 2*)  cat >&4 <<EOM
16755 The largest integer your NVs can preserve is equal to $xxx
16756 EOM
16757                     nv_overflows_integers_at="$xxx"
16758                     ;;
16759                 *)  cat >&4 <<EOM
16760 Cannot determine the largest integer value your NVs can hold, unexpected output
16761 '$xxx'
16762 EOM
16763                     ;;
16764             esac
16765             ;;
16766         *)  cat >&4 <<EOM
16767 Cannot determine the largest integer value your NVs can hold
16768 EOM
16769             ;;
16770     esac
16771 fi
16772 $rm_try
16773
16774 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16775 $cat <<EOP >try.c
16776 #include <stdio.h>
16777 #$i_stdlib I_STDLIB
16778 #ifdef I_STDLIB
16779 #include <stdlib.h>
16780 #endif
16781 #include <string.h>
16782 #include <sys/types.h>
16783 #include <signal.h>
16784 #ifdef SIGFPE
16785 /* volatile so that the compiler has to store it out to memory */
16786 volatile int bletched = 0;
16787 $signal_t blech(int s) { bletched = 1; }
16788 #endif
16789
16790 int checkit($nvtype d, const char *where) {
16791     void *v = &d;
16792     unsigned char *p = (unsigned char *)v;
16793     unsigned char *end = p + sizeof(d);
16794     int fail = 0;
16795
16796     while (p < end)
16797         fail += *p++;
16798
16799     if (!fail)
16800         return 0;
16801
16802     p = (unsigned char *)v;
16803     printf("No - %s: 0x", where);
16804     while (p < end)
16805         printf ("%02X", *p++);
16806     printf("\n");
16807     return 1;
16808 }
16809
16810 int main(int argc, char **argv) {
16811     $nvtype d = 0.0;
16812     int fail = 0;
16813     fail += checkit(d, "0.0");
16814
16815     /* The compiler shouldn't be assuming that bletched is 0  */
16816     d = bletched;
16817
16818     fail += checkit(d, "bleched");
16819
16820 #ifdef SIGFPE
16821     signal(SIGFPE, blech);
16822 #endif
16823
16824     /* Paranoia - the compiler should have no way of knowing that ANSI says
16825        that argv[argc] will always be NULL.  Actually, if it did assume this it
16826        would be buggy, as this is C and main() can be called from elsewhere in
16827        the program.  */
16828     d = argv[argc] ? 1 : 0;
16829
16830     if (d) {
16831         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16832     }
16833
16834     fail += checkit(d, "ternary");
16835
16836     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16837
16838     if (d != 0.0) {
16839         printf("No - memset doesn't give 0.0\n");
16840         /* This might just blow up:  */
16841         printf("(gives %g)\n", d);
16842         return 1;
16843     }
16844
16845 #ifdef SIGFPE
16846     if (bletched) {
16847         printf("No - something bleched\n");
16848         return 1;
16849     }
16850 #endif
16851     if (fail) {
16852       printf("No - %d fail(s)\n", fail);
16853       return 1;
16854     }
16855     printf("Yes\n");
16856     return 0;
16857 }
16858 EOP
16859 set try
16860
16861 d_nv_zero_is_allbits_zero="$undef"
16862 if eval $compile; then
16863     xxx="`$run ./try`"
16864     case "$?" in
16865         0)
16866             case "$xxx" in
16867                 Yes)  cat >&4 <<EOM
16868 0.0 is represented as all bits zero in memory
16869 EOM
16870                     d_nv_zero_is_allbits_zero="$define"
16871                     ;;
16872                 *)  cat >&4 <<EOM
16873 0.0 is not represented as all bits zero in memory
16874 EOM
16875                     d_nv_zero_is_allbits_zero="$undef"
16876                     ;;
16877             esac
16878             ;;
16879         *)  cat >&4 <<EOM
16880 0.0 is not represented as all bits zero in memory
16881 EOM
16882             d_nv_zero_is_allbits_zero="$undef"
16883             ;;
16884     esac
16885 fi
16886 $rm_try
16887
16888 : check for off64_t
16889 echo " "
16890 echo "Checking to see if you have off64_t..." >&4
16891 $cat >try.c <<EOCP
16892 #include <sys/types.h>
16893 #include <unistd.h>
16894 int main() { off64_t x = 7; }
16895 EOCP
16896 set try
16897 if eval $compile; then
16898         val="$define"
16899         echo "You have off64_t."
16900 else
16901         val="$undef"
16902         echo "You do not have off64_t."
16903         case "$lseeksize" in
16904         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16905         esac
16906 fi
16907 $rm_try
16908 set d_off64_t
16909 eval $setvar
16910
16911 : how to create joinable pthreads
16912 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16913         echo " "
16914         echo "Checking what constant to use for creating joinable pthreads..." >&4
16915         $cat >try.c <<'EOCP'
16916 #include <pthread.h>
16917 int main() {
16918     int detachstate = JOINABLE;
16919 }
16920 EOCP
16921         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16922         if eval $compile; then
16923                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16924                 val="$undef" # Yes, undef.
16925                 set d_old_pthread_create_joinable
16926                 eval $setvar
16927                 val=""
16928                 set old_pthread_create_joinable
16929                 eval $setvar
16930         else
16931                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16932                 if eval $compile; then
16933                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16934                         val="$define"
16935                         set d_old_pthread_create_joinable
16936                         eval $setvar
16937                         val=PTHREAD_CREATE_UNDETACHED
16938                         set old_pthread_create_joinable
16939                         eval $setvar
16940                 else
16941                         set try -DJOINABLE=__UNDETACHED
16942                         if eval $compile; then
16943                                 echo "You seem to use __UNDETACHED." >&4
16944                                 val="$define"
16945                                 set d_old_pthread_create_joinable
16946                                 eval $setvar
16947                                 val=__UNDETACHED
16948                                 set old_pthread_create_joinable
16949                                 eval $setvar
16950                         else
16951                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16952                                 val="$define"
16953                                 set d_old_pthread_create_joinable
16954                                 eval $setvar
16955                                 val=0
16956                                 set old_pthread_create_joinable
16957                                 eval $setvar
16958                         fi
16959                 fi
16960         fi
16961         $rm_try
16962 else
16963     d_old_pthread_create_joinable="$undef"
16964     old_pthread_create_joinable=""
16965 fi
16966
16967 : see if pause exists
16968 set pause d_pause
16969 eval $inlibc
16970
16971 : see if pipe2 exists
16972 set pipe2 d_pipe2
16973 eval $inlibc
16974
16975 : see if poll exists
16976 set poll d_poll
16977 eval $inlibc
16978
16979 : see if prctl exists
16980 set prctl d_prctl
16981 eval $inlibc
16982
16983 : see if prctl supports PR_SET_NAME
16984 d_prctl_set_name=$undef
16985 case $d_prctl in
16986     $define)
16987         $cat >try.c <<EOM
16988 #ifdef __ANDROID__
16989 #include <unistd.h>
16990 #endif
16991 #include <sys/prctl.h>
16992
16993 int main (int argc, char *argv[])
16994 {
16995     return (prctl (PR_SET_NAME, "Test"));
16996     } /* main */
16997 EOM
16998         set try
16999         if eval $compile_ok && $run ./try; then
17000             echo "Your prctl (PR_SET_NAME, ...) works"
17001             d_prctl_set_name=$define
17002             fi
17003         $rm_try
17004         ;;
17005     esac
17006
17007 : see if readlink exists
17008 set readlink d_readlink
17009 eval $inlibc
17010
17011 : Check if there is a /proc symlink to the abs path of
17012 : the executing program.  We will honor hints of d_procselfexe=$undef
17013 : or procselfexe being non-empty, otherwise will try to determine both
17014 : if we have readlink.
17015 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17016 : referenced, and AmigaOS does not have a proc filesystem anyway.
17017 echo " "
17018 val="$undef"
17019 if $test "X$d_procselfexe" = Xundef; then
17020         procselfexe=''
17021 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17022         val="$define"
17023 elif $test "X$d_readlink" = Xdefine; then
17024         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17025         : and it feels more tidy to avoid an extra level of symlink
17026         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17027         while test $# -gt 0; do
17028             type=$1; try=$2
17029             shift; shift
17030             if $issymlink $try; then
17031                 $ls -l $try > reflect
17032                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17033                     echo "You have $type-like $try."
17034                     procselfexe='"'$try'"'
17035                     val="$define"
17036                     : This will break out of the loop
17037                     set X; shift
17038                 fi
17039             fi
17040         done
17041 fi
17042 $rm -f reflect
17043 set d_procselfexe
17044 eval $setvar
17045
17046 : backward compatibility for d_hvfork
17047 if test X$d_hvfork != X; then
17048         d_vfork="$d_hvfork"
17049         d_hvfork=''
17050 fi
17051 : see if there is a vfork
17052 val=''
17053 set vfork val
17054 eval $inlibc
17055
17056 d_pseudofork=$undef
17057
17058 : Ok, but do we want to use it. vfork is reportedly unreliable in
17059 : perl on Solaris 2.x, and probably elsewhere.
17060 case "$val" in
17061 $define)
17062         echo " "
17063         case "$usevfork" in
17064         false) dflt='n';;
17065         *) dflt='y';;
17066         esac
17067         cat <<'EOM'
17068
17069 Perl can only use a vfork() that doesn't suffer from strict
17070 restrictions on calling functions or modifying global data in
17071 the child.  For example, glibc-2.1 contains such a vfork()
17072 that is unsuitable.  If your system provides a proper fork()
17073 call, chances are that you do NOT want perl to use vfork().
17074
17075 EOM
17076         rp="Do you still want to use vfork()?"
17077         . ./myread
17078         case "$ans" in
17079         y|Y) ;;
17080         *)
17081                 echo "Ok, we won't use vfork()."
17082                 val="$undef"
17083                 ;;
17084         esac
17085         ;;
17086 esac
17087 set d_vfork
17088 eval $setvar
17089 case "$d_vfork" in
17090 $define) usevfork='true';;
17091 *) usevfork='false';;
17092 esac
17093
17094 : see whether the pthread_atfork exists
17095 $cat >try.c <<EOP
17096 #include <pthread.h>
17097 #include <stdio.h>
17098 int main() {
17099 #ifdef  PTHREAD_ATFORK
17100         pthread_atfork(NULL,NULL,NULL);
17101 #endif
17102 }
17103 EOP
17104
17105 : see if pthread_atfork exists
17106 set try -DPTHREAD_ATFORK
17107 if eval $compile; then
17108     val="$define"
17109 else
17110     val="$undef"
17111 fi
17112 case "$usethreads" in
17113 $define)
17114         case "$val" in
17115         $define) echo 'pthread_atfork found.' >&4        ;;
17116         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17117         esac
17118 esac
17119 set d_pthread_atfork
17120 eval $setvar
17121
17122 : see if pthread_attr_setscope exists
17123 set pthread_attr_setscope d_pthread_attr_setscope
17124 eval $inlibc
17125
17126 : see whether the various POSIXish _yields exist
17127 $cat >try.c <<EOP
17128 #include <pthread.h>
17129 #include <stdio.h>
17130 int main() {
17131 #ifdef SCHED_YIELD
17132         sched_yield();
17133 #else
17134 #ifdef PTHREAD_YIELD
17135         pthread_yield();
17136 #else
17137 #ifdef PTHREAD_YIELD_NULL
17138         pthread_yield(NULL);
17139 #endif
17140 #endif
17141 #endif
17142 }
17143 EOP
17144 : see if sched_yield exists
17145 set try -DSCHED_YIELD
17146 if eval $compile; then
17147     val="$define"
17148     sched_yield='sched_yield()'
17149 else
17150     val="$undef"
17151 fi
17152 case "$usethreads" in
17153 $define)
17154         case "$val" in
17155         $define) echo 'sched_yield() found.' >&4        ;;
17156         *)       echo 'sched_yield() NOT found.' >&4    ;;
17157         esac
17158 esac
17159 set d_sched_yield
17160 eval $setvar
17161
17162 : see if pthread_yield exists
17163 set try -DPTHREAD_YIELD
17164 if eval $compile; then
17165     val="$define"
17166     case "$sched_yield" in
17167     '') sched_yield='pthread_yield()' ;;
17168     esac
17169 else
17170     set try -DPTHREAD_YIELD_NULL
17171     if eval $compile; then
17172         val="$define"
17173         case "$sched_yield" in
17174         '') sched_yield='pthread_yield(NULL)' ;;
17175         esac
17176     else
17177         val="$undef"
17178     fi
17179 fi
17180 case "$usethreads" in
17181 $define)
17182         case "$val" in
17183         $define) echo 'pthread_yield() found.' >&4      ;;
17184         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17185         esac
17186         ;;
17187 esac
17188 set d_pthread_yield
17189 eval $setvar
17190 case "$sched_yield" in
17191 '') sched_yield=undef ;;
17192 esac
17193 $rm_try
17194
17195 : check for ptrdiff_t
17196 echo " "
17197 echo "Checking to see if you have ptrdiff_t..." >&4
17198 $cat >try.c <<EOCP
17199 #include <stddef.h>
17200 int main() { ptrdiff_t x = 7; }
17201 EOCP
17202 set try
17203 if eval $compile; then
17204         val="$define"
17205         echo "You have ptrdiff_t."
17206 else
17207         val="$undef"
17208         echo "You do not have ptrdiff_t."
17209 fi
17210 $rm_try
17211 set d_ptrdiff_t
17212 eval $setvar
17213
17214 : see if random_r exists
17215 set random_r d_random_r
17216 eval $inlibc
17217 case "$d_random_r" in
17218 "$define")
17219         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17220         case "$d_random_r_proto:$usethreads" in
17221         ":define")      d_random_r_proto=define
17222                 set d_random_r_proto random_r $hdrs
17223                 eval $hasproto ;;
17224         *)      ;;
17225         esac
17226         case "$d_random_r_proto" in
17227         define)
17228         case "$random_r_proto" in
17229         ''|0) try='int random_r(int*, struct random_data*);'
17230         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17231         esac
17232         case "$random_r_proto" in
17233         ''|0) try='int random_r(long*, struct random_data*);'
17234         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17235         esac
17236         case "$random_r_proto" in
17237         ''|0) try='int random_r(struct random_data*, int32_t*);'
17238         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17239         esac
17240         case "$random_r_proto" in
17241         ''|0)   d_random_r=undef
17242                 random_r_proto=0
17243                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17244         * )     case "$random_r_proto" in
17245                 REENTRANT_PROTO*) ;;
17246                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17247                 esac
17248                 echo "Prototype: $try" ;;
17249         esac
17250         ;;
17251         *)      case "$usethreads" in
17252                 define) echo "random_r has no prototype, not using it." >&4 ;;
17253                 esac
17254                 d_random_r=undef
17255                 random_r_proto=0
17256                 ;;
17257         esac
17258         ;;
17259 *)      random_r_proto=0
17260         ;;
17261 esac
17262
17263 : see if readdir and friends exist
17264 set readdir d_readdir
17265 eval $inlibc
17266 set seekdir d_seekdir
17267 eval $inlibc
17268 set telldir d_telldir
17269 eval $inlibc
17270 set rewinddir d_rewinddir
17271 eval $inlibc
17272
17273 : see if readdir64_r exists
17274 set readdir64_r d_readdir64_r
17275 eval $inlibc
17276 case "$d_readdir64_r" in
17277 "$define")
17278         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17279         case "$d_readdir64_r_proto:$usethreads" in
17280         ":define")      d_readdir64_r_proto=define
17281                 set d_readdir64_r_proto readdir64_r $hdrs
17282                 eval $hasproto ;;
17283         *)      ;;
17284         esac
17285         case "$d_readdir64_r_proto" in
17286         define)
17287         case "$readdir64_r_proto" in
17288         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17289         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17290         esac
17291         case "$readdir64_r_proto" in
17292         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17293         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17294         esac
17295         case "$readdir64_r_proto" in
17296         ''|0)   d_readdir64_r=undef
17297                 readdir64_r_proto=0
17298                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17299         * )     case "$readdir64_r_proto" in
17300                 REENTRANT_PROTO*) ;;
17301                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17302                 esac
17303                 echo "Prototype: $try" ;;
17304         esac
17305         ;;
17306         *)      case "$usethreads" in
17307                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17308                 esac
17309                 d_readdir64_r=undef
17310                 readdir64_r_proto=0
17311                 ;;
17312         esac
17313         ;;
17314 *)      readdir64_r_proto=0
17315         ;;
17316 esac
17317
17318 : see if readdir_r exists
17319 set readdir_r d_readdir_r
17320 eval $inlibc
17321 case "$d_readdir_r" in
17322 "$define")
17323         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17324         case "$d_readdir_r_proto:$usethreads" in
17325         ":define")      d_readdir_r_proto=define
17326                 set d_readdir_r_proto readdir_r $hdrs
17327                 eval $hasproto ;;
17328         *)      ;;
17329         esac
17330         case "$d_readdir_r_proto" in
17331         define)
17332         case "$readdir_r_proto" in
17333         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17334         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17335         esac
17336         case "$readdir_r_proto" in
17337         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17338         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17339         esac
17340         case "$readdir_r_proto" in
17341         ''|0)   d_readdir_r=undef
17342                 readdir_r_proto=0
17343                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17344         * )     case "$readdir_r_proto" in
17345                 REENTRANT_PROTO*) ;;
17346                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17347                 esac
17348                 echo "Prototype: $try" ;;
17349         esac
17350         ;;
17351         *)      case "$usethreads" in
17352                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17353                 esac
17354                 d_readdir_r=undef
17355                 readdir_r_proto=0
17356                 ;;
17357         esac
17358         ;;
17359 *)      readdir_r_proto=0
17360         ;;
17361 esac
17362
17363 : see if readv exists
17364 set readv d_readv
17365 eval $inlibc
17366
17367 : see if recvmsg exists
17368 set recvmsg d_recvmsg
17369 eval $inlibc
17370
17371 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17372 echo " "
17373 if set regcomp val -f d_regcomp; eval $csym; $val; then
17374         echo 'regcomp() found.' >&4
17375         d_regcomp="$define"
17376         d_regcmp="$undef"
17377         d_re_comp="$undef"
17378 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17379         echo 'regcmp() found.' >&4
17380         d_regcmp="$define"
17381         d_regcomp="$undef"
17382         d_re_comp="$undef"
17383 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17384         echo 're_comp() found, assuming re_exec() also exists.' >&4
17385         d_re_comp="$define"
17386         d_regcomp="$undef"
17387         d_regcmp="$undef"
17388 else
17389         $cat >&4 <<EOM
17390 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17391 EOM
17392         d_regcmp="$undef"
17393         d_re_comp="$undef"
17394         d_regcomp="$undef"
17395 fi
17396
17397 : see if remainder exists
17398 set remainder d_remainder
17399 eval $inlibc
17400
17401 : see if remquo exists
17402 set remquo d_remquo
17403 eval $inlibc
17404
17405 : see if rename exists
17406 set rename d_rename
17407 eval $inlibc
17408
17409 : see if rint exists
17410 set rint d_rint
17411 eval $inlibc
17412
17413 : see if rmdir exists
17414 set rmdir d_rmdir
17415 eval $inlibc
17416
17417 : see if round exists
17418 set round d_round
17419 eval $inlibc
17420
17421 : see if prototype for sbrk is available
17422 echo " "
17423 set d_sbrkproto sbrk $i_unistd unistd.h
17424 eval $hasproto
17425
17426 : see if scalbn exists
17427 set scalbn d_scalbn
17428 eval $inlibc
17429
17430 : see if select exists
17431 set select d_select
17432 eval $inlibc
17433
17434 : see if semctl exists
17435 set semctl d_semctl
17436 eval $inlibc
17437
17438 : see if semget exists
17439 set semget d_semget
17440 eval $inlibc
17441
17442 : see if semop exists
17443 set semop d_semop
17444 eval $inlibc
17445
17446 : see how much of the 'sem*(2)' library is present.
17447 h_sem=true
17448 echo " "
17449 case "$d_semctl$d_semget$d_semop" in
17450 *"$undef"*) h_sem=false;;
17451 esac
17452 case "$osname" in
17453 freebsd)
17454     case "`ipcs 2>&1`" in
17455     "SVID messages"*"not configured"*)
17456         echo "Your $osname does not have the sem*(2) configured." >&4
17457         h_sem=false
17458         val="$undef"
17459         set semctl d_semctl
17460         eval $setvar
17461         set semget d_semget
17462         eval $setvar
17463         set semop d_semop
17464         eval $setvar
17465         ;;
17466     esac
17467     ;;
17468 esac
17469 : we could also check for sys/ipc.h ...
17470 if $h_sem && $test `./findhdr sys/sem.h`; then
17471         echo "You have the full sem*(2) library." >&4
17472         val="$define"
17473 else
17474         echo "You don't have the full sem*(2) library." >&4
17475         val="$undef"
17476 fi
17477 set d_sem
17478 eval $setvar
17479
17480 : see whether sys/sem.h defines union semun
17481 echo " "
17482 $cat > try.c <<'END'
17483 #include <sys/types.h>
17484 #include <sys/ipc.h>
17485 #include <sys/sem.h>
17486 int main () { union semun semun; semun.buf = 0; }
17487 END
17488 set try
17489 if eval $compile; then
17490     echo "You have union semun in <sys/sem.h>." >&4
17491     val="$define"
17492 else
17493     echo "You do not have union semun in <sys/sem.h>." >&4
17494     val="$undef"
17495 fi
17496 $rm_try
17497 set d_union_semun
17498 eval $setvar
17499
17500 : see how to do semctl IPC_STAT
17501 case "$d_sem" in
17502 $define)
17503     echo " "
17504     $cat > tryh.h <<END
17505 #ifndef S_IRUSR
17506 #   ifdef S_IREAD
17507 #       define S_IRUSR S_IREAD
17508 #       define S_IWUSR S_IWRITE
17509 #       define S_IXUSR S_IEXEC
17510 #   else
17511 #       define S_IRUSR 0400
17512 #       define S_IWUSR 0200
17513 #       define S_IXUSR 0100
17514 #   endif
17515 #   define S_IRGRP (S_IRUSR>>3)
17516 #   define S_IWGRP (S_IWUSR>>3)
17517 #   define S_IXGRP (S_IXUSR>>3)
17518 #   define S_IROTH (S_IRUSR>>6)
17519 #   define S_IWOTH (S_IWUSR>>6)
17520 #   define S_IXOTH (S_IXUSR>>6)
17521 #endif
17522 #ifndef S_IRWXU
17523 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17524 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17525 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17526 #endif
17527 END
17528     : see whether semctl IPC_STAT can use union semun
17529     case "$d_semctl_semun" in
17530     '')
17531       val="$undef"
17532       $cat > try.c <<END
17533 #include <sys/types.h>
17534 #include <sys/ipc.h>
17535 #include <sys/sem.h>
17536 #include <sys/stat.h>
17537 #include <stdio.h>
17538 #include <errno.h>
17539 #include "tryh.h"
17540 #ifndef errno
17541 extern int errno;
17542 #endif
17543 #$d_union_semun HAS_UNION_SEMUN
17544 int main() {
17545     union semun
17546 #ifndef HAS_UNION_SEMUN
17547     {
17548         int val;
17549         struct semid_ds *buf;
17550         unsigned short *array;
17551     }
17552 #endif
17553     arg;
17554     int sem, st;
17555
17556 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17557     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17558     if (sem > -1) {
17559         struct semid_ds argbuf;
17560         arg.buf = &argbuf;
17561 #       ifdef IPC_STAT
17562         st = semctl(sem, 0, IPC_STAT, arg);
17563         if (st == 0)
17564             printf("semun\n");
17565         else
17566 #       endif /* IPC_STAT */
17567             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17568 #       ifdef IPC_RMID
17569         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17570 #       endif /* IPC_RMID */
17571             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17572     } else
17573 #endif /* IPC_PRIVATE && ... */
17574         printf("semget failed: errno = %d\n", errno);
17575   return 0;
17576 }
17577 END
17578       set try
17579       if eval $compile; then
17580           xxx=`$run ./try`
17581           case "$xxx" in
17582           semun) val="$define" ;;
17583           esac
17584       fi
17585       $rm_try
17586       set d_semctl_semun
17587       eval $setvar
17588       ;;
17589     esac
17590     case "$d_semctl_semun" in
17591     $define)
17592         echo "You can use union semun for semctl IPC_STAT." >&4
17593         also='also'
17594         ;;
17595     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17596         also=''
17597         ;;
17598     esac
17599
17600     : see whether semctl IPC_STAT can use struct semid_ds pointer
17601     case "$d_semctl_semid_ds" in
17602     '')
17603       val="$undef"
17604       $cat > try.c <<'END'
17605 #include <sys/types.h>
17606 #include <sys/ipc.h>
17607 #include <sys/sem.h>
17608 #include <sys/stat.h>
17609 #include "tryh.h"
17610 #include <stdio.h>
17611 #include <errno.h>
17612 #ifndef errno
17613 extern int errno;
17614 #endif
17615 int main() {
17616     union semun
17617 #ifndef HAS_UNION_SEMUN
17618     {
17619         int val;
17620         struct semid_ds *buf;
17621         unsigned short *array;
17622     }
17623 #endif
17624     arg;
17625     struct semid_ds argbuf;
17626     int sem, st;
17627
17628 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17629     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17630     if (sem > -1) {
17631         arg.buf = &argbuf;
17632 #       ifdef IPC_STAT
17633         st = semctl(sem, 0, IPC_STAT, arg);
17634         if (st == 0)
17635             printf("semid_ds\n");
17636         else
17637 #       endif /* IPC_STAT */
17638             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17639 #       ifdef IPC_RMID
17640         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17641 #       endif /* IPC_RMID */
17642             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17643     } else
17644 #endif /* IPC_PRIVATE && ... */
17645         printf("semget failed: errno = %d\n", errno);
17646
17647     return 0;
17648 }
17649 END
17650       set try
17651       if eval $compile; then
17652           xxx=`$run ./try`
17653           case "$xxx" in
17654           semid_ds) val="$define" ;;
17655           esac
17656       fi
17657       $rm_try
17658       set d_semctl_semid_ds
17659       eval $setvar
17660       ;;
17661     esac
17662     case "$d_semctl_semid_ds" in
17663     $define)
17664         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17665         ;;
17666     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17667         ;;
17668     esac
17669     ;;
17670 *)  val="$undef"
17671
17672     # We do not have the full sem*(2) library, so assume we can not
17673     # use either.
17674
17675     set d_semctl_semun
17676     eval $setvar
17677
17678     set d_semctl_semid_ds
17679     eval $setvar
17680     ;;
17681 esac
17682 $rm_try tryh.h
17683
17684 : see if sendmsg exists
17685 set sendmsg d_sendmsg
17686 eval $inlibc
17687
17688 : see if setegid exists
17689 set setegid d_setegid
17690 eval $inlibc
17691
17692 : see if seteuid exists
17693 set seteuid d_seteuid
17694 eval $inlibc
17695
17696 : see if setgrent exists
17697 set setgrent d_setgrent
17698 eval $inlibc
17699
17700 : see if setgrent_r exists
17701 set setgrent_r d_setgrent_r
17702 eval $inlibc
17703 case "$d_setgrent_r" in
17704 "$define")
17705         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17706         case "$d_setgrent_r_proto:$usethreads" in
17707         ":define")      d_setgrent_r_proto=define
17708                 set d_setgrent_r_proto setgrent_r $hdrs
17709                 eval $hasproto ;;
17710         *)      ;;
17711         esac
17712         case "$d_setgrent_r_proto" in
17713         define)
17714         case "$setgrent_r_proto" in
17715         ''|0) try='int setgrent_r(FILE**);'
17716         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17717         esac
17718         case "$setgrent_r_proto" in
17719         ''|0) try='void setgrent_r(FILE**);'
17720         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17721         esac
17722         case "$setgrent_r_proto" in
17723         ''|0)   d_setgrent_r=undef
17724                 setgrent_r_proto=0
17725                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17726         * )     case "$setgrent_r_proto" in
17727                 REENTRANT_PROTO*) ;;
17728                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17729                 esac
17730                 echo "Prototype: $try" ;;
17731         esac
17732         ;;
17733         *)      case "$usethreads" in
17734                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17735                 esac
17736                 d_setgrent_r=undef
17737                 setgrent_r_proto=0
17738                 ;;
17739         esac
17740         ;;
17741 *)      setgrent_r_proto=0
17742         ;;
17743 esac
17744
17745 : see if sethostent exists
17746 set sethostent d_sethent
17747 eval $inlibc
17748
17749 : see if sethostent_r exists
17750 set sethostent_r d_sethostent_r
17751 eval $inlibc
17752 case "$d_sethostent_r" in
17753 "$define")
17754         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17755         case "$d_sethostent_r_proto:$usethreads" in
17756         ":define")      d_sethostent_r_proto=define
17757                 set d_sethostent_r_proto sethostent_r $hdrs
17758                 eval $hasproto ;;
17759         *)      ;;
17760         esac
17761         case "$d_sethostent_r_proto" in
17762         define)
17763         case "$sethostent_r_proto" in
17764         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17765         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17766         esac
17767         case "$sethostent_r_proto" in
17768         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17769         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17770         esac
17771         case "$sethostent_r_proto" in
17772         ''|0)   d_sethostent_r=undef
17773                 sethostent_r_proto=0
17774                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17775         * )     case "$sethostent_r_proto" in
17776                 REENTRANT_PROTO*) ;;
17777                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17778                 esac
17779                 echo "Prototype: $try" ;;
17780         esac
17781         ;;
17782         *)      case "$usethreads" in
17783                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17784                 esac
17785                 d_sethostent_r=undef
17786                 sethostent_r_proto=0
17787                 ;;
17788         esac
17789         ;;
17790 *)      sethostent_r_proto=0
17791         ;;
17792 esac
17793
17794 : see if setitimer exists
17795 set setitimer d_setitimer
17796 eval $inlibc
17797
17798 : see if setlinebuf exists
17799 set setlinebuf d_setlinebuf
17800 eval $inlibc
17801
17802 : see if locale.h is available
17803 set locale.h i_locale
17804 eval $inhdr
17805
17806 : see if this system has wctype.h
17807 set wctype.h i_wctype
17808 eval $inhdr
17809
17810 : see if towupper exists
17811 set towupper d_towupper
17812 eval $inlibc
17813
17814 : check for setlocale function and behavior
17815 $cat <<EOM
17816
17817 Checking to see if you have setlocale() and its behavior
17818 EOM
17819 $cat >try.c <<EOCP
17820 #include <stdlib.h>
17821 #include <string.h>
17822 #$i_locale I_LOCALE
17823 #ifdef I_LOCALE
17824 #  include <locale.h>
17825 #endif
17826 #$i_wctype I_WCTYPE
17827 #ifdef I_WCTYPE
17828 #  include <wctype.h>
17829 #endif
17830
17831 int main() {
17832     const char * invalid_name = "\a";   /* This is really invalid! */
17833     int accepts_any_locale_name = 0;
17834     int has_C_UTF8 = 0;
17835     unsigned char bad_setlocale = 255;
17836
17837     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17838      * disabled.  It's hard to imagine an instance where meaningful locale
17839      * handling could be done without LC_CTYPE */
17840     const char *  name = setlocale(LC_CTYPE, "C");
17841
17842     if (name == NULL || strcmp(name, "C") != 0) {
17843         exit(bad_setlocale);
17844     }
17845
17846     name = setlocale(LC_CTYPE, invalid_name);
17847     if (name != NULL) {
17848
17849         /* Let it pass if it accepts the name but gives back one of the C
17850          * locales */
17851         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17852             accepts_any_locale_name = 1;
17853         }
17854     }
17855
17856     name = setlocale(LC_CTYPE, "C.UTF-8");
17857     if (name != NULL) {
17858         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17859
17860 #$d_towupper HAS_TOWUPPER
17861 #ifdef HAS_TOWUPPER
17862
17863         /* We assume that if the machine doesn't have the C99 towupper, it
17864          * doesn't have C.UTF-8, even if we successfully changed locales to
17865          * include it.  This seems safer even on platforms that didn't accept
17866          * the really invalid name */
17867
17868         if (towupper(y_with_diaeresis) == 0x178) {
17869             has_C_UTF8 = 1;
17870         }
17871
17872 #endif
17873
17874     }
17875
17876 #if 0
17877
17878     /* Currently unused code to determine if LC_ALL with disparate values uses
17879      * category = value pairs or positional, and to determine the separator
17880      * between the categories.  We could add code so that if the separator were
17881      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17882      * every possible ASCII separator would fit in the 5 bits available in the
17883      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17884      * positional, we probably would want to know the order of the categories.
17885      * Using a file between the C program and the shell script would really be
17886      * require to do that */
17887 #ifdef LC_ALL
17888
17889     unsigned char min_separator = ' ' - 1;
17890     unsigned char separator = min_separator;
17891     int uses_name_value_pair_names = 0;
17892
17893     name = setlocale(LC_ALL, "C");
17894     if (name == NULL || strcmp(name, "C") != 0) {
17895         exit(bad_setlocale);
17896     }
17897
17898     if (has_C_UTF8) {
17899         char * pos;
17900
17901         name = setlocale(LC_CTYPE, "C.UTF-8");
17902         if (name == NULL) {
17903             exit(bad_setlocale);
17904         }
17905         name = setlocale(LC_ALL, NULL);
17906         if (name == NULL) {
17907             exit(bad_setlocale);
17908         }
17909
17910         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17911         if (pos != NULL) {
17912             uses_name_value_pair_names = 1;
17913             if (pos == name) {
17914                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17915             }
17916             else {
17917                 separator = *(pos - 1);
17918             }
17919         }
17920         else {
17921             pos = strstr(name, "C.UTF-8");
17922             if (pos == NULL) {
17923                 /* bad */
17924             }
17925             else if (pos == name) {
17926                 separator = name[sizeof("C.UTF-8") - 1];
17927             }
17928             else {
17929                 separator = *(pos - 1);
17930             }
17931         }
17932     }
17933
17934 #endif
17935 #endif
17936
17937     exit( 0 /* (separator - min_separator) << 3
17938         | uses_name_value_pair_names      << 2
17939           */
17940         | has_C_UTF8                      << 1
17941         | accepts_any_locale_name);
17942
17943 }
17944 EOCP
17945 set try
17946 if eval $compile; then
17947     echo "Your system has setlocale()..." >&4
17948     $run ./try
17949     case $? in
17950         0) echo "and it seems sane" >&4
17951            d_setlocale="$define"
17952            d_setlocale_accepts_any_locale_name="$undef"
17953            d_has_C_UTF8="false"
17954            ;;
17955         1) echo "and it seems sane, but accepts any locale name as valid" >&4
17956            d_setlocale="$define"
17957            d_setlocale_accepts_any_locale_name="$define"
17958            d_has_C_UTF8="false"
17959            ;;
17960         2) echo "and it seems sane" >&4
17961            d_setlocale="$define"
17962            d_setlocale_accepts_any_locale_name="$undef"
17963            d_has_C_UTF8="true"
17964            ;;
17965         3) echo "and it seems sane, but accepts any locale name as valid" >&4
17966            d_setlocale="$define"
17967            d_setlocale_accepts_any_locale_name="$define"
17968            d_has_C_UTF8="true"
17969            ;;
17970         *) echo "but it doesn't seem to work, so we won't use it." >&4
17971            d_setlocale="$undef"
17972            d_setlocale_accepts_any_locale_name="$undef"
17973            d_has_C_UTF8="false"
17974            ;;
17975     esac
17976 else
17977     echo "your system does not have setlocale()" >&4
17978     d_setlocale="$undef"
17979     d_setlocale_accepts_any_locale_name="$undef"
17980     d_has_C_UTF8="false"
17981 fi
17982 $rm_try
17983
17984 : see if setlocale_r exists
17985 set setlocale_r d_setlocale_r
17986 eval $inlibc
17987 case "$d_setlocale_r" in
17988 "$define")
17989         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17990         case "$d_setlocale_r_proto:$usethreads" in
17991         ":define")      d_setlocale_r_proto=define
17992                 set d_setlocale_r_proto setlocale_r $hdrs
17993                 eval $hasproto ;;
17994         *)      ;;
17995         esac
17996         case "$d_setlocale_r_proto" in
17997         define)
17998         case "$setlocale_r_proto" in
17999         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18000         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18001         esac
18002         case "$setlocale_r_proto" in
18003         ''|0)   d_setlocale_r=undef
18004                 setlocale_r_proto=0
18005                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18006         * )     case "$setlocale_r_proto" in
18007                 REENTRANT_PROTO*) ;;
18008                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18009                 esac
18010                 echo "Prototype: $try" ;;
18011         esac
18012         ;;
18013         *)      case "$usethreads" in
18014                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18015                 esac
18016                 d_setlocale_r=undef
18017                 setlocale_r_proto=0
18018                 ;;
18019         esac
18020         ;;
18021 *)      setlocale_r_proto=0
18022         ;;
18023 esac
18024
18025 : see if setnetent exists
18026 set setnetent d_setnent
18027 eval $inlibc
18028
18029 : see if setnetent_r exists
18030 set setnetent_r d_setnetent_r
18031 eval $inlibc
18032 case "$d_setnetent_r" in
18033 "$define")
18034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18035         case "$d_setnetent_r_proto:$usethreads" in
18036         ":define")      d_setnetent_r_proto=define
18037                 set d_setnetent_r_proto setnetent_r $hdrs
18038                 eval $hasproto ;;
18039         *)      ;;
18040         esac
18041         case "$d_setnetent_r_proto" in
18042         define)
18043         case "$setnetent_r_proto" in
18044         ''|0) try='int setnetent_r(int, struct netent_data*);'
18045         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18046         esac
18047         case "$setnetent_r_proto" in
18048         ''|0) try='void setnetent_r(int, struct netent_data*);'
18049         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18050         esac
18051         case "$setnetent_r_proto" in
18052         ''|0)   d_setnetent_r=undef
18053                 setnetent_r_proto=0
18054                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18055         * )     case "$setnetent_r_proto" in
18056                 REENTRANT_PROTO*) ;;
18057                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18058                 esac
18059                 echo "Prototype: $try" ;;
18060         esac
18061         ;;
18062         *)      case "$usethreads" in
18063                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18064                 esac
18065                 d_setnetent_r=undef
18066                 setnetent_r_proto=0
18067                 ;;
18068         esac
18069         ;;
18070 *)      setnetent_r_proto=0
18071         ;;
18072 esac
18073
18074 : see if setprotoent exists
18075 set setprotoent d_setpent
18076 eval $inlibc
18077
18078 : see if setpgid exists
18079 set setpgid d_setpgid
18080 eval $inlibc
18081
18082 : see if setpgrp2 exists
18083 set setpgrp2 d_setpgrp2
18084 eval $inlibc
18085
18086 : see if setpriority exists
18087 set setpriority d_setprior
18088 eval $inlibc
18089
18090 : see if setproctitle exists
18091 set setproctitle d_setproctitle
18092 eval $inlibc
18093
18094 : see if setprotoent_r exists
18095 set setprotoent_r d_setprotoent_r
18096 eval $inlibc
18097 case "$d_setprotoent_r" in
18098 "$define")
18099         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18100         case "$d_setprotoent_r_proto:$usethreads" in
18101         ":define")      d_setprotoent_r_proto=define
18102                 set d_setprotoent_r_proto setprotoent_r $hdrs
18103                 eval $hasproto ;;
18104         *)      ;;
18105         esac
18106         case "$d_setprotoent_r_proto" in
18107         define)
18108         case "$setprotoent_r_proto" in
18109         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18110         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18111         esac
18112         case "$setprotoent_r_proto" in
18113         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18114         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18115         esac
18116         case "$setprotoent_r_proto" in
18117         ''|0)   d_setprotoent_r=undef
18118                 setprotoent_r_proto=0
18119                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18120         * )     case "$setprotoent_r_proto" in
18121                 REENTRANT_PROTO*) ;;
18122                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18123                 esac
18124                 echo "Prototype: $try" ;;
18125         esac
18126         ;;
18127         *)      case "$usethreads" in
18128                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18129                 esac
18130                 d_setprotoent_r=undef
18131                 setprotoent_r_proto=0
18132                 ;;
18133         esac
18134         ;;
18135 *)      setprotoent_r_proto=0
18136         ;;
18137 esac
18138
18139 : see if setpwent exists
18140 set setpwent d_setpwent
18141 eval $inlibc
18142
18143 : see if setpwent_r exists
18144 set setpwent_r d_setpwent_r
18145 eval $inlibc
18146 case "$d_setpwent_r" in
18147 "$define")
18148         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18149         case "$d_setpwent_r_proto:$usethreads" in
18150         ":define")      d_setpwent_r_proto=define
18151                 set d_setpwent_r_proto setpwent_r $hdrs
18152                 eval $hasproto ;;
18153         *)      ;;
18154         esac
18155         case "$d_setpwent_r_proto" in
18156         define)
18157         case "$setpwent_r_proto" in
18158         ''|0) try='int setpwent_r(FILE**);'
18159         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18160         esac
18161         case "$setpwent_r_proto" in
18162         ''|0) try='void setpwent_r(FILE**);'
18163         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18164         esac
18165         case "$setpwent_r_proto" in
18166         ''|0)   d_setpwent_r=undef
18167                 setpwent_r_proto=0
18168                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18169         * )     case "$setpwent_r_proto" in
18170                 REENTRANT_PROTO*) ;;
18171                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18172                 esac
18173                 echo "Prototype: $try" ;;
18174         esac
18175         ;;
18176         *)      case "$usethreads" in
18177                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18178                 esac
18179                 d_setpwent_r=undef
18180                 setpwent_r_proto=0
18181                 ;;
18182         esac
18183         ;;
18184 *)      setpwent_r_proto=0
18185         ;;
18186 esac
18187
18188 : see if setregid exists
18189 set setregid d_setregid
18190 eval $inlibc
18191 set setresgid d_setresgid
18192 eval $inlibc
18193
18194 : see if setreuid exists
18195 set setreuid d_setreuid
18196 eval $inlibc
18197 set setresuid d_setresuid
18198 eval $inlibc
18199
18200 : see if setrgid exists
18201 set setrgid d_setrgid
18202 eval $inlibc
18203
18204 : see if setruid exists
18205 set setruid d_setruid
18206 eval $inlibc
18207
18208 : see if setservent exists
18209 set setservent d_setsent
18210 eval $inlibc
18211
18212 : see if setservent_r exists
18213 set setservent_r d_setservent_r
18214 eval $inlibc
18215 case "$d_setservent_r" in
18216 "$define")
18217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18218         case "$d_setservent_r_proto:$usethreads" in
18219         ":define")      d_setservent_r_proto=define
18220                 set d_setservent_r_proto setservent_r $hdrs
18221                 eval $hasproto ;;
18222         *)      ;;
18223         esac
18224         case "$d_setservent_r_proto" in
18225         define)
18226         case "$setservent_r_proto" in
18227         ''|0) try='int setservent_r(int, struct servent_data*);'
18228         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18229         esac
18230         case "$setservent_r_proto" in
18231         ''|0) try='void setservent_r(int, struct servent_data*);'
18232         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18233         esac
18234         case "$setservent_r_proto" in
18235         ''|0)   d_setservent_r=undef
18236                 setservent_r_proto=0
18237                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18238         * )     case "$setservent_r_proto" in
18239                 REENTRANT_PROTO*) ;;
18240                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18241                 esac
18242                 echo "Prototype: $try" ;;
18243         esac
18244         ;;
18245         *)      case "$usethreads" in
18246                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18247                 esac
18248                 d_setservent_r=undef
18249                 setservent_r_proto=0
18250                 ;;
18251         esac
18252         ;;
18253 *)      setservent_r_proto=0
18254         ;;
18255 esac
18256
18257 : see if setsid exists
18258 set setsid d_setsid
18259 eval $inlibc
18260
18261 : see if setvbuf exists
18262 set setvbuf d_setvbuf
18263 eval $inlibc
18264
18265 : see if shmctl exists
18266 set shmctl d_shmctl
18267 eval $inlibc
18268
18269 : see if shmget exists
18270 set shmget d_shmget
18271 eval $inlibc
18272
18273 : see if shmat exists
18274 set shmat d_shmat
18275 eval $inlibc
18276 : see what shmat returns
18277 case "$d_shmat" in
18278 "$define")
18279         $cat >shmat.c <<'END'
18280 #include <sys/shm.h>
18281 void *shmat();
18282 END
18283         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18284                 shmattype='void *'
18285         else
18286                 shmattype='char *'
18287         fi
18288         echo "and it returns ($shmattype)." >&4
18289         : see if a prototype for shmat is available
18290         xxx=`./findhdr sys/shm.h`
18291         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18292         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18293                 val="$define"
18294         else
18295                 val="$undef"
18296         fi
18297         $rm -f shmat.[co]
18298         ;;
18299 *)
18300         val="$undef"
18301         ;;
18302 esac
18303 set d_shmatprototype
18304 eval $setvar
18305
18306 : see if shmdt exists
18307 set shmdt d_shmdt
18308 eval $inlibc
18309
18310 : see how much of the 'shm*(2)' library is present.
18311 h_shm=true
18312 echo " "
18313 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18314 *"$undef"*) h_shm=false;;
18315 esac
18316 case "$osname" in
18317 freebsd)
18318     case "`ipcs 2>&1`" in
18319     "SVID shared memory"*"not configured"*)
18320         echo "Your $osname does not have the shm*(2) configured." >&4
18321         h_shm=false
18322         val="$undef"
18323         set shmctl d_shmctl
18324         eval $setvar
18325         set shmget d_shmget
18326         eval $setvar
18327         set shmat d_shmat
18328         eval $setvar
18329         set shmdt d_shmdt
18330         eval $setvar
18331         ;;
18332     esac
18333     ;;
18334 esac
18335 : we could also check for sys/ipc.h ...
18336 if $h_shm && $test `./findhdr sys/shm.h`; then
18337         echo "You have the full shm*(2) library." >&4
18338         val="$define"
18339 else
18340         echo "You don't have the full shm*(2) library." >&4
18341         val="$undef"
18342 fi
18343 set d_shm
18344 eval $setvar
18345
18346 : see if we have sigaction
18347 echo " "
18348 if set sigaction val -f d_sigaction; eval $csym; $val; then
18349         echo 'sigaction() found.' >&4
18350         $cat > try.c <<EOP
18351 #include <stdio.h>
18352 #include <sys/types.h>
18353 #include <signal.h>
18354 #$i_stdlib I_STDLIB
18355 #ifdef I_STDLIB
18356 #include <stdlib.h>
18357 #endif
18358 int main()
18359 {
18360     struct sigaction act, oact;
18361     act.sa_flags = 0;
18362     oact.sa_handler = 0;
18363     /* so that act and oact are used */
18364     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18365 }
18366 EOP
18367         set try
18368         if eval $compile_ok; then
18369                 val="$define"
18370         else
18371                 echo "But you don't seem to have a usable struct sigaction." >&4
18372                 val="$undef"
18373         fi
18374 else
18375         echo 'sigaction NOT found.' >&4
18376         val="$undef"
18377 fi
18378 set d_sigaction; eval $setvar
18379 $rm_try
18380
18381 : see what type pids are declared as in the kernel
18382 rp="What is the type of process ids on this system?"
18383 set pid_t pidtype int stdio.h sys/types.h
18384 eval $typedef_ask
18385
18386 : see what type uids are declared as in the kernel
18387 echo " "
18388 echo "Looking for the type for user ids returned by getuid()."
18389 set uid_t uidtype xxx stdio.h sys/types.h
18390 eval $typedef
18391 case "$uidtype" in
18392 xxx)
18393         xxx=`./findhdr sys/user.h`
18394         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18395         case $1 in
18396         unsigned) dflt="$1 $2" ;;
18397         *) dflt="$1" ;;
18398         esac
18399         ;;
18400 *) dflt="$uidtype";;
18401 esac
18402 case "$uidtype" in
18403 uid_t)  echo "uid_t found." ;;
18404 *)      rp="What is the type for user ids returned by getuid()?"
18405         . ./myread
18406         uidtype="$ans"
18407         ;;
18408 esac
18409
18410 : Define hasfield_t macro for Configure internal use
18411 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18412 while $test $# -ge 2; do
18413     case "$1" in
18414         $define) echo "#include <$2>";;
18415     esac ;
18416     shift 2;
18417 done > try.c;
18418 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18419 set try;
18420 if eval $compile; then
18421         val="$define";
18422 else
18423         val="$undef";
18424 fi;
18425 set $varname;
18426 eval $setvar;
18427 $rm_try'
18428
18429 : see what siginfo fields we have
18430 case "$d_sigaction" in
18431 "$define")
18432         echo "Checking if your siginfo_t has si_errno field...">&4
18433         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18434         eval $hasfield_t;
18435
18436         echo "Checking if your siginfo_t has si_pid field...">&4
18437         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18438         eval $hasfield_t;
18439
18440         echo "Checking if your siginfo_t has si_uid field...">&4
18441         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18442         eval $hasfield_t;
18443
18444         echo "Checking if your siginfo_t has si_addr field...">&4
18445         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18446         eval $hasfield_t;
18447
18448         echo "Checking if your siginfo_t has si_status field...">&4
18449         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18450         eval $hasfield_t;
18451
18452         echo "Checking if your siginfo_t has si_band field...">&4
18453         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18454         eval $hasfield_t;
18455
18456         echo "Checking if your siginfo_t has si_value field...">&4
18457         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18458         eval $hasfield_t;
18459
18460         echo "Checking if your siginfo_t has si_fd field...">&4
18461         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18462         eval $hasfield_t;
18463
18464         ;;
18465 *)
18466         d_siginfo_si_errno="$undef"
18467         d_siginfo_si_pid="$undef"
18468         d_siginfo_si_uid="$undef"
18469         d_siginfo_si_addr="$undef"
18470         d_siginfo_si_status="$undef"
18471         d_siginfo_si_band="$undef"
18472         d_siginfo_si_value="$undef"
18473         d_siginfo_si_fd="$undef"
18474         ;;
18475 esac
18476
18477 : see if this is a sunmath.h system
18478 set sunmath.h i_sunmath
18479 eval $inhdr
18480
18481 : see if signbit exists
18482 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18483 $cat >try.c <<EOCP
18484 #$i_sunmath I_SUNMATH
18485 #include <math.h>
18486 #ifdef I_SUNMATH  /* Solaris special math library */
18487 #  include <sunmath.h>
18488 #endif
18489 #define NV $nvtype
18490 int main(int argc, char **argv)
18491 {
18492     NV x = 0.0;
18493     NV y = -1.0;
18494     if ((signbit(x) == 0) && (signbit(y) != 0))
18495         return 0;
18496     else
18497         return 1;
18498 }
18499 EOCP
18500 val="$undef"
18501 set try
18502 if eval $compile; then
18503     if $run ./try; then
18504         $echo "Yes." >&4
18505         val="$define"
18506     else
18507         $echo "Signbit seems to be available, but doesn't work as I expected."
18508         $echo "I won't use it." >&4
18509         val="$undef"
18510     fi
18511 else
18512     $echo "Nope." >&4
18513     dflt="$undef"
18514 fi
18515 set d_signbit
18516 eval $setvar
18517 $rm_try
18518
18519 : see if sigprocmask exists
18520 set sigprocmask d_sigprocmask
18521 eval $inlibc
18522
18523 : see if sigsetjmp exists
18524 echo " "
18525 case "$d_sigsetjmp" in
18526 '')
18527         $cat >try.c <<EOP
18528 #include <setjmp.h>
18529 #$i_stdlib I_STDLIB
18530 #ifdef I_STDLIB
18531 #include <stdlib.h>
18532 #endif
18533 sigjmp_buf env;
18534 int set = 1;
18535 int main()
18536 {
18537         if (sigsetjmp(env,1))
18538                 exit(set);
18539         set = 0;
18540         siglongjmp(env, 1);
18541         exit(1);
18542 }
18543 EOP
18544         set try
18545         if eval $compile; then
18546                 if $run ./try >/dev/null 2>&1; then
18547                         echo "POSIX sigsetjmp found." >&4
18548                         val="$define"
18549                 else
18550                         $cat >&4 <<EOM
18551 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18552 I'll ignore them.
18553 EOM
18554                         val="$undef"
18555                 fi
18556         else
18557                 echo "sigsetjmp not found." >&4
18558                 val="$undef"
18559         fi
18560         ;;
18561 *) val="$d_sigsetjmp"
18562         case "$d_sigsetjmp" in
18563         $define) echo "POSIX sigsetjmp found." >&4;;
18564         $undef) echo "sigsetjmp not found." >&4;;
18565         esac
18566         ;;
18567 esac
18568 set d_sigsetjmp
18569 eval $setvar
18570 $rm_try
18571
18572 : see if snprintf exists
18573 set snprintf d_snprintf
18574 eval $inlibc
18575
18576 : see if vsnprintf exists
18577 set vsnprintf d_vsnprintf
18578 eval $inlibc
18579
18580 case "$d_snprintf-$d_vsnprintf" in
18581 "$define-$define")
18582     $cat <<EOM
18583 Checking whether your snprintf() and vsnprintf() work okay...
18584 EOM
18585     $cat >try.c <<'EOCP'
18586 /* v?snprintf testing logic courtesy of Russ Allbery.
18587  * According to C99:
18588  * - if the buffer is too short it still must be \0-terminated
18589  * - if the buffer is too short the potentially required length
18590  *   must be returned and not -1
18591  * - if the buffer is NULL the potentially required length
18592  *   must be returned and not -1 or core dump
18593  */
18594 #include <stdio.h>
18595 #include <stdarg.h>
18596
18597 char buf[2];
18598
18599 int test (char *format, ...)
18600 {
18601     va_list args;
18602     int count;
18603
18604     va_start (args, format);
18605     count = vsnprintf (buf, sizeof buf, format, args);
18606     va_end (args);
18607     return count;
18608 }
18609
18610 int main ()
18611 {
18612     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18613              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18614 }
18615 EOCP
18616     set try
18617     if eval $compile; then
18618         `$run ./try`
18619         case "$?" in
18620         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18621         *) cat <<EOM >&4
18622 Your snprintf() and snprintf() don't seem to be working okay.
18623 EOM
18624            d_snprintf="$undef"
18625            d_vsnprintf="$undef"
18626            ;;
18627         esac
18628     else
18629         echo "(I can't seem to compile the test program--assuming they don't)"
18630         d_snprintf="$undef"
18631         d_vsnprintf="$undef"
18632     fi
18633     $rm_try
18634     ;;
18635 esac
18636
18637 : see if sockatmark exists
18638 set sockatmark d_sockatmark
18639 eval $inlibc
18640
18641 : see if prototype for sockatmark is available
18642 echo " "
18643 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18644 eval $hasproto
18645
18646 : see if socks5_init exists
18647 set socks5_init d_socks5_init
18648 eval $inlibc
18649
18650 : see if srand48_r exists
18651 set srand48_r d_srand48_r
18652 eval $inlibc
18653 case "$d_srand48_r" in
18654 "$define")
18655         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18656         case "$d_srand48_r_proto:$usethreads" in
18657         ":define")      d_srand48_r_proto=define
18658                 set d_srand48_r_proto srand48_r $hdrs
18659                 eval $hasproto ;;
18660         *)      ;;
18661         esac
18662         case "$d_srand48_r_proto" in
18663         define)
18664         case "$srand48_r_proto" in
18665         ''|0) try='int srand48_r(long, struct drand48_data*);'
18666         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18667         esac
18668         case "$srand48_r_proto" in
18669         ''|0)   d_srand48_r=undef
18670                 srand48_r_proto=0
18671                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18672         * )     case "$srand48_r_proto" in
18673                 REENTRANT_PROTO*) ;;
18674                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18675                 esac
18676                 echo "Prototype: $try" ;;
18677         esac
18678         ;;
18679         *)      case "$usethreads" in
18680                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18681                 esac
18682                 d_srand48_r=undef
18683                 srand48_r_proto=0
18684                 ;;
18685         esac
18686         ;;
18687 *)      srand48_r_proto=0
18688         ;;
18689 esac
18690
18691 : see if srandom_r exists
18692 set srandom_r d_srandom_r
18693 eval $inlibc
18694 case "$d_srandom_r" in
18695 "$define")
18696         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18697         case "$d_srandom_r_proto:$usethreads" in
18698         ":define")      d_srandom_r_proto=define
18699                 set d_srandom_r_proto srandom_r $hdrs
18700                 eval $hasproto ;;
18701         *)      ;;
18702         esac
18703         case "$d_srandom_r_proto" in
18704         define)
18705         case "$srandom_r_proto" in
18706         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18707         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18708         esac
18709         case "$srandom_r_proto" in
18710         ''|0)   d_srandom_r=undef
18711                 srandom_r_proto=0
18712                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18713         * )     case "$srandom_r_proto" in
18714                 REENTRANT_PROTO*) ;;
18715                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18716                 esac
18717                 echo "Prototype: $try" ;;
18718         esac
18719         ;;
18720         *)      case "$usethreads" in
18721                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18722                 esac
18723                 d_srandom_r=undef
18724                 srandom_r_proto=0
18725                 ;;
18726         esac
18727         ;;
18728 *)      srandom_r_proto=0
18729         ;;
18730 esac
18731
18732 : see if prototype for setresgid is available
18733 echo " "
18734 set d_sresgproto setresgid $i_unistd unistd.h
18735 eval $hasproto
18736
18737 : see if prototype for setresuid is available
18738 echo " "
18739 set d_sresuproto setresuid $i_unistd unistd.h
18740 eval $hasproto
18741
18742 : see if stat exists
18743 set stat d_stat
18744 eval $inlibc
18745
18746 : see if sys/stat.h is available
18747 set sys/stat.h i_sysstat
18748 eval $inhdr
18749
18750 : see if stat knows about block sizes
18751 echo " "
18752 echo "Checking to see if your struct stat has st_blocks field..." >&4
18753 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18754 eval $hasfield
18755
18756 : see if this is a sys/vfs.h system
18757 set sys/vfs.h i_sysvfs
18758 eval $inhdr
18759
18760 : see if this is a sys/statfs.h system
18761 set sys/statfs.h i_sysstatfs
18762 eval $inhdr
18763
18764 : Check for statfs_s
18765 echo " "
18766 echo "Checking to see if your system supports struct statfs..." >&4
18767 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
18768 eval $hasstruct
18769 case "$d_statfs_s" in
18770 "$define")      echo "Yes, it does."   ;;
18771 *)              echo "No, it doesn't." ;;
18772 esac
18773
18774 : see if struct statfs knows about f_flags
18775 case "$d_statfs_s" in
18776 define)
18777         echo " "
18778         echo "Checking to see if your struct statfs has f_flags field..." >&4
18779         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
18780         eval $hasfield
18781         ;;
18782 *)      val="$undef"
18783         set d_statfs_f_flags
18784         eval $setvar
18785         ;;
18786 esac
18787 case "$d_statfs_f_flags" in
18788 "$define")      echo "Yes, it does."   ;;
18789 *)              echo "No, it doesn't." ;;
18790 esac
18791
18792 : see what flavor, if any, of static inline is supported
18793 echo " "
18794 echo "Checking to see if your system supports static inline..."
18795 $cat > try.c <<'EOCP'
18796 #include <stdlib.h>
18797 extern int f_via_a(int x);
18798 extern int f_via_b(int x);
18799 int main(int argc, char **argv)
18800 {
18801     int y;
18802
18803     y = f_via_a(0);
18804 #ifdef USE_B
18805     y = f_via_b(0);
18806 #endif
18807     if (y == 42) {
18808         return EXIT_SUCCESS;
18809     }
18810     else {
18811         return EXIT_FAILURE;
18812     }
18813 }
18814 EOCP
18815 $cat > a.c <<'EOCP'
18816 static INLINE int f(int x) {
18817     int y;
18818     y = x + 42;
18819     return y;
18820 }
18821
18822 int f_via_a(int x)
18823 {
18824     return f(x);
18825 }
18826 EOCP
18827 $cat > b.c <<'EOCP'
18828 extern int f(int x);
18829
18830 int f_via_b(int x)
18831 {
18832     return f(x);
18833 }
18834 EOCP
18835
18836 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18837 case "$perl_static_inline" in
18838 '')     # Check the various possibilities, and break out on success.
18839         # For gcc, prefer __inline__, which will still permit
18840         # cflags.SH to add in -ansi.
18841         case "$gccversion" in
18842                 '') xxx="inline __inline__ __inline _inline";;
18843                 *)  xxx="__inline__ inline __inline _inline";;
18844         esac
18845         for inline in $xxx; do
18846                 set try -DINLINE=$inline a.c
18847                 if eval $compile && $run ./try; then
18848                         # Now make sure there is no external linkage of static
18849                         # functions
18850                         set try -DINLINE=$inline -DUSE_B a.c b.c
18851                         if eval $compile && $run ./try; then
18852                                 $echo "Your compiler supports static $inline, " >&4
18853                                 $echo "but it also creates an external definition," >&4
18854                                 $echo "so I won't use it." >&4
18855                                 val=$undef
18856                         else
18857                                 $echo "Your compiler supports static $inline." >&4
18858                                 val=$define
18859                                 perl_static_inline="static $inline";
18860                                 break;
18861                         fi
18862                 else
18863                         $echo "Your compiler does NOT support static $inline." >&4
18864                         val="$undef"
18865                 fi
18866         done
18867         ;;
18868 *inline*) # Some variant of inline exists.
18869         echo "Keeping your $hint value of $perl_static_inline."
18870         val=$define
18871         ;;
18872 static)  # No inline capabilities
18873         echo "Keeping your $hint value of $perl_static_inline."
18874         val=$undef
18875         ;;
18876 *)  # Unrecognized previous value -- blindly trust the supplied
18877         # value and hope it makes sense.  Use old value for
18878         # d_static_inline, if there is one.
18879         echo "Keeping your $hint value of $perl_static_inline."
18880         case "$d_static_inline" in
18881                 '') val=$define ;;
18882                 *)  val=$d_static_inline ;;
18883         esac
18884         ;;
18885 esac
18886 # Fallback to plain 'static' if nothing worked.
18887 case "$perl_static_inline" in
18888 '')
18889         perl_static_inline="static"
18890         val=$undef
18891         ;;
18892 esac
18893 set d_static_inline
18894 eval $setvar
18895 $rm -f a.[co] b.[co]
18896 $rm_try
18897
18898 : Check stream access
18899 $cat >&4 <<EOM
18900 Checking how to access stdio streams by file descriptor number...
18901 EOM
18902 case "$stdio_stream_array" in
18903 '')     $cat >try.c <<EOCP
18904 #include <stdio.h>
18905 int main() {
18906   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18907     printf("yes\n");
18908 }
18909 EOCP
18910         for s in _iob __iob __sF
18911         do
18912                 set try -DSTDIO_STREAM_ARRAY=$s
18913                 if eval $compile; then
18914                         case "`$run ./try`" in
18915                         yes)    stdio_stream_array=$s; break ;;
18916                         esac
18917                 fi
18918         done
18919         $rm_try
18920 esac
18921 case "$stdio_stream_array" in
18922 '')     $cat >&4 <<EOM
18923 I can't figure out how to access stdio streams by file descriptor number.
18924 EOM
18925         d_stdio_stream_array="$undef"
18926         ;;
18927 *)      $cat >&4 <<EOM
18928 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18929 EOM
18930         d_stdio_stream_array="$define"
18931         ;;
18932 esac
18933
18934 : see if strcoll exists
18935 set strcoll d_strcoll
18936 eval $inlibc
18937
18938 : see if strerror_l exists
18939 set strerror_l d_strerror_l
18940 eval $inlibc
18941
18942 : see if strerror_r exists
18943 set strerror_r d_strerror_r
18944 eval $inlibc
18945 case "$d_strerror_r" in
18946 "$define")
18947         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18948         case "$d_strerror_r_proto:$usethreads" in
18949         ":define")      d_strerror_r_proto=define
18950                 set d_strerror_r_proto strerror_r $hdrs
18951                 eval $hasproto ;;
18952         *)      ;;
18953         esac
18954         case "$d_strerror_r_proto" in
18955         define)
18956         case "$strerror_r_proto" in
18957         ''|0) try='int strerror_r(int, char*, size_t);'
18958         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18959         esac
18960         case "$strerror_r_proto" in
18961         ''|0) try='int strerror_r(int, char*, int);'
18962         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18963         esac
18964         case "$strerror_r_proto" in
18965         ''|0) try='char* strerror_r(int, char*, size_t);'
18966         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18967         esac
18968         case "$strerror_r_proto" in
18969         ''|0)   d_strerror_r=undef
18970                 strerror_r_proto=0
18971                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18972         * )     case "$strerror_r_proto" in
18973                 REENTRANT_PROTO*) ;;
18974                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18975                 esac
18976                 echo "Prototype: $try" ;;
18977         esac
18978         ;;
18979         *)      case "$usethreads" in
18980                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18981                 esac
18982                 d_strerror_r=undef
18983                 strerror_r_proto=0
18984                 ;;
18985         esac
18986         ;;
18987 *)      strerror_r_proto=0
18988         ;;
18989 esac
18990
18991 : see if strftime exists
18992 set strftime d_strftime
18993 eval $inlibc
18994
18995 : see if strlcat exists
18996 : We need both a prototype in string.h and the symbol in libc.
18997 echo " "
18998 d_strlcat_proto=''
18999 xx1="#$d_gnulibc HAS_GNULIBC"
19000 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19001 xx3='#   define _GNU_SOURCE'
19002 xx4='#endif'
19003 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19004 eval $hasproto
19005 case "$d_strlcat_proto" in
19006     define) # see if strlcat exists
19007         set strlcat d_strlcat
19008         eval $inlibc
19009         ;;
19010     *)  val=$undef
19011         set d_strlcat
19012         eval $setvar
19013         ;;
19014 esac
19015
19016 : see if strlcpy exists
19017 : We need both a prototype in string.h and the symbol in libc.
19018 echo " "
19019 d_strlcpy_proto=''
19020 xx1="#$d_gnulibc HAS_GNULIBC"
19021 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19022 xx3='#   define _GNU_SOURCE'
19023 xx4='#endif'
19024 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19025 eval $hasproto
19026 case "$d_strlcpy_proto" in
19027     define) # see if strlcpy exists
19028         set strlcpy d_strlcpy
19029         eval $inlibc
19030         ;;
19031     *)  val=$undef
19032         set d_strlcpy
19033         eval $setvar
19034         ;;
19035 esac
19036
19037 : see if strnlen exists
19038 set strnlen d_strnlen
19039 eval $inlibc
19040
19041 : see if strtod exists
19042 set strtod d_strtod
19043 eval $inlibc
19044
19045 : see if strtod_l exists
19046 set strtod_l d_strtod_l
19047 eval $inlibc
19048
19049 : see if strtol exists
19050 set strtol d_strtol
19051 eval $inlibc
19052
19053 : see if strtold exists
19054 set strtold d_strtold
19055 eval $inlibc
19056
19057 : see if strtold_l exists
19058 set strtold_l d_strtold_l
19059 eval $inlibc
19060
19061 : see if strtoll exists
19062 set strtoll d_strtoll
19063 eval $inlibc
19064
19065 case "$d_longlong-$d_strtoll" in
19066 "$define-$define")
19067         $cat <<EOM
19068 Checking whether your strtoll() works okay...
19069 EOM
19070         $cat >try.c <<'EOCP'
19071 #include <errno.h>
19072 #ifdef __hpux
19073 #define strtoll __strtoll
19074 #endif
19075 #ifdef __EMX__
19076 #define strtoll _strtoll
19077 #endif
19078 #include <stdio.h>
19079 extern long long int strtoll(char *s, char **, int);
19080 static int bad = 0;
19081 int check(char *s, long long ell, int een) {
19082         long long gll;
19083         errno = 0;
19084         gll = strtoll(s, 0, 10);
19085         if (!((gll == ell) && (errno == een)))
19086                 bad++;
19087 }
19088 int main() {
19089         check(" 1",                                      1LL, 0);
19090         check(" 0",                                      0LL, 0);
19091         check("-1",                                     -1LL, 0);
19092         check("-9223372036854775808", -9223372036854775808LL, 0);
19093         check("-9223372036854775808", -9223372036854775808LL, 0);
19094         check(" 9223372036854775807",  9223372036854775807LL, 0);
19095         check("-9223372036854775808", -9223372036854775808LL, 0);
19096         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19097         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19098         if (!bad)
19099                 printf("ok\n");
19100 }
19101 EOCP
19102         set try
19103         if eval $compile; then
19104                 yyy=`$run ./try`
19105                 case "$yyy" in
19106                 ok) echo "Your strtoll() seems to be working okay." ;;
19107                 *) cat <<EOM >&4
19108 Your strtoll() doesn't seem to be working okay.
19109 EOM
19110                    d_strtoll="$undef"
19111                    ;;
19112                 esac
19113         else
19114                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19115                 d_strtoll="$undef"
19116         fi
19117         ;;
19118 esac
19119
19120 : see if strtoq exists
19121 set strtoq d_strtoq
19122 eval $inlibc
19123
19124 : see if strtoul exists
19125 set strtoul d_strtoul
19126 eval $inlibc
19127
19128 case "$d_strtoul" in
19129 "$define")
19130         $cat <<EOM
19131 Checking whether your strtoul() works okay...
19132 EOM
19133         $cat >try.c <<'EOCP'
19134 #include <errno.h>
19135 #include <stdio.h>
19136 extern unsigned long int strtoul(char *s, char **, int);
19137 static int bad = 0;
19138 void check(char *s, unsigned long eul, int een) {
19139         unsigned long gul;
19140         errno = 0;
19141         gul = strtoul(s, 0, 10);
19142         if (!((gul == eul) && (errno == een)))
19143                 bad++;
19144 }
19145 int main() {
19146         check(" 1", 1L, 0);
19147         check(" 0", 0L, 0);
19148 EOCP
19149         case "$longsize" in
19150         8)
19151             $cat >>try.c <<'EOCP'
19152         check("18446744073709551615", 18446744073709551615UL, 0);
19153         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19154 #if 0 /* strtoul() for /^-/ strings is undefined. */
19155         check("-1", 18446744073709551615UL, 0);
19156         check("-18446744073709551614", 2, 0);
19157         check("-18446744073709551615", 1, 0);
19158         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19159         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19160 #endif
19161 EOCP
19162                 ;;
19163         4)
19164                     $cat >>try.c <<'EOCP'
19165         check("4294967295", 4294967295UL, 0);
19166         check("4294967296", 4294967295UL, ERANGE);
19167 #if 0 /* strtoul() for /^-/ strings is undefined. */
19168         check("-1", 4294967295UL, 0);
19169         check("-4294967294", 2, 0);
19170         check("-4294967295", 1, 0);
19171         check("-4294967296", 4294967295UL, ERANGE);
19172         check("-4294967297", 4294967295UL, ERANGE);
19173 #endif
19174 EOCP
19175                 ;;
19176         *)
19177 : Should we write these tests to be more portable by sprintf-ing
19178 : ~0 and then manipulating that char string as input for strtol?
19179                 ;;
19180         esac
19181         $cat >>try.c <<'EOCP'
19182         if (!bad)
19183                 printf("ok\n");
19184         return 0;
19185 }
19186 EOCP
19187         set try
19188         if eval $compile; then
19189                 case "`$run ./try`" in
19190                 ok) echo "Your strtoul() seems to be working okay." ;;
19191                 *) cat <<EOM >&4
19192 Your strtoul() doesn't seem to be working okay.
19193 EOM
19194                    d_strtoul="$undef"
19195                    ;;
19196                 esac
19197         else
19198                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19199                 d_strtoul="$undef"
19200         fi
19201         ;;
19202 esac
19203
19204 : see if strtoull exists
19205 set strtoull d_strtoull
19206 eval $inlibc
19207
19208 case "$d_longlong-$d_strtoull" in
19209 "$define-$define")
19210         $cat <<EOM
19211 Checking whether your strtoull() works okay...
19212 EOM
19213         $cat >try.c <<'EOCP'
19214 #include <errno.h>
19215 #ifdef __hpux
19216 #define strtoull __strtoull
19217 #endif
19218 #include <stdio.h>
19219 extern unsigned long long int strtoull(char *s, char **, int);
19220 static int bad = 0;
19221 int check(char *s, long long eull, int een) {
19222         long long gull;
19223         errno = 0;
19224         gull = strtoull(s, 0, 10);
19225         if (!((gull == eull) && (errno == een)))
19226                 bad++;
19227 }
19228 int main() {
19229         check(" 1",                                        1LL, 0);
19230         check(" 0",                                        0LL, 0);
19231         check("18446744073709551615",  18446744073709551615ULL, 0);
19232         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19233 #if 0 /* strtoull() for /^-/ strings is undefined. */
19234         check("-1",                    18446744073709551615ULL, 0);
19235         check("-18446744073709551614",                     2LL, 0);
19236         check("-18446744073709551615",                     1LL, 0);
19237         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19238         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19239 #endif
19240         if (!bad)
19241                 printf("ok\n");
19242 }
19243 EOCP
19244         set try
19245         if eval $compile; then
19246                 case "`$run ./try`" in
19247                 ok) echo "Your strtoull() seems to be working okay." ;;
19248                 *) cat <<EOM >&4
19249 Your strtoull() doesn't seem to be working okay.
19250 EOM
19251                    d_strtoull="$undef"
19252                    ;;
19253                 esac
19254         else
19255                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19256                 d_strtoull="$undef"
19257         fi
19258         ;;
19259 esac
19260
19261 : see if strtouq exists
19262 set strtouq d_strtouq
19263 eval $inlibc
19264
19265 case "$d_strtouq" in
19266 "$define")
19267         $cat <<EOM
19268 Checking whether your strtouq() works okay...
19269 EOM
19270         $cat >try.c <<'EOCP'
19271 #include <errno.h>
19272 #include <stdio.h>
19273 extern unsigned long long int strtouq(char *s, char **, int);
19274 static int bad = 0;
19275 void check(char *s, unsigned long long eull, int een) {
19276         unsigned long long gull;
19277         errno = 0;
19278         gull = strtouq(s, 0, 10);
19279         if (!((gull == eull) && (errno == een)))
19280                 bad++;
19281 }
19282 int main() {
19283         check(" 1",                                        1LL, 0);
19284         check(" 0",                                        0LL, 0);
19285         check("18446744073709551615",  18446744073709551615ULL, 0);
19286         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19287 #if 0 /* strtouq() for /^-/ strings is undefined. */
19288         check("-1",                    18446744073709551615ULL, 0);
19289         check("-18446744073709551614",                     2LL, 0);
19290         check("-18446744073709551615",                     1LL, 0);
19291         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19292         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19293 #endif
19294         if (!bad)
19295                 printf("ok\n");
19296         return 0;
19297 }
19298 EOCP
19299         set try
19300         if eval $compile; then
19301                 case "`$run ./try`" in
19302                 ok) echo "Your strtouq() seems to be working okay." ;;
19303                 *) cat <<EOM >&4
19304 Your strtouq() doesn't seem to be working okay.
19305 EOM
19306                    d_strtouq="$undef"
19307                    ;;
19308                 esac
19309         else
19310                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19311                 d_strtouq="$undef"
19312         fi
19313         ;;
19314 esac
19315
19316 : see if strxfrm exists
19317 set strxfrm d_strxfrm
19318 eval $inlibc
19319
19320 : see if symlink exists
19321 set symlink d_symlink
19322 eval $inlibc
19323
19324 : see if syscall exists
19325 set syscall d_syscall
19326 eval $inlibc
19327
19328 : see if prototype for syscall is available
19329 echo " "
19330 set d_syscallproto syscall $i_unistd unistd.h
19331 eval $hasproto
19332
19333 : see if sysconf exists
19334 set sysconf d_sysconf
19335 eval $inlibc
19336
19337 : see if sys_errlist[] exists
19338 echo " "
19339 if test "X$d_syserrlst" = X; then
19340         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19341                 echo "You have sys_errlist[], so we could roll our own strerror."
19342                 d_syserrlst="$define"
19343         else
19344                 echo "You don't have sys_errlist[], so strerror() is welcome."
19345                 d_syserrlst="$undef"
19346         fi
19347 fi
19348
19349 : see if system exists
19350 set system d_system
19351 eval $inlibc
19352
19353 : see if tcgetpgrp exists
19354 set tcgetpgrp d_tcgetpgrp
19355 eval $inlibc
19356
19357 : see if tcsetpgrp exists
19358 set tcsetpgrp d_tcsetpgrp
19359 eval $inlibc
19360
19361 : see if prototype for telldir is available
19362 echo " "
19363 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19364 eval $hasproto
19365
19366 : see if tgamma exists
19367 set tgamma d_tgamma
19368 eval $inlibc
19369
19370 : check for thread_safe_nl_langinfo_l item
19371 $cat <<EOM
19372
19373 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19374 EOM
19375 $cat >try.c <<EOCP
19376 #$i_stdlib I_STDLIB
19377 #ifdef I_STDLIB
19378 #  include <stdlib.h>
19379 #endif
19380 #include <string.h>
19381 #$i_langinfo I_LANGINFO
19382 #ifdef I_LANGINFO
19383 #  include <langinfo.h>
19384 #endif
19385 #$i_pthread I_PTHREAD
19386 #ifdef I_PTHREAD
19387 #  include <pthread.h>
19388 #endif
19389 #$i_locale I_LOCALE
19390 #ifdef I_LOCALE
19391 #  include <locale.h>
19392 #endif
19393
19394 void *
19395 thread_start(void * arg)
19396 {
19397     nl_langinfo(RADIXCHAR);
19398 }
19399
19400 int main() {
19401     char * main_buffer;
19402     char save_main_buffer[1000];
19403     pthread_t subthread;
19404     pthread_attr_t attr;
19405
19406     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19407
19408     /* If too large for our generous allowance, just assume we don't have
19409      * it. */
19410     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19411         exit(1);
19412     }
19413
19414     strcpy(save_main_buffer, main_buffer);
19415
19416     if (pthread_attr_init(&attr) != 0) {
19417         exit(1);
19418     }
19419
19420     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19421         exit(1);
19422     }
19423
19424     if (pthread_join(subthread, NULL) != 0) {
19425         exit(1);
19426     }
19427
19428     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19429 }
19430 EOCP
19431 case "$usethreads" in
19432     define)
19433         set try
19434         if eval $compile; then
19435             echo "Your system has nl_langinfo_l()..." >&4
19436             if $run ./try; then
19437                 echo "and it is thread-safe (just as I'd hoped)." >&4
19438                 d_thread_safe_nl_langinfo_l="$define"
19439                 echo "$d_thread_safe_nl_langinfo_l" >&4
19440             else
19441                 echo "but it isn't thread-safe, so we won't use it." >&4
19442             fi
19443         else
19444             echo "your system does not have nl_langinfo_l()" >&4
19445         fi
19446         ;;
19447     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19448 esac
19449 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19450         d_thread_safe_nl_langinfo_l="$undef"
19451 fi
19452 $rm_try
19453
19454 : see if time exists
19455 echo " "
19456 if test "X$d_time" = X -o X"$timetype" = X; then
19457     if set time val -f d_time; eval $csym; $val; then
19458                 echo 'time() found.' >&4
19459                 val="$define"
19460                 rp="What is the type returned by time() on this system?"
19461                 set time_t timetype long stdio.h sys/types.h
19462                 eval $typedef_ask
19463     else
19464                 echo 'time() not found, hope that will do.' >&4
19465                 val="$undef"
19466                 timetype='int';
19467     fi
19468     set d_time
19469     eval $setvar
19470 fi
19471
19472 : see if timegm exists
19473 set timegm d_timegm
19474 eval $inlibc
19475
19476 : see if this is a sys/times.h system
19477 set sys/times.h i_systimes
19478 eval $inhdr
19479
19480 : see if times exists
19481 echo " "
19482 if set times val -f d_times; eval $csym; $val; then
19483         echo 'times() found.' >&4
19484         d_times="$define"
19485         inc=''
19486         case "$i_systimes" in
19487         "$define") inc='sys/times.h';;
19488         esac
19489         rp="What is the type returned by times() on this system?"
19490         set clock_t clocktype long stdio.h sys/types.h $inc
19491         eval $typedef_ask
19492 else
19493         echo 'times() NOT found, hope that will do.' >&4
19494         d_times="$undef"
19495         clocktype='int'
19496 fi
19497
19498 : see if tmpnam_r exists
19499 set tmpnam_r d_tmpnam_r
19500 eval $inlibc
19501 case "$d_tmpnam_r" in
19502 "$define")
19503         hdrs="$i_systypes sys/types.h define stdio.h "
19504         case "$d_tmpnam_r_proto:$usethreads" in
19505         ":define")      d_tmpnam_r_proto=define
19506                 set d_tmpnam_r_proto tmpnam_r $hdrs
19507                 eval $hasproto ;;
19508         *)      ;;
19509         esac
19510         case "$d_tmpnam_r_proto" in
19511         define)
19512         case "$tmpnam_r_proto" in
19513         ''|0) try='char* tmpnam_r(char*);'
19514         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19515         esac
19516         case "$tmpnam_r_proto" in
19517         ''|0)   d_tmpnam_r=undef
19518                 tmpnam_r_proto=0
19519                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19520         * )     case "$tmpnam_r_proto" in
19521                 REENTRANT_PROTO*) ;;
19522                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19523                 esac
19524                 echo "Prototype: $try" ;;
19525         esac
19526         ;;
19527         *)      case "$usethreads" in
19528                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19529                 esac
19530                 d_tmpnam_r=undef
19531                 tmpnam_r_proto=0
19532                 ;;
19533         esac
19534         ;;
19535 *)      tmpnam_r_proto=0
19536         ;;
19537 esac
19538
19539 : see if towlower exists
19540 set towlower d_towlower
19541 eval $inlibc
19542
19543 : see if trunc exists
19544 set trunc d_trunc
19545 eval $inlibc
19546
19547 : see if truncate exists
19548 set truncate d_truncate
19549 eval $inlibc
19550
19551 : see if ttyname_r exists
19552 set ttyname_r d_ttyname_r
19553 eval $inlibc
19554 case "$d_ttyname_r" in
19555 "$define")
19556         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19557         case "$d_ttyname_r_proto:$usethreads" in
19558         ":define")      d_ttyname_r_proto=define
19559                 set d_ttyname_r_proto ttyname_r $hdrs
19560                 eval $hasproto ;;
19561         *)      ;;
19562         esac
19563         case "$d_ttyname_r_proto" in
19564         define)
19565         case "$ttyname_r_proto" in
19566         ''|0) try='int ttyname_r(int, char*, size_t);'
19567         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19568         esac
19569         case "$ttyname_r_proto" in
19570         ''|0) try='int ttyname_r(int, char*, int);'
19571         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19572         esac
19573         case "$ttyname_r_proto" in
19574         ''|0) try='char* ttyname_r(int, char*, int);'
19575         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19576         esac
19577         case "$ttyname_r_proto" in
19578         ''|0)   d_ttyname_r=undef
19579                 ttyname_r_proto=0
19580                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19581         * )     case "$ttyname_r_proto" in
19582                 REENTRANT_PROTO*) ;;
19583                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19584                 esac
19585                 echo "Prototype: $try" ;;
19586         esac
19587         ;;
19588         *)      case "$usethreads" in
19589                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19590                 esac
19591                 d_ttyname_r=undef
19592                 ttyname_r_proto=0
19593                 ;;
19594         esac
19595         ;;
19596 *)      ttyname_r_proto=0
19597         ;;
19598 esac
19599
19600 : see if tzname[] exists
19601 echo " "
19602 if set tzname val -a d_tzname; eval $csym; $val; then
19603         val="$define"
19604         echo 'tzname[] found.' >&4
19605 else
19606         val="$undef"
19607         echo 'tzname[] NOT found.' >&4
19608 fi
19609 set d_tzname
19610 eval $setvar
19611
19612 : Check if is a multiplatform env
19613 case "$osname" in
19614 darwin) multiarch="$define" ;;
19615 esac
19616 case "$multiarch" in
19617 ''|[nN]*) multiarch="$undef" ;;
19618 esac
19619
19620 : check for ordering of bytes in a UV
19621 echo " "
19622 case "$multiarch" in
19623 *$define*)
19624         $cat <<EOM
19625 You seem to be doing a multiarchitecture build,
19626 skipping the byteorder check.
19627
19628 EOM
19629         byteorder='ffff'
19630         ;;
19631 *)
19632         case "$byteorder" in
19633         '')
19634                 $cat <<'EOM'
19635 In the following, larger digits indicate more significance.  A big-endian
19636 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19637 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19638 machines may have weird orders like 3412.  A Cray will report 87654321,
19639 an Alpha will report 12345678. If the test program works the default is
19640 probably right.
19641 I'm now running the test program...
19642 EOM
19643                 $cat >try.c <<EOCP
19644 #include <stdio.h>
19645 #$i_stdlib I_STDLIB
19646 #ifdef I_STDLIB
19647 #include <stdlib.h>
19648 #endif
19649 #include <sys/types.h>
19650 typedef $uvtype UV;
19651 int main()
19652 {
19653         int i;
19654         union {
19655                 UV l;
19656                 char c[$uvsize];
19657         } u;
19658
19659         if ($uvsize > 4)
19660                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19661         else
19662                 u.l = (UV)0x04030201;
19663         for (i = 0; i < $uvsize; i++)
19664                 printf("%c", u.c[i]+'0');
19665         printf("\n");
19666         exit(0);
19667 }
19668 EOCP
19669                 xxx_prompt=y
19670                 set try
19671                 if eval $compile && $run ./try > /dev/null; then
19672                         dflt=`$run ./try`
19673                         case "$dflt" in
19674                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19675                                 echo "(The test program ran ok.)"
19676                                 echo "byteorder=$dflt"
19677                                 xxx_prompt=n
19678                         ;;
19679                         ????|????????) echo "(The test program ran ok.)" ;;
19680                         *) echo "(The test program didn't run right for some reason.)" ;;
19681                         esac
19682                 else
19683                         dflt='4321'
19684                         cat <<'EOM'
19685 (I can't seem to compile the test program.  Guessing big-endian...)
19686 EOM
19687                 fi
19688                 case "$xxx_prompt" in
19689                 y)
19690                         rp="What is the order of bytes in $uvtype?"
19691                         . ./myread
19692                         byteorder="$ans"
19693                         ;;
19694                 *)      byteorder=$dflt
19695                         ;;
19696                 esac
19697                 ;;
19698         esac
19699         $rm_try
19700         ;;
19701 esac
19702
19703 : Checking 32bit alignedness
19704 $cat <<EOM
19705
19706 Checking to see whether you can access character data unalignedly...
19707 EOM
19708 case "$d_u32align" in
19709 '')   $cat >try.c <<EOCP
19710 #include <stdio.h>
19711 #$i_stdlib I_STDLIB
19712 #ifdef I_STDLIB
19713 #include <stdlib.h>
19714 #endif
19715 #define U32 $u32type
19716 #define BYTEORDER 0x$byteorder
19717 #define U8 $u8type
19718 #include <signal.h>
19719 #ifdef SIGBUS
19720 $signal_t bletch(int s) { exit(4); }
19721 #endif
19722 int main() {
19723 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19724     volatile U8 buf[8];
19725     volatile U32 *up;
19726     int i;
19727
19728     if (sizeof(U32) != 4) {
19729         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19730         exit(1);
19731     }
19732
19733     fflush(stdout);
19734
19735 #ifdef SIGBUS
19736     signal(SIGBUS, bletch);
19737 #endif
19738
19739     buf[0] = 0;
19740     buf[1] = 0;
19741     buf[2] = 0;
19742     buf[3] = 1;
19743     buf[4] = 0;
19744     buf[5] = 0;
19745     buf[6] = 0;
19746     buf[7] = 1;
19747
19748     for (i = 0; i < 4; i++) {
19749         up = (U32*)(buf + i);
19750         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19751                (*up == 1 << (8*(3-i)))  /* little-endian */
19752               )
19753            )
19754         {
19755             printf("read failed (%x)\n", *up);
19756             exit(2);
19757         }
19758     }
19759
19760     /* write test */
19761     for (i = 0; i < 4; i++) {
19762         up = (U32*)(buf + i);
19763         *up = 0xBeef;
19764         if (*up != 0xBeef) {
19765             printf("write failed (%x)\n", *up);
19766             exit(3);
19767         }
19768     }
19769
19770     exit(0);
19771 #else
19772     printf("1\n");
19773     exit(1);
19774 #endif
19775     return 0;
19776 }
19777 EOCP
19778 set try
19779 if eval $compile_ok; then
19780         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19781         $run ./try 2>&1 >/dev/null
19782         case "$?" in
19783         0)      cat >&4 <<EOM
19784 You can access character data pretty unalignedly.
19785 EOM
19786                 d_u32align="$undef"
19787                 ;;
19788         *)      cat >&4 <<EOM
19789 It seems that you must access character data in an aligned manner.
19790 EOM
19791                 d_u32align="$define"
19792                 ;;
19793         esac
19794 else
19795         rp='Can you access character data at unaligned addresses?'
19796         dflt='n'
19797         . ./myread
19798         case "$ans" in
19799         [yY]*)  d_u32align="$undef"  ;;
19800         *)      d_u32align="$define" ;;
19801         esac
19802 fi
19803 $rm_try
19804 ;;
19805 esac
19806
19807 : see if ualarm exists
19808 set ualarm d_ualarm
19809 eval $inlibc
19810
19811 : see if umask exists
19812 set umask d_umask
19813 eval $inlibc
19814
19815 : see if unordered exists
19816 set unordered d_unordered
19817 eval $inlibc
19818
19819 : see if unsetenv exists
19820 set unsetenv d_unsetenv
19821 eval $inlibc
19822
19823 : see if usleep exists
19824 set usleep d_usleep
19825 eval $inlibc
19826
19827 : see if prototype for usleep is available
19828 echo " "
19829 set d_usleepproto usleep $i_unistd unistd.h
19830 eval $hasproto
19831
19832 : see if ustat exists
19833 set ustat d_ustat
19834 eval $inlibc
19835
19836 : see if closedir exists
19837 set closedir d_closedir
19838 eval $inlibc
19839
19840 case "$d_closedir" in
19841 "$define")
19842         echo " "
19843         echo "Checking whether closedir() returns a status..." >&4
19844         cat > try.c <<EOM
19845 #$i_dirent I_DIRENT             /**/
19846 #$i_sysdir I_SYS_DIR            /**/
19847 #$i_sysndir I_SYS_NDIR          /**/
19848 #$i_systypes I_SYS_TYPES        /**/
19849
19850 #if defined(I_SYS_TYPES)
19851 #include <sys/types.h>
19852 #endif
19853 #if defined(I_DIRENT)
19854 #include <dirent.h>
19855 #else
19856 #ifdef I_SYS_NDIR
19857 #include <sys/ndir.h>
19858 #else
19859 #ifdef I_SYS_DIR
19860 #include <sys/dir.h>
19861 #endif
19862 #endif
19863 #endif
19864 int main() { return closedir(opendir(".")); }
19865 EOM
19866         set try
19867         if eval $compile_ok; then
19868                 if $run ./try > /dev/null 2>&1 ; then
19869                         echo "Yes, it does."
19870                         val="$undef"
19871                 else
19872                         echo "No, it doesn't."
19873                         val="$define"
19874                 fi
19875         else
19876                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19877                 val="$define"
19878         fi
19879         ;;
19880 *)
19881         val="$undef";
19882         ;;
19883 esac
19884 set d_void_closedir
19885 eval $setvar
19886 $rm_try
19887
19888 : see if there is a wait4
19889 set wait4 d_wait4
19890 eval $inlibc
19891
19892 : see if waitpid exists
19893 set waitpid d_waitpid
19894 eval $inlibc
19895
19896 : look for wcscmp
19897 echo " "
19898 $cat >try.c <<'EOCP'
19899 #include <stdio.h>
19900 #include <wchar.h>
19901 int main ()
19902 {
19903     wchar_t *s = L" ";
19904     return (wcscmp (s, s) ? 1 : 0);
19905     }
19906 EOCP
19907 set try
19908 val="$undef"
19909 if eval $compile; then
19910     `$run ./try`
19911     case "$?" in
19912         0)  echo "A working wcscmp() found." >&4
19913             val="$define" ;;
19914         *)  echo "wcscmp() found, but it doesn't work" >&4
19915             ;;
19916         esac
19917 else
19918     echo "wcscmp() NOT found." >&4
19919     fi
19920 set d_wcscmp
19921 eval $setvar
19922 $rm_try
19923
19924 : see if wcstombs exists
19925 set wcstombs d_wcstombs
19926 eval $inlibc
19927
19928 : look for wcsxfrm
19929 echo " "
19930 $cat >try.c <<'EOCP'
19931 #include <errno.h>
19932 #include <wchar.h>
19933 int main ()
19934 {
19935     wchar_t dst[4], *src = L" ";
19936     errno = 0;
19937     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19938     }
19939 EOCP
19940 set try
19941 val="$undef"
19942 if eval $compile; then
19943     `$run ./try`
19944     case "$?" in
19945         0)  echo "A working wcsxfrm() found." >&4
19946             val="$define" ;;
19947         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19948             ;;
19949         esac
19950 else
19951     echo "wcsxfrm() NOT found." >&4
19952     fi
19953 set d_wcsxfrm
19954 eval $setvar
19955 $rm_try
19956
19957 : see if wctomb exists
19958 set wctomb d_wctomb
19959 eval $inlibc
19960
19961 : see if writev exists
19962 set writev d_writev
19963 eval $inlibc
19964
19965 : check for alignment requirements
19966 echo " "
19967 case "$alignbytes" in
19968     '') echo "Checking alignment constraints..." >&4
19969         $cat >try.c <<EOCP
19970 #include <stdio.h>
19971 struct foobar {
19972     char foo;
19973     $nvtype bar;
19974 } try_algn;
19975 int main()
19976 {
19977     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19978     return(0);
19979 }
19980 EOCP
19981         set try
19982         if eval $compile_ok; then
19983             dflt=`$run ./try`
19984         else
19985             dflt='8'
19986             echo "(I can't seem to compile the test program...)"
19987         fi
19988         case "$multiarch" in
19989             *$define*)
19990                 : The usual safe value is 8, but Darwin with -Duselongdouble
19991                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19992                 : Configure to pick a larger value if needed.
19993                 if $test "$dflt" -lt 8; then
19994                     dflt='8'
19995                     echo "Setting alignment to 8 for multiarch support.">&4
19996                 fi
19997                 ;;
19998         esac
19999         ;;
20000     *) dflt="$alignbytes"
20001         ;;
20002 esac
20003 rp="Doubles must be aligned on a how-many-byte boundary?"
20004 . ./myread
20005 alignbytes="$ans"
20006 $rm_try
20007
20008 : set the base revision
20009 baserev=5.0
20010
20011 : length of character in bytes. Is always 1, otherwise it is not C
20012 : This used to be a test using sizeof
20013 charsize=1
20014
20015 : Check for the number of bits in a character
20016 case "$charbits" in
20017 '')     echo "Checking how long a character is (in bits)..." >&4
20018         $cat >try.c <<EOCP
20019 #include <stdio.h>
20020 int main ()
20021 {
20022     int n;
20023     unsigned char c;
20024     for (c = 1, n = 0; c; c <<= 1, n++) ;
20025     printf ("%d\n", n);
20026     return (0);
20027     }
20028 EOCP
20029         set try
20030         if eval $compile_ok; then
20031                 dflt=`$run ./try`
20032         else
20033                 dflt='8'
20034                 echo "(I can't seem to compile the test program.  Guessing...)"
20035         fi
20036         ;;
20037 *)
20038         dflt="$charbits"
20039         ;;
20040 esac
20041 rp="What is the length of a character (in bits)?"
20042 . ./myread
20043 charbits="$ans"
20044 $rm_try
20045 case "$charbits" in
20046 8)      ;;
20047 *)      cat >&4 << EOM
20048 Your system has an unsigned character size of $charbits bits, which
20049 is rather unusual (normally it is 8 bits).  Perl likely will not work
20050 correctly on your system, with subtle bugs in various places.
20051 EOM
20052         rp='Do you really want to continue?'
20053         dflt='n'
20054         . ./myread
20055         case "$ans" in
20056                 [yY])   echo >&4 "Okay, continuing."    ;;
20057                 *)      exit 1                          ;;
20058         esac
20059 esac
20060
20061 : how do we concatenate cpp tokens here?
20062 echo " "
20063 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20064 $cat >cpp_stuff.c <<'EOCP'
20065 #define RCAT(a,b)a/**/b
20066 #define ACAT(a,b)a ## b
20067 RCAT(Rei,ser)
20068 ACAT(Cir,cus)
20069 EOCP
20070 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20071 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20072         echo "Oh!  Smells like ANSI's been here." >&4
20073         echo "We can catify or stringify, separately or together!"
20074         cpp_stuff=42
20075 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20076         echo "Ah, yes!  The good old days!" >&4
20077         echo "However, in the good old days we don't know how to stringify and"
20078         echo "catify at the same time."
20079         cpp_stuff=1
20080 else
20081         $cat >&4 <<EOM
20082 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20083 You're going to have to edit the values of CAT[2-5] in config.h...
20084 EOM
20085         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20086 fi
20087 $rm -f cpp_stuff.*
20088
20089 : see if this is a db.h system
20090 set db.h i_db
20091 eval $inhdr
20092
20093 case "$i_db" in
20094 $define)
20095         : Check db version.
20096         echo " "
20097         echo "Checking Berkeley DB version ..." >&4
20098         $cat >try.c <<EOCP
20099 #include <sys/types.h>
20100 #include <stdio.h>
20101 #$i_stdlib I_STDLIB
20102 #ifdef I_STDLIB
20103 #include <stdlib.h>
20104 #endif
20105 #include <db.h>
20106 int main(int argc, char *argv[])
20107 {
20108 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20109     int Major, Minor, Patch ;
20110     unsigned long Version ;
20111     (void)db_version(&Major, &Minor, &Patch) ;
20112     if (argc == 2) {
20113         printf("%d %d %d %d %d %d\n",
20114                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20115                Major, Minor, Patch);
20116         exit(0);
20117     }
20118     printf("You have Berkeley DB Version 2 or greater.\n");
20119
20120     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20121                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20122     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20123                 Major, Minor, Patch) ;
20124
20125     /* check that db.h & libdb are compatible */
20126     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20127         printf("db.h and libdb are incompatible.\n") ;
20128         exit(3);
20129     }
20130
20131     printf("db.h and libdb are compatible.\n") ;
20132
20133     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20134                 + DB_VERSION_PATCH ;
20135
20136     /* needs to be >= 2.3.4 */
20137     if (Version < 2003004) {
20138     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20139         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20140         exit(2);
20141     }
20142
20143     exit(0);
20144 #else
20145 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20146     if (argc == 2) {
20147         printf("1 0 0\n");
20148         exit(0);
20149     }
20150     printf("You have Berkeley DB Version 1.\n");
20151     exit(0);    /* DB version < 2: the coast is clear. */
20152 #else
20153     exit(1);    /* <db.h> not Berkeley DB? */
20154 #endif
20155 #endif
20156 }
20157 EOCP
20158         set try
20159         if eval $compile_ok && $run ./try; then
20160                 echo 'Looks OK.' >&4
20161                 set `$run ./try 1`
20162                 db_version_major=$1
20163                 db_version_minor=$2
20164                 db_version_patch=$3
20165         else
20166                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20167                 i_db=$undef
20168                 case " $libs " in
20169                 *"-ldb "*)
20170                         : Remove db from list of libraries to use
20171                         echo "Removing unusable -ldb from library list" >&4
20172                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20173                         shift
20174                         libs="$*"
20175                         echo "libs = $libs" >&4
20176                         ;;
20177                 esac
20178         fi
20179         $rm_try
20180         ;;
20181 esac
20182
20183 case "$i_db" in
20184 define)
20185         : Check the return type needed for hash
20186         echo " "
20187         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20188         $cat >try.c <<EOCP
20189 #include <sys/types.h>
20190 #include <db.h>
20191
20192 #ifndef DB_VERSION_MAJOR
20193 u_int32_t hash_cb (const void* ptr, size_t size)
20194 {
20195         return 0;
20196 }
20197 HASHINFO info;
20198 int main()
20199 {
20200         info.hash = hash_cb;
20201 }
20202 #endif
20203 EOCP
20204         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20205                 if $contains warning try.out >>/dev/null 2>&1 ; then
20206                         db_hashtype='int'
20207                 else
20208                         db_hashtype='u_int32_t'
20209                 fi
20210         else
20211                 : XXX Maybe we should just give up here.
20212                 db_hashtype=u_int32_t
20213                 $cat try.out >&4
20214                 echo "Help:  I can't seem to compile the db test program." >&4
20215                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20216         fi
20217         $rm_try
20218         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20219         ;;
20220 *)      db_hashtype=u_int32_t
20221         ;;
20222 esac
20223 case "$i_db" in
20224 define)
20225         : Check the return type needed for prefix
20226         echo " "
20227         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20228         cat >try.c <<EOCP
20229 #include <sys/types.h>
20230 #include <db.h>
20231
20232 #ifndef DB_VERSION_MAJOR
20233 size_t prefix_cb (const DBT *key1, const DBT *key2)
20234 {
20235         return 0;
20236 }
20237 BTREEINFO info;
20238 int main()
20239 {
20240         info.prefix = prefix_cb;
20241 }
20242 #endif
20243 EOCP
20244         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20245                 if $contains warning try.out >>/dev/null 2>&1 ; then
20246                         db_prefixtype='int'
20247                 else
20248                         db_prefixtype='size_t'
20249                 fi
20250         else
20251                 db_prefixtype='size_t'
20252                 : XXX Maybe we should just give up here.
20253                 $cat try.out >&4
20254                 echo "Help:  I can't seem to compile the db test program." >&4
20255                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20256         fi
20257         $rm_try
20258         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20259         ;;
20260 *)      db_prefixtype='size_t'
20261         ;;
20262 esac
20263
20264 : Include . in @INC
20265 $cat <<EOM
20266
20267 Historically Perl has provided a final fallback of the current working
20268 directory '.' when searching for a library. This, however, can lead to
20269 problems when a Perl program which loads optional modules is called from
20270 a shared directory. This can lead to executing unexpected code.
20271
20272 EOM
20273
20274 # When changing to exclude by default:
20275 case "$default_inc_excludes_dot" in
20276     $undef|false|[nN]*) dflt="n" ;;
20277     *)                  dflt="y" ;;
20278 esac
20279 # To turn exclude off by default:
20280 #case "$default_inc_excludes_dot" in
20281 #    $define|true|[yY]*) dflt="y" ;;
20282 #    *)                  dflt="n" ;;
20283 #esac
20284
20285 rp='Exclude '.' from @INC by default? '
20286 . ./myread
20287 case "$ans" in
20288     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20289     *)          default_inc_excludes_dot="$define" ;;
20290 esac
20291
20292 : Check what kind of inf/nan your system has
20293 $echo "Checking the kind of infinities and nans you have..." >&4
20294 $echo "(The following tests may crash.  That's okay.)" >&4
20295 $cat >try.c <<EOP
20296 #define DOUBLESIZE $doublesize
20297 #$d_longdbl HAS_LONG_DOUBLE
20298 #ifdef HAS_LONG_DOUBLE
20299 #define LONG_DOUBLESIZE $longdblsize
20300 #define LONG_DOUBLEKIND $longdblkind
20301 #endif
20302 #include <math.h>
20303 #include <string.h>
20304 #include <stdio.h>
20305 /* Note that whether the sign bit is on or off
20306  * for NaN depends on the CPU/FPU, and possibly
20307  * can be affected by the build toolchain.
20308  *
20309  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20310  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20311  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20312  * (respectively) as opposed to the more usual
20313  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20314  *
20315  * Pre-IEEE-754 floating point format do not even have inf/nan support
20316  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20317  * to even mention, causing immediate SIGFPE or equivalent: this is
20318  * the case with VAX floating point, for example.
20319  */
20320 static void bytes(void *v, unsigned int n) {
20321   unsigned char *p = (unsigned char *)v;
20322   int i;
20323   for (i = 0; i < n; i++) {
20324     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20325   }
20326 }
20327 int main(int argc, char *argv[]) {
20328    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20329     * because some compilers are 'smart' and not only warn but refuse to
20330     * compile such 'illegal' values. */
20331    double dinf = exp(1e9);
20332    double dnan = sqrt(-1.0);
20333 #ifdef HAS_LONG_DOUBLE
20334    long double ldinf = (long double)exp(1e9);
20335    long double ldnan = (long double)sqrt(-1.0);
20336 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20337 /* the 80-bit long doubles might have garbage in their excess bytes */
20338     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20339     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20340 # endif
20341   if (argc == 2) {
20342     switch (argv[1][0]) {
20343     case '1': bytes(&dinf, sizeof(dinf)); break;
20344     case '2': bytes(&dnan, sizeof(dnan)); break;
20345     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20346     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20347 #endif
20348     }
20349   }
20350   return 0;
20351 }
20352 EOP
20353 set try
20354 if eval $compile; then
20355     doubleinfbytes=`$run ./try 1`
20356     doublenanbytes=`$run ./try 2`
20357     case "$d_longdbl" in
20358     $define)
20359       longdblinfbytes=`$run ./try 3`
20360       longdblnanbytes=`$run ./try 4`
20361       ;;
20362     esac
20363 else
20364     # Defaults in case the above test program failed.
20365     case "$doublekind" in
20366     1) # IEEE 754 32-bit LE
20367        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20368        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20369        ;;
20370     2) # IEEE 754 32-bit BE
20371        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20372        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20373        ;;
20374     3) # IEEE 754 64-bit LE
20375        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20376        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20377        ;;
20378     4) # IEEE 754 64-bit BE
20379        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20380        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20381        ;;
20382     5) # IEEE 754 128-bit LE
20383        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20384        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20385        ;;
20386     6) # IEEE 754 128-bit BE
20387        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20388        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20389        ;;
20390     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20391        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20392        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20393        ;;
20394     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20395        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20396        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20397        ;;
20398     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20399        doubleinfbytes=$undef
20400        doublenanbytes=$undef
20401        ;;
20402     *) # No idea.
20403        doubleinfbytes=$undef
20404        doublenanbytes=$undef
20405        ;;
20406     esac
20407     case "$longdblkind" in
20408     1) # IEEE 754 128-bit LE
20409        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20410        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20411        ;;
20412     2) # IEEE 754 128-bit BE
20413        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20414        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20415        ;;
20416     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20417        case "$longdblsize" in
20418        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20419            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20420            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20421            ;;
20422        16) # x86_64
20423            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20424            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20425            ;;
20426        *)  # No idea.
20427            longdblinfbytes=$undef
20428            longdblnanbytes=$undef
20429        ;;
20430        esac
20431        ;;
20432     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20433        case "$longdblsize" in
20434        12) # 32-bit system
20435            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20436            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20437            ;;
20438        16) # 64-bit system
20439            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20440            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20441            ;;
20442        *)  # No idea.
20443            longdblinfbytes=$undef
20444            longdblnanbytes=$undef
20445        ;;
20446        esac
20447        ;;
20448     5) # 128-bit LE-LE "double double"
20449        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20450        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20451        ;;
20452     6) # 128-bit BE-BE "double double"
20453        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20454        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20455        ;;
20456     7) # 128-bit LE-BE "double double"
20457        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20458        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20459        ;;
20460     8) # 128-bit BE-LE "double double"
20461        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20462        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20463        ;;
20464     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20465        longdblinfbytes=$undef
20466        longdblnanbytes=$undef
20467        ;;
20468     *) # No idea.
20469        longdblinfbytes=$undef
20470        longdblnanbytes=$undef
20471        ;;
20472     esac
20473 fi
20474 # In case the program crashed the values are empty, turn them undef.
20475 case "$doubleinfbytes" in
20476 '') doubleinfbytes=$undef ;;
20477 esac
20478 case "$doublenanbytes" in
20479 '') doublenanbytes=$undef ;;
20480 esac
20481 case "$longdblinfbytes" in
20482 '') longdblinfbytes=$undef ;;
20483 esac
20484 case "$longdblnanbytes" in
20485 '') longdblnanbytes=$undef ;;
20486 esac
20487 $rm_try
20488
20489 : Check the length of the double mantissa
20490 $echo "Checking how many mantissa bits your doubles have..." >&4
20491 $cat >try.c <<EOP
20492 #$i_sunmath I_SUNMATH
20493 #include <float.h>
20494 #ifdef I_SUNMATH
20495 # include <sunmath.h>
20496 #endif
20497 #ifdef DBL_MANT_DIG
20498 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20499 #endif
20500 #include <stdio.h>
20501 int main(int argc, char *argv[]) {
20502 #ifdef BITS
20503   printf("%d\n", BITS);
20504 #endif
20505   return 0;
20506 }
20507 EOP
20508 set try
20509 if eval $compile; then
20510     doublemantbits=`$run ./try`
20511 else
20512     doublemantbits="$undef"
20513 fi
20514 $rm_try
20515
20516 : Check the length of the longdouble mantissa
20517 $echo "Checking how many mantissa bits your long doubles have..." >&4
20518 $cat >try.c <<EOP
20519 #$i_sunmath I_SUNMATH
20520 #include <float.h>
20521 #ifdef I_SUNMATH
20522 # include <sunmath.h>
20523 #endif
20524 #$d_longdbl HAS_LONG_DOUBLE
20525 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20526 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20527 /* This format has no implicit bit.  Beware, however, that for
20528  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20529  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20530  * and the top bit must have been one since 387, zero is plain invalid.
20531  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20532 #  define BITS LDBL_MANT_DIG
20533 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20534 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20535  * reason e.g. Irix thinks 107.  But in any case, we want only
20536  * the number of real bits, the implicit bits are of no interest.  */
20537 #  define BITS 2 * (DBL_MANT_DIG - 1)
20538 # else
20539 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20540 # endif
20541 #endif
20542 #include <stdio.h>
20543 int main(int argc, char *argv[]) {
20544 #ifdef BITS
20545   printf("%d\n", BITS);
20546 #endif
20547   return 0;
20548 }
20549 EOP
20550 set try
20551 if eval $compile; then
20552     longdblmantbits=`$run ./try`
20553 else
20554     longdblmantbits="$undef"
20555 fi
20556 $rm_try
20557
20558 : Check the length of the NV mantissa
20559 $echo "Checking how many mantissa bits your NVs have..." >&4
20560 if test "X$usequadmath" = "X$define"; then
20561   nvmantbits=112 # 128-1-15
20562 else
20563   if test "X$nvsize" = "X$doublesize"; then
20564     nvmantbits="$doublemantbits"
20565   else
20566      if test "X$nvsize" = "X$longdblsize"; then
20567        nvmantbits="$longdblmantbits"
20568      else
20569        nvmantbits="$undef"
20570      fi
20571   fi
20572 fi
20573
20574 : How can we generate normalized random numbers ?
20575 echo " "
20576 echo "Using our internal random number implementation..." >&4
20577
20578 case "$ccflags" in
20579 *-Dmy_rand=*|*-Dmy_srand=*)
20580         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20581         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20582         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20583         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20584         ;;
20585 esac
20586
20587 randfunc=Perl_drand48
20588 drand01="Perl_drand48()"
20589 seedfunc="Perl_drand48_init"
20590 randbits=48
20591 randseedtype=U32
20592
20593 : Probe whether dtrace builds an object, as newer Illumos requires an input
20594 : object file that uses at least one of the probes defined in the .d file
20595 case "$usedtrace" in
20596 $define)
20597     case "$dtracexnolibs" in
20598     $define|true|[yY]*)
20599         dtracexnolibs=$define
20600         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20601         ;;
20602     ' '|'')
20603         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20604              dtracexnolibs=$define
20605              echo "Your dtrace accepts -xnolibs"
20606         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20607              dtracexnolibs=$undef
20608              echo "Your dtrace doesn't accept -xnolibs"
20609         else
20610              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20611              exit 1
20612         fi
20613         ;;
20614     *)
20615         dtracexnolibs=$undef
20616         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20617         ;;
20618     esac
20619     case $dtracexnolibs in
20620     $define) xnolibs=-xnolibs ;;
20621     *) xnolibs= ;;
20622     esac
20623
20624     case "$dtraceobject" in
20625     $define|true|[yY]*)
20626         dtraceobject=$define
20627         ;;
20628     ' '|'')
20629         $cat >try.c <<EOM
20630 #include "perldtrace.h"
20631 int main(void) {
20632     PERL_LOADED_FILE("dummy");
20633     return 0;
20634 }
20635 EOM
20636         dtraceobject=$undef
20637         if $cc -c -o try.o $optimize $ccflags try.c \
20638                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20639                 dtraceobject=$define
20640             echo "Your dtrace builds an object file"
20641         fi
20642         ;;
20643     *) dtraceobject=$undef ;;
20644     esac
20645     $rm_try perldtrace.o perldtrace.h
20646 esac
20647
20648 : Determine if this is an EBCDIC system
20649 echo " "
20650 echo "Determining whether or not we are on an EBCDIC system..." >&4
20651 $cat >try.c <<'EOM'
20652 int main()
20653 {
20654   if ('M'==0xd4) return 0;
20655   return 1;
20656 }
20657 EOM
20658
20659 val=$undef
20660 set try
20661 if eval $compile_ok; then
20662         if $run ./try; then
20663                 echo "You seem to speak EBCDIC." >&4
20664                 val="$define"
20665         else
20666                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20667         fi
20668 else
20669         echo "I'm unable to compile the test program." >&4
20670         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20671 fi
20672 $rm_try
20673 set ebcdic
20674 eval $setvar
20675
20676 : Check how to flush
20677 echo " "
20678 $cat >&4 <<EOM
20679 Checking how to flush all pending stdio output...
20680 EOM
20681 # I only know how to find the first 32 possibly open files on SunOS.
20682 # See also hints/sunos_4_1.sh and util.c  --AD
20683 case "$osname" in
20684 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20685 esac
20686 $cat >>try.c <<EOCP
20687 #include <stdio.h>
20688 #$i_stdlib I_STDLIB
20689 #ifdef I_STDLIB
20690 #include <stdlib.h>
20691 #endif
20692 #$i_unistd I_UNISTD
20693 #ifdef I_UNISTD
20694 # include <unistd.h>
20695 #endif
20696 #$d_sysconf HAS_SYSCONF
20697 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20698 #ifdef HAS_STDIO_STREAM_ARRAY
20699 # define STDIO_STREAM_ARRAY $stdio_stream_array
20700 #endif
20701 int main() {
20702   FILE* p;
20703   unlink("try.out");
20704   p = fopen("try.out", "w");
20705 #ifdef TRY_FPUTC
20706   fputc('x', p);
20707 #else
20708 # ifdef TRY_FPRINTF
20709   fprintf(p, "x");
20710 # endif
20711 #endif
20712 #ifdef TRY_FFLUSH_NULL
20713   fflush(NULL);
20714 #endif
20715 #ifdef TRY_FFLUSH_ALL
20716   {
20717     long open_max = -1;
20718 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20719     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20720 # else
20721 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20722     open_max = sysconf(_SC_OPEN_MAX);
20723 #  else
20724 #   ifdef FOPEN_MAX
20725     open_max = FOPEN_MAX;
20726 #   else
20727 #    ifdef OPEN_MAX
20728     open_max = OPEN_MAX;
20729 #    else
20730 #     ifdef _NFILE
20731     open_max = _NFILE;
20732 #     endif
20733 #    endif
20734 #   endif
20735 #  endif
20736 # endif
20737 # ifdef HAS_STDIO_STREAM_ARRAY
20738     if (open_max > 0) {
20739       long i;
20740       for (i = 0; i < open_max; i++)
20741             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20742                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20743                 STDIO_STREAM_ARRAY[i]._flag)
20744                 fflush(&STDIO_STREAM_ARRAY[i]);
20745     }
20746   }
20747 # endif
20748 #endif
20749   _exit(42);
20750 }
20751 EOCP
20752 : first we have to find out how _not_ to flush
20753 $to try.c
20754 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20755     output=''
20756     set try -DTRY_FPUTC
20757     if eval $compile; then
20758             $run ./try 2>/dev/null
20759             code="$?"
20760             $from try.out
20761             if $test ! -s try.out -a "X$code" = X42; then
20762                 output=-DTRY_FPUTC
20763             fi
20764     fi
20765     case "$output" in
20766     '')
20767             set try -DTRY_FPRINTF
20768             if eval $compile; then
20769                     $run ./try 2>/dev/null
20770                     code="$?"
20771                     $from try.out
20772                     if $test ! -s try.out -a "X$code" = X42; then
20773                         output=-DTRY_FPRINTF
20774                     fi
20775             fi
20776         ;;
20777     esac
20778 fi
20779 : check for fflush NULL behavior
20780 case "$fflushNULL" in
20781 '')     set try -DTRY_FFLUSH_NULL $output
20782         if eval $compile; then
20783                 $run ./try 2>/dev/null
20784                 code="$?"
20785                 $from try.out
20786                 if $test -s try.out -a "X$code" = X42; then
20787                         fflushNULL="`$cat try.out`"
20788                 else
20789                         if $test "X$code" != X42; then
20790                                 $cat >&4 <<EOM
20791 (If this test failed, don't worry, we'll try another method shortly.)
20792 EOM
20793                         fi
20794                 fi
20795         fi
20796         $rm -f core try.core core.try.*
20797         case "$fflushNULL" in
20798         x)      $cat >&4 <<EOM
20799 Your fflush(NULL) works okay for output streams.
20800 Let's see if it clobbers input pipes...
20801 EOM
20802 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20803 # bug that improperly flushes the input end of pipes.  So we avoid the
20804 # autoflush on fork/system/exec support for now. :-(
20805 $cat >tryp.c <<EOCP
20806 #include <stdio.h>
20807 int
20808 main(int argc, char **argv)
20809 {
20810     char buf[1024];
20811     int i;
20812     char *bp = buf;
20813     while (1) {
20814         while ((i = getc(stdin)) != -1
20815                && (*bp++ = i) != '\n'
20816                && bp < &buf[1024])
20817         /* DO NOTHING */ ;
20818         *bp = '\0';
20819         fprintf(stdout, "%s", buf);
20820         fflush(NULL);
20821         if (i == -1)
20822             return 0;
20823         bp = buf;
20824     }
20825 }
20826 EOCP
20827                 fflushNULL="$define"
20828                 set tryp
20829                 if eval $compile; then
20830                     $rm -f tryp.out
20831                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20832                     if $test "X$targethost" != X; then
20833                         $to tryp.c
20834                         $to tryp
20835                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20836                     else
20837                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20838                     fi
20839                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20840                        $cat >&4 <<EOM
20841 fflush(NULL) seems to behave okay with input streams.
20842 EOM
20843                         fflushNULL="$define"
20844                     else
20845                         $cat >&4 <<EOM
20846 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20847 EOM
20848                         fflushNULL="$undef"
20849                     fi
20850                 fi
20851                 $rm -f core tryp.c tryp.core core.tryp.*
20852                 ;;
20853         '')     $cat >&4 <<EOM
20854 Your fflush(NULL) isn't working (contrary to ANSI C).
20855 EOM
20856                 fflushNULL="$undef"
20857                 ;;
20858         *)      $cat >&4 <<EOM
20859 Cannot figure out whether your fflush(NULL) works or not.
20860 I'm assuming it doesn't (contrary to ANSI C).
20861 EOM
20862                 fflushNULL="$undef"
20863                 ;;
20864         esac
20865         ;;
20866 $define|true|[yY]*)
20867         fflushNULL="$define"
20868         ;;
20869 *)
20870         fflushNULL="$undef"
20871         ;;
20872 esac
20873 : check explicit looping only if NULL did not work, and if the pipe
20874 : bug does not show up on an explicit flush too
20875 case "$fflushNULL" in
20876 "$undef")
20877         $cat >tryp.c <<EOCP
20878 #include <stdio.h>
20879 int
20880 main(int argc, char **argv)
20881 {
20882     char buf[1024];
20883     int i;
20884     char *bp = buf;
20885     while (1) {
20886         while ((i = getc(stdin)) != -1
20887                && (*bp++ = i) != '\n'
20888                && bp < &buf[1024])
20889         /* DO NOTHING */ ;
20890         *bp = '\0';
20891         fprintf(stdout, "%s", buf);
20892         fflush(stdin);
20893         if (i == -1)
20894             return 0;
20895         bp = buf;
20896     }
20897 }
20898 EOCP
20899         set tryp
20900         if eval $compile; then
20901             $rm -f tryp.out
20902             if $test "X$targethost" != X; then
20903                 $to tryp.c
20904                 $to tryp
20905                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20906             else
20907                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20908             fi
20909             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20910                $cat >&4 <<EOM
20911 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20912 EOM
20913                 : now check for fflushall behaviour
20914                 case "$fflushall" in
20915                 '')     set try -DTRY_FFLUSH_ALL $output
20916                         if eval $compile; then
20917                                 $cat >&4 <<EOM
20918 (Now testing the other method--but note that this also may fail.)
20919 EOM
20920                                 $run ./try 2>/dev/null
20921                                 code=$?
20922                                 $from try.out
20923                                 if $test -s try.out -a "X$code" = X42; then
20924                                         fflushall="`$cat try.out`"
20925                                 fi
20926                         fi
20927                         $rm_try
20928                         case "$fflushall" in
20929                         x)      $cat >&4 <<EOM
20930 Whew. Flushing explicitly all the stdio streams works.
20931 EOM
20932                                 fflushall="$define"
20933                                 ;;
20934                         '')     $cat >&4 <<EOM
20935 Sigh. Flushing explicitly all the stdio streams doesn't work.
20936 EOM
20937                                 fflushall="$undef"
20938                                 ;;
20939                         *)      $cat >&4 <<EOM
20940 Cannot figure out whether flushing stdio streams explicitly works or not.
20941 I'm assuming it doesn't.
20942 EOM
20943                                 fflushall="$undef"
20944                                 ;;
20945                         esac
20946                         ;;
20947                 "$define"|true|[yY]*)
20948                         fflushall="$define"
20949                         ;;
20950                 *)
20951                         fflushall="$undef"
20952                         ;;
20953                 esac
20954             else
20955                 $cat >&4 <<EOM
20956 All is futile.  Even fflush(stdin) clobbers input pipes!
20957 EOM
20958                 fflushall="$undef"
20959             fi
20960         else
20961             fflushall="$undef"
20962         fi
20963         $rm -f core tryp.c tryp.core core.tryp.*
20964         ;;
20965 *)      fflushall="$undef"
20966         ;;
20967 esac
20968
20969 case "$fflushNULL$fflushall" in
20970 undefundef)
20971         $cat <<EOM
20972 OK, I give up.  I cannot figure out how to flush pending stdio output.
20973 We won't be flushing handles at all before fork/exec/popen.
20974 EOM
20975         ;;
20976 esac
20977 $rm_try tryp
20978
20979 : Store the full pathname to the ar program for use in the C program
20980 : Respect a hint or command line value for full_ar.
20981 case "$full_ar" in
20982 '') full_ar=$ar ;;
20983 esac
20984
20985 : Store the full pathname to the sed program for use in the C program
20986 full_sed=$sed
20987
20988 : see what type gids are declared as in the kernel
20989 echo " "
20990 echo "Looking for the type for group ids returned by getgid()."
20991 set gid_t gidtype xxx stdio.h sys/types.h
20992 eval $typedef
20993 case "$gidtype" in
20994 xxx)
20995         xxx=`./findhdr sys/user.h`
20996         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20997         case $1 in
20998         unsigned) dflt="$1 $2" ;;
20999         *) dflt="$1" ;;
21000         esac
21001         ;;
21002 *) dflt="$gidtype";;
21003 esac
21004 case "$gidtype" in
21005 gid_t) echo "gid_t found." ;;
21006 *)      rp="What is the type for group ids returned by getgid()?"
21007         . ./myread
21008         gidtype="$ans"
21009         ;;
21010 esac
21011
21012 : Check the size of GID
21013 echo " "
21014 case "$gidtype" in
21015 *_t) zzz="$gidtype"     ;;
21016 *)   zzz="gid"          ;;
21017 esac
21018 echo "Checking the size of $zzz..." >&4
21019 cat > try.c <<EOCP
21020 #include <sys/types.h>
21021 #include <stdio.h>
21022 #$i_stdlib I_STDLIB
21023 #ifdef I_STDLIB
21024 #include <stdlib.h>
21025 #endif
21026 int main() {
21027     printf("%d\n", (int)sizeof($gidtype));
21028     exit(0);
21029 }
21030 EOCP
21031 set try
21032 if eval $compile_ok; then
21033         yyy=`$run ./try`
21034         case "$yyy" in
21035         '')     gidsize=4
21036                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21037                 ;;
21038         *)      gidsize=$yyy
21039                 echo "Your $zzz is $gidsize bytes long."
21040                 ;;
21041         esac
21042 else
21043         gidsize=4
21044         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21045 fi
21046
21047 : Check if GID is signed
21048 echo " "
21049 case "$gidtype" in
21050 *_t) zzz="$gidtype"     ;;
21051 *)   zzz="gid"          ;;
21052 esac
21053 echo "Checking the sign of $zzz..." >&4
21054 cat > try.c <<EOCP
21055 #include <sys/types.h>
21056 #include <stdio.h>
21057 int main() {
21058         $gidtype foo = -1;
21059         if (foo < 0)
21060                 printf("-1\n");
21061         else
21062                 printf("1\n");
21063 }
21064 EOCP
21065 set try
21066 if eval $compile; then
21067         yyy=`$run ./try`
21068         case "$yyy" in
21069         '')     gidsign=1
21070                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21071                 ;;
21072         *)      gidsign=$yyy
21073                 case "$gidsign" in
21074                  1) echo "Your $zzz is unsigned." ;;
21075                 -1) echo "Your $zzz is signed."   ;;
21076                 esac
21077                 ;;
21078         esac
21079 else
21080         gidsign=1
21081         echo "(I can't compile the test program--guessing unsigned.)" >&4
21082 fi
21083
21084 : Check 64bit sizes
21085 echo " "
21086
21087 if $test X"$quadtype" != X; then
21088
21089 echo "Checking how to print 64-bit integers..." >&4
21090
21091 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21092         $cat >try.c <<'EOCP'
21093 #include <sys/types.h>
21094 #include <stdio.h>
21095 int main() {
21096   int q = 12345678901;
21097   printf("%ld\n", q);
21098 }
21099 EOCP
21100         set try
21101         if eval $compile; then
21102                 yyy=`$run ./try`
21103                 case "$yyy" in
21104                 12345678901)
21105                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21106                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21107                         echo "We will use %d."
21108                         ;;
21109                 esac
21110         fi
21111 fi
21112
21113 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21114         $cat >try.c <<'EOCP'
21115 #include <sys/types.h>
21116 #include <stdio.h>
21117 int main() {
21118   long q = 12345678901;
21119   printf("%ld\n", q);
21120 }
21121 EOCP
21122         set try
21123         if eval $compile; then
21124                 yyy=`$run ./try`
21125                 case "$yyy" in
21126                 12345678901)
21127                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21128                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21129                         echo "We will use %ld."
21130                         ;;
21131                 esac
21132         fi
21133 fi
21134
21135 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21136         $cat >try.c <<'EOCP'
21137 #include <sys/types.h>
21138 #include <inttypes.h>
21139 #include <stdio.h>
21140 int main() {
21141   int64_t q = 12345678901;
21142   printf("%" PRId64 "\n", q);
21143 }
21144 EOCP
21145         set try
21146         if eval $compile; then
21147                 yyy=`$run ./try`
21148                 case "$yyy" in
21149                 12345678901)
21150                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21151                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21152                         echo "We will use the C9X style."
21153                         ;;
21154                 esac
21155         fi
21156 fi
21157
21158 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21159         $cat >try.c <<EOCP
21160 #include <sys/types.h>
21161 #include <stdio.h>
21162 int main() {
21163   $quadtype q = 12345678901;
21164   printf("%Ld\n", q);
21165 }
21166 EOCP
21167         set try
21168         if eval $compile; then
21169                 yyy=`$run ./try`
21170                 case "$yyy" in
21171                 12345678901)
21172                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21173                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21174                         echo "We will use %Ld."
21175                         ;;
21176                 esac
21177         fi
21178 fi
21179
21180 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21181         $cat >try.c <<'EOCP'
21182 #include <sys/types.h>
21183 #include <stdio.h>
21184 int main() {
21185   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21186   printf("%lld\n", q);
21187 }
21188 EOCP
21189         set try
21190         if eval $compile; then
21191                 yyy=`$run ./try`
21192                 case "$yyy" in
21193                 12345678901)
21194                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21195                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21196                         echo "We will use the %lld style."
21197                         ;;
21198                 esac
21199         fi
21200 fi
21201
21202 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21203         $cat >try.c <<EOCP
21204 #include <sys/types.h>
21205 #include <stdio.h>
21206 int main() {
21207   $quadtype q = 12345678901;
21208   printf("%qd\n", q);
21209 }
21210 EOCP
21211         set try
21212         if eval $compile; then
21213                 yyy=`$run ./try`
21214                 case "$yyy" in
21215                 12345678901)
21216                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21217                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21218                         echo "We will use %qd."
21219                         ;;
21220                 esac
21221         fi
21222 fi
21223
21224 if $test X"$sPRId64" = X; then
21225         echo "Cannot figure out how to print 64-bit integers." >&4
21226 fi
21227 $rm_try
21228
21229 fi
21230
21231 case "$sPRId64" in
21232 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21233         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21234         ;;
21235 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21236         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21237         ;;
21238 esac
21239
21240 : Check format strings for internal types
21241 echo " "
21242 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21243
21244 if $test X"$ivsize" = X8; then
21245         ivdformat="$sPRId64"
21246         uvuformat="$sPRIu64"
21247         uvoformat="$sPRIo64"
21248         uvxformat="$sPRIx64"
21249         uvXUformat="$sPRIXU64"
21250 else
21251         if $test X"$ivsize" = X"$longsize"; then
21252                 ivdformat='"ld"'
21253                 uvuformat='"lu"'
21254                 uvoformat='"lo"'
21255                 uvxformat='"lx"'
21256                 uvXUformat='"lX"'
21257         else
21258                 if $test X"$ivsize" = X"$intsize"; then
21259                         ivdformat='"d"'
21260                         uvuformat='"u"'
21261                         uvoformat='"o"'
21262                         uvxformat='"x"'
21263                         uvXUformat='"X"'
21264                 else
21265                         : far out
21266                         if $test X"$ivsize" = X"$shortsize"; then
21267                                 ivdformat='"hd"'
21268                                 uvuformat='"hu"'
21269                                 uvoformat='"ho"'
21270                                 uvxformat='"hx"'
21271                                 uvXUformat='"hX"'
21272                         fi
21273                 fi
21274         fi
21275 fi
21276
21277 if $test X"$usequadmath" = X"$define"; then
21278     nveformat='"Qe"'
21279     nvfformat='"Qf"'
21280     nvgformat='"Qg"'
21281     nvEUformat='"QE"'
21282     nvFUformat='"QF"'
21283     nvGUformat='"QG"'
21284 else
21285     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21286         nveformat="$sPRIeldbl"
21287         nvfformat="$sPRIfldbl"
21288         nvgformat="$sPRIgldbl"
21289         nvEUformat="$sPRIEUldbl"
21290         nvFUformat="$sPRIFUldbl"
21291         nvGUformat="$sPRIGUldbl"
21292     else
21293         nveformat='"e"'
21294         nvfformat='"f"'
21295         nvgformat='"g"'
21296         nvEUformat='"E"'
21297         nvFUformat='"F"'
21298         nvGUformat='"G"'
21299     fi
21300 fi
21301
21302 case "$ivdformat" in
21303 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21304     exit 1
21305     ;;
21306 esac
21307
21308 : Check format string for GID
21309
21310 echo " "
21311 $echo "Checking the format string to be used for gids..." >&4
21312
21313 case "$gidsign" in
21314 -1)     if $test X"$gidsize" = X"$ivsize"; then
21315                 gidformat="$ivdformat"
21316         else
21317                 if $test X"$gidsize" = X"$longsize"; then
21318                         gidformat='"ld"'
21319                 else
21320                         if $test X"$gidsize" = X"$intsize"; then
21321                                 gidformat='"d"'
21322                         else
21323                                 if $test X"$gidsize" = X"$shortsize"; then
21324                                         gidformat='"hd"'
21325                                 fi
21326                         fi
21327                 fi
21328         fi
21329         ;;
21330 *)      if $test X"$gidsize" = X"$uvsize"; then
21331                 gidformat="$uvuformat"
21332         else
21333                 if $test X"$gidsize" = X"$longsize"; then
21334                         gidformat='"lu"'
21335                 else
21336                         if $test X"$gidsize" = X"$intsize"; then
21337                                 gidformat='"u"'
21338                         else
21339                                 if $test X"$gidsize" = X"$shortsize"; then
21340                                         gidformat='"hu"'
21341                                 fi
21342                         fi
21343                 fi
21344         fi
21345         ;;
21346 esac
21347
21348 : see if getgroups exists
21349 set getgroups d_getgrps
21350 eval $inlibc
21351
21352 : see if setgroups exists
21353 set setgroups d_setgrps
21354 eval $inlibc
21355
21356 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21357 echo " "
21358 case "$d_getgrps$d_setgrps" in
21359 *define*)
21360         case "$groupstype" in
21361         '') dflt="$gidtype" ;;
21362         *)  dflt="$groupstype" ;;
21363         esac
21364         $cat <<EOM
21365 What type of pointer is the second argument to getgroups() and setgroups()?
21366 Usually this is the same as group ids, $gidtype, but not always.
21367
21368 EOM
21369         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21370         . ./myread
21371         groupstype="$ans"
21372         ;;
21373 *)  groupstype="$gidtype";;
21374 esac
21375
21376 : check whether make sets MAKE
21377 echo " "
21378 echo "Checking if your $make program sets \$(MAKE)..." >&4
21379 case "$make_set_make" in
21380 '')
21381         $sed 's/^X //' > testmake.mak << 'EOF'
21382 Xall:
21383 X       @echo 'maketemp="$(MAKE)"'
21384 EOF
21385         case "`$make -f testmake.mak 2>/dev/null`" in
21386         *maketemp=*) make_set_make='#' ;;
21387         *)      make_set_make="MAKE=$make" ;;
21388         esac
21389         $rm -f testmake.mak
21390         ;;
21391 esac
21392 case "$make_set_make" in
21393 '#') echo "Yup, it does.";;
21394 *) echo "Nope, it doesn't.";;
21395 esac
21396
21397 : see what type is used for mode_t
21398 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21399 set mode_t modetype int stdio.h sys/types.h
21400 eval $typedef_ask
21401
21402 : see if we need va_copy
21403 echo " "
21404 $cat >try.c <<EOCP
21405 #include <stdarg.h>
21406 #include <stdio.h>
21407 #include <stdlib.h>
21408 #include <signal.h>
21409
21410 int
21411 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21412 {
21413   return vfprintf(f, fmt, *valp);
21414 }
21415
21416 int
21417 myvfprintf(FILE *f, const  char *fmt, va_list val)
21418 {
21419   return ivfprintf(f, fmt, &val);
21420 }
21421
21422 int
21423 myprintf(char *fmt, ...)
21424 {
21425   va_list val;
21426   va_start(val, fmt);
21427   return myvfprintf(stdout, fmt, val);
21428 }
21429
21430 int
21431 main(int ac, char **av)
21432 {
21433   signal(SIGSEGV, exit);
21434
21435   myprintf("%s%cs all right, then\n", "that", '\'');
21436   exit(0);
21437 }
21438 EOCP
21439 set try
21440 if eval $compile && $run ./try 2>&1 >/dev/null; then
21441         case "`$run ./try`" in
21442         "that's all right, then")
21443                 okay=yes
21444                 ;;
21445         esac
21446 fi
21447 case "$okay" in
21448 yes)    echo "It seems that you don't need va_copy()." >&4
21449         need_va_copy="$undef"
21450         ;;
21451 *)      echo "It seems that va_copy() or similar will be needed." >&4
21452         need_va_copy="$define"
21453         ;;
21454 esac
21455 $rm_try
21456
21457 : see what type is used for size_t
21458 rp="What is the type used for the length parameter for string functions?"
21459 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21460 eval $typedef_ask
21461
21462 : check for type of arguments to gethostbyaddr.
21463 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21464         case "$d_gethbyaddr" in
21465         $define)
21466                 $cat <<EOM
21467
21468 Checking to see what type of arguments are accepted by gethostbyaddr().
21469 EOM
21470                 hdrs="$define sys/types.h
21471                         $d_socket sys/socket.h
21472                         $i_niin netinet/in.h
21473                         $i_netdb netdb.h
21474                         $i_unistd unistd.h"
21475                 : The first arg can 'char *' or 'void *'
21476                 : The second arg is some of integral type
21477                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21478                         for yyy in size_t long int; do
21479                                 case "$netdb_host_type" in
21480                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21481                                         if ./protochk "$try" $hdrs; then
21482                                                 echo "Your system accepts $xxx for the first arg."
21483                                                 echo "...and $yyy for the second arg."
21484                                                 netdb_host_type="$xxx"
21485                                                 netdb_hlen_type="$yyy"
21486                                         fi
21487                                         ;;
21488                                 esac
21489                         done
21490                 done
21491                 : In case none of those worked, prompt the user.
21492                 case "$netdb_host_type" in
21493                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21494                         dflt='char *'
21495                         . ./myread
21496                         netdb_host_type=$ans
21497                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21498                         dflt="$sizetype"
21499                         . ./myread
21500                         netdb_hlen_type=$ans
21501                         ;;
21502                 esac
21503                 ;;
21504         *)      : no gethostbyaddr, so pick harmless defaults
21505                 netdb_host_type='char *'
21506                 netdb_hlen_type="$sizetype"
21507                 ;;
21508         esac
21509         # Remove the "const" if needed. -- but then we'll have a
21510         # prototype clash!
21511         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21512 fi
21513
21514 : check for type of argument to gethostbyname.
21515 if test "X$netdb_name_type" = X ; then
21516         case "$d_gethbyname" in
21517         $define)
21518                 $cat <<EOM
21519
21520 Checking to see what type of argument is accepted by gethostbyname().
21521 EOM
21522                 hdrs="$define sys/types.h
21523                         $d_socket sys/socket.h
21524                         $i_niin netinet/in.h
21525                         $i_netdb netdb.h
21526                         $i_unistd unistd.h"
21527                 for xxx in "const char *" "char *"; do
21528                         case "$netdb_name_type" in
21529                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21530                                 if ./protochk "$try" $hdrs; then
21531                                         echo "Your system accepts $xxx."
21532                                         netdb_name_type="$xxx"
21533                                 fi
21534                                 ;;
21535                         esac
21536                 done
21537                 : In case none of those worked, prompt the user.
21538                 case "$netdb_name_type" in
21539                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21540                         dflt='char *'
21541                         . ./myread
21542                         netdb_name_type=$ans
21543                         ;;
21544                 esac
21545                 ;;
21546         *)      : no gethostbyname, so pick harmless default
21547                 netdb_name_type='char *'
21548                 ;;
21549         esac
21550 fi
21551
21552 : check for type of 1st argument to getnetbyaddr.
21553 if test "X$netdb_net_type" = X ; then
21554         case "$d_getnbyaddr" in
21555         $define)
21556                 $cat <<EOM
21557
21558 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21559 EOM
21560                 hdrs="$define sys/types.h
21561                         $d_socket sys/socket.h
21562                         $i_niin netinet/in.h
21563                         $i_netdb netdb.h
21564                         $i_unistd unistd.h"
21565                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21566                         case "$netdb_net_type" in
21567                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21568                                 if ./protochk "$try" $hdrs; then
21569                                         echo "Your system accepts $xxx."
21570                                         netdb_net_type="$xxx"
21571                                 fi
21572                                 ;;
21573                         esac
21574                 done
21575                 : In case none of those worked, prompt the user.
21576                 case "$netdb_net_type" in
21577                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21578                         dflt='long'
21579                         . ./myread
21580                         netdb_net_type=$ans
21581                         ;;
21582                 esac
21583                 ;;
21584         *)      : no getnetbyaddr, so pick harmless default
21585                 netdb_net_type='long'
21586                 ;;
21587         esac
21588 fi
21589 : locate the preferred pager for this system
21590 fn=f/
21591 case "$pager" in
21592 '')
21593         dflt=''
21594         case "$pg" in
21595         /*) dflt=$pg;;
21596         [a-zA-Z]:/*) dflt=$pg;;
21597         esac
21598         case "$more" in
21599         /*) dflt=$more;;
21600         [a-zA-Z]:/*) dflt=$more;;
21601         esac
21602         case "$less" in
21603         /*) dflt=$less;;
21604         [a-zA-Z]:/*) dflt=$less;;
21605         esac
21606         case "$dflt" in
21607         '') dflt=/usr/ucb/more;;
21608         esac
21609         ;;
21610 *)      dflt="$pager"
21611         ;;
21612 esac
21613 fn="f/($dflt)"
21614 echo " "
21615 rp='What pager is used on your system?'
21616 . ./getfile
21617 pager="$ans"
21618
21619 : see if ar generates random libraries by itself
21620 echo " "
21621 echo "Checking how to generate random libraries on your machine..." >&4
21622 echo 'int bar1() { return bar2(); }' > bar1.c
21623 echo 'int bar2() { return 2; }' > bar2.c
21624 $cat > foo.c <<EOP
21625 #$i_stdlib I_STDLIB
21626 #ifdef I_STDLIB
21627 #include <stdlib.h>
21628 #endif
21629 int main() { printf("%d\n", bar1()); exit(0); }
21630 EOP
21631 $cc $ccflags -c bar1.c >/dev/null 2>&1
21632 $cc $ccflags -c bar2.c >/dev/null 2>&1
21633 $cc $ccflags -c foo.c >/dev/null 2>&1
21634 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21635 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21636         $run ./foobar >/dev/null 2>&1; then
21637         echo "$ar appears to generate random libraries itself."
21638         orderlib=false
21639         if [ "X$ranlib" = "X" ]; then
21640             ranlib=":"
21641         fi
21642 elif $ar s bar$_a >/dev/null 2>&1 &&
21643         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21644         $run ./foobar >/dev/null 2>&1; then
21645                 echo "a table of contents needs to be added with '$ar s'."
21646                 orderlib=false
21647                 ranlib="$ar s"
21648 elif $ar ts bar$_a >/dev/null 2>&1 &&
21649         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21650         $run ./foobar >/dev/null 2>&1; then
21651                 echo "a table of contents needs to be added with '$ar ts'."
21652                 orderlib=false
21653                 ranlib="$ar ts"
21654 else
21655         case "$ranlib" in
21656         :) ranlib='';;
21657         '')
21658                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21659                 $test -f $ranlib || ranlib=''
21660                 ;;
21661         esac
21662         if $test -n "$ranlib"; then
21663                 echo "your system has '$ranlib'; we'll use that."
21664                 orderlib=false
21665         else
21666                 echo "your system doesn't seem to support random libraries"
21667                 echo "so we'll use lorder and tsort to order the libraries."
21668                 orderlib=true
21669                 ranlib=":"
21670         fi
21671 fi
21672 $rm -f foo* bar*
21673
21674 : Check the max offset that gmtime and localtime accept
21675 echo "Checking max offsets that gmtime () accepts"
21676
21677 case "$sGMTIME_min/$sGMTIME_max" in
21678     0/0|/)
21679         $cat >try.c <<EOCP
21680 #include <sys/types.h>
21681 #include <stdio.h>
21682 #include <time.h>
21683
21684 int i;
21685 struct tm *tmp;
21686 time_t pt;
21687
21688 void gm_check (time_t t, int min_year, int max_year)
21689 {
21690     tmp = gmtime (&t);
21691     if ( tmp == NULL ||
21692         /* Check tm_year overflow */
21693          tmp->tm_year < min_year || tmp->tm_year > max_year)
21694         tmp = NULL;
21695     else
21696         pt = t;
21697     } /* gm_check */
21698
21699 int check_max ()
21700 {
21701     tmp = NULL;
21702     pt  = 0;
21703 #ifdef MAXLONG
21704     gm_check (MAXLONG, 69, 0x7fffffff);
21705 #endif
21706     if (tmp == NULL || tmp->tm_year < 0) {
21707         for (i = 63; i >= 0; i--) {
21708             time_t x = pt | ((time_t)1 << i);
21709             if (x < 0 || x < pt) continue;
21710             gm_check (x, 69, 0x7fffffff);
21711             }
21712         }
21713     printf ("sGMTIME_max=%ld\n", pt);
21714     return (0);
21715     } /* check_max */
21716
21717 int check_min ()
21718 {
21719     tmp = NULL;
21720     pt  = 0;
21721 #ifdef MINLONG
21722     gm_check (MINLONG, -1900, 70);
21723 #endif
21724     if (tmp == NULL) {
21725         for (i = 36; i >= 0; i--) {
21726             time_t x = pt - ((time_t)1 << i);
21727             if (x > 0) continue;
21728             gm_check (x, -1900, 70);
21729             }
21730         }
21731     printf ("sGMTIME_min=%ld\n", pt);
21732     return (0);
21733     } /* check_min */
21734
21735 int main (int argc, char *argv[])
21736 {
21737     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21738     check_max ();
21739     check_min ();
21740     return (0);
21741     } /* main */
21742 EOCP
21743         set try
21744         if eval $compile; then
21745             eval `$run ./try 2>/dev/null`
21746         else
21747             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21748             fi
21749         $rm_try
21750         ;;
21751     esac
21752
21753 echo "Checking max offsets that localtime () accepts"
21754
21755 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21756     0/0|/)
21757         $cat >try.c <<EOCP
21758 #include <sys/types.h>
21759 #include <stdio.h>
21760 #include <time.h>
21761
21762 int i;
21763 struct tm *tmp;
21764 time_t pt;
21765
21766 void local_check (time_t t, int min_year, int max_year)
21767 {
21768     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21769         tmp = NULL;
21770     else
21771         tmp = localtime (&t);
21772     if ( tmp == NULL ||
21773         /* Check tm_year overflow */
21774          tmp->tm_year < min_year || tmp->tm_year > max_year)
21775         tmp = NULL;
21776     else
21777         pt = t;
21778     } /* local_check */
21779
21780 int check_max ()
21781 {
21782     tmp = NULL;
21783     pt  = 0;
21784 #ifdef MAXLONG
21785     local_check (MAXLONG, 69, 0x7fffffff);
21786 #endif
21787     if (tmp == NULL || tmp->tm_year < 0) {
21788         for (i = 63; i >= 0; i--) {
21789             time_t x = pt | ((time_t)1 << i);
21790             if (x < 0 || x < pt) continue;
21791             local_check (x, 69, 0x7fffffff);
21792             }
21793         }
21794     printf ("sLOCALTIME_max=%ld\n", pt);
21795     return (0);
21796    } /* check_max */
21797
21798 int check_min ()
21799 {
21800     tmp = NULL;
21801     pt  = 0;
21802 #ifdef MINLONG
21803     local_check (MINLONG, -1900, 70);
21804 #endif
21805     if (tmp == NULL) {
21806         for (i = 36; i >= 0; i--) {
21807             time_t x = pt - ((time_t)1 << i);
21808             if (x > 0) continue;
21809             local_check (x, -1900, 70);
21810             }
21811         }
21812     printf ("sLOCALTIME_min=%ld\n", pt);
21813     return (0);
21814     } /* check_min */
21815
21816 int main (int argc, char *argv[])
21817 {
21818     check_max ();
21819     check_min ();
21820     return (0);
21821     } /* main */
21822 EOCP
21823         set try
21824         if eval $compile; then
21825             eval `$run ./try 2>/dev/null`
21826         else
21827             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21828             fi
21829         $rm_try
21830         ;;
21831     esac
21832
21833 : check for type of arguments to select.
21834 case "$selecttype" in
21835 '') case "$d_select" in
21836         $define)
21837                 echo " "
21838                 $cat <<EOM
21839 Checking to see what type of arguments are accepted by select().
21840 EOM
21841                 hdrs="$define sys/types.h
21842                         $i_systime sys/time.h
21843                         $i_sysselct sys/select.h
21844                         $d_socket sys/socket.h"
21845                 : The first arg can be int, unsigned, or size_t
21846                 : The last arg may or may not be 'const'
21847                 val=''
21848                 : void pointer has been seen but using that
21849                 : breaks the selectminbits test
21850                 for xxx in 'fd_set *' 'int *'; do
21851                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21852                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21853                                         case "$val" in
21854                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21855                                                 if ./protochk "$try" $hdrs; then
21856                                                         echo "Your system accepts $xxx."
21857                                                         val="$xxx"
21858                                                 fi
21859                                                 ;;
21860                                         esac
21861                                 done
21862                         done
21863                 done
21864                 case "$val" in
21865                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21866                         case "$d_fd_set" in
21867                                 $define) dflt="fd_set *" ;;
21868                                 *)              dflt="int *" ;;
21869                         esac
21870                         . ./myread
21871                         val=$ans
21872                         ;;
21873                 esac
21874                 selecttype="$val"
21875                 ;;
21876         *)      : no select, so pick a harmless default
21877                 selecttype='int *'
21878                 ;;
21879         esac
21880         ;;
21881 esac
21882
21883 : check for the select 'width'
21884 case "$selectminbits" in
21885 '') safebits=`expr $ptrsize \* 8`
21886     case "$d_select" in
21887         $define)
21888                 $cat <<EOM
21889
21890 Checking to see on how many bits at a time your select() operates...
21891 EOM
21892                 $cat >try.c <<EOCP
21893 #include <sys/types.h>
21894 #$i_time I_TIME
21895 #$i_systime I_SYS_TIME
21896 #$i_systimek I_SYS_TIME_KERNEL
21897 #ifdef I_TIME
21898 #   include <time.h>
21899 #endif
21900 #ifdef I_SYS_TIME
21901 #   ifdef I_SYS_TIME_KERNEL
21902 #       define KERNEL
21903 #   endif
21904 #   include <sys/time.h>
21905 #   ifdef I_SYS_TIME_KERNEL
21906 #       undef KERNEL
21907 #   endif
21908 #endif
21909 #$i_sysselct I_SYS_SELECT
21910 #ifdef I_SYS_SELECT
21911 #include <sys/select.h>
21912 #endif
21913 #$d_socket HAS_SOCKET
21914 #ifdef HAS_SOCKET
21915 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21916 #endif
21917 #include <stdio.h>
21918 #$i_stdlib I_STDLIB
21919 #ifdef I_STDLIB
21920 #include <stdlib.h>
21921 #endif
21922 $selecttype b;
21923 #define S sizeof(*(b))
21924 #define MINBITS 64
21925 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21926 #define NBITS  (NBYTES * 8)
21927 int main() {
21928     char *s = (char *)malloc(NBYTES);
21929     struct timeval t;
21930     int i;
21931     FILE* fp;
21932     int fd;
21933
21934     if (!s)
21935         exit(1);
21936     fclose(stdin);
21937     fp = fopen("try.c", "r");
21938     if (fp == 0)
21939       exit(2);
21940     fd = fileno(fp);
21941     if (fd < 0)
21942       exit(3);
21943     b = ($selecttype)s;
21944     for (i = 0; i < NBITS; i++)
21945         FD_SET(i, b);
21946     t.tv_sec  = 0;
21947     t.tv_usec = 0;
21948     select(fd + 1, b, 0, 0, &t);
21949     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21950     free(s);
21951     printf("%d\n", i + 1);
21952     return 0;
21953 }
21954 EOCP
21955                 set try
21956                 if eval $compile_ok; then
21957                         selectminbits=`$run ./try 2>/dev/null`
21958                         case "$selectminbits" in
21959                         '')     cat >&4 <<EOM
21960 Cannot figure out on how many bits at a time your select() operates.
21961 I'll play safe and guess it is $safebits bits.
21962 EOM
21963                                 selectminbits=$safebits
21964                                 bits="$safebits bits"
21965                                 ;;
21966                         1)      bits="1 bit" ;;
21967                         *)      bits="$selectminbits bits" ;;
21968                         esac
21969                         echo "Your select() operates on $bits at a time." >&4
21970                 else
21971                         rp='What is the minimum number of bits your select() operates on?'
21972                         case "$byteorder" in
21973                         12345678)       dflt=64 ;;
21974                         1234)           dflt=32 ;;
21975                         *)              dflt=1  ;;
21976                         esac
21977                         . ./myread
21978                         val=$ans
21979                         selectminbits="$val"
21980                 fi
21981                 $rm_try
21982                 ;;
21983         *)      : no select, so pick a harmless default
21984                 selectminbits=$safebits
21985                 ;;
21986         esac
21987         ;;
21988 esac
21989
21990 : Trace out the files included by signal.h, then look for SIGxxx names.
21991 case "$sig_num_init" in
21992 '')
21993 if [ "X$fieldn" = X ]; then
21994         : Just make some guesses.  We check them later.
21995         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21996 else
21997         xxx=`echo '#include <signal.h>' |
21998         $cppstdin $cppminus $cppflags 2>/dev/null |
21999         $grep '^[       ]*#.*include' |
22000         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22001                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22002 fi
22003 xxxfiles=''
22004 for xx in $xxx /dev/null ; do
22005         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22006 done
22007 case "$xxxfiles" in
22008 '')     xxxfiles=`./findhdr signal.h` ;;
22009 esac
22010 xxx=`awk '
22011 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22012         print substr($2, 4, 20)
22013 }
22014 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22015         print substr($3, 4, 20)
22016 }' $xxxfiles`
22017 : Append some common names just in case the awk scan failed.
22018 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22019 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22020 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22021 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22022 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22023
22024 : generate a few handy files for later
22025 $cat > signal.c <<EOCP
22026 #include <sys/types.h>
22027 #include <signal.h>
22028 #$i_stdlib I_STDLIB
22029 #ifdef I_STDLIB
22030 #include <stdlib.h>
22031 #endif
22032 #include <stdio.h>
22033 int main() {
22034
22035 /* Strange style to avoid deeply-nested #if/#else/#endif */
22036 #ifndef NSIG
22037 #  ifdef _NSIG
22038 #    define NSIG (_NSIG)
22039 #  endif
22040 #endif
22041
22042 #ifndef NSIG
22043 #  ifdef SIGMAX
22044 #    define NSIG (SIGMAX+1)
22045 #  endif
22046 #endif
22047
22048 #ifndef NSIG
22049 #  ifdef SIG_MAX
22050 #    define NSIG (SIG_MAX+1)
22051 #  endif
22052 #endif
22053
22054 #ifndef NSIG
22055 #  ifdef _SIG_MAX
22056 #    define NSIG (_SIG_MAX+1)
22057 #  endif
22058 #endif
22059
22060 #ifndef NSIG
22061 #  ifdef MAXSIG
22062 #    define NSIG (MAXSIG+1)
22063 #  endif
22064 #endif
22065
22066 #ifndef NSIG
22067 #  ifdef MAX_SIG
22068 #    define NSIG (MAX_SIG+1)
22069 #  endif
22070 #endif
22071
22072 #ifndef NSIG
22073 #  ifdef SIGARRAYSIZE
22074 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22075 #  endif
22076 #endif
22077
22078 #ifndef NSIG
22079 #  ifdef _sys_nsig
22080 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22081 #  endif
22082 #endif
22083
22084 /* Default to some arbitrary number that's big enough to get most
22085    of the common signals.
22086 */
22087 #ifndef NSIG
22088 #    define NSIG 50
22089 #endif
22090
22091 printf("NSIG %d\n", NSIG);
22092
22093 #ifndef JUST_NSIG
22094
22095 EOCP
22096
22097 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22098 {
22099         printf "#ifdef SIG"; printf $1; printf "\n"
22100         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22101         printf $1; printf ");\n"
22102         printf "#endif\n"
22103 }
22104 END {
22105         printf "#endif /* JUST_NSIG */\n";
22106         printf "exit(0);\n}\n";
22107 }
22108 ' >>signal.c
22109 $cat >signal.awk <<'EOP'
22110 BEGIN { ndups = 0 }
22111 $1 ~ /^NSIG$/ { nsig = $2 }
22112 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22113     if ($2 > maxsig) { maxsig = $2 }
22114     if (sig_name[$2]) {
22115         dup_name[ndups] = $1
22116         dup_num[ndups] = $2
22117         ndups++
22118     }
22119     else {
22120         sig_name[$2] = $1
22121         sig_num[$2] = $2
22122     }
22123 }
22124 END {
22125     if (nsig == 0) {
22126         nsig = maxsig + 1
22127     }
22128     printf("NSIG %d\n", nsig);
22129     for (n = 1; n < nsig; n++) {
22130         if (sig_name[n]) {
22131             printf("%s %d\n", sig_name[n], sig_num[n])
22132         }
22133         else {
22134             printf("NUM%d %d\n", n, n)
22135         }
22136     }
22137     for (n = 0; n < ndups; n++) {
22138         printf("%s %d\n", dup_name[n], dup_num[n])
22139     }
22140 }
22141 EOP
22142 $cat >signal_cmd <<EOS
22143 $startsh
22144 if $test -s signal.lst; then
22145     echo "Using your existing signal.lst file"
22146         exit 0
22147 fi
22148 xxx="$xxx"
22149 EOS
22150 $cat >>signal_cmd <<'EOS'
22151
22152 set signal
22153 if eval $compile_ok; then
22154         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22155                 $uniq | $awk -f signal.awk >signal.lst
22156 else
22157         echo "(I can't seem be able to compile the whole test program)" >&4
22158         echo "(I'll try it in little pieces.)" >&4
22159         set signal -DJUST_NSIG
22160         if eval $compile_ok; then
22161                 $run ./signal$_exe > signal.nsg
22162                 $cat signal.nsg
22163         else
22164                 echo "I can't seem to figure out how many signals you have." >&4
22165                 echo "Guessing 50." >&4
22166                 echo 'NSIG 50' > signal.nsg
22167         fi
22168         : Now look at all the signal names, one at a time.
22169         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22170                 $cat > signal.c <<EOCP
22171 #include <sys/types.h>
22172 #include <signal.h>
22173 #include <stdio.h>
22174 int main() {
22175 printf("$xx %d\n", SIG${xx});
22176 return 0;
22177 }
22178 EOCP
22179                 set signal
22180                 if eval $compile; then
22181                         echo "SIG${xx} found."
22182                         $run ./signal$_exe  >> signal.ls1
22183                 else
22184                         echo "SIG${xx} NOT found."
22185                 fi
22186         done
22187         if $test -s signal.ls1; then
22188                 $cat signal.nsg signal.ls1 |
22189                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22190         fi
22191
22192 fi
22193 if $test -s signal.lst; then
22194         :
22195 else
22196         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22197         echo 'kill -l' >signal
22198         set X `csh -f <signal`
22199         $rm -f signal
22200         shift
22201         case $# in
22202         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22203         esac
22204         echo $@ | $tr ' ' $trnl | \
22205             $awk '{ printf "%s %d\n", $1, ++s; }
22206                   END { printf "NSIG %d\n", ++s }' >signal.lst
22207 fi
22208 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22209 EOS
22210 chmod a+x signal_cmd
22211 $eunicefix signal_cmd
22212 ;;
22213 esac
22214
22215 : generate list of signal names
22216 case "$sig_num_init" in
22217 '')
22218 echo " "
22219 case "$sig_name_init" in
22220 '') doinit=yes ;;
22221 *)  case "$sig_num_init" in
22222     ''|*,*) doinit=yes ;;
22223     esac ;;
22224 esac
22225 case "$doinit" in
22226 yes)
22227         echo "Generating a list of signal names and numbers..." >&4
22228         . ./signal_cmd
22229         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22230         sig_name=`$awk 'BEGIN { printf "ZERO " }
22231                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22232         sig_num=`$awk  'BEGIN { printf "0 " }
22233                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22234         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22235                              !/^NSIG/   { printf "\"%s\", ", $1 }
22236                              END        { printf "0\n" }' signal.lst`
22237         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22238                              !/^NSIG/   { printf "%d, ", $2}
22239                              END        { printf "0\n"}' signal.lst`
22240         ;;
22241 esac
22242 echo "The following $sig_count signals are available:"
22243 echo " "
22244 echo $sig_name | $awk \
22245 'BEGIN { linelen = 0 }
22246 {
22247         for (i = 1; i <= NF; i++) {
22248                 name = "SIG" $i " "
22249                 linelen = linelen + length(name)
22250                 if (linelen > 70) {
22251                         printf "\n"
22252                         linelen = length(name)
22253                 }
22254                 printf "%s", name
22255         }
22256         printf "\n"
22257 }'
22258 sig_size=`echo $sig_name | awk '{print NF}'`
22259 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22260 ;;
22261 esac
22262
22263 : Check size of size
22264 echo " "
22265 case "$sizetype" in
22266 *_t) zzz="$sizetype"    ;;
22267 *)   zzz="filesize"     ;;
22268 esac
22269 echo "Checking the size of $zzz..." >&4
22270 cat > try.c <<EOCP
22271 #include <sys/types.h>
22272 #include <stdio.h>
22273 #$i_stdlib I_STDLIB
22274 #ifdef I_STDLIB
22275 #include <stdlib.h>
22276 #endif
22277 int main() {
22278     printf("%d\n", (int)sizeof($sizetype));
22279     exit(0);
22280 }
22281 EOCP
22282 set try
22283 if eval $compile_ok; then
22284         yyy=`$run ./try`
22285         case "$yyy" in
22286         '')     sizesize=4
22287                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22288                 ;;
22289         *)      sizesize=$yyy
22290                 echo "Your $zzz size is $sizesize bytes."
22291                 ;;
22292         esac
22293 else
22294         sizesize=4
22295         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22296 fi
22297
22298 : check for socklen_t
22299 echo " "
22300 echo "Checking to see if you have socklen_t..." >&4
22301 $cat >try.c <<EOCP
22302 #include <sys/types.h>
22303 #$d_socket HAS_SOCKET
22304 #ifdef HAS_SOCKET
22305 #include <sys/socket.h>
22306 #endif
22307 int main() { socklen_t x = 16; }
22308 EOCP
22309 set try
22310 if eval $compile; then
22311         val="$define"
22312         echo "You have socklen_t."
22313 else
22314         val="$undef"
22315         echo "You do not have socklen_t."
22316         case "$sizetype" in
22317         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22318         esac
22319 fi
22320 $rm_try
22321 set d_socklen_t
22322 eval $setvar
22323
22324 : see if this is a socks.h system
22325 set socks.h i_socks
22326 eval $inhdr
22327
22328 : check for type of the size argument to socket calls
22329 case "$d_socket" in
22330 "$define")
22331         $cat <<EOM
22332
22333 Checking to see what type is the last argument of accept().
22334 EOM
22335         yyy=''
22336         case "$d_socklen_t" in
22337         "$define") yyy="$yyy socklen_t"
22338         esac
22339         yyy="$yyy $sizetype int long unsigned"
22340         for xxx in $yyy; do
22341                 case "$socksizetype" in
22342                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22343                         case "$usesocks" in
22344                         "$define")
22345                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22346                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22347                                         socksizetype="$xxx"
22348                                 fi
22349                                 ;;
22350                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22351                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22352                                         socksizetype="$xxx"
22353                                 fi
22354                                 ;;
22355                         esac
22356                         ;;
22357                 esac
22358         done
22359 : In case none of those worked, prompt the user.
22360         case "$socksizetype" in
22361         '')     rp='What is the type for socket address structure sizes?'
22362                 dflt='int'
22363                 . ./myread
22364                 socksizetype=$ans
22365                 ;;
22366         esac
22367         ;;
22368 *)      : no sockets, so pick relatively harmless default
22369         socksizetype='int'
22370         ;;
22371 esac
22372
22373 : see what type is used for signed size_t
22374 set ssize_t ssizetype int stdio.h sys/types.h
22375 eval $typedef
22376 dflt="$ssizetype"
22377 $cat > try.c <<EOM
22378 #include <stdio.h>
22379 #$i_stdlib I_STDLIB
22380 #ifdef I_STDLIB
22381 #include <stdlib.h>
22382 #endif
22383 #include <sys/types.h>
22384 #define Size_t $sizetype
22385 #define SSize_t $dflt
22386 int main()
22387 {
22388         if (sizeof(Size_t) == sizeof(SSize_t))
22389                 printf("$dflt\n");
22390         else if (sizeof(Size_t) == sizeof(int))
22391                 printf("int\n");
22392         else
22393                 printf("long\n");
22394         exit(0);
22395 }
22396 EOM
22397 echo " "
22398 set try
22399 if eval $compile_ok && $run ./try > /dev/null; then
22400         ssizetype=`$run ./try`
22401         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22402 else
22403         $cat >&4 <<EOM
22404 Help! I can't compile and run the ssize_t test program: please enlighten me!
22405 (This is probably a misconfiguration in your system or libraries, and
22406 you really ought to fix it.  Still, I'll try anyway.)
22407
22408 I need a type that is the same size as $sizetype, but is guaranteed to
22409 be signed.  Common values are ssize_t, int and long.
22410
22411 EOM
22412         rp="What signed type is the same size as $sizetype?"
22413         . ./myread
22414         ssizetype="$ans"
22415 fi
22416 $rm_try
22417
22418 : Check the size of st_ino
22419 $echo " "
22420 $echo "Checking the size of st_ino..." >&4
22421 $cat > try.c <<EOCP
22422 #include <sys/stat.h>
22423 #include <stdio.h>
22424 #$i_stdlib I_STDLIB
22425 #ifdef I_STDLIB
22426 #include <stdlib.h>
22427 #endif
22428 int main() {
22429     struct stat st;
22430     printf("%d\n", (int)sizeof(st.st_ino));
22431     exit(0);
22432 }
22433 EOCP
22434 set try
22435 if eval $compile_ok; then
22436         val=`$run ./try`
22437         case "$val" in
22438         '')     st_ino_size=4
22439                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22440                 ;;
22441         *)      st_ino_size=$val
22442                 $echo "Your st_ino is $st_ino_size bytes long."
22443                 ;;
22444         esac
22445 else
22446         st_ino_size=4
22447         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22448 fi
22449 $rm_try
22450
22451 : Check if st_ino is signed
22452 $echo " "
22453 $echo "Checking the sign of st_ino..." >&4
22454 $cat > try.c <<EOCP
22455 #include <sys/stat.h>
22456 #include <stdio.h>
22457 int main() {
22458         struct stat foo;
22459         foo.st_ino = -1;
22460         if (foo.st_ino < 0)
22461                 printf("-1\n");
22462         else
22463                 printf("1\n");
22464 }
22465 EOCP
22466 set try
22467 if eval $compile; then
22468         val=`$run ./try`
22469         case "$val" in
22470         '')     st_ino_sign=1
22471                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22472                 ;;
22473         *)      st_ino_sign=$val
22474                 case "$st_ino_sign" in
22475                  1) $echo "Your st_ino is unsigned." ;;
22476                 -1) $echo "Your st_ino is signed."   ;;
22477                 esac
22478                 ;;
22479         esac
22480 else
22481         st_ino_sign=1
22482         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22483 fi
22484 $rm_try
22485
22486 : see what type of char stdio uses.
22487 echo " "
22488 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22489 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22490         echo "Your stdio uses unsigned chars." >&4
22491         stdchar="unsigned char"
22492 else
22493         echo "Your stdio uses signed chars." >&4
22494         stdchar="char"
22495 fi
22496 $rm -f stdioh
22497
22498 : Check size of UID
22499 echo " "
22500 case "$uidtype" in
22501 *_t) zzz="$uidtype"     ;;
22502 *)   zzz="uid"          ;;
22503 esac
22504 echo "Checking the size of $zzz..." >&4
22505 cat > try.c <<EOCP
22506 #include <sys/types.h>
22507 #include <stdio.h>
22508 #$i_stdlib I_STDLIB
22509 #ifdef I_STDLIB
22510 #include <stdlib.h>
22511 #endif
22512 int main() {
22513     printf("%d\n", (int)sizeof($uidtype));
22514     exit(0);
22515 }
22516 EOCP
22517 set try
22518 if eval $compile_ok; then
22519         yyy=`$run ./try`
22520         case "$yyy" in
22521         '')     uidsize=4
22522                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22523                 ;;
22524         *)      uidsize=$yyy
22525                 echo "Your $zzz is $uidsize bytes long."
22526                 ;;
22527         esac
22528 else
22529         uidsize=4
22530         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22531 fi
22532
22533 : Check if UID is signed
22534 echo " "
22535 case "$uidtype" in
22536 *_t) zzz="$uidtype"     ;;
22537 *)   zzz="uid"          ;;
22538 esac
22539 echo "Checking the sign of $zzz..." >&4
22540 cat > try.c <<EOCP
22541 #include <sys/types.h>
22542 #include <stdio.h>
22543 int main() {
22544         $uidtype foo = -1;
22545         if (foo < 0)
22546                 printf("-1\n");
22547         else
22548                 printf("1\n");
22549 }
22550 EOCP
22551 set try
22552 if eval $compile; then
22553         yyy=`$run ./try`
22554         case "$yyy" in
22555         '')     uidsign=1
22556                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22557                 ;;
22558         *)      uidsign=$yyy
22559                 case "$uidsign" in
22560                  1) echo "Your $zzz is unsigned." ;;
22561                 -1) echo "Your $zzz is signed."   ;;
22562                 esac
22563                 ;;
22564         esac
22565 else
22566         uidsign=1
22567         echo "(I can't compile the test program--guessing unsigned.)" >&4
22568 fi
22569
22570 : Check format string for UID
22571 echo " "
22572 $echo "Checking the format string to be used for uids..." >&4
22573
22574 case "$uidsign" in
22575 -1)     if $test X"$uidsize" = X"$ivsize"; then
22576                 uidformat="$ivdformat"
22577         else
22578                 if $test X"$uidsize" = X"$longsize"; then
22579                         uidformat='"ld"'
22580                 else
22581                         if $test X"$uidsize" = X"$intsize"; then
22582                                 uidformat='"d"'
22583                         else
22584                                 if $test X"$uidsize" = X"$shortsize"; then
22585                                         uidformat='"hd"'
22586                                 fi
22587                         fi
22588                 fi
22589         fi
22590         ;;
22591 *)      if $test X"$uidsize" = X"$uvsize"; then
22592                 uidformat="$uvuformat"
22593         else
22594                 if $test X"$uidsize" = X"$longsize"; then
22595                         uidformat='"lu"'
22596                 else
22597                         if $test X"$uidsize" = X"$intsize"; then
22598                                 uidformat='"u"'
22599                         else
22600                                 if $test X"$uidsize" = X"$shortsize"; then
22601                                         uidformat='"hu"'
22602                                 fi
22603                         fi
22604                 fi
22605         fi
22606         ;;
22607 esac
22608
22609 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22610 echo " "
22611 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22612 $cat >try.c <<'EOM'
22613 /* Intentionally a long probe as I'd like to sanity check that the exact
22614    approach is going to work, as thinking it will work, but only having it
22615    part working at runtime is worse than not having it.  */
22616
22617 #include <sys/types.h>
22618 #include <sys/sysctl.h>
22619 #include <sys/param.h>
22620 #include <stdio.h>
22621 #include <string.h>
22622 #include <stdlib.h>
22623 #include <unistd.h>
22624
22625 int
22626 main(int argc, char **argv) {
22627     char *buffer;
22628     char *argv_leaf = strrchr(argv[0], '/');
22629     char *buffer_leaf;
22630     size_t size = 0;
22631     int mib[4];
22632
22633     mib[0] = CTL_KERN;
22634     mib[1] = KERN_PROC;
22635     mib[2] = KERN_PROC_PATHNAME;
22636     mib[3] = -1;
22637
22638     if (!argv_leaf) {
22639         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22640         return 1;
22641     }
22642
22643     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22644         perror("sysctl");
22645         return 2;
22646     }
22647
22648     if (size < strlen(argv_leaf) + 1) {
22649         fprintf(stderr, "size %lu is too short for a path\n",
22650                 (unsigned long) size);
22651         return 3;
22652     }
22653
22654     if (size > MAXPATHLEN * MAXPATHLEN) {
22655         fprintf(stderr, "size %lu is too long for a path\n",
22656                 (unsigned long) size);
22657         return 4;
22658     }
22659
22660     buffer = (char *)malloc(size);
22661     if (!buffer) {
22662         perror("malloc");
22663         return 5;
22664     }
22665
22666     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22667         perror("sysctl");
22668         return 6;
22669     }
22670
22671     if (strlen(buffer) + 1 != size) {
22672         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22673                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22674         return 7;
22675     }
22676
22677
22678     if (*buffer != '/') {
22679         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22680         return 8;
22681     }
22682
22683     if (strstr(buffer, "/./")) {
22684         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22685         return 9;
22686     }
22687
22688     if (strstr(buffer, "/../")) {
22689         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22690         return 10;
22691     }
22692
22693     buffer_leaf = strrchr(buffer, '/');
22694     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22695         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22696         return 11;
22697     }
22698
22699     free(buffer);
22700
22701     return 0;
22702 }
22703 EOM
22704
22705 val=$undef
22706 set try
22707 if eval $compile; then
22708         if $run ./try; then
22709                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22710                 val="$define"
22711         else
22712                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22713                 val="$undef"
22714         fi
22715 else
22716         echo "I'm unable to compile the test program." >&4
22717         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22718         val="$undef"
22719 fi
22720 $rm_try
22721 set usekernprocpathname
22722 eval $setvar
22723
22724 : Determine if we can use _NSGetExecutablePath to find executing program
22725 echo " "
22726 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22727 $cat >try.c <<'EOM'
22728 /* Intentionally a long probe as I'd like to sanity check that the exact
22729    approach is going to work, as thinking it will work, but only having it
22730    part working at runtime is worse than not having it.  */
22731 #include <mach-o/dyld.h>
22732 #include <stdio.h>
22733 #include <stdlib.h>
22734 #include <sys/param.h>
22735 #include <string.h>
22736
22737 int
22738 main(int argc, char **argv) {
22739     char buf[1];
22740     uint32_t size = sizeof(buf);
22741     int result;
22742     char *buffer;
22743     char *tidied;
22744     char *argv_leaf = strrchr(argv[0], '/');
22745     char *tidied_leaf;
22746
22747     if (!argv_leaf) {
22748         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22749         return 1;
22750     }
22751
22752     _NSGetExecutablePath(buf, &size);
22753     if (size > MAXPATHLEN * MAXPATHLEN) {
22754         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22755                 (unsigned int) size);
22756         return 2;
22757     }
22758
22759     buffer = (char *)malloc(size);
22760     if (!buffer) {
22761         perror("malloc");
22762         return 3;
22763     }
22764
22765     result = _NSGetExecutablePath(buffer, &size);
22766     if (result != 0) {
22767         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22768                 result, (unsigned int) size);
22769         return 4;
22770     }
22771
22772     tidied = realpath(buffer, NULL);
22773     if (!tidied) {
22774         perror("realpath");
22775         return 5;
22776     }
22777
22778     free(buffer);
22779
22780     if (*tidied != '/') {
22781         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22782         return 6;
22783     }
22784
22785     if (strstr(tidied, "/./")) {
22786         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22787         return 7;
22788     }
22789
22790     if (strstr(tidied, "/../")) {
22791         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22792         return 8;
22793     }
22794
22795     tidied_leaf = strrchr(tidied, '/');
22796     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22797         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22798         return 9;
22799     }
22800
22801     free(tidied);
22802
22803     return 0;
22804 }
22805 EOM
22806
22807 val=$undef
22808 set try
22809 if eval $compile; then
22810         if $run ./try; then
22811                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22812                 val="$define"
22813         else
22814                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22815         fi
22816 else
22817         echo "I'm unable to compile the test program." >&4
22818         echo "I'll assume no _NSGetExecutablePath here." >&4
22819 fi
22820 $rm_try
22821 set usensgetexecutablepath
22822 eval $setvar
22823
22824 : Check if site customization support was requested
22825 case "$usesitecustomize" in
22826     $define|true|[Yy]*)
22827         usesitecustomize="$define"
22828         ;;
22829     *)
22830         usesitecustomize="$undef"
22831         ;;
22832     esac
22833
22834 : determine compiler compiler
22835 case "$yacc" in
22836 '')
22837         dflt=yacc;;
22838 *)
22839         dflt="$yacc";;
22840 esac
22841 echo " "
22842 comp='yacc'
22843 if $test -f "$byacc$_exe"; then
22844         dflt="$byacc"
22845         comp="byacc or $comp"
22846 fi
22847 if $test -f "$bison$_exe"; then
22848         comp="$comp or bison -y"
22849 fi
22850 rp="Which compiler compiler ($comp) shall I use?"
22851 . ./myread
22852 yacc="$ans"
22853 case "$yacc" in
22854 *bis*)
22855         case "$yacc" in
22856         *-y*) ;;
22857         *)
22858                 yacc="$yacc -y"
22859                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22860                 ;;
22861         esac
22862         ;;
22863 esac
22864
22865 : see if this is a bfd.h system
22866 set bfd.h i_bfd
22867 eval $inhdr
22868
22869 : see if this is an execinfo.h system
22870 set execinfo.h i_execinfo
22871 eval $inhdr
22872
22873 : see if this is a fenv.h system
22874 set fenv.h i_fenv
22875 eval $inhdr
22876
22877 : see if this is a fp.h system
22878 set fp.h i_fp
22879 eval $inhdr
22880
22881 : see if this is a fp_class.h system
22882 set fp_class.h i_fp_class
22883 eval $inhdr
22884
22885 : see if gdbm.h is available
22886 set gdbm.h t_gdbm
22887 eval $inhdr
22888 case "$t_gdbm" in
22889 $define)
22890         : see if gdbm_open exists
22891         set gdbm_open d_gdbm_open
22892         eval $inlibc
22893         case "$d_gdbm_open" in
22894         $undef)
22895                 t_gdbm="$undef"
22896                 echo "We won't be including <gdbm.h>"
22897                 ;;
22898         esac
22899         ;;
22900 esac
22901 val="$t_gdbm"
22902 set i_gdbm
22903 eval $setvar
22904
22905 : see if this is a ieeefp.h system
22906 case "$i_ieeefp" in
22907 '' ) set ieeefp.h i_ieeefp
22908      eval $inhdr
22909      ;;
22910 esac
22911
22912 : see if this is a libutil.h system
22913 set libutil.h i_libutil
22914 eval $inhdr
22915
22916 : see if mach cthreads are available
22917 if test "X$usethreads" = "X$define"; then
22918         set mach/cthreads.h i_machcthr
22919         eval $inhdr
22920 else
22921         i_machcthr="$undef"
22922 fi
22923
22924 : see if this is a mntent.h system
22925 set mntent.h i_mntent
22926 eval $inhdr
22927
22928 : see if net/errno.h is available
22929 val=''
22930 set net/errno.h val
22931 eval $inhdr
22932
22933 : Unfortunately, it causes problems on some systems.  Arrgh.
22934 case "$val" in
22935 $define)
22936         cat > try.c <<'EOM'
22937 #include <stdio.h>
22938 #include <errno.h>
22939 #include <net/errno.h>
22940 int func()
22941 {
22942         return ENOTSOCK;
22943 }
22944 EOM
22945         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22946                 echo "We'll be including <net/errno.h>." >&4
22947         else
22948                 echo "We won't be including <net/errno.h>." >&4
22949                 val="$undef"
22950         fi
22951         $rm_try
22952         ;;
22953 esac
22954 set i_neterrno
22955 eval $setvar
22956
22957 : see if netinet/tcp.h is available
22958 set netinet/tcp.h i_netinettcp
22959 eval $inhdr
22960
22961 : see if this is a poll.h system
22962 set poll.h i_poll
22963 eval $inhdr
22964
22965 : see if this is a prot.h system
22966 set prot.h i_prot
22967 eval $inhdr
22968
22969 : Preprocessor symbols
22970 echo " "
22971 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22972 $cat <<'EOSH' > Cppsym.know
22973 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22974 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22975 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22976 arch_pwr ardent ARM ARM32 atarist att386 att3b
22977 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22978 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22979 byteorder byte_order
22980 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22981 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22982 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22983 ELF encore EPI EXTENSIONS
22984 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22985 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22986 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22987 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22988 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22989 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22990 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22991 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22992 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22993 ksr1
22994 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22995 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22996 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22997 luna88k Lynx
22998 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22999 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23000 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23001 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23002 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23003 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23004 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23005 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23006 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23007 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23008 ns32000 ns32016 ns32332 ns32k nsc32000
23009 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23010 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23011 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23012 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23013 QK_USER QNX
23014 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23015 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23016 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23017 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23018 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23019 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23020 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23021 SYSV4 SYSV5 sysV68 sysV88
23022 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23023 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23024 tower32_800 tower32_850 tss
23025 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23026 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23027 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23028 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23029 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23030 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23031 uxpm uxps
23032 vax venix VMESA vms
23033 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23034 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23035 z8000 zarch
23036 EOSH
23037 # Maybe put other stuff here too.
23038 ./tr '-' '_' <<EOSH >>Cppsym.know
23039 $osname
23040 EOSH
23041 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23042 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23043 $cat Cppsym.know > Cppsym.c
23044 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23045 $rm -f Cppsym.a Cppsym.b Cppsym.c
23046 cat <<EOSH > Cppsym
23047 $startsh
23048 if $test \$# -gt 0; then
23049     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23050     if $test -s Cppsym.got; then
23051         $rm -f Cppsym.got
23052         exit 0
23053     fi
23054     $rm -f Cppsym.got
23055     exit 1
23056 else
23057     $tr " " "$trnl" | ./Cppsym.try
23058     exit 0
23059 fi
23060 EOSH
23061 chmod +x Cppsym
23062 $eunicefix Cppsym
23063 cat <<EOSH > Cppsym.try
23064 $startsh
23065 cat <<'EOCP' > try.c
23066 #include <stdio.h>
23067 #if cpp_stuff == 1
23068 #define STRINGIFY(a)    "a"
23069 #endif
23070 #if cpp_stuff == 42
23071 #define StGiFy(a)  #a
23072 #define STRINGIFY(a)    StGiFy(a)
23073 #endif
23074 #if $cpp_stuff != 1 && $cpp_stuff != 42
23075 #   include "Bletch: How does this C preprocessor stringify macros?"
23076 #endif
23077 int main() {
23078 EOCP
23079 $awk \\
23080 EOSH
23081 cat <<'EOSH' >> Cppsym.try
23082 'length($1) > 0 {
23083     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23084     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23085     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23086     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23087 }' >> try.c
23088 echo 'return 0;}' >> try.c
23089 EOSH
23090 cat <<EOSH >> Cppsym.try
23091 ccflags="$ccflags"
23092 case "$osname-$gccversion" in
23093 irix-) ccflags="\$ccflags -woff 1178" ;;
23094 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23095 esac
23096 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23097 EOSH
23098 chmod +x Cppsym.try
23099 $eunicefix Cppsym.try
23100 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23101 : Add in any Linux cpp "predefined macros":
23102 case "$osname::$gccversion" in
23103   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23104     tHdrH=_tmpHdr
23105     rm -f $tHdrH'.h' $tHdrH
23106     touch $tHdrH'.h'
23107     # Filter out macro arguments, such as Linux's __INT8_C(c)
23108     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23109        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23110        if [ -s $tHdrH'_cppsym.real' ]; then
23111           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23112        fi
23113     fi
23114     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23115   ;;
23116 esac
23117 : now check the C compiler for additional symbols
23118 postprocess_cc_v=''
23119 case "$osname" in
23120 aix) postprocess_cc_v="|$tr , ' '" ;;
23121 esac
23122 $cat >ccsym <<EOS
23123 $startsh
23124 $cat >tmp.c <<EOF
23125 extern int foo;
23126 EOF
23127 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23128 do
23129         case "\$i" in
23130         -D*) echo "\$i" | $sed 's/^-D//';;
23131         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23132         esac
23133 done
23134 $rm_try
23135 EOS
23136 postprocess_cc_v=''
23137 chmod +x ccsym
23138 $eunicefix ccsym
23139 ./ccsym > ccsym1.raw
23140 if $test -s ccsym1.raw; then
23141     $sort ccsym1.raw | $uniq >ccsym.raw
23142 else
23143     mv ccsym1.raw ccsym.raw
23144 fi
23145
23146 $awk '/\=/ { print $0; next }
23147         { print $0"=1" }' ccsym.raw >ccsym.list
23148 $comm -13 Cppsym.true ccsym.list >ccsym.own
23149 $comm -12 Cppsym.true ccsym.list >ccsym.com
23150 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23151 also=''
23152 if $test -z ccsym.raw; then
23153         echo "Your C compiler doesn't seem to define any symbols!" >&4
23154         echo " "
23155         echo "However, your C preprocessor defines the following symbols:"
23156         $cat Cppsym.true
23157         ccsymbols=''
23158         cppsymbols=`$cat Cppsym.true`
23159         cppsymbols=`echo $cppsymbols`
23160         cppccsymbols="$cppsymbols"
23161 else
23162         if $test -s ccsym.com; then
23163                 echo "Your C compiler and pre-processor define these symbols:"
23164                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23165                 also='also '
23166                 symbols='ones'
23167                 cppccsymbols=`$cat ccsym.com`
23168                 cppccsymbols=`echo $cppccsymbols`
23169                 $test "$silent" || sleep 1
23170         fi
23171         if $test -s ccsym.cpp; then
23172                 $test "$also" && echo " "
23173                 echo "Your C pre-processor ${also}defines the following symbols:"
23174                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23175                 also='further '
23176                 cppsymbols=`$cat ccsym.cpp`
23177                 cppsymbols=`echo $cppsymbols`
23178                 $test "$silent" || sleep 1
23179         fi
23180         if $test -s ccsym.own; then
23181                 $test "$also" && echo " "
23182                 echo "Your C compiler ${also}defines the following cpp symbols:"
23183                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23184                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23185                 ccsymbols=`$cat ccsym.own`
23186                 ccsymbols=`echo $ccsymbols`
23187                 $test "$silent" || sleep 1
23188         fi
23189 fi
23190
23191 : add -D_FORTIFY_SOURCE if feasible and not already there
23192 case "$gccversion" in
23193 [456789].*)     case "$optimize$ccflags" in
23194         *-O*)   case "$ccflags$cppsymbols" in
23195                 *_FORTIFY_SOURCE=*) # Don't add it again.
23196                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23197                         ;;
23198                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23199                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23200                         ;;
23201                 esac
23202                 ;;
23203         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23204                 ;;
23205         esac
23206         ;;
23207 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23208         ;;
23209 esac
23210
23211 : script used to emit important warnings
23212 cat >warn <<EOS
23213 $startsh
23214 if test \$# -gt 0; then
23215         echo "\$@" >msg
23216 else
23217         cat >msg
23218 fi
23219 echo "*** WARNING:" >&4
23220 sed -e 's/^/*** /' <msg >&4
23221 echo "*** " >&4
23222 cat msg >>config.msg
23223 echo " " >>config.msg
23224 rm -f msg
23225 EOS
23226 chmod +x warn
23227 $eunicefix warn
23228
23229 : see if this is a termio system
23230 val="$undef"
23231 val2="$undef"
23232 val3="$undef"
23233 if $test `./findhdr termios.h`; then
23234     set tcsetattr i_termios
23235     eval $inlibc
23236     val3="$i_termios"
23237 fi
23238 echo " "
23239 case "$val3" in
23240     "$define") echo "You have POSIX termios.h... good!" >&4;;
23241     *)  if ./Cppsym pyr; then
23242             case "`$run /bin/universe`" in
23243                 ucb) if $test `./findhdr sgtty.h`; then
23244                         val2="$define"
23245                         echo "<sgtty.h> found." >&4
23246                     else
23247                         echo "System is pyramid with BSD universe."
23248                         ./warn "<sgtty.h> not found--you could have problems."
23249                     fi;;
23250                 *)  if $test `./findhdr termio.h`; then
23251                         val="$define"
23252                         echo "<termio.h> found." >&4
23253                     else
23254                         echo "System is pyramid with USG universe."
23255                         ./warn "<termio.h> not found--you could have problems."
23256                     fi;;
23257             esac
23258         elif ./usg; then
23259             if $test `./findhdr termio.h`; then
23260                 echo "<termio.h> found." >&4
23261                 val="$define"
23262             elif $test `./findhdr sgtty.h`; then
23263                 echo "<sgtty.h> found." >&4
23264                 val2="$define"
23265             else
23266                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23267             fi
23268         else
23269             if $test `./findhdr sgtty.h`; then
23270                 echo "<sgtty.h> found." >&4
23271                 val2="$define"
23272             elif $test `./findhdr termio.h`; then
23273                 echo "<termio.h> found." >&4
23274                 val="$define"
23275             else
23276                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23277             fi
23278         fi;;
23279 esac
23280 set i_termio; eval $setvar
23281 val=$val2; set i_sgtty; eval $setvar
23282 val=$val3; set i_termios; eval $setvar
23283
23284 : see if stdbool is available
23285 : we want a real compile instead of Inhdr because some Solaris systems
23286 : have stdbool.h, but it can only be used if the compiler indicates it
23287 : is sufficiently c99-compliant.
23288 echo " "
23289 $cat >try.c <<EOCP
23290 #include <stdio.h>
23291 #include <stdbool.h>
23292 int func(bool x)
23293 {
23294     return x ? 1 : 0;
23295 }
23296 int main(int argc, char **argv)
23297 {
23298     return func(0);
23299 }
23300 EOCP
23301 set try
23302 if eval $compile; then
23303         echo "<stdbool.h> found." >&4
23304         val="$define"
23305 else
23306         echo "<stdbool.h> NOT found." >&4
23307         val="$undef"
23308 fi
23309 $rm_try
23310 set i_stdbool
23311 eval $setvar
23312
23313 : see if stdint is available
23314 set stdint.h i_stdint
23315 eval $inhdr
23316
23317 : see if sys/access.h is available
23318 set sys/access.h i_sysaccess
23319 eval $inhdr
23320
23321 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23322 set sys/filio.h i_sysfilio
23323 eval $inhdr
23324 echo " "
23325 if $test `./findhdr sys/ioctl.h`; then
23326         val="$define"
23327         echo '<sys/ioctl.h> found.' >&4
23328 else
23329         val="$undef"
23330         if $test $i_sysfilio = "$define"; then
23331             echo '<sys/ioctl.h> NOT found.' >&4
23332         else
23333                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23334                 $test $i_termio = "$define" && xxx="termio.h"
23335                 $test $i_termios = "$define" && xxx="termios.h"
23336 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23337         fi
23338 fi
23339 set i_sysioctl
23340 eval $setvar
23341
23342 : see if socket ioctl defs are in sys/sockio.h
23343 echo " "
23344 xxx=`./findhdr sys/sockio.h`
23345 if $test "$xxx"; then
23346         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23347                 val="$define"
23348                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23349         else
23350                 val="$undef"
23351                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23352         fi
23353 else
23354         val="$undef"
23355         $cat <<EOM
23356 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23357 EOM
23358 fi
23359 set i_syssockio
23360 eval $setvar
23361
23362 : see if this is a syslog.h system
23363 set syslog.h i_syslog
23364 eval $inhdr
23365
23366 : see if this is a sys/mode.h system
23367 set sys/mode.h i_sysmode
23368 eval $inhdr
23369
23370 : see if there is a sys/poll.h file
23371 set sys/poll.h i_syspoll
23372 eval $inhdr
23373
23374 : see if sys/resource.h has to be included
23375 set sys/resource.h i_sysresrc
23376 eval $inhdr
23377
23378 : see if sys/security.h is available
23379 set sys/security.h i_syssecrt
23380 eval $inhdr
23381
23382 : see if this is a sys/statvfs.h system
23383 set sys/statvfs.h i_sysstatvfs
23384 eval $inhdr
23385
23386 : see if this is a sys/un.h system
23387 set sys/un.h i_sysun
23388 eval $inhdr
23389
23390 : see if this is a sys/utsname.h system
23391 set sys/utsname.h i_sysutsname
23392 eval $inhdr
23393
23394 : see if this is a syswait system
23395 set sys/wait.h i_syswait
23396 eval $inhdr
23397
23398 : see if this is a ustat.h system
23399 set ustat.h i_ustat
23400 eval $inhdr
23401
23402 : see if this is an utime system
23403 set utime.h i_utime
23404 eval $inhdr
23405
23406 : see if this is a vfork system
23407 case "$d_vfork" in
23408 "$define")
23409         set vfork.h i_vfork
23410         eval $inhdr
23411         ;;
23412 *)
23413         i_vfork="$undef"
23414         ;;
23415 esac
23416
23417 : see if wchar.h is present
23418 set wchar.h i_wchar
23419 eval $inhdr
23420
23421 : Check extensions
23422 echo " "
23423 echo "Looking for extensions..." >&4
23424 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23425 : contain old or inaccurate or duplicate values.
23426 nonxs_extensions=''
23427 xs_extensions=''
23428 : We do not use find because it might not be available.
23429 : We do not just use MANIFEST because the user may have dropped
23430 : some additional extensions into the source tree and expect them
23431 : to be built.
23432
23433 : Function to recursively find available extensions, ignoring DynaLoader
23434 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23435 : In 5.10.1 and later, extensions are stored in directories
23436 : like File-Glob instead of the older File/Glob/.
23437 find_extensions='
23438     for xxx in *; do
23439         case "$xxx" in
23440             DynaLoader|dynaload) ;;
23441             *)
23442             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23443             case "$this_ext" in
23444                 Scalar/List/Utils) this_ext="List/Util" ;;
23445                 PathTools)         this_ext="Cwd"       ;;
23446             esac;
23447             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23448             if $contains " $this_ext " "$tdir/$$.tmp"; then
23449                 echo >&4;
23450                 echo "Duplicate directories detected for extension $xxx" >&4;
23451                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23452                 case "$knowitall" in
23453                 "") dflt=y;;
23454                 *) dflt=n;;
23455                 esac;
23456                 . ../UU/myread;
23457                 case "$ans" in
23458                 n*|N*) ;;
23459                 *) echo >&4;
23460                     echo "Ok.  Stopping Configure." >&4;
23461                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23462                     exit 1;;
23463                 esac;
23464                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23465             fi;
23466             $ls -1 "$xxx" > "$tdir/$$.tmp";
23467             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23468                 xs_extensions="$xs_extensions $this_ext";
23469             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23470                 xs_extensions="$xs_extensions $this_ext";
23471             elif $test -d "$xxx"; then
23472                 nonxs_extensions="$nonxs_extensions $this_ext";
23473             fi;
23474             $rm -f "$tdir/$$.tmp";
23475             ;;
23476         esac;
23477     done'
23478 tdir=`pwd`
23479 cd "$rsrc/cpan"
23480 set X
23481 shift
23482 eval $find_extensions
23483 cd "$rsrc/dist"
23484 set X
23485 shift
23486 eval $find_extensions
23487 cd "$rsrc/ext"
23488 set X
23489 shift
23490 eval $find_extensions
23491 set X $xs_extensions
23492 shift
23493 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23494 set X $nonxs_extensions
23495 shift
23496 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23497 cd "$tdir"
23498 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23499
23500 : Now see which are supported on this system.
23501 avail_ext=''
23502 for xxx in $xs_extensions ; do
23503         case "$xxx" in
23504         Amiga*)
23505                 case "$osname" in
23506                 amigaos) avail_ext="$avail_ext $xxx" ;;
23507                 esac
23508                 ;;
23509         DB_File|db_file)
23510                 case "$i_db" in
23511                 $define) avail_ext="$avail_ext $xxx" ;;
23512                 esac
23513                 ;;
23514         GDBM_File|gdbm_fil)
23515                 case "$i_gdbm" in
23516                 $define) avail_ext="$avail_ext $xxx" ;;
23517                 esac
23518                 ;;
23519         IPC/SysV|ipc/sysv)
23520                 : XXX Do we need a useipcsysv variable here
23521                 case "${d_msg}${d_sem}${d_shm}" in
23522                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23523                 esac
23524                 ;;
23525         NDBM_File|ndbm_fil)
23526                 case "$d_ndbm" in
23527                 $define)
23528                     case "$osname-$use64bitint" in
23529                     hpux-define)
23530                         case "$libs" in
23531                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23532                         esac
23533                         ;;
23534                     *) avail_ext="$avail_ext $xxx" ;;
23535                     esac
23536                     ;;
23537                 esac
23538                 ;;
23539         ODBM_File|odbm_fil)
23540                 case "${i_dbm}${i_rpcsvcdbm}" in
23541                 *"${define}"*)
23542                     case "$d_cplusplus" in
23543                     define) ;; # delete as a function name will not work
23544                     *)  case "$osname-$use64bitint" in
23545                         hpux-define)
23546                             case "$libs" in
23547                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23548                             esac
23549                             ;;
23550                         *) avail_ext="$avail_ext $xxx" ;;
23551                         esac
23552                         ;;
23553                     esac
23554                     ;;
23555                 esac
23556                 ;;
23557         Opcode|opcode)
23558                 case "$useopcode" in
23559                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23560                 esac
23561                 ;;
23562         POSIX|posix)
23563                 case "$useposix" in
23564                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23565                 esac
23566                 ;;
23567         Socket|socket)
23568                 case "$d_socket" in
23569                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23570                 esac
23571                 ;;
23572         I18N/Langinfo|langinfo)
23573                 case "$uselanginfo" in
23574                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23575                 esac
23576                 ;;
23577         Sys/Syslog|sys/syslog)
23578                 case $osname in
23579                         amigaos) ;; # not really very useful on AmigaOS
23580                         *)
23581                         : XXX syslog requires socket
23582                         case "$d_socket" in
23583                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23584                         esac
23585                         ;;
23586                 esac
23587                 ;;
23588         Thread|thread)
23589                 case "$usethreads" in
23590                 true|$define|y)
23591                         case "$use5005threads" in
23592                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23593                         esac
23594                 esac
23595                 ;;
23596         threads|threads/shared)
23597                 # threads and threads::shared are special cases.
23598                 # To stop people from asking "Perl 5.8.0 was supposed
23599                 # to have this new fancy threads implementation but my
23600                 # perl doesn't have it" and from people trying to
23601                 # (re)install the threads module using CPAN.pm and
23602                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23603                 # the threads.pm and threads/shared.pm will always be
23604                 # there, croaking informatively ("you need to rebuild
23605                 # all of Perl with threads, sorry") when threads haven't
23606                 # been compiled in.
23607                 # --jhi
23608                 avail_ext="$avail_ext $xxx"
23609                 ;;
23610         VMS*)
23611                 ;;
23612         Win32*)
23613                 case "$osname" in
23614                 cygwin) avail_ext="$avail_ext $xxx" ;;
23615                 esac
23616                 ;;
23617         XS/APItest|xs/apitest)
23618                 # This is just for testing.  Skip it unless we have dynamic loading.
23619
23620                 case "$usedl" in
23621                 $define) avail_ext="$avail_ext $xxx" ;;
23622                 esac
23623                 ;;
23624         XS/Typemap|xs/typemap)
23625                 # This is just for testing.  Skip it unless we have dynamic loading.
23626                 case "$usedl" in
23627                 $define) avail_ext="$avail_ext $xxx" ;;
23628                 esac
23629                 ;;
23630         *)      avail_ext="$avail_ext $xxx"
23631                 ;;
23632         esac
23633 done
23634
23635 set X $avail_ext
23636 shift
23637 avail_ext="$*"
23638
23639 case "$onlyextensions" in
23640 '') ;;
23641 *)  keepextensions=''
23642     echo "You have requested that only certain extensions be included..." >&4
23643     for i in $onlyextensions; do
23644         case " $avail_ext " in
23645         *" $i "*)
23646             echo "Keeping extension $i."
23647             keepextensions="$keepextensions $i"
23648             ;;
23649         *) echo "Ignoring extension $i." ;;
23650         esac
23651     done
23652     avail_ext="$keepextensions"
23653     ;;
23654 esac
23655
23656 case "$noextensions" in
23657 '') ;;
23658 *)  keepextensions=''
23659     echo "You have requested that certain extensions be ignored..." >&4
23660     for i in $avail_ext; do
23661         case " $noextensions " in
23662         *" $i "*) echo "Ignoring extension $i." ;;
23663         *) echo "Keeping extension $i.";
23664            keepextensions="$keepextensions $i"
23665            ;;
23666         esac
23667     done
23668     avail_ext="$keepextensions"
23669     ;;
23670 esac
23671
23672 : Now see which nonxs extensions are supported on this system.
23673 : For now assume all are.
23674 nonxs_ext=''
23675 for xxx in $nonxs_extensions ; do
23676         case "$xxx" in
23677         VMS*)
23678                 ;;
23679         *)      nonxs_ext="$nonxs_ext $xxx"
23680                 ;;
23681         esac
23682 done
23683
23684 set X $nonxs_ext
23685 shift
23686 nonxs_ext="$*"
23687
23688 case $usedl in
23689 $define)
23690         $cat <<EOM
23691 A number of extensions are supplied with $package.  You may choose to
23692 compile these extensions for dynamic loading (the default), compile
23693 them into the $package executable (static loading), or not include
23694 them at all.  Answer "none" to include no extensions.
23695 Note that DynaLoader is always built and need not be mentioned here.
23696
23697 EOM
23698         case "$dynamic_ext" in
23699         '')
23700                 : Exclude those listed in static_ext
23701                 dflt=''
23702                 for xxx in $avail_ext; do
23703                         case " $static_ext " in
23704                         *" $xxx "*) ;;
23705                         *) dflt="$dflt $xxx" ;;
23706                         esac
23707                 done
23708                 set X $dflt
23709                 shift
23710                 dflt="$*"
23711                 ;;
23712         *)      dflt="$dynamic_ext"
23713                 # Perhaps we are reusing an old out-of-date config.sh.
23714                 case "$hint" in
23715                 previous)
23716                         if test X"$dynamic_ext" != X"$avail_ext"; then
23717                                 $cat <<EOM
23718 NOTICE:  Your previous config.sh list may be incorrect.
23719 The extensions now available to you are
23720         ${avail_ext}
23721 but the default list from your previous config.sh is
23722         ${dynamic_ext}
23723
23724 EOM
23725                         fi
23726                         ;;
23727                 esac
23728                 ;;
23729         esac
23730         case "$dflt" in
23731         '')     dflt=none;;
23732         esac
23733         rp="What extensions do you wish to load dynamically?"
23734         . ./myread
23735         case "$ans" in
23736         none) dynamic_ext=' ' ;;
23737         *) dynamic_ext="$ans" ;;
23738         esac
23739
23740         case "$static_ext" in
23741         '')
23742                 : Exclude those already listed in dynamic linking
23743                 dflt=''
23744                 for xxx in $avail_ext; do
23745                         case " $dynamic_ext " in
23746                         *" $xxx "*) ;;
23747                         *) dflt="$dflt $xxx" ;;
23748                         esac
23749                 done
23750                 set X $dflt
23751                 shift
23752                 dflt="$*"
23753                 ;;
23754         *)  dflt="$static_ext"
23755                 ;;
23756         esac
23757
23758         case "$dflt" in
23759         '')     dflt=none;;
23760         esac
23761         rp="What extensions do you wish to load statically?"
23762         . ./myread
23763         case "$ans" in
23764         none) static_ext=' ' ;;
23765         *) static_ext="$ans" ;;
23766         esac
23767         ;;
23768 *)
23769         $cat <<EOM
23770 A number of extensions are supplied with $package.  Answer "none"
23771 to include no extensions.
23772 Note that DynaLoader is always built and need not be mentioned here.
23773
23774 EOM
23775         case "$static_ext" in
23776         '') dflt="$avail_ext" ;;
23777         *)      dflt="$static_ext"
23778                 # Perhaps we are reusing an old out-of-date config.sh.
23779                 case "$hint" in
23780                 previous)
23781                         if test X"$static_ext" != X"$avail_ext"; then
23782                                 $cat <<EOM
23783 NOTICE:  Your previous config.sh list may be incorrect.
23784 The extensions now available to you are
23785         ${avail_ext}
23786 but the default list from your previous config.sh is
23787         ${static_ext}
23788
23789 EOM
23790                         fi
23791                         ;;
23792                 esac
23793                 ;;
23794         esac
23795         : Exclude those that are not xs extensions
23796         case "$dflt" in
23797         '')     dflt=none;;
23798         esac
23799         rp="What extensions do you wish to include?"
23800         . ./myread
23801         case "$ans" in
23802         none) static_ext=' ' ;;
23803         *) static_ext="$ans" ;;
23804         esac
23805         ;;
23806 esac
23807 #
23808 # Encode is a special case.  If we are building Encode as a static
23809 # extension, we need to explicitly list its subextensions as well.
23810 # For other nested extensions, this is handled automatically by
23811 # the appropriate Makefile.PL.
23812 case " $static_ext " in
23813         *" Encode "*) # Add the subextensions of Encode
23814         cd "$rsrc/cpan"
23815         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23816                 static_ext="$static_ext Encode/$xxx"
23817                 known_extensions="$known_extensions Encode/$xxx"
23818         done
23819         cd "$tdir"
23820         ;;
23821 esac
23822
23823 set X $dynamic_ext $static_ext $nonxs_ext
23824 shift
23825 extensions="$*"
23826
23827 # Sanity check:  We require an extension suitable for use with
23828 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23829 # should show up as failures in the test suite, but it's helpful to
23830 # catch them now.) The 'extensions' list is normally sorted
23831 # alphabetically, so we need to accept either
23832 #    DB_File ... Fcntl ... IO  ....
23833 # or something like
23834 #    Fcntl ... NDBM_File ... IO  ....
23835 case " $extensions"  in
23836 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23837 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23838 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23839 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23840    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23841    ;;
23842 esac
23843
23844 : Remove libraries needed only for extensions
23845 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23846 : The exception is SunOS 4.x, which needs them.
23847 case "${osname}X${osvers}" in
23848 sunos*X4*)
23849     perllibs="$libs"
23850     ;;
23851 *) case "$usedl" in
23852     $define|true|[yY]*)
23853             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23854             shift
23855             perllibs="$*"
23856             ;;
23857     *)  perllibs="$libs"
23858             ;;
23859     esac
23860     ;;
23861 esac
23862
23863 : Remove build directory name from cppstdin so it can be used from
23864 : either the present location or the final installed location.
23865 echo " "
23866 : Get out of the UU directory to get correct path name.
23867 cd ..
23868 case "$cppstdin" in
23869 `pwd`/cppstdin)
23870         echo "Stripping down cppstdin path name"
23871         cppstdin=cppstdin
23872         ;;
23873 esac
23874 cd UU
23875
23876 : end of configuration questions
23877 echo " "
23878 echo "End of configuration questions."
23879 echo " "
23880
23881 : back to where it started
23882 if test -d ../UU; then
23883         cd ..
23884 fi
23885
23886 : configuration may be unconditionally patched via a 'config.arch' file
23887 if $test -f config.arch; then
23888         echo "I see a config.arch file, loading it." >&4
23889         . ./config.arch
23890 fi
23891
23892 : configuration may be patched via a 'config.over' file
23893 if $test -f config.over; then
23894         echo " "
23895         dflt=y
23896         rp='I see a config.over file.  Do you wish to load it?'
23897         . UU/myread
23898         case "$ans" in
23899         n*) echo "OK, I'll ignore it.";;
23900         *)      . ./config.over
23901                 echo "Configuration override changes have been loaded."
23902                 ;;
23903         esac
23904 fi
23905
23906 : in case they want portability, strip down executable paths
23907 case "$d_portable" in
23908 "$define")
23909         echo " "
23910         echo "Stripping down executable paths..." >&4
23911         for file in $loclist $trylist; do
23912                 eval temp=\$$file
23913                 eval $file=`basename $temp`
23914         done
23915         ;;
23916 esac
23917
23918 : create config.sh file
23919 echo " "
23920 echo "Creating config.sh..." >&4
23921 $spitshell <<EOT >config.sh
23922 $startsh
23923 #
23924 # This file was produced by running the Configure script. It holds all the
23925 # definitions figured out by Configure. Should you modify one of these values,
23926 # do not forget to propagate your changes by running "Configure -der". You may
23927 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23928 #
23929
23930 # Package name      : $package
23931 # Source directory  : $src
23932 # Configuration time: $cf_time
23933 # Configured by     : $cf_by
23934 # Target system     : $myuname
23935
23936 EOT
23937 : Add in command line options if available
23938 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23939
23940 $spitshell <<EOT >>config.sh
23941
23942 Author='$Author'
23943 Date='$Date'
23944 Header='$Header'
23945 Id='$Id'
23946 Locker='$Locker'
23947 Log='$Log'
23948 RCSfile='$RCSfile'
23949 Revision='$Revision'
23950 Source='$Source'
23951 State='$State'
23952 _a='$_a'
23953 _exe='$_exe'
23954 _o='$_o'
23955 afs='$afs'
23956 afsroot='$afsroot'
23957 alignbytes='$alignbytes'
23958 aphostname='$aphostname'
23959 api_revision='$api_revision'
23960 api_subversion='$api_subversion'
23961 api_version='$api_version'
23962 api_versionstring='$api_versionstring'
23963 ar='$ar'
23964 archlib='$archlib'
23965 archlibexp='$archlibexp'
23966 archname64='$archname64'
23967 archname='$archname'
23968 archobjs='$archobjs'
23969 asctime_r_proto='$asctime_r_proto'
23970 awk='$awk'
23971 baserev='$baserev'
23972 bash='$bash'
23973 bin='$bin'
23974 bin_ELF='$bin_ELF'
23975 binexp='$binexp'
23976 bison='$bison'
23977 byacc='$byacc'
23978 byteorder='$byteorder'
23979 c='$c'
23980 castflags='$castflags'
23981 cat='$cat'
23982 cc='$cc'
23983 cccdlflags='$cccdlflags'
23984 ccdlflags='$ccdlflags'
23985 ccflags='$ccflags'
23986 ccflags_uselargefiles='$ccflags_uselargefiles'
23987 ccname='$ccname'
23988 ccsymbols='$ccsymbols'
23989 ccversion='$ccversion'
23990 cf_by='$cf_by'
23991 cf_email='$cf_email'
23992 cf_time='$cf_time'
23993 charbits='$charbits'
23994 charsize='$charsize'
23995 chgrp='$chgrp'
23996 chmod='$chmod'
23997 chown='$chown'
23998 clocktype='$clocktype'
23999 comm='$comm'
24000 compress='$compress'
24001 contains='$contains'
24002 cp='$cp'
24003 cpio='$cpio'
24004 cpp='$cpp'
24005 cpp_stuff='$cpp_stuff'
24006 cppccsymbols='$cppccsymbols'
24007 cppflags='$cppflags'
24008 cpplast='$cpplast'
24009 cppminus='$cppminus'
24010 cpprun='$cpprun'
24011 cppstdin='$cppstdin'
24012 cppsymbols='$cppsymbols'
24013 crypt_r_proto='$crypt_r_proto'
24014 cryptlib='$cryptlib'
24015 csh='$csh'
24016 ctermid_r_proto='$ctermid_r_proto'
24017 ctime_r_proto='$ctime_r_proto'
24018 d_Gconvert='$d_Gconvert'
24019 d_PRIEUldbl='$d_PRIEUldbl'
24020 d_PRIFUldbl='$d_PRIFUldbl'
24021 d_PRIGUldbl='$d_PRIGUldbl'
24022 d_PRIXU64='$d_PRIXU64'
24023 d_PRId64='$d_PRId64'
24024 d_PRIeldbl='$d_PRIeldbl'
24025 d_PRIfldbl='$d_PRIfldbl'
24026 d_PRIgldbl='$d_PRIgldbl'
24027 d_PRIi64='$d_PRIi64'
24028 d_PRIo64='$d_PRIo64'
24029 d_PRIu64='$d_PRIu64'
24030 d_PRIx64='$d_PRIx64'
24031 d_SCNfldbl='$d_SCNfldbl'
24032 d__fwalk='$d__fwalk'
24033 d_accept4='$d_accept4'
24034 d_access='$d_access'
24035 d_accessx='$d_accessx'
24036 d_acosh='$d_acosh'
24037 d_aintl='$d_aintl'
24038 d_alarm='$d_alarm'
24039 d_archlib='$d_archlib'
24040 d_asctime64='$d_asctime64'
24041 d_asctime_r='$d_asctime_r'
24042 d_asinh='$d_asinh'
24043 d_atanh='$d_atanh'
24044 d_atolf='$d_atolf'
24045 d_atoll='$d_atoll'
24046 d_attribute_deprecated='$d_attribute_deprecated'
24047 d_attribute_format='$d_attribute_format'
24048 d_attribute_malloc='$d_attribute_malloc'
24049 d_attribute_nonnull='$d_attribute_nonnull'
24050 d_attribute_noreturn='$d_attribute_noreturn'
24051 d_attribute_pure='$d_attribute_pure'
24052 d_attribute_unused='$d_attribute_unused'
24053 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24054 d_backtrace='$d_backtrace'
24055 d_bsd='$d_bsd'
24056 d_bsdgetpgrp='$d_bsdgetpgrp'
24057 d_bsdsetpgrp='$d_bsdsetpgrp'
24058 d_builtin_add_overflow='$d_builtin_add_overflow'
24059 d_builtin_choose_expr='$d_builtin_choose_expr'
24060 d_builtin_expect='$d_builtin_expect'
24061 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24062 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24063 d_c99_variadic_macros='$d_c99_variadic_macros'
24064 d_casti32='$d_casti32'
24065 d_castneg='$d_castneg'
24066 d_cbrt='$d_cbrt'
24067 d_chown='$d_chown'
24068 d_chroot='$d_chroot'
24069 d_chsize='$d_chsize'
24070 d_class='$d_class'
24071 d_clearenv='$d_clearenv'
24072 d_closedir='$d_closedir'
24073 d_cmsghdr_s='$d_cmsghdr_s'
24074 d_copysign='$d_copysign'
24075 d_copysignl='$d_copysignl'
24076 d_cplusplus='$d_cplusplus'
24077 d_crypt='$d_crypt'
24078 d_crypt_r='$d_crypt_r'
24079 d_csh='$d_csh'
24080 d_ctermid='$d_ctermid'
24081 d_ctermid_r='$d_ctermid_r'
24082 d_ctime64='$d_ctime64'
24083 d_ctime_r='$d_ctime_r'
24084 d_cuserid='$d_cuserid'
24085 d_dbminitproto='$d_dbminitproto'
24086 d_difftime64='$d_difftime64'
24087 d_difftime='$d_difftime'
24088 d_dir_dd_fd='$d_dir_dd_fd'
24089 d_dirfd='$d_dirfd'
24090 d_dirnamlen='$d_dirnamlen'
24091 d_dladdr='$d_dladdr'
24092 d_dlerror='$d_dlerror'
24093 d_dlopen='$d_dlopen'
24094 d_dlsymun='$d_dlsymun'
24095 d_dosuid='$d_dosuid'
24096 d_double_has_inf='$d_double_has_inf'
24097 d_double_has_nan='$d_double_has_nan'
24098 d_double_has_negative_zero='$d_double_has_negative_zero'
24099 d_double_has_subnormals='$d_double_has_subnormals'
24100 d_double_style_cray='$d_double_style_cray'
24101 d_double_style_ibm='$d_double_style_ibm'
24102 d_double_style_ieee='$d_double_style_ieee'
24103 d_double_style_vax='$d_double_style_vax'
24104 d_drand48_r='$d_drand48_r'
24105 d_drand48proto='$d_drand48proto'
24106 d_dup2='$d_dup2'
24107 d_dup3='$d_dup3'
24108 d_duplocale='$d_duplocale'
24109 d_eaccess='$d_eaccess'
24110 d_endgrent='$d_endgrent'
24111 d_endgrent_r='$d_endgrent_r'
24112 d_endhent='$d_endhent'
24113 d_endhostent_r='$d_endhostent_r'
24114 d_endnent='$d_endnent'
24115 d_endnetent_r='$d_endnetent_r'
24116 d_endpent='$d_endpent'
24117 d_endprotoent_r='$d_endprotoent_r'
24118 d_endpwent='$d_endpwent'
24119 d_endpwent_r='$d_endpwent_r'
24120 d_endsent='$d_endsent'
24121 d_endservent_r='$d_endservent_r'
24122 d_eofnblk='$d_eofnblk'
24123 d_erf='$d_erf'
24124 d_erfc='$d_erfc'
24125 d_eunice='$d_eunice'
24126 d_exp2='$d_exp2'
24127 d_expm1='$d_expm1'
24128 d_faststdio='$d_faststdio'
24129 d_fchdir='$d_fchdir'
24130 d_fchmod='$d_fchmod'
24131 d_fchmodat='$d_fchmodat'
24132 d_fchown='$d_fchown'
24133 d_fcntl='$d_fcntl'
24134 d_fcntl_can_lock='$d_fcntl_can_lock'
24135 d_fd_macros='$d_fd_macros'
24136 d_fd_set='$d_fd_set'
24137 d_fdclose='$d_fdclose'
24138 d_fdim='$d_fdim'
24139 d_fds_bits='$d_fds_bits'
24140 d_fegetround='$d_fegetround'
24141 d_fgetpos='$d_fgetpos'
24142 d_finite='$d_finite'
24143 d_finitel='$d_finitel'
24144 d_flexfnam='$d_flexfnam'
24145 d_flock='$d_flock'
24146 d_flockproto='$d_flockproto'
24147 d_fma='$d_fma'
24148 d_fmax='$d_fmax'
24149 d_fmin='$d_fmin'
24150 d_fork='$d_fork'
24151 d_fp_class='$d_fp_class'
24152 d_fp_classify='$d_fp_classify'
24153 d_fp_classl='$d_fp_classl'
24154 d_fpathconf='$d_fpathconf'
24155 d_fpclass='$d_fpclass'
24156 d_fpclassify='$d_fpclassify'
24157 d_fpclassl='$d_fpclassl'
24158 d_fpgetround='$d_fpgetround'
24159 d_fpos64_t='$d_fpos64_t'
24160 d_freelocale='$d_freelocale'
24161 d_frexpl='$d_frexpl'
24162 d_fs_data_s='$d_fs_data_s'
24163 d_fseeko='$d_fseeko'
24164 d_fsetpos='$d_fsetpos'
24165 d_fstatfs='$d_fstatfs'
24166 d_fstatvfs='$d_fstatvfs'
24167 d_fsync='$d_fsync'
24168 d_ftello='$d_ftello'
24169 d_ftime='$d_ftime'
24170 d_futimes='$d_futimes'
24171 d_gai_strerror='$d_gai_strerror'
24172 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24173 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24174 d_getaddrinfo='$d_getaddrinfo'
24175 d_getcwd='$d_getcwd'
24176 d_getespwnam='$d_getespwnam'
24177 d_getfsstat='$d_getfsstat'
24178 d_getgrent='$d_getgrent'
24179 d_getgrent_r='$d_getgrent_r'
24180 d_getgrgid_r='$d_getgrgid_r'
24181 d_getgrnam_r='$d_getgrnam_r'
24182 d_getgrps='$d_getgrps'
24183 d_gethbyaddr='$d_gethbyaddr'
24184 d_gethbyname='$d_gethbyname'
24185 d_gethent='$d_gethent'
24186 d_gethname='$d_gethname'
24187 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24188 d_gethostbyname_r='$d_gethostbyname_r'
24189 d_gethostent_r='$d_gethostent_r'
24190 d_gethostprotos='$d_gethostprotos'
24191 d_getitimer='$d_getitimer'
24192 d_getlogin='$d_getlogin'
24193 d_getlogin_r='$d_getlogin_r'
24194 d_getmnt='$d_getmnt'
24195 d_getmntent='$d_getmntent'
24196 d_getnameinfo='$d_getnameinfo'
24197 d_getnbyaddr='$d_getnbyaddr'
24198 d_getnbyname='$d_getnbyname'
24199 d_getnent='$d_getnent'
24200 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24201 d_getnetbyname_r='$d_getnetbyname_r'
24202 d_getnetent_r='$d_getnetent_r'
24203 d_getnetprotos='$d_getnetprotos'
24204 d_getpagsz='$d_getpagsz'
24205 d_getpbyname='$d_getpbyname'
24206 d_getpbynumber='$d_getpbynumber'
24207 d_getpent='$d_getpent'
24208 d_getpgid='$d_getpgid'
24209 d_getpgrp2='$d_getpgrp2'
24210 d_getpgrp='$d_getpgrp'
24211 d_getppid='$d_getppid'
24212 d_getprior='$d_getprior'
24213 d_getprotobyname_r='$d_getprotobyname_r'
24214 d_getprotobynumber_r='$d_getprotobynumber_r'
24215 d_getprotoent_r='$d_getprotoent_r'
24216 d_getprotoprotos='$d_getprotoprotos'
24217 d_getprpwnam='$d_getprpwnam'
24218 d_getpwent='$d_getpwent'
24219 d_getpwent_r='$d_getpwent_r'
24220 d_getpwnam_r='$d_getpwnam_r'
24221 d_getpwuid_r='$d_getpwuid_r'
24222 d_getsbyname='$d_getsbyname'
24223 d_getsbyport='$d_getsbyport'
24224 d_getsent='$d_getsent'
24225 d_getservbyname_r='$d_getservbyname_r'
24226 d_getservbyport_r='$d_getservbyport_r'
24227 d_getservent_r='$d_getservent_r'
24228 d_getservprotos='$d_getservprotos'
24229 d_getspnam='$d_getspnam'
24230 d_getspnam_r='$d_getspnam_r'
24231 d_gettimeod='$d_gettimeod'
24232 d_gmtime64='$d_gmtime64'
24233 d_gmtime_r='$d_gmtime_r'
24234 d_gnulibc='$d_gnulibc'
24235 d_grpasswd='$d_grpasswd'
24236 d_has_C_UTF8='$d_has_C_UTF8'
24237 d_hasmntopt='$d_hasmntopt'
24238 d_htonl='$d_htonl'
24239 d_hypot='$d_hypot'
24240 d_ilogb='$d_ilogb'
24241 d_ilogbl='$d_ilogbl'
24242 d_inc_version_list='$d_inc_version_list'
24243 d_inetaton='$d_inetaton'
24244 d_inetntop='$d_inetntop'
24245 d_inetpton='$d_inetpton'
24246 d_int64_t='$d_int64_t'
24247 d_ip_mreq='$d_ip_mreq'
24248 d_ip_mreq_source='$d_ip_mreq_source'
24249 d_ipv6_mreq='$d_ipv6_mreq'
24250 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24251 d_isascii='$d_isascii'
24252 d_isblank='$d_isblank'
24253 d_isfinite='$d_isfinite'
24254 d_isfinitel='$d_isfinitel'
24255 d_isinf='$d_isinf'
24256 d_isinfl='$d_isinfl'
24257 d_isless='$d_isless'
24258 d_isnan='$d_isnan'
24259 d_isnanl='$d_isnanl'
24260 d_isnormal='$d_isnormal'
24261 d_j0='$d_j0'
24262 d_j0l='$d_j0l'
24263 d_killpg='$d_killpg'
24264 d_lc_monetary_2008='$d_lc_monetary_2008'
24265 d_lchown='$d_lchown'
24266 d_ldbl_dig='$d_ldbl_dig'
24267 d_ldexpl='$d_ldexpl'
24268 d_lgamma='$d_lgamma'
24269 d_lgamma_r='$d_lgamma_r'
24270 d_libm_lib_version='$d_libm_lib_version'
24271 d_libname_unique='$d_libname_unique'
24272 d_link='$d_link'
24273 d_linkat='$d_linkat'
24274 d_llrint='$d_llrint'
24275 d_llrintl='$d_llrintl'
24276 d_llround='$d_llround'
24277 d_llroundl='$d_llroundl'
24278 d_localeconv_l='$d_localeconv_l'
24279 d_localtime64='$d_localtime64'
24280 d_localtime_r='$d_localtime_r'
24281 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24282 d_locconv='$d_locconv'
24283 d_lockf='$d_lockf'
24284 d_log1p='$d_log1p'
24285 d_log2='$d_log2'
24286 d_logb='$d_logb'
24287 d_long_double_style_ieee='$d_long_double_style_ieee'
24288 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24289 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24290 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24291 d_long_double_style_vax='$d_long_double_style_vax'
24292 d_longdbl='$d_longdbl'
24293 d_longlong='$d_longlong'
24294 d_lrint='$d_lrint'
24295 d_lrintl='$d_lrintl'
24296 d_lround='$d_lround'
24297 d_lroundl='$d_lroundl'
24298 d_lseekproto='$d_lseekproto'
24299 d_lstat='$d_lstat'
24300 d_madvise='$d_madvise'
24301 d_malloc_good_size='$d_malloc_good_size'
24302 d_malloc_size='$d_malloc_size'
24303 d_mblen='$d_mblen'
24304 d_mbrlen='$d_mbrlen'
24305 d_mbrtowc='$d_mbrtowc'
24306 d_mbstowcs='$d_mbstowcs'
24307 d_mbtowc='$d_mbtowc'
24308 d_memmem='$d_memmem'
24309 d_memrchr='$d_memrchr'
24310 d_mkdir='$d_mkdir'
24311 d_mkdtemp='$d_mkdtemp'
24312 d_mkfifo='$d_mkfifo'
24313 d_mkostemp='$d_mkostemp'
24314 d_mkstemp='$d_mkstemp'
24315 d_mkstemps='$d_mkstemps'
24316 d_mktime64='$d_mktime64'
24317 d_mktime='$d_mktime'
24318 d_mmap='$d_mmap'
24319 d_modfl='$d_modfl'
24320 d_modflproto='$d_modflproto'
24321 d_mprotect='$d_mprotect'
24322 d_msg='$d_msg'
24323 d_msg_ctrunc='$d_msg_ctrunc'
24324 d_msg_dontroute='$d_msg_dontroute'
24325 d_msg_oob='$d_msg_oob'
24326 d_msg_peek='$d_msg_peek'
24327 d_msg_proxy='$d_msg_proxy'
24328 d_msgctl='$d_msgctl'
24329 d_msgget='$d_msgget'
24330 d_msghdr_s='$d_msghdr_s'
24331 d_msgrcv='$d_msgrcv'
24332 d_msgsnd='$d_msgsnd'
24333 d_msync='$d_msync'
24334 d_munmap='$d_munmap'
24335 d_mymalloc='$d_mymalloc'
24336 d_nan='$d_nan'
24337 d_nanosleep='$d_nanosleep'
24338 d_ndbm='$d_ndbm'
24339 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24340 d_nearbyint='$d_nearbyint'
24341 d_newlocale='$d_newlocale'
24342 d_nextafter='$d_nextafter'
24343 d_nexttoward='$d_nexttoward'
24344 d_nice='$d_nice'
24345 d_nl_langinfo='$d_nl_langinfo'
24346 d_nv_preserves_uv='$d_nv_preserves_uv'
24347 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24348 d_off64_t='$d_off64_t'
24349 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24350 d_oldpthreads='$d_oldpthreads'
24351 d_oldsock='$d_oldsock'
24352 d_open3='$d_open3'
24353 d_openat='$d_openat'
24354 d_pathconf='$d_pathconf'
24355 d_pause='$d_pause'
24356 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24357 d_phostname='$d_phostname'
24358 d_pipe2='$d_pipe2'
24359 d_pipe='$d_pipe'
24360 d_poll='$d_poll'
24361 d_portable='$d_portable'
24362 d_prctl='$d_prctl'
24363 d_prctl_set_name='$d_prctl_set_name'
24364 d_printf_format_null='$d_printf_format_null'
24365 d_procselfexe='$d_procselfexe'
24366 d_pseudofork='$d_pseudofork'
24367 d_pthread_atfork='$d_pthread_atfork'
24368 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24369 d_pthread_yield='$d_pthread_yield'
24370 d_ptrdiff_t='$d_ptrdiff_t'
24371 d_pwage='$d_pwage'
24372 d_pwchange='$d_pwchange'
24373 d_pwclass='$d_pwclass'
24374 d_pwcomment='$d_pwcomment'
24375 d_pwexpire='$d_pwexpire'
24376 d_pwgecos='$d_pwgecos'
24377 d_pwpasswd='$d_pwpasswd'
24378 d_pwquota='$d_pwquota'
24379 d_qgcvt='$d_qgcvt'
24380 d_quad='$d_quad'
24381 d_querylocale='$d_querylocale'
24382 d_random_r='$d_random_r'
24383 d_re_comp='$d_re_comp'
24384 d_readdir64_r='$d_readdir64_r'
24385 d_readdir='$d_readdir'
24386 d_readdir_r='$d_readdir_r'
24387 d_readlink='$d_readlink'
24388 d_readv='$d_readv'
24389 d_recvmsg='$d_recvmsg'
24390 d_regcmp='$d_regcmp'
24391 d_regcomp='$d_regcomp'
24392 d_remainder='$d_remainder'
24393 d_remquo='$d_remquo'
24394 d_rename='$d_rename'
24395 d_renameat='$d_renameat'
24396 d_rewinddir='$d_rewinddir'
24397 d_rint='$d_rint'
24398 d_rmdir='$d_rmdir'
24399 d_round='$d_round'
24400 d_sbrkproto='$d_sbrkproto'
24401 d_scalbn='$d_scalbn'
24402 d_scalbnl='$d_scalbnl'
24403 d_sched_yield='$d_sched_yield'
24404 d_scm_rights='$d_scm_rights'
24405 d_seekdir='$d_seekdir'
24406 d_select='$d_select'
24407 d_sem='$d_sem'
24408 d_semctl='$d_semctl'
24409 d_semctl_semid_ds='$d_semctl_semid_ds'
24410 d_semctl_semun='$d_semctl_semun'
24411 d_semget='$d_semget'
24412 d_semop='$d_semop'
24413 d_sendmsg='$d_sendmsg'
24414 d_setegid='$d_setegid'
24415 d_seteuid='$d_seteuid'
24416 d_setgrent='$d_setgrent'
24417 d_setgrent_r='$d_setgrent_r'
24418 d_setgrps='$d_setgrps'
24419 d_sethent='$d_sethent'
24420 d_sethostent_r='$d_sethostent_r'
24421 d_setitimer='$d_setitimer'
24422 d_setlinebuf='$d_setlinebuf'
24423 d_setlocale='$d_setlocale'
24424 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24425 d_setlocale_r='$d_setlocale_r'
24426 d_setnent='$d_setnent'
24427 d_setnetent_r='$d_setnetent_r'
24428 d_setpent='$d_setpent'
24429 d_setpgid='$d_setpgid'
24430 d_setpgrp2='$d_setpgrp2'
24431 d_setpgrp='$d_setpgrp'
24432 d_setprior='$d_setprior'
24433 d_setproctitle='$d_setproctitle'
24434 d_setprotoent_r='$d_setprotoent_r'
24435 d_setpwent='$d_setpwent'
24436 d_setpwent_r='$d_setpwent_r'
24437 d_setregid='$d_setregid'
24438 d_setresgid='$d_setresgid'
24439 d_setresuid='$d_setresuid'
24440 d_setreuid='$d_setreuid'
24441 d_setrgid='$d_setrgid'
24442 d_setruid='$d_setruid'
24443 d_setsent='$d_setsent'
24444 d_setservent_r='$d_setservent_r'
24445 d_setsid='$d_setsid'
24446 d_setvbuf='$d_setvbuf'
24447 d_shm='$d_shm'
24448 d_shmat='$d_shmat'
24449 d_shmatprototype='$d_shmatprototype'
24450 d_shmctl='$d_shmctl'
24451 d_shmdt='$d_shmdt'
24452 d_shmget='$d_shmget'
24453 d_sigaction='$d_sigaction'
24454 d_siginfo_si_addr='$d_siginfo_si_addr'
24455 d_siginfo_si_band='$d_siginfo_si_band'
24456 d_siginfo_si_errno='$d_siginfo_si_errno'
24457 d_siginfo_si_fd='$d_siginfo_si_fd'
24458 d_siginfo_si_pid='$d_siginfo_si_pid'
24459 d_siginfo_si_status='$d_siginfo_si_status'
24460 d_siginfo_si_uid='$d_siginfo_si_uid'
24461 d_siginfo_si_value='$d_siginfo_si_value'
24462 d_signbit='$d_signbit'
24463 d_sigprocmask='$d_sigprocmask'
24464 d_sigsetjmp='$d_sigsetjmp'
24465 d_sin6_scope_id='$d_sin6_scope_id'
24466 d_sitearch='$d_sitearch'
24467 d_snprintf='$d_snprintf'
24468 d_sockaddr_in6='$d_sockaddr_in6'
24469 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24470 d_sockatmark='$d_sockatmark'
24471 d_sockatmarkproto='$d_sockatmarkproto'
24472 d_socket='$d_socket'
24473 d_socklen_t='$d_socklen_t'
24474 d_sockpair='$d_sockpair'
24475 d_socks5_init='$d_socks5_init'
24476 d_sqrtl='$d_sqrtl'
24477 d_srand48_r='$d_srand48_r'
24478 d_srandom_r='$d_srandom_r'
24479 d_sresgproto='$d_sresgproto'
24480 d_sresuproto='$d_sresuproto'
24481 d_stat='$d_stat'
24482 d_statblks='$d_statblks'
24483 d_statfs_f_flags='$d_statfs_f_flags'
24484 d_statfs_s='$d_statfs_s'
24485 d_static_inline='$d_static_inline'
24486 d_statvfs='$d_statvfs'
24487 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24488 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24489 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24490 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24491 d_stdio_stream_array='$d_stdio_stream_array'
24492 d_stdiobase='$d_stdiobase'
24493 d_stdstdio='$d_stdstdio'
24494 d_strcoll='$d_strcoll'
24495 d_strerror_l='$d_strerror_l'
24496 d_strerror_r='$d_strerror_r'
24497 d_strftime='$d_strftime'
24498 d_strlcat='$d_strlcat'
24499 d_strlcpy='$d_strlcpy'
24500 d_strnlen='$d_strnlen'
24501 d_strtod='$d_strtod'
24502 d_strtod_l='$d_strtod_l'
24503 d_strtol='$d_strtol'
24504 d_strtold='$d_strtold'
24505 d_strtold_l='$d_strtold_l'
24506 d_strtoll='$d_strtoll'
24507 d_strtoq='$d_strtoq'
24508 d_strtoul='$d_strtoul'
24509 d_strtoull='$d_strtoull'
24510 d_strtouq='$d_strtouq'
24511 d_strxfrm='$d_strxfrm'
24512 d_suidsafe='$d_suidsafe'
24513 d_symlink='$d_symlink'
24514 d_syscall='$d_syscall'
24515 d_syscallproto='$d_syscallproto'
24516 d_sysconf='$d_sysconf'
24517 d_sysernlst='$d_sysernlst'
24518 d_syserrlst='$d_syserrlst'
24519 d_system='$d_system'
24520 d_tcgetpgrp='$d_tcgetpgrp'
24521 d_tcsetpgrp='$d_tcsetpgrp'
24522 d_telldir='$d_telldir'
24523 d_telldirproto='$d_telldirproto'
24524 d_tgamma='$d_tgamma'
24525 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24526 d_time='$d_time'
24527 d_timegm='$d_timegm'
24528 d_times='$d_times'
24529 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24530 d_tm_tm_zone='$d_tm_tm_zone'
24531 d_tmpnam_r='$d_tmpnam_r'
24532 d_towlower='$d_towlower'
24533 d_towupper='$d_towupper'
24534 d_trunc='$d_trunc'
24535 d_truncate='$d_truncate'
24536 d_truncl='$d_truncl'
24537 d_ttyname_r='$d_ttyname_r'
24538 d_tzname='$d_tzname'
24539 d_u32align='$d_u32align'
24540 d_ualarm='$d_ualarm'
24541 d_umask='$d_umask'
24542 d_uname='$d_uname'
24543 d_union_semun='$d_union_semun'
24544 d_unlinkat='$d_unlinkat'
24545 d_unordered='$d_unordered'
24546 d_unsetenv='$d_unsetenv'
24547 d_uselocale='$d_uselocale'
24548 d_usleep='$d_usleep'
24549 d_usleepproto='$d_usleepproto'
24550 d_ustat='$d_ustat'
24551 d_vendorarch='$d_vendorarch'
24552 d_vendorbin='$d_vendorbin'
24553 d_vendorlib='$d_vendorlib'
24554 d_vendorscript='$d_vendorscript'
24555 d_vfork='$d_vfork'
24556 d_void_closedir='$d_void_closedir'
24557 d_voidsig='$d_voidsig'
24558 d_voidtty='$d_voidtty'
24559 d_vsnprintf='$d_vsnprintf'
24560 d_wait4='$d_wait4'
24561 d_waitpid='$d_waitpid'
24562 d_wcscmp='$d_wcscmp'
24563 d_wcstombs='$d_wcstombs'
24564 d_wcsxfrm='$d_wcsxfrm'
24565 d_wctomb='$d_wctomb'
24566 d_writev='$d_writev'
24567 d_xenix='$d_xenix'
24568 date='$date'
24569 db_hashtype='$db_hashtype'
24570 db_prefixtype='$db_prefixtype'
24571 db_version_major='$db_version_major'
24572 db_version_minor='$db_version_minor'
24573 db_version_patch='$db_version_patch'
24574 default_inc_excludes_dot='$default_inc_excludes_dot'
24575 direntrytype='$direntrytype'
24576 dlext='$dlext'
24577 dlsrc='$dlsrc'
24578 doubleinfbytes='$doubleinfbytes'
24579 doublekind='$doublekind'
24580 doublemantbits='$doublemantbits'
24581 doublenanbytes='$doublenanbytes'
24582 doublesize='$doublesize'
24583 drand01='$drand01'
24584 drand48_r_proto='$drand48_r_proto'
24585 dtrace='$dtrace'
24586 dtraceobject='$dtraceobject'
24587 dtracexnolibs='$dtracexnolibs'
24588 dynamic_ext='$dynamic_ext'
24589 eagain='$eagain'
24590 ebcdic='$ebcdic'
24591 echo='$echo'
24592 egrep='$egrep'
24593 emacs='$emacs'
24594 endgrent_r_proto='$endgrent_r_proto'
24595 endhostent_r_proto='$endhostent_r_proto'
24596 endnetent_r_proto='$endnetent_r_proto'
24597 endprotoent_r_proto='$endprotoent_r_proto'
24598 endpwent_r_proto='$endpwent_r_proto'
24599 endservent_r_proto='$endservent_r_proto'
24600 eunicefix='$eunicefix'
24601 exe_ext='$exe_ext'
24602 expr='$expr'
24603 extensions='$extensions'
24604 extern_C='$extern_C'
24605 extras='$extras'
24606 fflushNULL='$fflushNULL'
24607 fflushall='$fflushall'
24608 find='$find'
24609 firstmakefile='$firstmakefile'
24610 flex='$flex'
24611 fpossize='$fpossize'
24612 fpostype='$fpostype'
24613 freetype='$freetype'
24614 from='$from'
24615 full_ar='$full_ar'
24616 full_csh='$full_csh'
24617 full_sed='$full_sed'
24618 gccansipedantic='$gccansipedantic'
24619 gccosandvers='$gccosandvers'
24620 gccversion='$gccversion'
24621 getgrent_r_proto='$getgrent_r_proto'
24622 getgrgid_r_proto='$getgrgid_r_proto'
24623 getgrnam_r_proto='$getgrnam_r_proto'
24624 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24625 gethostbyname_r_proto='$gethostbyname_r_proto'
24626 gethostent_r_proto='$gethostent_r_proto'
24627 getlogin_r_proto='$getlogin_r_proto'
24628 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24629 getnetbyname_r_proto='$getnetbyname_r_proto'
24630 getnetent_r_proto='$getnetent_r_proto'
24631 getprotobyname_r_proto='$getprotobyname_r_proto'
24632 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24633 getprotoent_r_proto='$getprotoent_r_proto'
24634 getpwent_r_proto='$getpwent_r_proto'
24635 getpwnam_r_proto='$getpwnam_r_proto'
24636 getpwuid_r_proto='$getpwuid_r_proto'
24637 getservbyname_r_proto='$getservbyname_r_proto'
24638 getservbyport_r_proto='$getservbyport_r_proto'
24639 getservent_r_proto='$getservent_r_proto'
24640 getspnam_r_proto='$getspnam_r_proto'
24641 gidformat='$gidformat'
24642 gidsign='$gidsign'
24643 gidsize='$gidsize'
24644 gidtype='$gidtype'
24645 glibpth='$glibpth'
24646 gmake='$gmake'
24647 gmtime_r_proto='$gmtime_r_proto'
24648 gnulibc_version='$gnulibc_version'
24649 grep='$grep'
24650 groupcat='$groupcat'
24651 groupstype='$groupstype'
24652 gzip='$gzip'
24653 h_fcntl='$h_fcntl'
24654 h_sysfile='$h_sysfile'
24655 hint='$hint'
24656 hostcat='$hostcat'
24657 hostgenerate='$hostgenerate'
24658 hostosname='$hostosname'
24659 hostperl='$hostperl'
24660 html1dir='$html1dir'
24661 html1direxp='$html1direxp'
24662 html3dir='$html3dir'
24663 html3direxp='$html3direxp'
24664 i16size='$i16size'
24665 i16type='$i16type'
24666 i32size='$i32size'
24667 i32type='$i32type'
24668 i64size='$i64size'
24669 i64type='$i64type'
24670 i8size='$i8size'
24671 i8type='$i8type'
24672 i_arpainet='$i_arpainet'
24673 i_bfd='$i_bfd'
24674 i_bsdioctl='$i_bsdioctl'
24675 i_crypt='$i_crypt'
24676 i_db='$i_db'
24677 i_dbm='$i_dbm'
24678 i_dirent='$i_dirent'
24679 i_dlfcn='$i_dlfcn'
24680 i_execinfo='$i_execinfo'
24681 i_fcntl='$i_fcntl'
24682 i_fenv='$i_fenv'
24683 i_fp='$i_fp'
24684 i_fp_class='$i_fp_class'
24685 i_gdbm='$i_gdbm'
24686 i_gdbm_ndbm='$i_gdbm_ndbm'
24687 i_gdbmndbm='$i_gdbmndbm'
24688 i_grp='$i_grp'
24689 i_ieeefp='$i_ieeefp'
24690 i_inttypes='$i_inttypes'
24691 i_langinfo='$i_langinfo'
24692 i_libutil='$i_libutil'
24693 i_locale='$i_locale'
24694 i_machcthr='$i_machcthr'
24695 i_malloc='$i_malloc'
24696 i_mallocmalloc='$i_mallocmalloc'
24697 i_mntent='$i_mntent'
24698 i_ndbm='$i_ndbm'
24699 i_netdb='$i_netdb'
24700 i_neterrno='$i_neterrno'
24701 i_netinettcp='$i_netinettcp'
24702 i_niin='$i_niin'
24703 i_poll='$i_poll'
24704 i_prot='$i_prot'
24705 i_pthread='$i_pthread'
24706 i_pwd='$i_pwd'
24707 i_quadmath='$i_quadmath'
24708 i_rpcsvcdbm='$i_rpcsvcdbm'
24709 i_sgtty='$i_sgtty'
24710 i_shadow='$i_shadow'
24711 i_socks='$i_socks'
24712 i_stdbool='$i_stdbool'
24713 i_stdint='$i_stdint'
24714 i_stdlib='$i_stdlib'
24715 i_sunmath='$i_sunmath'
24716 i_sysaccess='$i_sysaccess'
24717 i_sysdir='$i_sysdir'
24718 i_sysfile='$i_sysfile'
24719 i_sysfilio='$i_sysfilio'
24720 i_sysin='$i_sysin'
24721 i_sysioctl='$i_sysioctl'
24722 i_syslog='$i_syslog'
24723 i_sysmman='$i_sysmman'
24724 i_sysmode='$i_sysmode'
24725 i_sysmount='$i_sysmount'
24726 i_sysndir='$i_sysndir'
24727 i_sysparam='$i_sysparam'
24728 i_syspoll='$i_syspoll'
24729 i_sysresrc='$i_sysresrc'
24730 i_syssecrt='$i_syssecrt'
24731 i_sysselct='$i_sysselct'
24732 i_syssockio='$i_syssockio'
24733 i_sysstat='$i_sysstat'
24734 i_sysstatfs='$i_sysstatfs'
24735 i_sysstatvfs='$i_sysstatvfs'
24736 i_systime='$i_systime'
24737 i_systimek='$i_systimek'
24738 i_systimes='$i_systimes'
24739 i_systypes='$i_systypes'
24740 i_sysuio='$i_sysuio'
24741 i_sysun='$i_sysun'
24742 i_sysutsname='$i_sysutsname'
24743 i_sysvfs='$i_sysvfs'
24744 i_syswait='$i_syswait'
24745 i_termio='$i_termio'
24746 i_termios='$i_termios'
24747 i_time='$i_time'
24748 i_unistd='$i_unistd'
24749 i_ustat='$i_ustat'
24750 i_utime='$i_utime'
24751 i_vfork='$i_vfork'
24752 i_wchar='$i_wchar'
24753 i_wctype='$i_wctype'
24754 i_xlocale='$i_xlocale'
24755 ignore_versioned_solibs='$ignore_versioned_solibs'
24756 inc_version_list='$inc_version_list'
24757 inc_version_list_init='$inc_version_list_init'
24758 incpath='$incpath'
24759 incpth='$incpth'
24760 inews='$inews'
24761 initialinstalllocation='$initialinstalllocation'
24762 installarchlib='$installarchlib'
24763 installbin='$installbin'
24764 installhtml1dir='$installhtml1dir'
24765 installhtml3dir='$installhtml3dir'
24766 installman1dir='$installman1dir'
24767 installman3dir='$installman3dir'
24768 installprefix='$installprefix'
24769 installprefixexp='$installprefixexp'
24770 installprivlib='$installprivlib'
24771 installscript='$installscript'
24772 installsitearch='$installsitearch'
24773 installsitebin='$installsitebin'
24774 installsitehtml1dir='$installsitehtml1dir'
24775 installsitehtml3dir='$installsitehtml3dir'
24776 installsitelib='$installsitelib'
24777 installsiteman1dir='$installsiteman1dir'
24778 installsiteman3dir='$installsiteman3dir'
24779 installsitescript='$installsitescript'
24780 installstyle='$installstyle'
24781 installusrbinperl='$installusrbinperl'
24782 installvendorarch='$installvendorarch'
24783 installvendorbin='$installvendorbin'
24784 installvendorhtml1dir='$installvendorhtml1dir'
24785 installvendorhtml3dir='$installvendorhtml3dir'
24786 installvendorlib='$installvendorlib'
24787 installvendorman1dir='$installvendorman1dir'
24788 installvendorman3dir='$installvendorman3dir'
24789 installvendorscript='$installvendorscript'
24790 intsize='$intsize'
24791 issymlink='$issymlink'
24792 ivdformat='$ivdformat'
24793 ivsize='$ivsize'
24794 ivtype='$ivtype'
24795 known_extensions='$known_extensions'
24796 ksh='$ksh'
24797 ld='$ld'
24798 ld_can_script='$ld_can_script'
24799 lddlflags='$lddlflags'
24800 ldflags='$ldflags'
24801 ldflags_uselargefiles='$ldflags_uselargefiles'
24802 ldlibpthname='$ldlibpthname'
24803 less='$less'
24804 lib_ext='$lib_ext'
24805 libc='$libc'
24806 libperl='$libperl'
24807 libpth='$libpth'
24808 libs='$libs'
24809 libsdirs='$libsdirs'
24810 libsfiles='$libsfiles'
24811 libsfound='$libsfound'
24812 libspath='$libspath'
24813 libswanted='$libswanted'
24814 libswanted_uselargefiles='$libswanted_uselargefiles'
24815 line='$line'
24816 lint='$lint'
24817 lkflags='$lkflags'
24818 ln='$ln'
24819 lns='$lns'
24820 localtime_r_proto='$localtime_r_proto'
24821 locincpth='$locincpth'
24822 loclibpth='$loclibpth'
24823 longdblinfbytes='$longdblinfbytes'
24824 longdblkind='$longdblkind'
24825 longdblmantbits='$longdblmantbits'
24826 longdblnanbytes='$longdblnanbytes'
24827 longdblsize='$longdblsize'
24828 longlongsize='$longlongsize'
24829 longsize='$longsize'
24830 lp='$lp'
24831 lpr='$lpr'
24832 ls='$ls'
24833 lseeksize='$lseeksize'
24834 lseektype='$lseektype'
24835 mail='$mail'
24836 mailx='$mailx'
24837 make='$make'
24838 make_set_make='$make_set_make'
24839 mallocobj='$mallocobj'
24840 mallocsrc='$mallocsrc'
24841 malloctype='$malloctype'
24842 man1dir='$man1dir'
24843 man1direxp='$man1direxp'
24844 man1ext='$man1ext'
24845 man3dir='$man3dir'
24846 man3direxp='$man3direxp'
24847 man3ext='$man3ext'
24848 mips_type='$mips_type'
24849 mistrustnm='$mistrustnm'
24850 mkdir='$mkdir'
24851 mmaptype='$mmaptype'
24852 modetype='$modetype'
24853 more='$more'
24854 multiarch='$multiarch'
24855 mv='$mv'
24856 myarchname='$myarchname'
24857 mydomain='$mydomain'
24858 myhostname='$myhostname'
24859 myuname='$myuname'
24860 n='$n'
24861 need_va_copy='$need_va_copy'
24862 netdb_hlen_type='$netdb_hlen_type'
24863 netdb_host_type='$netdb_host_type'
24864 netdb_name_type='$netdb_name_type'
24865 netdb_net_type='$netdb_net_type'
24866 nm='$nm'
24867 nm_opt='$nm_opt'
24868 nm_so_opt='$nm_so_opt'
24869 nonxs_ext='$nonxs_ext'
24870 nroff='$nroff'
24871 nvEUformat='$nvEUformat'
24872 nvFUformat='$nvFUformat'
24873 nvGUformat='$nvGUformat'
24874 nv_overflows_integers_at='$nv_overflows_integers_at'
24875 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24876 nveformat='$nveformat'
24877 nvfformat='$nvfformat'
24878 nvgformat='$nvgformat'
24879 nvmantbits='$nvmantbits'
24880 nvsize='$nvsize'
24881 nvtype='$nvtype'
24882 o_nonblock='$o_nonblock'
24883 obj_ext='$obj_ext'
24884 old_pthread_create_joinable='$old_pthread_create_joinable'
24885 optimize='$optimize'
24886 orderlib='$orderlib'
24887 osname='$osname'
24888 osvers='$osvers'
24889 otherlibdirs='$otherlibdirs'
24890 package='$package'
24891 pager='$pager'
24892 passcat='$passcat'
24893 patchlevel='$patchlevel'
24894 path_sep='$path_sep'
24895 perl5='$perl5'
24896 perl='$perl'
24897 perl_patchlevel='$perl_patchlevel'
24898 perl_static_inline='$perl_static_inline'
24899 perladmin='$perladmin'
24900 perllibs='$perllibs'
24901 perlpath='$perlpath'
24902 pg='$pg'
24903 phostname='$phostname'
24904 pidtype='$pidtype'
24905 plibpth='$plibpth'
24906 pmake='$pmake'
24907 pr='$pr'
24908 prefix='$prefix'
24909 prefixexp='$prefixexp'
24910 privlib='$privlib'
24911 privlibexp='$privlibexp'
24912 procselfexe='$procselfexe'
24913 ptrsize='$ptrsize'
24914 quadkind='$quadkind'
24915 quadtype='$quadtype'
24916 randbits='$randbits'
24917 randfunc='$randfunc'
24918 random_r_proto='$random_r_proto'
24919 randseedtype='$randseedtype'
24920 ranlib='$ranlib'
24921 rd_nodata='$rd_nodata'
24922 readdir64_r_proto='$readdir64_r_proto'
24923 readdir_r_proto='$readdir_r_proto'
24924 revision='$revision'
24925 rm='$rm'
24926 rm_try='$rm_try'
24927 rmail='$rmail'
24928 run='$run'
24929 runnm='$runnm'
24930 sGMTIME_max='$sGMTIME_max'
24931 sGMTIME_min='$sGMTIME_min'
24932 sLOCALTIME_max='$sLOCALTIME_max'
24933 sLOCALTIME_min='$sLOCALTIME_min'
24934 sPRIEUldbl='$sPRIEUldbl'
24935 sPRIFUldbl='$sPRIFUldbl'
24936 sPRIGUldbl='$sPRIGUldbl'
24937 sPRIXU64='$sPRIXU64'
24938 sPRId64='$sPRId64'
24939 sPRIeldbl='$sPRIeldbl'
24940 sPRIfldbl='$sPRIfldbl'
24941 sPRIgldbl='$sPRIgldbl'
24942 sPRIi64='$sPRIi64'
24943 sPRIo64='$sPRIo64'
24944 sPRIu64='$sPRIu64'
24945 sPRIx64='$sPRIx64'
24946 sSCNfldbl='$sSCNfldbl'
24947 sched_yield='$sched_yield'
24948 scriptdir='$scriptdir'
24949 scriptdirexp='$scriptdirexp'
24950 sed='$sed'
24951 seedfunc='$seedfunc'
24952 selectminbits='$selectminbits'
24953 selecttype='$selecttype'
24954 sendmail='$sendmail'
24955 setgrent_r_proto='$setgrent_r_proto'
24956 sethostent_r_proto='$sethostent_r_proto'
24957 setlocale_r_proto='$setlocale_r_proto'
24958 setnetent_r_proto='$setnetent_r_proto'
24959 setprotoent_r_proto='$setprotoent_r_proto'
24960 setpwent_r_proto='$setpwent_r_proto'
24961 setservent_r_proto='$setservent_r_proto'
24962 sh='$sh'
24963 shar='$shar'
24964 sharpbang='$sharpbang'
24965 shmattype='$shmattype'
24966 shortsize='$shortsize'
24967 shrpenv='$shrpenv'
24968 shsharp='$shsharp'
24969 sig_count='$sig_count'
24970 sig_name='$sig_name'
24971 sig_name_init='$sig_name_init'
24972 sig_num='$sig_num'
24973 sig_num_init='$sig_num_init'
24974 sig_size='$sig_size'
24975 signal_t='$signal_t'
24976 sitearch='$sitearch'
24977 sitearchexp='$sitearchexp'
24978 sitebin='$sitebin'
24979 sitebinexp='$sitebinexp'
24980 sitehtml1dir='$sitehtml1dir'
24981 sitehtml1direxp='$sitehtml1direxp'
24982 sitehtml3dir='$sitehtml3dir'
24983 sitehtml3direxp='$sitehtml3direxp'
24984 sitelib='$sitelib'
24985 sitelib_stem='$sitelib_stem'
24986 sitelibexp='$sitelibexp'
24987 siteman1dir='$siteman1dir'
24988 siteman1direxp='$siteman1direxp'
24989 siteman3dir='$siteman3dir'
24990 siteman3direxp='$siteman3direxp'
24991 siteprefix='$siteprefix'
24992 siteprefixexp='$siteprefixexp'
24993 sitescript='$sitescript'
24994 sitescriptexp='$sitescriptexp'
24995 sizesize='$sizesize'
24996 sizetype='$sizetype'
24997 sleep='$sleep'
24998 smail='$smail'
24999 so='$so'
25000 sockethdr='$sockethdr'
25001 socketlib='$socketlib'
25002 socksizetype='$socksizetype'
25003 sort='$sort'
25004 spackage='$spackage'
25005 spitshell='$spitshell'
25006 srand48_r_proto='$srand48_r_proto'
25007 srandom_r_proto='$srandom_r_proto'
25008 src='$src'
25009 ssizetype='$ssizetype'
25010 st_ino_sign='$st_ino_sign'
25011 st_ino_size='$st_ino_size'
25012 startperl='$startperl'
25013 startsh='$startsh'
25014 static_ext='$static_ext'
25015 stdchar='$stdchar'
25016 stdio_base='$stdio_base'
25017 stdio_bufsiz='$stdio_bufsiz'
25018 stdio_cnt='$stdio_cnt'
25019 stdio_filbuf='$stdio_filbuf'
25020 stdio_ptr='$stdio_ptr'
25021 stdio_stream_array='$stdio_stream_array'
25022 strerror_r_proto='$strerror_r_proto'
25023 submit='$submit'
25024 subversion='$subversion'
25025 sysman='$sysman'
25026 sysroot='$sysroot'
25027 tail='$tail'
25028 tar='$tar'
25029 targetarch='$targetarch'
25030 targetdir='$targetdir'
25031 targetenv='$targetenv'
25032 targethost='$targethost'
25033 targetmkdir='$targetmkdir'
25034 targetport='$targetport'
25035 targetsh='$targetsh'
25036 tbl='$tbl'
25037 tee='$tee'
25038 test='$test'
25039 timeincl='$timeincl'
25040 timetype='$timetype'
25041 tmpnam_r_proto='$tmpnam_r_proto'
25042 to='$to'
25043 touch='$touch'
25044 tr='$tr'
25045 trnl='$trnl'
25046 troff='$troff'
25047 ttyname_r_proto='$ttyname_r_proto'
25048 u16size='$u16size'
25049 u16type='$u16type'
25050 u32size='$u32size'
25051 u32type='$u32type'
25052 u64size='$u64size'
25053 u64type='$u64type'
25054 u8size='$u8size'
25055 u8type='$u8type'
25056 uidformat='$uidformat'
25057 uidsign='$uidsign'
25058 uidsize='$uidsize'
25059 uidtype='$uidtype'
25060 uname='$uname'
25061 uniq='$uniq'
25062 uquadtype='$uquadtype'
25063 use5005threads='$use5005threads'
25064 use64bitall='$use64bitall'
25065 use64bitint='$use64bitint'
25066 usecbacktrace='$usecbacktrace'
25067 usecrosscompile='$usecrosscompile'
25068 usedevel='$usedevel'
25069 usedl='$usedl'
25070 usedtrace='$usedtrace'
25071 usefaststdio='$usefaststdio'
25072 useithreads='$useithreads'
25073 usekernprocpathname='$usekernprocpathname'
25074 uselanginfo='$uselanginfo'
25075 uselargefiles='$uselargefiles'
25076 uselongdouble='$uselongdouble'
25077 usemallocwrap='$usemallocwrap'
25078 usemorebits='$usemorebits'
25079 usemultiplicity='$usemultiplicity'
25080 usemymalloc='$usemymalloc'
25081 usenm='$usenm'
25082 usensgetexecutablepath='$usensgetexecutablepath'
25083 useopcode='$useopcode'
25084 useperlio='$useperlio'
25085 useposix='$useposix'
25086 usequadmath='$usequadmath'
25087 usereentrant='$usereentrant'
25088 userelocatableinc='$userelocatableinc'
25089 useshrplib='$useshrplib'
25090 usesitecustomize='$usesitecustomize'
25091 usesocks='$usesocks'
25092 usethreads='$usethreads'
25093 usevendorprefix='$usevendorprefix'
25094 useversionedarchname='$useversionedarchname'
25095 usevfork='$usevfork'
25096 usrinc='$usrinc'
25097 uuname='$uuname'
25098 uvXUformat='$uvXUformat'
25099 uvoformat='$uvoformat'
25100 uvsize='$uvsize'
25101 uvtype='$uvtype'
25102 uvuformat='$uvuformat'
25103 uvxformat='$uvxformat'
25104 vendorarch='$vendorarch'
25105 vendorarchexp='$vendorarchexp'
25106 vendorbin='$vendorbin'
25107 vendorbinexp='$vendorbinexp'
25108 vendorhtml1dir='$vendorhtml1dir'
25109 vendorhtml1direxp='$vendorhtml1direxp'
25110 vendorhtml3dir='$vendorhtml3dir'
25111 vendorhtml3direxp='$vendorhtml3direxp'
25112 vendorlib='$vendorlib'
25113 vendorlib_stem='$vendorlib_stem'
25114 vendorlibexp='$vendorlibexp'
25115 vendorman1dir='$vendorman1dir'
25116 vendorman1direxp='$vendorman1direxp'
25117 vendorman3dir='$vendorman3dir'
25118 vendorman3direxp='$vendorman3direxp'
25119 vendorprefix='$vendorprefix'
25120 vendorprefixexp='$vendorprefixexp'
25121 vendorscript='$vendorscript'
25122 vendorscriptexp='$vendorscriptexp'
25123 version='$version'
25124 version_patchlevel_string='$version_patchlevel_string'
25125 versiononly='$versiononly'
25126 vi='$vi'
25127 xlibpth='$xlibpth'
25128 yacc='$yacc'
25129 yaccflags='$yaccflags'
25130 zcat='$zcat'
25131 zip='$zip'
25132 EOT
25133
25134 : add special variables
25135 $test -f $src/patchlevel.h && \
25136 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25137 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25138 echo "PERL_CONFIG_SH=true" >>config.sh
25139
25140 : propagate old symbols
25141 if $test -f UU/config.sh; then
25142         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25143         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25144                 config.sh config.sh UU/oldconfig.sh |\
25145                 $sort | $uniq -u >UU/oldsyms
25146         set X `$cat UU/oldsyms`
25147         shift
25148         case $# in
25149         0) ;;
25150         *)
25151                 $cat <<EOM
25152 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25153 EOM
25154                 echo ": Variables propagated from previous config.sh file." >>config.sh
25155                 for sym in `$cat UU/oldsyms`; do
25156                         echo "    Propagating $hint variable "'$'"$sym..."
25157                         eval 'tmp="$'"${sym}"'"'
25158                         echo "$tmp" | \
25159                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25160                 done
25161                 ;;
25162         esac
25163 fi
25164
25165 : preserve RCS keywords in files with variable substitution, grrr
25166 Id='$Id'
25167
25168 : Finish up by extracting the .SH files
25169 case "$alldone" in
25170 exit)
25171         echo "Stopping at your request, leaving temporary files around."
25172         exit 0
25173         ;;
25174 cont)
25175         ;;
25176 '')
25177         dflt=''
25178         nostick=true
25179         $cat <<EOM
25180
25181 If you'd like to make any changes to the config.sh file before I begin
25182 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25183
25184 EOM
25185         rp="Press return or use a shell escape to edit config.sh:"
25186         . UU/myread
25187         nostick=''
25188         case "$ans" in
25189         '') ;;
25190         *) : in case they cannot read
25191                 sh 1>&4 -c "$ans";;
25192         esac
25193         ;;
25194 esac
25195
25196 : if this fails, just run all the .SH files by hand
25197 . ./config.sh
25198
25199 echo " "
25200 exec 1>&4
25201 pwd=`pwd`
25202 . ./UU/extract
25203 cd "$pwd"
25204
25205 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25206         dflt=y
25207         case "$silent" in
25208         true) ;;
25209         *)
25210                 $cat <<EOM
25211
25212 Now you need to generate make dependencies by running "$make depend".
25213 You might prefer to run it in background: "$make depend > makedepend.out &"
25214 It can take a while, so you might not want to run it right now.
25215
25216 EOM
25217                 ;;
25218         esac
25219         rp="Run $make depend now?"
25220         . UU/myread
25221         case "$ans" in
25222         y*)
25223                 $make depend && echo "Now you must run '$make'."
25224                 ;;
25225         *)
25226                 echo "You must run '$make depend' then '$make'."
25227                 ;;
25228         esac
25229 elif test -f [Mm]akefile; then
25230         echo " "
25231         echo "Now you must run a $make."
25232 else
25233         echo "Configure done."
25234 fi
25235
25236 if $test -f Policy.sh; then
25237     $cat <<EOM
25238
25239 If you compile $package on a different machine or from a different object
25240 directory, copy the Policy.sh file from this object directory to the
25241 new one before you run Configure -- this will help you with most of
25242 the policy defaults.
25243
25244 EOM
25245 fi
25246 if $test -f UU/config.msg; then
25247     echo "Hmm.  I also noted the following information while running:"
25248     echo " "
25249     $cat UU/config.msg >&4
25250 fi
25251 $rm -f kit*isdone ark*isdone
25252 $rm -rf UU
25253
25254 : End of Configure
25255