This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c: S_assignment_type(): make truly trinary
[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 '')
4173         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4174         ;;
4175 *?/)
4176         dflt=`echo "$prefix" | sed 's/.$//'`
4177         ;;
4178 *)
4179         dflt="$prefix"
4180         ;;
4181 esac
4182 $cat <<EOM
4183
4184 By default, $package will be installed in $dflt/bin, manual pages
4185 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4186 installation directories. Typically this is something like /usr/local.
4187 If you wish to have binaries under /usr/bin but other parts of the
4188 installation under /usr/local, that's ok: you will be prompted
4189 separately for each of the installation directories, the prefix being
4190 only used to set the defaults.
4191
4192 EOM
4193 fn=d~
4194 rp='Installation prefix to use?'
4195 . ./getfile
4196 oldprefix=''
4197 case "$prefix" in
4198 '') ;;
4199 *)
4200         case "$ans" in
4201         "$prefix") ;;
4202         *) oldprefix="$prefix";;
4203         esac
4204         ;;
4205 esac
4206 prefix="$ans"
4207 prefixexp="$ansexp"
4208
4209 : allow them to override the AFS root
4210 case "$afsroot" in
4211 '')     afsroot=/afs ;;
4212 *)      afsroot=$afsroot ;;
4213 esac
4214
4215 : is AFS running?
4216 echo " "
4217 case "$afs" in
4218 $define|true)   afs=true ;;
4219 $undef|false)   afs=false ;;
4220 *)      if $test -d $afsroot; then
4221                 afs=true
4222         else
4223                 afs=false
4224         fi
4225         ;;
4226 esac
4227 if $afs; then
4228         echo "AFS may be running... I'll be extra cautious then..." >&4
4229 else
4230         echo "AFS does not seem to be running..." >&4
4231 fi
4232
4233 : determine installation prefix for where package is to be installed.
4234 if $afs; then
4235 $cat <<EOM
4236
4237 Since you are running AFS, I need to distinguish the directory in which
4238 files will reside from the directory in which they are installed (and from
4239 which they are presumably copied to the former directory by occult means).
4240
4241 EOM
4242         case "$installprefix" in
4243         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4244         *) dflt="$installprefix";;
4245         esac
4246 else
4247 $cat <<EOM
4248
4249 In some special cases, particularly when building $package for distribution,
4250 it is convenient to distinguish the directory in which files should be
4251 installed from the directory ($prefix) in which they will
4252 eventually reside.  For most users, these two directories are the same.
4253
4254 EOM
4255         case "$installprefix" in
4256         '') dflt=$prefix ;;
4257         *) dflt=$installprefix;;
4258         esac
4259 fi
4260 fn=d~
4261 rp='What installation prefix should I use for installing files?'
4262 . ./getfile
4263 installprefix="$ans"
4264 installprefixexp="$ansexp"
4265
4266 : Perform the prefixexp/installprefixexp correction if necessary
4267 cat <<EOS >installprefix
4268 $startsh
4269 EOS
4270 cat <<'EOSC' >>installprefix
4271 : Change installation prefix, if necessary.
4272 if $test X"$prefix" != X"$installprefix"; then
4273     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4274 else
4275     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4276 fi
4277 EOSC
4278 chmod +x installprefix
4279 $eunicefix installprefix
4280
4281 : Set variables such as privlib and privlibexp from the output of ./getfile
4282 : performing the prefixexp/installprefixexp correction if necessary.
4283 cat <<EOS >setprefixvar
4284 $startsh
4285 EOS
4286 cat <<'EOSC' >>setprefixvar
4287 eval "${prefixvar}=\"\$ans\""
4288 eval "${prefixvar}exp=\"\$ansexp\""
4289 . ./installprefix
4290 EOSC
4291 chmod +x setprefixvar
4292 $eunicefix setprefixvar
4293
4294 : set up the script used to warn in case of inconsistency
4295 cat <<EOS >whoa
4296 $startsh
4297 EOS
4298 cat <<'EOSC' >>whoa
4299 dflt=y
4300 case "$hint" in
4301     recommended)
4302         case "$hintfile" in
4303         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4304                 ;;
4305         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4306                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4307                 ;;
4308         esac
4309         ;;
4310     *)  echo " "
4311         echo "*** WHOA THERE!!! ***" >&4
4312         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4313         ;;
4314 esac
4315 rp="    Keep the $hint value?"
4316 . ./myread
4317 case "$ans" in
4318 y) td=$was; tu=$was;;
4319 esac
4320 EOSC
4321
4322 : function used to set '$1' to '$val'
4323 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4324 case "$val$was" in
4325 $define$undef) . ./whoa; eval "$var=\$td";;
4326 $undef$define) . ./whoa; eval "$var=\$tu";;
4327 *) eval "$var=$val";;
4328 esac'
4329
4330 : get the patchlevel
4331 echo " "
4332 echo "Getting the current patchlevel..." >&4
4333 if $test -r $rsrc/patchlevel.h;then
4334         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4335         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4336         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4337         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4338         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4339         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4340         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4341 else
4342         revision=0
4343         patchlevel=0
4344         subversion=0
4345         api_revision=0
4346         api_version=0
4347         api_subversion=0
4348         perl_patchlevel=0
4349         $echo "(You do not have patchlevel.h.  Eek.)"
4350 fi
4351 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4352 version_patchlevel_string="version $patchlevel subversion $subversion"
4353 case "$perl_patchlevel" in
4354 0|'') ;;
4355 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4356     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4357     ;;
4358 esac
4359
4360 $echo "(You have $package $version_patchlevel_string.)"
4361
4362 case "$osname" in
4363 dos|vms)
4364         : XXX Should be a Configure test for double-dots in filenames.
4365         version=`echo $revision $patchlevel $subversion | \
4366                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4367         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4368                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4369         ;;
4370 *)
4371         version=`echo $revision $patchlevel $subversion | \
4372                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4373         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4374                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4375         ;;
4376 esac
4377 : Special case the 5.005_xx maintenance series, which used 5.005
4378 : without any subversion label as a subdirectory in $sitelib
4379 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4380         api_versionstring='5.005'
4381 fi
4382
4383 : Do we want threads support and if so, what type
4384 case "$usethreads" in
4385 $define|true|[yY]*)     dflt='y';;
4386 *)     # Catch case where user specified ithreads or 5005threads but
4387        # forgot -Dusethreads (A.D. 4/2002)
4388        case "$useithreads$use5005threads" in
4389        *$define*)       dflt='y';;
4390        *)               dflt='n';;
4391        esac
4392        ;;
4393 esac
4394 cat <<EOM
4395
4396 Perl can be built to offer a form of threading support on some systems
4397 To do so, Configure can be run with -Dusethreads.
4398
4399 Note that Perl built with threading support runs slightly slower
4400 and uses slightly more memory than plain Perl.
4401
4402 If this doesn't make any sense to you, just accept the default '$dflt'.
4403 EOM
4404 rp='Build a threading Perl?'
4405 . ./myread
4406 case "$ans" in
4407 y|Y)    val="$define" ;;
4408 *)      val="$undef" ;;
4409 esac
4410 set usethreads
4411 eval $setvar
4412
4413 if $test $patchlevel -lt 9; then
4414     case "$usethreads" in
4415     $define)
4416         : Default to ithreads unless overridden on command line or with
4417         : old config.sh
4418         dflt='y'
4419         case "$use5005threads" in
4420                 $define|true|[yY]*)
4421                         echo "5.005 threads are no longer supported"
4422                         exit 1
4423                 ;;
4424         esac
4425         case "$useithreads" in
4426                 $undef|false|[nN]*) dflt='n';;
4427         esac
4428         rp='Use the newer interpreter-based ithreads?'
4429         . ./myread
4430         case "$ans" in
4431         y|Y)    val="$define" ;;
4432         *)      val="$undef" ;;
4433         esac
4434         set useithreads
4435         eval $setvar
4436         : Now set use5005threads to the opposite value.
4437         case "$useithreads" in
4438         $define) val="$undef" ;;
4439         *) val="$define" ;;
4440         esac
4441         set use5005threads
4442         eval $setvar
4443         ;;
4444     *)
4445         useithreads="$undef"
4446         use5005threads="$undef"
4447         ;;
4448     esac
4449
4450     case "$useithreads$use5005threads" in
4451     "$define$define")
4452         $cat >&4 <<EOM
4453
4454 You cannot have both the ithreads and the 5.005 threads enabled
4455 at the same time.  Disabling the 5.005 threads since they are
4456 much less stable than the ithreads.
4457
4458 EOM
4459         use5005threads="$undef"
4460         ;;
4461     esac
4462
4463 else
4464 : perl-5.9.x and later
4465
4466     if test X"$usethreads" = "X$define"; then
4467         case "$use5005threads" in
4468             $define|true|[yY]*)
4469                 $cat >&4 <<EOM
4470
4471 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4472
4473 EOM
4474             ;;
4475         esac
4476     fi
4477
4478     use5005threads="$undef"
4479     useithreads="$usethreads"
4480 fi
4481
4482 case "$d_oldpthreads" in
4483 '')     : Configure tests would be welcome here.  For now, assume undef.
4484         val="$undef" ;;
4485 *)      val="$d_oldpthreads" ;;
4486 esac
4487 set d_oldpthreads
4488 eval $setvar
4489
4490
4491 : Look for a hint-file generated 'call-back-unit'.  If the
4492 : user has specified that a threading perl is to be built,
4493 : we may need to set or change some other defaults.
4494 if $test -f usethreads.cbu; then
4495     echo "Your platform has some specific hints regarding threaded builds, using them..."
4496     . ./usethreads.cbu
4497 else
4498     case "$usethreads" in
4499         "$define"|true|[yY]*)
4500                 $cat <<EOM
4501 (Your platform does not have any specific hints for threaded builds.
4502  Assuming POSIX threads, then.)
4503 EOM
4504         ;;
4505     esac
4506 fi
4507
4508 : Check if multiplicity is required
4509 cat <<EOM
4510
4511 Perl can be built so that multiple Perl interpreters can coexist
4512 within the same Perl executable.
4513 EOM
4514
4515 case "$useithreads" in
4516 $define)
4517         cat <<EOM
4518 This multiple interpreter support is required for interpreter-based threads.
4519 EOM
4520         val="$define"
4521         ;;
4522 *)      case "$usemultiplicity" in
4523         $define|true|[yY]*)     dflt='y';;
4524         *) dflt='n';;
4525         esac
4526         echo " "
4527         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4528         rp='Build Perl for multiplicity?'
4529         . ./myread
4530         case "$ans" in
4531         y|Y)    val="$define" ;;
4532         *)      val="$undef" ;;
4533         esac
4534         ;;
4535 esac
4536 set usemultiplicity
4537 eval $setvar
4538
4539 : Check if morebits is requested
4540 case "$usemorebits" in
4541 "$define"|true|[yY]*)
4542         use64bitint="$define"
4543         uselongdouble="$define"
4544         usemorebits="$define"
4545         ;;
4546 *)      usemorebits="$undef"
4547         ;;
4548 esac
4549
4550 : Determine the C compiler to be used
4551 echo " "
4552 case "$cc" in
4553 '') dflt=cc;;
4554 *) dflt="$cc";;
4555 esac
4556 rp="Use which C compiler?"
4557 . ./myread
4558 cc="$ans"
4559
4560 : See whether they have no cc but they do have gcc
4561 . ./trygcc
4562 if $test -f cc.cbu; then
4563     . ./cc.cbu
4564 fi
4565 . ./checkcc
4566
4567 : make some quick guesses about what we are up against
4568 echo " "
4569 $echo $n "Hmm...  $c"
4570 echo exit 1 >bsd
4571 echo exit 1 >usg
4572 echo exit 1 >v7
4573 echo exit 1 >osf1
4574 echo exit 1 >eunice
4575 echo exit 1 >xenix
4576 echo exit 1 >venix
4577 echo exit 1 >os2
4578 d_bsd="$undef"
4579 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4580 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4581 then
4582         echo "Looks kind of like an OSF/1 system, but we'll see..."
4583         echo exit 0 >osf1
4584 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4585         xxx=`./loc addbib blurfl $pth`
4586         if $test -f $xxx; then
4587         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4588                 echo exit 0 >bsd
4589                 echo exit 0 >usg
4590         else
4591                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4592                         echo "Looks kind of like an extended USG system, but we'll see..."
4593                 else
4594                         echo "Looks kind of like a USG system, but we'll see..."
4595                 fi
4596                 echo exit 0 >usg
4597         fi
4598 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4599         echo "Looks kind of like a BSD system, but we'll see..."
4600         d_bsd="$define"
4601         echo exit 0 >bsd
4602 else
4603         echo "Looks kind of like a Version 7 system, but we'll see..."
4604         echo exit 0 >v7
4605 fi
4606 case "$eunicefix" in
4607 *unixtovms*)
4608         $cat <<'EOI'
4609 There is, however, a strange, musty smell in the air that reminds me of
4610 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4611 EOI
4612         echo exit 0 >eunice
4613         d_eunice="$define"
4614 : it so happens the Eunice I know will not run shell scripts in Unix format
4615         ;;
4616 *)
4617         echo " "
4618         echo "Congratulations.  You aren't running Eunice."
4619         d_eunice="$undef"
4620         ;;
4621 esac
4622 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4623 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4624 : semicolon as a patch separator
4625 case "$p_" in
4626 :) ;;
4627 *)
4628         $cat <<'EOI'
4629 I have the feeling something is not exactly right, however...don't tell me...
4630 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4631 (Or you may be running DOS with DJGPP.)
4632 EOI
4633         echo exit 0 >os2
4634         ;;
4635 esac
4636 if test -f /xenix; then
4637         echo "Actually, this looks more like a XENIX system..."
4638         echo exit 0 >xenix
4639         d_xenix="$define"
4640 else
4641         echo " "
4642         echo "It's not Xenix..."
4643         d_xenix="$undef"
4644 fi
4645 chmod +x xenix
4646 $eunicefix xenix
4647 if test -f /venix; then
4648         echo "Actually, this looks more like a VENIX system..."
4649         echo exit 0 >venix
4650 else
4651         echo " "
4652         if ./xenix; then
4653                 : null
4654         else
4655                 echo "Nor is it Venix..."
4656         fi
4657 fi
4658 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4659 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4660 $rm -f foo
4661
4662 : Check if we are using GNU gcc and what its version is
4663 echo " "
4664 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4665 $cat >try.c <<EOM
4666 #include <stdio.h>
4667 int main() {
4668 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4669 #ifdef __VERSION__
4670         printf("%s\n", __VERSION__);
4671 #else
4672         printf("%s\n", "1");
4673 #endif
4674 #endif
4675         return(0);
4676 }
4677 EOM
4678 if $cc -o try $ccflags $ldflags try.c; then
4679         gccversion=`$run ./try`
4680         case "$gccversion" in
4681         '') echo "You are not using GNU cc." ;;
4682         *)  echo "You are using GNU cc $gccversion."
4683             ccname=gcc
4684             ;;
4685         esac
4686 else
4687         echo " "
4688         echo "*** WHOA THERE!!! ***" >&4
4689         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4690         case "$knowitall" in
4691         '')
4692         echo "    You'd better start hunting for one and let me know about it." >&4
4693                 exit 1
4694                 ;;
4695         esac
4696 fi
4697 $rm -f try try.*
4698 case "$gccversion" in
4699 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4700 esac
4701 case "$gccversion" in
4702 '') gccosandvers='' ;;
4703 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4704    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4705    gccshortvers=''
4706    case "$gccosandvers" in
4707    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4708    $osname$osvers) ;; # looking good
4709    $osname*) cat <<EOM >&4
4710
4711 *** WHOA THERE!!! ***
4712
4713     Your gcc has not been compiled for the exact release of
4714     your operating system ($gccosandvers versus $osname$osvers).
4715
4716     In general it is a good idea to keep gcc synchronized with
4717     the operating system because otherwise serious problems
4718     may ensue when trying to compile software, like Perl.
4719
4720     I'm trying to be optimistic here, though, and will continue.
4721     If later during the configuration and build icky compilation
4722     problems appear (headerfile conflicts being the most common
4723     manifestation), I suggest reinstalling the gcc to match
4724     your operating system release.
4725
4726 EOM
4727       ;;
4728    *) gccosandvers='' ;; # failed to parse, better be silent
4729    esac
4730    ;;
4731 esac
4732 case "$ccname" in
4733 '') ccname="$cc" ;;
4734 esac
4735
4736 # gcc 3.* complain about adding -Idirectories that they already know about,
4737 # so we will take those off from locincpth.
4738 case "$gccversion" in
4739 3*)
4740     echo "main(){}">try.c
4741     for incdir in $locincpth; do
4742        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4743              grep '^c[cp]p*[01]: warning: changing search order '`
4744        if test "X$warn" != X; then
4745            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4746        fi
4747     done
4748     $rm -f try try.*
4749 esac
4750
4751 # gcc 4.9 by default does some optimizations that break perl.
4752 # see ticket 121505.
4753 #
4754 # The -fwrapv disables those optimizations (and probably others,) so
4755 # for gcc 4.9 (and later, since the optimizations probably won't go
4756 # away), add -fwrapv unless the user requests -fno-wrapv, which
4757 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4758 # which turns the overflows -fwrapv ignores into runtime errors.
4759 case "$gccversion" in
4760 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4761     case "$ccflags" in
4762     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4763     *) ccflags="$ccflags -fwrapv" ;;
4764     esac
4765 esac
4766
4767 : What should the include directory be ?
4768 : Use sysroot if set, so findhdr looks in the right place.
4769 echo " "
4770 $echo $n "Hmm...  $c"
4771 dflt="$sysroot/usr/include"
4772 incpath=''
4773 mips_type=''
4774 if $test -f /bin/mips && /bin/mips; then
4775         echo "Looks like a MIPS system..."
4776         $cat >usr.c <<'EOCP'
4777 #ifdef SYSTYPE_BSD43
4778 /bsd43
4779 #endif
4780 EOCP
4781         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4782                 dflt='/bsd43/usr/include'
4783                 incpath='/bsd43'
4784                 mips_type='BSD 4.3'
4785         else
4786                 mips_type='System V'
4787         fi
4788         $rm -f usr.c usr.out
4789         echo "and you're compiling with the $mips_type compiler and libraries."
4790         xxx_prompt=y
4791         echo "exit 0" >mips
4792 else
4793         echo "Doesn't look like a MIPS system."
4794         xxx_prompt=n
4795         echo "exit 1" >mips
4796 fi
4797 chmod +x mips
4798 $eunicefix mips
4799 case "$usrinc" in
4800 '') ;;
4801 *) dflt="$usrinc";;
4802 esac
4803 case "$xxx_prompt" in
4804 y)      fn=d/
4805         echo " "
4806         rp='Where are the include files you want to use?'
4807         . ./getfile
4808         usrinc="$ans"
4809         ;;
4810 *)      usrinc="$dflt"
4811         ;;
4812 esac
4813
4814 : see how we invoke the C preprocessor
4815 echo " "
4816 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4817 cat <<'EOT' >testcpp.c
4818 #define ABC abc
4819 #define XYZ xyz
4820 ABC.XYZ
4821 EOT
4822 cd ..
4823 if test ! -f cppstdin; then
4824         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4825                 # AIX cc -E doesn't show the absolute headerfile
4826                 # locations but we'll cheat by using the -M flag.
4827                 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
4828         else
4829                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4830         fi
4831 else
4832         echo "Keeping your $hint cppstdin wrapper."
4833 fi
4834 chmod 755 cppstdin
4835 wrapper=`pwd`/cppstdin
4836 ok='false'
4837 cd UU
4838
4839 if $test "X$cppstdin" != "X" && \
4840         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4841         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4842 then
4843         echo "You used to use $cppstdin $cppminus so we'll use that again."
4844         case "$cpprun" in
4845         '') echo "But let's see if we can live without a wrapper..." ;;
4846         *)
4847                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4848                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4849                 then
4850                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4851                         ok='true'
4852                 else
4853                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4854                 fi
4855                 ;;
4856         esac
4857 else
4858         case "$cppstdin" in
4859         '') ;;
4860         *)
4861                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4862                 ;;
4863         esac
4864 fi
4865
4866 if $ok; then
4867         : nothing
4868 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4869         $cc -E <testcpp.c >testcpp.out 2>&1; \
4870         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4871         echo "Yup, it does."
4872         x_cpp="$cc $cppflags -E"
4873         x_minus='';
4874 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4875         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4876         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877         echo "Yup, it does."
4878         x_cpp="$cc $cppflags -E"
4879         x_minus='-';
4880 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4881         $cc -P <testcpp.c >testcpp.out 2>&1; \
4882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4883         echo "Yipee, that works!"
4884         x_cpp="$cc $cppflags -P"
4885         x_minus='';
4886 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4887         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4888         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4889         echo "At long last!"
4890         x_cpp="$cc $cppflags -P"
4891         x_minus='-';
4892 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4893         $cpp <testcpp.c >testcpp.out 2>&1; \
4894         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4895         echo "It works!"
4896         x_cpp="$cpp $cppflags"
4897         x_minus='';
4898 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4899         $cpp - <testcpp.c >testcpp.out 2>&1; \
4900         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4901         echo "Hooray, it works!  I was beginning to wonder."
4902         x_cpp="$cpp $cppflags"
4903         x_minus='-';
4904 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4905         $wrapper <testcpp.c >testcpp.out 2>&1; \
4906         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4907         x_cpp="$wrapper"
4908         x_minus=''
4909         echo "Eureka!"
4910 else
4911         dflt=''
4912         rp="No dice.  I can't find a C preprocessor.  Name one:"
4913         . ./myread
4914         x_cpp="$ans"
4915         x_minus=''
4916         $x_cpp <testcpp.c >testcpp.out 2>&1
4917         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4918                 echo "OK, that will do." >&4
4919         else
4920 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4921                 exit 1
4922         fi
4923 fi
4924
4925 case "$ok" in
4926 false)
4927         cppstdin="$x_cpp"
4928         cppminus="$x_minus"
4929         cpprun="$x_cpp"
4930         cpplast="$x_minus"
4931         set X $x_cpp
4932         shift
4933         case "$1" in
4934         "$cpp")
4935                 echo "Perhaps can we force $cc -E using a wrapper..."
4936                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4937                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4938                 then
4939                         echo "Yup, we can."
4940                         cppstdin="$wrapper"
4941                         cppminus='';
4942                 else
4943                         echo "Nope, we'll have to live without it..."
4944                 fi
4945                 ;;
4946         esac
4947         case "$cpprun" in
4948         "$wrapper")
4949                 cpprun=''
4950                 cpplast=''
4951                 ;;
4952         esac
4953         ;;
4954 esac
4955
4956 case "$cppstdin" in
4957 "$wrapper"|'cppstdin') ;;
4958 *) $rm -f $wrapper;;
4959 esac
4960 $rm -f testcpp.c testcpp.out
4961
4962 : Adjust cppfilter for path component separator
4963 case "$osname" in
4964 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4965 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4966 *)   cppfilter='' ;;
4967 esac
4968
4969 : Use gcc to determine libpth and incpth
4970 # If using gcc or clang, we can get better values for libpth, incpth
4971 # and usrinc directly from the compiler.
4972 # Note that ccname for clang is also gcc.
4973 case "$ccname" in
4974     gcc)
4975         $echo 'extern int foo;' > try.c
4976         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4977         shift
4978         if $test $# -gt 0; then
4979             incpth="$incpth $*"
4980             incpth="`$echo $incpth|$sed 's/^ //'`"
4981             for i in $*; do
4982                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4983                 if $test -d $j; then
4984                     libpth="$libpth $j"
4985                 fi
4986             done
4987             libpth="`$echo $libpth|$sed 's/^ //'`"
4988             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4989                 if $test -d $xxx; then
4990                     case " $libpth " in
4991                     *" $xxx "*) ;;
4992                     *) libpth="$libpth $xxx";;
4993                     esac
4994                 fi
4995             done
4996         fi
4997         $rm -f try.c
4998         case "$usrinc" in
4999         '') for i in $incpth; do
5000                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5001                     usrinc="$i"
5002                     break
5003                 fi
5004             done
5005             ;;
5006         esac
5007
5008         case "$usecrosscompile" in
5009         $define|true|[yY]*)
5010             case "$incpth" in
5011                 '') echo "Incpth not defined." >&4; croak=y ;;
5012                 *)  echo "Using incpth '$incpth'." >&4 ;;
5013             esac
5014             case "$libpth" in
5015                 '') echo "Libpth not defined." >&4; croak=y ;;
5016                 *)  echo "Using libpth '$libpth'." >&4 ;;
5017             esac
5018             case "$usrinc" in
5019                 '') echo "Usrinc not defined." >&4; croak=y ;;
5020                 *)  echo "Using usrinc $usrinc." >&4 ;;
5021             esac
5022             case "$croak" in
5023                 y)
5024                 if test "X$sysroot" = X; then
5025                     echo "Cannot continue, aborting." >&4; exit 1
5026                 else
5027                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5028                 fi
5029                 ;;
5030             esac
5031             ;;
5032         esac
5033     ;;
5034 esac
5035
5036 : Default value for incpth is just usrinc
5037 case "$incpth" in
5038 '') incpth="$usrinc";;
5039 esac
5040
5041 : Set private lib path
5042 case "$plibpth" in
5043 '') if ./mips; then
5044         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5045     fi;;
5046 esac
5047 case "$libpth" in
5048 ' ') dlist='';;
5049 '') dlist="$loclibpth $plibpth $glibpth";;
5050 *) dlist="$libpth";;
5051 esac
5052
5053 : Now check and see which directories actually exist, avoiding duplicates
5054 for xxx in $dlist
5055 do
5056     if $test -d $xxx; then
5057                 case " $libpth " in
5058                 *" $xxx "*) ;;
5059                 *) libpth="$libpth $xxx";;
5060                 esac
5061     fi
5062 done
5063 $cat <<'EOM'
5064
5065 Some systems have incompatible or broken versions of libraries.  Among
5066 the directories listed in the question below, please remove any you
5067 know not to be holding relevant libraries, and add any that are needed.
5068 Say "none" for none.
5069
5070 EOM
5071
5072 if test "X$sysroot" != X; then
5073     $cat <<EOM
5074 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5075
5076 EOM
5077 fi
5078
5079 case "$libpth" in
5080 '') dflt='none';;
5081 *)
5082         set X $libpth
5083         shift
5084         dflt=${1+"$@"}
5085         ;;
5086 esac
5087 rp="Directories to use for library searches?"
5088 . ./myread
5089 case "$ans" in
5090 none) libpth=' ';;
5091 *) libpth="$ans";;
5092 esac
5093
5094 : compute shared library extension
5095 case "$so" in
5096 '')
5097         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5098                 dflt='sl'
5099         else
5100                 dflt='so'
5101         fi
5102         ;;
5103 *) dflt="$so";;
5104 esac
5105 $cat <<EOM
5106
5107 On some systems, shared libraries may be available.  Answer 'none' if
5108 you want to suppress searching of shared libraries for the remainder
5109 of this configuration.
5110
5111 EOM
5112 rp='What is the file extension used for shared libraries?'
5113 . ./myread
5114 so="$ans"
5115
5116 : Does target system insist that shared library basenames are unique
5117 $cat << EOM
5118
5119 Some dynamic loaders assume that the *basename* of shared library filenames
5120 are globally unique.  We'll default this to undef as we assume your system
5121 is not this weird. Set to defined if you're on one of them.
5122
5123 EOM
5124
5125 dflt='n'
5126 rp='Make shared library basenames unique?'
5127 . ./myread
5128 case "$ans" in
5129 y|Y) val="$define" ;;
5130 *)   val="$undef"  ;;
5131 esac
5132 set d_libname_unique
5133 eval $setvar
5134
5135 : Define several unixisms.
5136 : Hints files or command line option can be used to override them.
5137 : The convoluted testing is in case hints files set either the old
5138 : or the new name.
5139 case "$_exe" in
5140 '')     case "$exe_ext" in
5141         '')     ;;
5142         *)      _exe="$exe_ext" ;;
5143         esac
5144         ;;
5145 esac
5146 case "$_a" in
5147 '')     case "$lib_ext" in
5148     '') _a='.a';;
5149         *)      _a="$lib_ext" ;;
5150         esac
5151         ;;
5152 esac
5153 case "$_o" in
5154 '') case "$obj_ext" in
5155         '')     _o='.o';;
5156         *)      _o="$obj_ext";;
5157         esac
5158         ;;
5159 esac
5160 case "$p_" in
5161 '') case "$path_sep" in
5162         '')     p_=':';;
5163         *)      p_="$path_sep";;
5164         esac
5165         ;;
5166 esac
5167 exe_ext=$_exe
5168 lib_ext=$_a
5169 obj_ext=$_o
5170 path_sep=$p_
5171
5172 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5173
5174 : Which makefile gets called first.  This is used by make depend.
5175 case "$firstmakefile" in
5176 '') firstmakefile='makefile';;
5177 esac
5178
5179 : Check is we will use socks
5180 case "$usesocks" in
5181 $define|true|[yY]*)     dflt='y';;
5182 *) dflt='n';;
5183 esac
5184 cat <<EOM
5185
5186 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5187 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5188 to use the PerlIO abstraction layer, this will be implicitly selected.
5189
5190 If this doesn't make any sense to you, just accept the default '$dflt'.
5191 EOM
5192 rp='Build Perl for SOCKS?'
5193 . ./myread
5194 case "$ans" in
5195 y|Y)    val="$define" ;;
5196 *)      val="$undef" ;;
5197 esac
5198 set usesocks
5199 eval $setvar
5200
5201 : Check for uselongdouble support
5202 case "$ccflags" in
5203 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5204 esac
5205
5206 case "$uselongdouble" in
5207 $define|true|[yY]*)     dflt='y';;
5208 *) dflt='n';;
5209 esac
5210 cat <<EOM
5211
5212 Perl can be built to take advantage of long doubles which
5213 (if available) may give more accuracy and range for floating point numbers.
5214
5215 If this doesn't make any sense to you, just accept the default '$dflt'.
5216 EOM
5217 rp='Try to use long doubles if available?'
5218 . ./myread
5219 case "$ans" in
5220 y|Y)    val="$define"   ;;
5221 *)      val="$undef"    ;;
5222 esac
5223 set uselongdouble
5224 eval $setvar
5225
5226 case "$uselongdouble" in
5227 true|[yY]*) uselongdouble="$define" ;;
5228 esac
5229
5230 : Look for a hint-file generated 'call-back-unit'.  If the
5231 : user has specified that long doubles should be used,
5232 : we may need to set or change some other defaults.
5233 if $test -f uselongdouble.cbu; then
5234     echo "Your platform has some specific hints regarding long doubles, using them..."
5235     . ./uselongdouble.cbu
5236 else
5237     case "$uselongdouble" in
5238         $define)
5239                 $cat <<EOM
5240 (Your platform does not have any specific hints for long doubles.)
5241 EOM
5242         ;;
5243     esac
5244 fi
5245
5246 : Check if quadmath is requested
5247 case "$usequadmath" in
5248 "$define"|true|[yY]*) usequadmath="$define" ;;
5249 *)                    usequadmath="$undef"  ;;
5250 esac
5251
5252 : Fail if both uselongdouble and usequadmath are requested
5253 case "$usequadmath:$uselongdouble" in
5254 define:define)
5255         $cat <<EOM >&4
5256
5257 *** You requested the use of the quadmath library and use
5258 *** of long doubles.
5259 ***
5260 *** Please select one or the other.
5261 EOM
5262         exit 1
5263         ;;
5264 esac
5265
5266 : Looking for optional libraries
5267 echo " "
5268 echo "Checking for optional libraries..." >&4
5269 case "$libs" in
5270 ' '|'') dflt='';;
5271 *) dflt="$libs";;
5272 esac
5273 case "$libswanted" in
5274 '') libswanted='c_s';;
5275 esac
5276 case "$usesocks" in
5277 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5278 esac
5279 case "$usecbacktrace" in
5280 "$define") libswanted="$libswanted bfd" ;;
5281 esac
5282 case "$usequadmath" in
5283 "$define") libswanted="$libswanted quadmath" ;;
5284 esac
5285 libsfound=''
5286 libsfiles=''
5287 libsdirs=''
5288 libspath=''
5289 for thisdir in $libpth $xlibpth; do
5290   test -d $thisdir && libspath="$libspath $thisdir"
5291 done
5292 for thislib in $libswanted; do
5293         for thisdir in $libspath; do
5294             xxx=''
5295             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5296                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5297                 $test -f "$xxx" && eval $libscheck
5298                 $test -f "$xxx" && libstyle=shared
5299                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5300                 $test -f "$xxx" && eval $libscheck
5301                 $test -f "$xxx" && libstyle=shared
5302             fi
5303             if test ! -f "$xxx"; then
5304                 xxx=$thisdir/lib$thislib.$so
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=shared
5307             fi
5308             if test ! -f "$xxx"; then
5309                 xxx=$thisdir/lib$thislib$_a
5310                 $test -f "$xxx" && eval $libscheck
5311                 $test -f "$xxx" && libstyle=static
5312             fi
5313             if test ! -f "$xxx"; then
5314                 xxx=$thisdir/$thislib$_a
5315                 $test -f "$xxx" && eval $libscheck
5316                 $test -f "$xxx" && libstyle=static
5317             fi
5318             if test ! -f "$xxx"; then
5319                 xxx=$thisdir/lib${thislib}_s$_a
5320                 $test -f "$xxx" && eval $libscheck
5321                 $test -f "$xxx" && libstyle=static
5322                 $test -f "$xxx" && thislib=${thislib}_s
5323             fi
5324             if test ! -f "$xxx"; then
5325                 xxx=$thisdir/Slib$thislib$_a
5326                 $test -f "$xxx" && eval $libscheck
5327                 $test -f "$xxx" && libstyle=static
5328             fi
5329             if $test -f "$xxx"; then
5330                 case "$libstyle" in
5331                 shared) echo "Found -l$thislib (shared)." ;;
5332                 static) echo "Found -l$thislib." ;;
5333                 *)      echo "Found -l$thislib ($libstyle)." ;;
5334                 esac
5335                 case " $dflt " in
5336                 *"-l$thislib "*);;
5337                 *) dflt="$dflt -l$thislib"
5338                    libsfound="$libsfound $xxx"
5339                    yyy=`basename $xxx`
5340                    libsfiles="$libsfiles $yyy"
5341                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5342                    case " $libsdirs " in
5343                    *" $yyy "*) ;;
5344                    *) libsdirs="$libsdirs $yyy" ;;
5345                    esac
5346                    ;;
5347                 esac
5348                 break
5349             fi
5350         done
5351         if $test ! -f "$xxx"; then
5352             echo "No -l$thislib."
5353         fi
5354 done
5355 set X $dflt
5356 shift
5357 dflt="$*"
5358 case "$libs" in
5359 '') dflt="$dflt";;
5360 *) dflt="$libs";;
5361 esac
5362 case "$dflt" in
5363 ' '|'') dflt='none';;
5364 esac
5365
5366 $cat <<EOM
5367
5368 In order to compile $package on your machine, a number of libraries
5369 are usually needed.  Include any other special libraries here as well.
5370 Say "none" for none.  The default list is almost always right.
5371 EOM
5372
5373 echo " "
5374 rp="What libraries to use?"
5375 . ./myread
5376 case "$ans" in
5377 none) libs=' ';;
5378 *) libs="$ans";;
5379 esac
5380
5381 : determine optimization, if desired, or use for debug flag also
5382 case "$optimize" in
5383 ' '|$undef) dflt='none';;
5384 '') dflt='-O';;
5385 *) dflt="$optimize";;
5386 esac
5387 $cat <<EOH
5388
5389 By default, $package compiles with the -O flag to use the optimizer.
5390 Alternately, you might want to use the symbolic debugger, which uses
5391 the -g flag (on traditional Unix systems).  Either flag can be
5392 specified here.  To use neither flag, specify the word "none".
5393
5394 EOH
5395 rp="What optimizer/debugger flag should be used?"
5396 . ./myread
5397 optimize="$ans"
5398 case "$optimize" in
5399 'none') optimize=" ";;
5400 esac
5401
5402 : Check what DEBUGGING is required from the command line
5403 : -DEBUGGING      or -DDEBUGGING or
5404 : -DEBUGGING=both                       = -g + -DDEBUGGING
5405 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5406 : -DEBUGGING=none or -UDEBUGGING        =
5407 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5408 case "$EBUGGING" in
5409 '')     ;;
5410 *)      DEBUGGING=$EBUGGING ;;
5411 esac
5412
5413 case "$DEBUGGING" in
5414 -g|both|$define)
5415     case "$optimize" in
5416         *-g*) ;;
5417         *)    optimize="$optimize -g" ;;
5418     esac ;;
5419 none|$undef)
5420     case "$optimize" in
5421         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5422                 shift
5423                 optimize="$*"
5424                 ;;
5425     esac ;;
5426 esac
5427
5428 dflt=''
5429 case "$DEBUGGING" in
5430 both|$define) dflt='-DDEBUGGING'
5431 esac
5432
5433 : argument order is deliberate, as the flag will start with - which set could
5434 : think is an option
5435 checkccflag='check=$1; flag=$2; callback=$3;
5436 echo " ";
5437 echo "Checking if your compiler accepts $flag" 2>&1;
5438 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5439 echo "int main(void) { return 0; }" > gcctest.c;
5440 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5441     echo "Yes, it does." 2>&1;
5442     if $test -s gcctest.out ; then
5443         echo "But your platform does not like it:";
5444         cat gcctest.out;
5445     else
5446         case "$ccflags" in
5447         *$check*)
5448             echo "Leaving current flags $ccflags alone." 2>&1
5449             ;;
5450         *) dflt="$dflt $flag";
5451             eval $callback
5452             ;;
5453         esac
5454     fi
5455 else
5456     echo "Nope, it does not, but that is ok." 2>&1;
5457 fi
5458 '
5459
5460 : We will not override a previous value, but we might want to
5461 : augment a hint file
5462 case "$hint" in
5463 default|recommended)
5464         case "$gccversion" in
5465         1*) dflt="$dflt -fpcc-struct-return" ;;
5466         esac
5467         case "$optimize:$DEBUGGING" in
5468         *-g*:old) dflt="$dflt -DDEBUGGING";;
5469         esac
5470         case "$gccversion" in
5471         2*) if $test -d /etc/conf/kconfig.d &&
5472                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5473                 then
5474                         # Interactive Systems (ISC) POSIX mode.
5475                         dflt="$dflt -posix"
5476                 fi
5477                 ;;
5478         esac
5479         case "$gccversion" in
5480         1*) ;;
5481         2.[0-8]*) ;;
5482         ?*)     set strict-aliasing -fno-strict-aliasing
5483                 eval $checkccflag
5484                 ;;
5485         esac
5486         # For gcc, adding -pipe speeds up compilations for some, but apparently
5487         # some assemblers can't read from stdin.  (It also slows down compilations
5488         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5489         case "$gccversion" in
5490         ?*)     set pipe -pipe
5491                 eval $checkccflag
5492                 ;;
5493         esac
5494
5495         # on x86_64 (at least) we require an extra library (libssp) in the
5496         # link command line. This library is not named, so I infer that it is
5497         # an implementation detail that may change. Hence the safest approach
5498         # is to add the flag to the flags passed to the compiler at link time,
5499         # as that way the compiler can do the right implementation dependant
5500         # thing. (NWC)
5501         case "$osname" in
5502         amigaos) ;; # -fstack-protector builds but doesn't work
5503         *)      case "$gccversion" in
5504                 ?*)     set stack-protector-strong -fstack-protector-strong
5505                         eval $checkccflag
5506                         case "$dflt" in
5507                         *-fstack-protector-strong*) ;; # It got added.
5508                         *) # Try the plain/older -fstack-protector.
5509                            set stack-protector -fstack-protector
5510                            eval $checkccflag
5511                            ;;
5512                         esac
5513                         ;;
5514                 esac
5515                 ;;
5516         esac
5517         ;;
5518 esac
5519
5520 case "$mips_type" in
5521 *BSD*|'') inclwanted="$locincpth $usrinc";;
5522 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5523 esac
5524 for thisincl in $inclwanted; do
5525         if $test -d $thisincl; then
5526                 if $test x$thisincl != x$usrinc; then
5527                         case "$dflt" in
5528                         *" -I$thisincl "*);;
5529                         *) dflt="$dflt -I$thisincl ";;
5530                         esac
5531                 fi
5532         fi
5533 done
5534
5535 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5536         xxx=true;
5537 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5538         xxx=true;
5539 else
5540         xxx=false;
5541 fi;
5542 if $xxx; then
5543         case "$dflt" in
5544         *$2*);;
5545         *) dflt="$dflt -D$2";;
5546         esac;
5547 fi'
5548
5549 set signal.h LANGUAGE_C; eval $inctest
5550
5551 case "$usesocks" in
5552 $define)
5553         ccflags="$ccflags -DSOCKS"
5554         ;;
5555 esac
5556
5557 case "$hint" in
5558 default|recommended) dflt="$ccflags $dflt" ;;
5559 *) dflt="$ccflags";;
5560 esac
5561
5562 case "$dflt" in
5563 ''|' ') dflt=none;;
5564 esac
5565
5566 $cat <<EOH
5567
5568 Your C compiler may want other flags.  For this question you should include
5569 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5570 but you should NOT include libraries or ld flags like -lwhatever.  If you
5571 want $package to honor its debug switch, you should include -DDEBUGGING here.
5572 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5573
5574 To use no flags, specify the word "none".
5575
5576 EOH
5577 set X $dflt
5578 shift
5579 dflt=${1+"$@"}
5580 rp="Any additional cc flags?"
5581 . ./myread
5582 case "$ans" in
5583 none) ccflags='';;
5584 *) ccflags="$ans";;
5585 esac
5586
5587 : the following weeds options from ccflags that are of no interest to cpp
5588 case "$cppflags" in
5589 '') cppflags="$ccflags" ;;
5590 *)  set X $ccflags; shift
5591     case " $cppflags " in
5592     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5593     *) cppflags="$cppflags $ccflags" ;;
5594     esac
5595     ;;
5596 esac
5597 case "$gccversion" in
5598 1*) cppflags="$cppflags -D__GNUC__"
5599 esac
5600 case "$mips_type" in
5601 '');;
5602 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5603 esac
5604 case "$cppflags" in
5605 '');;
5606 *)
5607         echo " "
5608         echo "Let me guess what the preprocessor flags are..." >&4
5609         set X $cppflags
5610         shift
5611         cppflags=''
5612         $cat >cpp.c <<'EOM'
5613 #define BLURFL foo
5614
5615 BLURFL xx LFRULB
5616 EOM
5617         previous=''
5618         for flag in $*
5619         do
5620                 case "$flag" in
5621                 -*) ftry="$flag";;
5622                 *) ftry="$previous $flag";;
5623                 esac
5624                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5625                         >cpp1.out 2>/dev/null && \
5626                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5627                         >cpp2.out 2>/dev/null && \
5628                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5629                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5630                 then
5631                         cppflags="$cppflags $ftry"
5632                         previous=''
5633                 else
5634                         previous="$flag"
5635                 fi
5636         done
5637         set X $cppflags
5638         shift
5639         cppflags=${1+"$@"}
5640         case "$cppflags" in
5641         *-*)  echo "They appear to be: $cppflags";;
5642         esac
5643         $rm -f cpp.c cpp?.out
5644         ;;
5645 esac
5646
5647 : flags used in final linking phase
5648 case "$ldflags" in
5649 '') if ./venix; then
5650                 dflt='-i -z'
5651         else
5652                 dflt=''
5653         fi
5654         case "$ccflags" in
5655         *-posix*) dflt="$dflt -posix" ;;
5656         esac
5657         ;;
5658 *) dflt="$ldflags";;
5659 esac
5660 # See note above about -fstack-protector
5661 case "$ccflags" in
5662 *-fstack-protector-strong*)
5663         case "$dflt" in
5664         *-fstack-protector-strong*) ;; # Don't add it again
5665         *) dflt="$dflt -fstack-protector-strong" ;;
5666         esac
5667         ;;
5668 *-fstack-protector*)
5669         case "$dflt" in
5670         *-fstack-protector*) ;; # Don't add it again
5671         *) dflt="$dflt -fstack-protector" ;;
5672         esac
5673         ;;
5674 esac
5675
5676 : Try to guess additional flags to pick up local libraries.
5677 for thislibdir in $libpth; do
5678         case " $loclibpth " in
5679         *" $thislibdir "*)
5680                 case "$dflt " in
5681                 *"-L$thislibdir "*) ;;
5682                 *)  dflt="$dflt -L$thislibdir" ;;
5683                 esac
5684                 ;;
5685         esac
5686 done
5687
5688 case "$dflt" in
5689 '') dflt='none' ;;
5690 esac
5691
5692 $cat <<EOH
5693
5694 Your C linker may need flags.  For this question you should
5695 include -L/whatever and any other flags used by the C linker, but you
5696 should NOT include libraries like -lwhatever.
5697
5698 Make sure you include the appropriate -L/path flags if your C linker
5699 does not normally search all of the directories you specified above,
5700 namely
5701         $libpth
5702 To use no flags, specify the word "none".
5703
5704 EOH
5705
5706 rp="Any additional ld flags (NOT including libraries)?"
5707 . ./myread
5708 case "$ans" in
5709 none) ldflags='';;
5710 *) ldflags="$ans";;
5711 esac
5712 rmlist="$rmlist pdp11"
5713
5714 : coherency check
5715 echo " "
5716 echo "Checking your choice of C compiler and flags for coherency..." >&4
5717 $cat > try.c <<'EOF'
5718 #include <stdio.h>
5719 int main() { printf("Ok\n"); return(0); }
5720 EOF
5721 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5722 shift
5723 $cat >try.msg <<'EOM'
5724 I've tried to compile and run the following simple program:
5725
5726 EOM
5727 $cat try.c >> try.msg
5728
5729 $cat >> try.msg <<EOM
5730
5731 I used the command:
5732
5733         $*
5734         $run ./try
5735
5736 and I got the following output:
5737
5738 EOM
5739 dflt=y
5740 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5741         if $sh -c "$run ./try " >>try.msg 2>&1; then
5742                 xxx=`$run ./try`
5743                 case "$xxx" in
5744                 "Ok") dflt=n ;;
5745                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5746                 esac
5747         else
5748                 echo "The program compiled OK, but exited with status $?." >>try.msg
5749                 rp="You have a problem.  Shall I abort Configure"
5750                 dflt=y
5751         fi
5752 else
5753         echo "I can't compile the test program." >>try.msg
5754         rp="You have a BIG problem.  Shall I abort Configure"
5755         dflt=y
5756 fi
5757 case "$dflt" in
5758 y)
5759         $cat try.msg >&4
5760         case "$knowitall" in
5761         '')
5762                 echo "(The supplied flags or libraries might be incorrect.)"
5763                 ;;
5764         *) dflt=n;;
5765         esac
5766         echo " "
5767         . ./myread
5768         case "$ans" in
5769         n*|N*) ;;
5770         *)      echo "Ok.  Stopping Configure." >&4
5771                 exit 1
5772                 ;;
5773         esac
5774         ;;
5775 n) echo "OK, that should do.";;
5776 esac
5777 $rm_try gcctest gcctest.out
5778
5779 : define a shorthand compile call
5780 compile='
5781 mc_file=$1;
5782 shift;
5783 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5784 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5785 exit 1;
5786 fi;
5787 esac;
5788 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5789 : define a shorthand compile call for compilations that should be ok.
5790 compile_ok='
5791 mc_file=$1;
5792 shift;
5793 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5794
5795 : stub, used only to satisfy other units
5796 i_stdlib='define'
5797
5798 : check for lengths of integral types
5799 echo " "
5800 case "$intsize" in
5801 '')
5802         echo "Checking to see how big your integers are..." >&4
5803         $cat >try.c <<EOCP
5804 #include <stdio.h>
5805 #$i_stdlib I_STDLIB
5806 #ifdef I_STDLIB
5807 #include <stdlib.h>
5808 #endif
5809 int main()
5810 {
5811         printf("intsize=%d;\n", (int)sizeof(int));
5812         printf("longsize=%d;\n", (int)sizeof(long));
5813         printf("shortsize=%d;\n", (int)sizeof(short));
5814         exit(0);
5815 }
5816 EOCP
5817         set try
5818         if eval $compile_ok && $run ./try > /dev/null; then
5819                 eval `$run ./try`
5820                 echo "Your integers are $intsize bytes long."
5821                 echo "Your long integers are $longsize bytes long."
5822                 echo "Your short integers are $shortsize bytes long."
5823         else
5824                 $cat >&4 <<EOM
5825 !
5826 Help! I can't compile and run the intsize test program: please enlighten me!
5827 (This is probably a misconfiguration in your system or libraries, and
5828 you really ought to fix it.  Still, I'll try anyway.)
5829 !
5830 EOM
5831                 dflt=4
5832                 rp="What is the size of an integer (in bytes)?"
5833                 . ./myread
5834                 intsize="$ans"
5835                 dflt=$intsize
5836                 rp="What is the size of a long integer (in bytes)?"
5837                 . ./myread
5838                 longsize="$ans"
5839                 dflt=2
5840                 rp="What is the size of a short integer (in bytes)?"
5841                 . ./myread
5842                 shortsize="$ans"
5843         fi
5844         ;;
5845 esac
5846 $rm_try
5847
5848 : check for long long
5849 echo " "
5850 echo "Checking to see if you have long long..." >&4
5851 echo 'int main() { long long x = 7; return 0; }' > try.c
5852 set try
5853 if eval $compile; then
5854         val="$define"
5855         echo "You have long long."
5856 else
5857         val="$undef"
5858         echo "You do not have long long."
5859 fi
5860 $rm_try
5861 set d_longlong
5862 eval $setvar
5863
5864 : check for length of long long
5865 case "${d_longlong}${longlongsize}" in
5866 $define)
5867         echo " "
5868         echo "Checking to see how big your long longs are..." >&4
5869         $cat >try.c <<'EOCP'
5870 #include <stdio.h>
5871 int main()
5872 {
5873     printf("%d\n", (int)sizeof(long long));
5874     return(0);
5875 }
5876 EOCP
5877         set try
5878         if eval $compile_ok; then
5879                 longlongsize=`$run ./try`
5880                 echo "Your long longs are $longlongsize bytes long."
5881         else
5882                 dflt='8'
5883                 echo " "
5884                 echo "(I can't seem to compile the test program.  Guessing...)"
5885                 rp="What is the size of a long long (in bytes)?"
5886                 . ./myread
5887                 longlongsize="$ans"
5888         fi
5889         if $test "X$longsize" = "X$longlongsize"; then
5890                 echo "(That isn't any different from an ordinary long.)"
5891         fi
5892         ;;
5893 esac
5894 $rm_try
5895
5896 : determine filename position in cpp output
5897 echo " "
5898 echo "Computing filename position in cpp output for #include directives..." >&4
5899 case "$osname" in
5900 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5901 esac
5902 case "$fieldn" in
5903 '')
5904 case "$osname" in
5905 vos) testaccess=-e ;;
5906 *)   testaccess=-r ;;
5907 esac
5908 echo '#include <stdio.h>' > foo.c
5909 $cat >fieldn <<EOF
5910 $startsh
5911 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5912 $grep '^[       ]*#.*stdio\.h' | \
5913 while read cline; do
5914         pos=1
5915         set \$cline
5916         while $test \$# -gt 0; do
5917                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5918                         echo "\$pos"
5919                         exit 0
5920                 fi
5921                 shift
5922                 pos=\`expr \$pos + 1\`
5923         done
5924 done
5925 EOF
5926 chmod +x fieldn
5927 fieldn=`./fieldn`
5928 $rm -f foo.c fieldn
5929 ;;
5930 esac
5931 case $fieldn in
5932 '') pos='???';;
5933 1) pos=first;;
5934 2) pos=second;;
5935 3) pos=third;;
5936 *) pos="${fieldn}th";;
5937 esac
5938 echo "Your cpp writes the filename in the $pos field of the line."
5939
5940 : locate header file
5941 $cat >findhdr <<EOF
5942 $startsh
5943 wanted=\$1
5944 name=''
5945 for usrincdir in $incpth
5946 do
5947         if test -f \$usrincdir/\$wanted; then
5948                 echo "\$usrincdir/\$wanted"
5949                 exit 0
5950         fi
5951 done
5952 awkprg='{ print \$$fieldn }'
5953 echo "#include <\$wanted>" > foo\$\$.c
5954 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5955 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5956 while read cline; do
5957         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5958         case "\$name" in
5959         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5960         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5961         *) exit 2;;
5962         esac;
5963 done;
5964 #
5965 # status = 0: grep returned 0 lines, case statement not executed
5966 # status = 1: headerfile found
5967 # status = 2: while loop executed, no headerfile found
5968 #
5969 status=\$?
5970 $rm -f foo\$\$.c;
5971 if test \$status -eq 1; then
5972         exit 0;
5973 fi
5974 exit 1
5975 EOF
5976 chmod +x findhdr
5977
5978 : define an alternate in-header-list? function
5979 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5980 cont=true; xxf="echo \"<\$1> found.\" >&4";
5981 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5982 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5983 esac;
5984 case $# in 4) instead=instead;; *) instead="at last";; esac;
5985 while $test "$cont"; do
5986         xxx=`./findhdr $1`
5987         var=$2; eval "was=\$$2";
5988         if $test "$xxx" && $test -r "$xxx";
5989         then eval $xxf;
5990         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5991                 cont="";
5992         else eval $xxnf;
5993         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5994         set $yyy; shift; shift; yyy=$@;
5995         case $# in 0) cont="";;
5996         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5997                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5998         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5999                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6000         esac;
6001 done;
6002 while $test "$yyy";
6003 do set $yyy; var=$2; eval "was=\$$2";
6004         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6005         set $yyy; shift; shift; yyy=$@;
6006 done'
6007
6008 : see if inttypes.h is available
6009 : we want a real compile instead of Inhdr because some systems
6010 : have an inttypes.h which includes non-existent headers
6011 echo " "
6012 $cat >try.c <<EOCP
6013 #include <inttypes.h>
6014 int main() {
6015         static int32_t foo32 = 0x12345678;
6016 }
6017 EOCP
6018 set try
6019 if eval $compile; then
6020         echo "<inttypes.h> found." >&4
6021         val="$define"
6022 else
6023         echo "<inttypes.h> NOT found." >&4
6024         val="$undef"
6025 fi
6026 $rm_try
6027 set i_inttypes
6028 eval $setvar
6029
6030 : check for int64_t
6031 echo " "
6032 echo "Checking to see if you have int64_t..." >&4
6033 $cat >try.c <<EOCP
6034 #include <sys/types.h>
6035 #$i_inttypes I_INTTYPES
6036 #ifdef I_INTTYPES
6037 #include <inttypes.h>
6038 #endif
6039 int main() { int64_t x = 7; }
6040 EOCP
6041 set try
6042 if eval $compile; then
6043         val="$define"
6044         echo "You have int64_t."
6045 else
6046         val="$undef"
6047         echo "You do not have int64_t."
6048 fi
6049 $rm_try
6050 set d_int64_t
6051 eval $setvar
6052
6053 : Check if 64bit ints have a quad type
6054 echo " "
6055 echo "Checking which 64-bit integer type we could use..." >&4
6056
6057 case "$intsize" in
6058 8) val=int
6059    set quadtype
6060    eval $setvar
6061    val='"unsigned int"'
6062    set uquadtype
6063    eval $setvar
6064    quadkind=1
6065    ;;
6066 *) case "$longsize" in
6067    8) val=long
6068       set quadtype
6069       eval $setvar
6070       val='"unsigned long"'
6071       set uquadtype
6072       eval $setvar
6073       quadkind=2
6074       ;;
6075    *) case "$d_longlong:$longlongsize" in
6076       define:8)
6077         val='"long long"'
6078         set quadtype
6079         eval $setvar
6080         val='"unsigned long long"'
6081         set uquadtype
6082         eval $setvar
6083         quadkind=3
6084         ;;
6085       *) case "$d_int64_t" in
6086          define)
6087            val=int64_t
6088            set quadtype
6089            eval $setvar
6090            val=uint64_t
6091            set uquadtype
6092            eval $setvar
6093            quadkind=4
6094            ;;
6095          esac
6096          ;;
6097       esac
6098       ;;
6099    esac
6100    ;;
6101 esac
6102
6103 case "$quadtype" in
6104 '')     echo "Alas, no 64-bit integer types in sight." >&4
6105         d_quad="$undef"
6106         ;;
6107 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6108         d_quad="$define"
6109         ;;
6110 esac
6111
6112 : Do we want 64bit support
6113 case "$uselonglong" in
6114 "$define"|true|[yY]*)
6115         cat <<EOM >&4
6116
6117 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6118 EOM
6119         use64bitint="$define"
6120         ;;
6121 esac
6122 case "$use64bits" in
6123 "$define"|true|[yY]*)
6124         cat <<EOM >&4
6125
6126 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6127 EOM
6128         use64bitint="$define"
6129         ;;
6130 esac
6131 case "$use64bitints" in
6132 "$define"|true|[yY]*)
6133         cat <<EOM >&4
6134
6135 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6136 EOM
6137         use64bitint="$define"
6138         ;;
6139 esac
6140 case "$use64bitsint" in
6141 "$define"|true|[yY]*)
6142         cat <<EOM >&4
6143
6144 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6145 EOM
6146         use64bitint="$define"
6147         ;;
6148 esac
6149 case "$uselonglongs" in
6150 "$define"|true|[yY]*)
6151         cat <<EOM >&4
6152
6153 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6154 EOM
6155         use64bitint="$define"
6156         ;;
6157 esac
6158 case "$use64bitsall" in
6159 "$define"|true|[yY]*)
6160         cat <<EOM >&4
6161
6162 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6163 EOM
6164         use64bitall="$define"
6165         ;;
6166 esac
6167
6168 case "$ccflags" in
6169 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6170 esac
6171 case "$use64bitall" in
6172 "$define"|true|[yY]*) use64bitint="$define" ;;
6173 esac
6174
6175 case "$longsize" in
6176 8) cat <<EOM
6177
6178 You have natively 64-bit long integers.
6179 EOM
6180    val="$define"
6181    ;;
6182 *) case "$use64bitint" in
6183    "$define"|true|[yY]*) dflt='y';;
6184    *) dflt='n';;
6185    esac
6186    case "$d_quad" in
6187    "$define") ;;
6188    *) dflt='n' ;;
6189    esac
6190    cat <<EOM
6191
6192 Perl can be built to take advantage of 64-bit integer types
6193 on some systems.  To do so, Configure can be run with -Duse64bitint.
6194 Choosing this option will most probably introduce binary incompatibilities.
6195
6196 If this doesn't make any sense to you, just accept the default '$dflt'.
6197 (The default has been chosen based on your configuration.)
6198 EOM
6199    rp='Try to use 64-bit integers, if available?'
6200    . ./myread
6201    case "$ans" in
6202    [yY]*) val="$define" ;;
6203    *)     val="$undef"  ;;
6204    esac
6205    ;;
6206 esac
6207 set use64bitint
6208 eval $setvar
6209
6210 case "$use64bitall" in
6211 "$define"|true|[yY]*) dflt='y' ;;
6212 *) case "$longsize" in
6213    8) dflt='y' ;;
6214    *) dflt='n' ;;
6215    esac
6216    ;;
6217 esac
6218 cat <<EOM
6219
6220 You may also choose to try maximal 64-bitness.  It means using as much
6221 64-bitness as possible on the platform.  This in turn means even more
6222 binary incompatibilities.  On the other hand, your platform may not
6223 have any more 64-bitness available than what you already have chosen.
6224
6225 If this doesn't make any sense to you, just accept the default '$dflt'.
6226 (The default has been chosen based on your configuration.)
6227 EOM
6228 rp='Try to use maximal 64-bit support, if available?'
6229 . ./myread
6230 case "$ans" in
6231 [yY]*) val="$define" ;;
6232 *)     val="$undef"  ;;
6233 esac
6234 set use64bitall
6235 eval $setvar
6236 case "$use64bitall" in
6237 "$define")
6238         case "$use64bitint" in
6239         "$undef")
6240                 cat <<EOM
6241
6242 Since you have chosen a maximally 64-bit build, I'm also turning on
6243 the use of 64-bit integers.
6244 EOM
6245                 use64bitint="$define" ;;
6246         esac
6247         ;;
6248 esac
6249
6250 : Look for a hint-file generated 'call-back-unit'.  If the
6251 : user has specified that a 64-bit perl is to be built,
6252 : we may need to set or change some other defaults.
6253 if $test -f use64bitint.cbu; then
6254         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6255         . ./use64bitint.cbu
6256 fi
6257 case "$use64bitint" in
6258 "$define"|true|[yY]*)
6259         : This test was common to all the OpenBSD forks, and seems harmless for
6260         : other platforms:
6261         echo " "
6262         echo "Checking if your C library has broken 64-bit functions..." >&4
6263         cat >try.c <<EOCP
6264 #include <stdio.h>
6265 typedef $uquadtype myULL;
6266 int main (void)
6267 {
6268     struct {
6269         double d;
6270         myULL  u;
6271     } *p, test[] = {
6272         {4294967303.15, 4294967303ULL},
6273         {4294967294.2,  4294967294ULL},
6274         {4294967295.7,  4294967295ULL},
6275         {0.0, 0ULL}
6276     };
6277     for (p = test; p->u; p++) {
6278         myULL x = (myULL)p->d;
6279         if (x != p->u) {
6280             printf("buggy\n");
6281             return 0;
6282         }
6283     }
6284     printf("ok\n");
6285     return 0;
6286 }
6287 EOCP
6288         set try
6289         if eval $compile_ok; then
6290             libcquad=`$run ./try`
6291             echo "Your C library's 64-bit functions are $libcquad."
6292         else
6293             echo "(I can't seem to compile the test program.)"
6294             echo "Assuming that your C library's 64-bit functions are ok."
6295             libcquad="ok"
6296         fi
6297         $rm_try
6298
6299         case "$libcquad" in
6300             buggy*)
6301                 cat >&4 <<EOM
6302
6303 *** You have a C library with broken 64-bit functions.
6304 *** 64-bit support does not work reliably in this configuration.
6305 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6306 *** Cannot continue, aborting.
6307
6308 EOM
6309                 exit 1
6310                 ;;
6311         esac
6312         case "$longsize" in
6313         4) case "$archname64" in
6314            '') archname64=64int ;;
6315            esac
6316            ;;
6317         esac
6318         ;;
6319 esac
6320
6321 : Look for a hint-file generated 'call-back-unit'.  If the
6322 : user has specified that a maximally 64-bit perl is to be built,
6323 : we may need to set or change some other defaults.
6324 if $test -f use64bitall.cbu; then
6325         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6326         . ./use64bitall.cbu
6327 fi
6328 case "$use64bitall" in
6329 "$define"|true|[yY]*)
6330         case "$longsize" in
6331         4) case "$archname64" in
6332            ''|64int) archname64=64all ;;
6333            esac
6334            ;;
6335         esac
6336         ;;
6337 esac
6338
6339 case "$d_quad:$use64bitint" in
6340 $undef:$define)
6341         cat >&4 <<EOF
6342
6343 *** You have chosen to use 64-bit integers,
6344 *** but none can be found.
6345 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6346 *** Cannot continue, aborting.
6347
6348 EOF
6349         exit 1
6350         ;;
6351 esac
6352
6353 : Check if we are using the GNU C library
6354 echo " "
6355 echo "Checking for GNU C Library..." >&4
6356 cat >try.c <<'EOCP'
6357 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6358    alone are insufficient to distinguish different versions, such as
6359    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6360    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6361 */
6362 #include <stdio.h>
6363 int main(void)
6364 {
6365 #ifdef __GLIBC__
6366 #   ifdef __GLIBC_MINOR__
6367 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6368 #           include <gnu/libc-version.h>
6369             printf("%s\n",  gnu_get_libc_version());
6370 #       else
6371             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6372 #       endif
6373 #   else
6374         printf("%d\n",  __GLIBC__);
6375 #   endif
6376     return 0;
6377 #else
6378     return 1;
6379 #endif
6380 }
6381 EOCP
6382 set try
6383 if eval $compile_ok && $run ./try > glibc.ver; then
6384         val="$define"
6385         gnulibc_version=`$cat glibc.ver`
6386         echo "You are using the GNU C Library version $gnulibc_version"
6387 else
6388         val="$undef"
6389         gnulibc_version=''
6390         echo "You are not using the GNU C Library"
6391 fi
6392 $rm_try glibc.ver
6393 set d_gnulibc
6394 eval $setvar
6395
6396 : see if nm is to be used to determine whether a symbol is defined or not
6397 case "$usenm" in
6398 '')
6399         dflt=''
6400         case "$d_gnulibc" in
6401         "$define")
6402                 echo " "
6403                 echo "nm probably won't work on the GNU C Library." >&4
6404                 dflt=n
6405                 ;;
6406         esac
6407         case "$dflt" in
6408         '')
6409                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6410                         echo " "
6411                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6412                         echo "'nm' won't be sufficient on this system." >&4
6413                         dflt=n
6414                 fi
6415                 ;;
6416         esac
6417         case "$dflt" in
6418         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6419                 if $test $dflt -gt 20; then
6420                         dflt=y
6421                 else
6422                         dflt=n
6423                 fi
6424                 ;;
6425         esac
6426         ;;
6427 *)
6428         case "$usenm" in
6429         true|$define) dflt=y;;
6430         *) dflt=n;;
6431         esac
6432         ;;
6433 esac
6434 $cat <<EOM
6435
6436 I can use $nm to extract the symbols from your C libraries. This
6437 is a time consuming task which may generate huge output on the disk (up
6438 to 3 megabytes) but that should make the symbols extraction faster. The
6439 alternative is to skip the 'nm' extraction part and to compile a small
6440 test program instead to determine whether each symbol is present. If
6441 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6442 this may be the best solution.
6443
6444 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6445
6446 EOM
6447 rp="Shall I use $nm to extract C symbols from the libraries?"
6448 . ./myread
6449 case "$ans" in
6450 [Nn]*) usenm=false;;
6451 *) usenm=true;;
6452 esac
6453
6454 runnm=$usenm
6455 case "$reuseval" in
6456 true) runnm=false;;
6457 esac
6458
6459 : nm options which may be necessary
6460 case "$nm_opt" in
6461 '') if $test -f /mach_boot; then
6462                 nm_opt=''       # Mach
6463         elif $test -d /usr/ccs/lib; then
6464                 nm_opt='-p'     # Solaris (and SunOS?)
6465         elif $test -f /dgux; then
6466                 nm_opt='-p'     # DG-UX
6467         elif $test -f /lib64/rld; then
6468                 nm_opt='-p'     # 64-bit Irix
6469         else
6470                 nm_opt=''
6471         fi;;
6472 esac
6473
6474 : nm options which may be necessary for shared libraries but illegal
6475 : for archive libraries.  Thank you, Linux.
6476 case "$nm_so_opt" in
6477 '')     case "$myuname" in
6478         *linux*|gnu*)
6479                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6480                         nm_so_opt='--dynamic'
6481                 fi
6482                 ;;
6483         esac
6484         ;;
6485 esac
6486
6487 : Figure out where the libc is located
6488 case "$runnm" in
6489 true)
6490 : get list of predefined functions in a handy place
6491 echo " "
6492 case "$libc" in
6493 '') libc=unknown
6494         case "$libs" in
6495         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6496         esac
6497         ;;
6498 esac
6499 case "$libs" in
6500 '') ;;
6501 *)  for thislib in $libs; do
6502         case "$thislib" in
6503         -lc|-lc_s)
6504                 : Handle C library specially below.
6505                 ;;
6506         -l*)
6507                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6508                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6515                         :
6516                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6519                         :
6520                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6521                         :
6522                 else
6523                         try=''
6524                 fi
6525                 libnames="$libnames $try"
6526                 ;;
6527         *) libnames="$libnames $thislib" ;;
6528         esac
6529         done
6530         ;;
6531 esac
6532 xxx=normal
6533 case "$libc" in
6534 unknown)
6535         set /lib/libc.$so
6536         for xxx in $libpth; do
6537                 $test -r $1 || set $xxx/libc.$so
6538                 : The messy sed command sorts on library version numbers.
6539                 $test -r $1 || \
6540                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6541                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6542                                 h
6543                                 s/[0-9][0-9]*/0000&/g
6544                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6545                                 G
6546                                 s/\n/ /' | \
6547                          $sort | $sed -e 's/^.* //'`
6548                 eval set \$$#
6549         done
6550         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6551         $test -r $1 || set $sysroot/lib/libsys_s$_a
6552         ;;
6553 *)
6554         set blurfl
6555         ;;
6556 esac
6557 if $test -r "$1"; then
6558         echo "Your (shared) C library seems to be in $1."
6559         libc="$1"
6560 elif $test -r /lib/libc && $test -r /lib/clib; then
6561         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6562         xxx=apollo
6563         libc='/lib/clib /lib/libc'
6564         if $test -r /lib/syslib; then
6565                 echo "(Your math library is in /lib/syslib.)"
6566                 libc="$libc /lib/syslib"
6567         fi
6568 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6569         echo "Your C library seems to be in $libc, as you said before."
6570 elif $test -r $incpath/usr/lib/libc$_a; then
6571         libc=$incpath/usr/lib/libc$_a;
6572         echo "Your C library seems to be in $libc.  That's fine."
6573 elif $test -r /lib/libc$_a; then
6574         libc=/lib/libc$_a;
6575         echo "Your C library seems to be in $libc.  You're normal."
6576 else
6577         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6578                 :
6579         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6580                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6581         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6582                 :
6583         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6584                 :
6585         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6586                 :
6587         else
6588                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6589         fi
6590         if $test -r "$tans"; then
6591                 echo "Your C library seems to be in $tans, of all places."
6592                 libc=$tans
6593         else
6594                 libc='blurfl'
6595         fi
6596 fi
6597 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6598         dflt="$libc"
6599         cat <<EOM
6600
6601 If the guess above is wrong (which it might be if you're using a strange
6602 compiler, or your machine supports multiple models), you can override it here.
6603
6604 EOM
6605 else
6606         dflt=''
6607         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6608         cat >&4 <<EOM
6609 I can't seem to find your C library.  I've looked in the following places:
6610
6611 EOM
6612         $sed 's/^/      /' libpath
6613         cat <<EOM
6614
6615 None of these seems to contain your C library. I need to get its name...
6616
6617 EOM
6618 fi
6619 fn=f
6620 rp='Where is your C library?'
6621 . ./getfile
6622 libc="$ans"
6623
6624 echo " "
6625 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6626 set X `cat libnames`
6627 shift
6628 xxx=files
6629 case $# in 1) xxx=file; esac
6630 echo "Extracting names from the following $xxx for later perusal:" >&4
6631 echo " "
6632 $sed 's/^/      /' libnames >&4
6633 echo " "
6634 $echo $n "This may take a while...$c" >&4
6635
6636 for file in $*; do
6637         case $file in
6638         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6639         *) $nm $nm_opt $file 2>/dev/null;;
6640         esac
6641 done >libc.tmp
6642
6643 $echo $n ".$c"
6644 $grep fprintf libc.tmp > libc.ptf
6645 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6646 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6647 xxx='[ADTSIWi]'
6648 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6673                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
6698         eval $xscan;\
6699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6700                 eval $xrun
6701 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6702         eval $xscan;\
6703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6704                 eval $xrun
6705 else
6706         $nm -p $* 2>/dev/null >libc.tmp
6707         $grep fprintf libc.tmp > libc.ptf
6708         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6709                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6710         then
6711                 nm_opt='-p'
6712                 eval $xrun
6713         else
6714                 echo " "
6715                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6716                 com=''
6717                 if $ar t $libc > libc.tmp && \
6718                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6719                 then
6720                         for thisname in $libnames $libc; do
6721                                 $ar t $thisname >>libc.tmp
6722                         done
6723                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6724                         echo "Ok." >&4
6725                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6726                         for thisname in $libnames $libc; do
6727                                 $ar tv $thisname >>libc.tmp
6728                                 emximp -o tmp.imp $thisname \
6729                                     2>/dev/null && \
6730                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6731                                     < tmp.imp >>libc.tmp
6732                                 $rm -f tmp.imp
6733                         done
6734                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6735                         echo "Ok." >&4
6736                 else
6737                         echo "$ar didn't seem to work right." >&4
6738                         echo "Maybe this is a Cray...trying bld instead..." >&4
6739                         if  bld t $libc | \
6740                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6741                                 $test -s libc.list
6742                         then
6743                                 for thisname in $libnames; do
6744                                         bld t $libnames | \
6745                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6746                                         $ar t $thisname >>libc.tmp
6747                                 done
6748                                 echo "Ok." >&4
6749                         else
6750                                 echo "That didn't work either.  Giving up." >&4
6751                                 exit 1
6752                         fi
6753                 fi
6754         fi
6755 fi
6756 nm_extract="$com"
6757 case "$PASE" in
6758 define)
6759     echo " "
6760     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6761     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6762     ;;
6763 *)  if $test -f /lib/syscalls.exp; then
6764         echo " "
6765         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6766         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6767                 /lib/syscalls.exp >>libc.list
6768     fi
6769     ;;
6770 esac
6771 ;;
6772 esac
6773 $rm -f libnames libpath
6774
6775 : Check if we are using C++
6776 echo " "
6777 echo "Checking for C++..." >&4
6778 $cat >try.c <<'EOCP'
6779 #include <stdio.h>
6780 int main(void)
6781 {
6782 #ifdef __cplusplus
6783     return 0;
6784 #else
6785     return 1;
6786 #endif
6787 }
6788 EOCP
6789 set try
6790 if eval $compile_ok && $run ./try; then
6791         val="$define"
6792         echo "You are using a C++ compiler."
6793 else
6794         val="$undef"
6795         echo "You are not using a C++ compiler."
6796 fi
6797 $rm_try cplusplus$$
6798 set d_cplusplus
6799 eval $setvar
6800
6801 : is a C symbol defined?
6802 csym='tlook=$1;
6803 case "$3" in
6804 -v) tf=libc.tmp; tdc="";;
6805 -a) tf=libc.tmp; tdc="[]";;
6806 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6807 esac;
6808 case "$d_cplusplus" in
6809     $define)    extern_C="extern \"C\"" ;;
6810     *)          extern_C="extern"       ;;
6811 esac;
6812 tx=yes;
6813 case "$reuseval-$4" in
6814 true-) ;;
6815 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6816 esac;
6817 case "$tx" in
6818 yes)
6819         tval=false;
6820         if $test "$runnm" = true; then
6821                 if $contains $tlook $tf >/dev/null 2>&1; then
6822                         tval=true;
6823                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6824                         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;
6825                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6826                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6827                         $rm_try;
6828                 fi;
6829         else
6830                 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;
6831                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6832                 $rm_try;
6833         fi;
6834         ;;
6835 *)
6836         case "$tval" in
6837         $define) tval=true;;
6838         *) tval=false;;
6839         esac;
6840         ;;
6841 esac;
6842 eval "$2=$tval"'
6843
6844 : define an is-in-libc? function
6845 inlibc='echo " "; td=$define; tu=$undef;
6846 sym=$1; var=$2; eval "was=\$$2";
6847 tx=yes;
6848 case "$reuseval$was" in
6849 true) ;;
6850 true*) tx=no;;
6851 esac;
6852 case "$tx" in
6853 yes)
6854         set $sym tres -f;
6855         eval $csym;
6856         case "$tres" in
6857         true)
6858                 echo "$sym() found." >&4;
6859                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6860         *)
6861                 echo "$sym() NOT found." >&4;
6862                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6863         esac;;
6864 *)
6865         case "$was" in
6866         $define) echo "$sym() found." >&4;;
6867         *) echo "$sym() NOT found." >&4;;
6868         esac;;
6869 esac'
6870
6871 : check for length of double
6872 echo " "
6873 case "$doublesize" in
6874 '')
6875         echo "Checking to see how big your double precision numbers are..." >&4
6876         $cat >try.c <<EOCP
6877 #include <stdio.h>
6878 #$i_stdlib I_STDLIB
6879 #ifdef I_STDLIB
6880 #include <stdlib.h>
6881 #endif
6882 int main()
6883 {
6884     printf("%d\n", (int)sizeof(double));
6885     exit(0);
6886 }
6887 EOCP
6888         set try
6889         if eval $compile_ok; then
6890                 doublesize=`$run ./try`
6891                 echo "Your double is $doublesize bytes long."
6892         else
6893                 dflt='8'
6894                 echo "(I can't seem to compile the test program.  Guessing...)"
6895                 rp="What is the size of a double precision number (in bytes)?"
6896                 . ./myread
6897                 doublesize="$ans"
6898         fi
6899         ;;
6900 esac
6901 $rm_try
6902
6903 : check for long doubles
6904 echo " "
6905 echo "Checking to see if you have long double..." >&4
6906 echo 'int main() { long double x = 7.0; }' > try.c
6907 set try
6908 if eval $compile; then
6909         val="$define"
6910         echo "You have long double."
6911 else
6912         val="$undef"
6913         echo "You do not have long double."
6914 fi
6915 $rm_try
6916 set d_longdbl
6917 eval $setvar
6918
6919 : see if ldexpl exists
6920 set ldexpl d_ldexpl
6921 eval $inlibc
6922
6923 : check for length of long double
6924 case "${d_longdbl}${longdblsize}" in
6925 $define)
6926         echo " "
6927         echo "Checking to see how big your long doubles are..." >&4
6928         $cat >try.c <<'EOCP'
6929 #include <stdio.h>
6930 int main()
6931 {
6932         printf("%d\n", sizeof(long double));
6933 }
6934 EOCP
6935         set try
6936         set try
6937         if eval $compile; then
6938                 longdblsize=`$run ./try`
6939                 echo "Your long doubles are $longdblsize bytes long."
6940         else
6941                 dflt='8'
6942                 echo " "
6943                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6944                 rp="What is the size of a long double (in bytes)?"
6945                 . ./myread
6946                 longdblsize="$ans"
6947         fi
6948         if $test "X$doublesize" = "X$longdblsize"; then
6949                 echo "That isn't any different from an ordinary double."
6950                 echo "I'll keep your setting anyway, but you may see some"
6951                 echo "harmless compilation warnings."
6952         fi
6953         ;;
6954 esac
6955 $rm_try
6956
6957 $echo "Checking the kind of long doubles you have..." >&4
6958 case "$d_longdbl" in
6959 define)
6960 $cat <<EOP >try.c
6961 #$i_stdlib I_STDLIB
6962 #define LONGDBLSIZE $longdblsize
6963 #define DOUBLESIZE $doublesize
6964 #include <float.h>
6965 #ifdef I_STDLIB
6966 #include <stdlib.h>
6967 #endif
6968 #include <stdio.h>
6969 static const long double d = -0.1L;
6970 int main() {
6971   unsigned const char* b = (unsigned const char*)(&d);
6972 #if DOUBLESIZE == LONGDBLSIZE
6973   printf("0\n"); /* if it floats like double */
6974   exit(0);
6975 #endif
6976 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6977   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6978     /* IEEE 754 128-bit little-endian */
6979     printf("1\n");
6980     exit(0);
6981   }
6982   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6983     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6984     printf("2\n");
6985     exit(0);
6986   }
6987 #endif
6988 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6989  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6990  * cannot be trusted. */
6991 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6992   if (b[0] == 0xCD && b[9] == 0xBF) {
6993     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6994      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6995      * Also known as "extended precision". */
6996     printf("3\n");
6997     exit(0);
6998   }
6999   if (b[0] == 0xBF && b[9] == 0xCD) {
7000     /* Is there ever big-endian 80-bit, really?
7001      *
7002      * The Motorola 68881 had another "extended precision" format:
7003      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7004      * for total of 96 bits of bytes.  The zero bits were unused.
7005      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7006      * If it ever becomes relevant, this format should be allocated
7007      * a new doublekind code since it's quite different from the Intel x87.
7008      */
7009     printf("4\n");
7010     exit(0);
7011   }
7012 #endif
7013 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7014   /* software "double double", the 106 is 53+53.
7015    * but irix thinks it is 107. */
7016   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7017     /* double double 128-bit fully little-endian,
7018      * little-endian doubles in little-endian order,
7019      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7020     printf("5\n");
7021     exit(0);
7022   }
7023   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7024     /* double double 128-bit fully big-endian,
7025      * big-endian doubles in big-endian order,
7026      * e.g. PPC/Power and MIPS:
7027      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7028     printf("6\n");
7029     exit(0);
7030   }
7031   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7032     /* double double 128-bit mixed endian.
7033      * little-endian doubles in big-endian order,
7034      * e.g. ppc64el,
7035      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7036     printf("7\n");
7037     exit(0);
7038   }
7039   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7040     /* double double 128-bit mixed endian,
7041      * big-endian doubles in little-endian order,
7042      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7043     printf("8\n");
7044     exit(0);
7045   }
7046 #endif
7047 /* We are largely making this up because it may well be
7048  * that the VAX format H was never made available to C,
7049  * only to Fortran. */
7050 #if LONGDBLSIZE == 16 && defined(__vax__)
7051   if (b[0] == 0xFD && b[15] == 0x99) {
7052     /* VAX format H, PDP-11 mixed endian. */
7053     printf("9\n");
7054     exit(0);
7055   }
7056 #endif
7057   printf("-1\n"); /* unknown */
7058   exit(0);
7059 }
7060 EOP
7061 set try
7062 if eval $compile; then
7063     longdblkind=`$run ./try`
7064 else
7065     longdblkind=-1
7066 fi
7067 ;;
7068 *) longdblkind=0 ;;
7069 esac
7070 case "$longdblkind" in
7071 0) echo "Your long doubles are doubles." >&4 ;;
7072 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7073 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7074 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7075 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7076 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7077 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7078 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7079 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7080 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7081 *) echo "Cannot figure out your long double." >&4 ;;
7082 esac
7083 d_long_double_style_ieee=$undef
7084 d_long_double_style_ieee_std=$undef
7085 d_long_double_style_ieee_extended=$undef
7086 d_long_double_style_ieee_doubledouble=$undef
7087 d_long_double_style_vax=$undef
7088 case "$longdblkind" in
7089 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7090 esac
7091 case "$longdblkind" in
7092 1|2) d_long_double_style_ieee_std=$define ;;
7093 esac
7094 case "$longdblkind" in
7095 3|4) d_long_double_style_ieee_extended=$define ;;
7096 esac
7097 case "$longdblkind" in
7098 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7099 esac
7100 case "$longdblkind" in
7101 9) d_long_double_style_vax=$define ;;
7102 esac
7103 $rm_try
7104
7105 : determine the architecture name
7106 echo " "
7107 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7108         tarch=`arch`"-$osname"
7109 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7110         if uname -m > tmparch 2>&1 ; then
7111                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7112                         -e 's/$/'"-$osname/" tmparch`
7113         else
7114                 tarch="$osname"
7115         fi
7116         $rm -f tmparch
7117 else
7118         tarch="$osname"
7119 fi
7120 case "$myarchname" in
7121 ''|"$tarch") ;;
7122 *)
7123         echo "(Your architecture name used to be $myarchname.)"
7124         archname=''
7125         ;;
7126 esac
7127 case "$targetarch" in
7128 '') ;;
7129 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7130 esac
7131 myarchname="$tarch"
7132 case "$archname" in
7133 '') dflt="$tarch";;
7134 *) dflt="$archname";;
7135 esac
7136 rp='What is your architecture name'
7137 . ./myread
7138 archname="$ans"
7139
7140 : optionally add API version to the architecture for versioned archlibs
7141 case "$useversionedarchname" in
7142 $define|true|[yY]*) dflt='y';;
7143 *)                  dflt='n';;
7144 esac
7145 rp='Add the Perl API version to your archname?'
7146 . ./myread
7147 case "$ans" in
7148 y|Y)    useversionedarchname="$define" ;;
7149 *)      useversionedarchname="$undef" ;;
7150 esac
7151 case "$useversionedarchname" in
7152 $define)
7153         case "$archname" in
7154         *-$api_versionstring)
7155                 echo "...and architecture name already has -$api_versionstring" >&4
7156                 ;;
7157         *)
7158                 archname="$archname-$api_versionstring"
7159                 echo "...setting architecture name to $archname." >&4
7160                 ;;
7161         esac
7162         ;;
7163 esac
7164
7165 case "$usethreads" in
7166 $define)
7167         echo "Threads selected." >&4
7168         case "$archname" in
7169         *-thread*) echo "...and architecture name already has -thread." >&4
7170                 ;;
7171         *)      archname="$archname-thread"
7172                 echo "...setting architecture name to $archname." >&4
7173                 ;;
7174         esac
7175         ;;
7176 esac
7177 case "$usemultiplicity" in
7178 $define)
7179         echo "Multiplicity selected." >&4
7180         case "$archname" in
7181         *-multi*) echo "...and architecture name already has -multi." >&4
7182                 ;;
7183         *)      archname="$archname-multi"
7184                 echo "...setting architecture name to $archname." >&4
7185                 ;;
7186         esac
7187         ;;
7188 esac
7189 case "$use64bitint$use64bitall" in
7190 *"$define"*)
7191         case "$archname64" in
7192         '')
7193                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7194                 ;;
7195         *)
7196                 case "$use64bitint" in
7197                 "$define") echo "64 bit integers selected." >&4 ;;
7198                 esac
7199                 case "$use64bitall" in
7200                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7201                 esac
7202                 case "$archname" in
7203                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7204                         ;;
7205                 *)      archname="$archname-$archname64"
7206                         echo "...setting architecture name to $archname." >&4
7207                         ;;
7208                 esac
7209                 ;;
7210         esac
7211 esac
7212 case "$uselongdouble" in
7213 $define)
7214         echo "Long doubles selected." >&4
7215         case "$longdblsize" in
7216         $doublesize)
7217                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7218                 ;;
7219         *)
7220                 case "$archname" in
7221                 *-ld*) echo "...and architecture name already has -ld." >&4
7222                         ;;
7223                 *)      archname="$archname-ld"
7224                         echo "...setting architecture name to $archname." >&4
7225                         ;;
7226                 esac
7227                 ;;
7228         esac
7229         ;;
7230 esac
7231 case "$usequadmath" in
7232 $define)
7233         echo "quadmath selected." >&4
7234         case "$archname" in
7235         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7236                 ;;
7237         *)      archname="$archname-quadmath"
7238                 echo "...setting architecture name to $archname." >&4
7239                 ;;
7240         esac
7241         ;;
7242 esac
7243 if $test -f archname.cbu; then
7244         echo "Your platform has some specific hints for architecture name, using them..."
7245         . ./archname.cbu
7246 fi
7247
7248 : set the prefixit variable, to compute a suitable default value
7249 prefixit='case "$3" in
7250 ""|none)
7251         case "$oldprefix" in
7252         "") eval "$1=\"\$$2\"";;
7253         *)
7254                 case "$3" in
7255                 "") eval "$1=";;
7256                 none)
7257                         eval "tp=\"\$$2\"";
7258                         case "$tp" in
7259                         ""|" ") eval "$1=\"\$$2\"";;
7260                         *) eval "$1=";;
7261                         esac;;
7262                 esac;;
7263         esac;;
7264 *)
7265         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7266         case "$tp" in
7267         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7268         /*-$oldprefix/*|\~*-$oldprefix/*)
7269                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7270         *) eval "$1=\"\$$2\"";;
7271         esac;;
7272 esac'
7273
7274 : determine installation style
7275 : For now, try to deduce it from prefix unless it is already set.
7276 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7277 case "$installstyle" in
7278 '')     case "$prefix" in
7279                 *perl*) dflt='lib';;
7280                 *) dflt='lib/perl5' ;;
7281         esac
7282         ;;
7283 *)      dflt="$installstyle" ;;
7284 esac
7285 : Probably not worth prompting for this since we prompt for all
7286 : the directories individually, and the prompt would be too long and
7287 : confusing anyway.
7288 installstyle=$dflt
7289
7290 : determine where public executables go
7291 echo " "
7292 set dflt bin bin
7293 eval $prefixit
7294 fn=d~
7295 rp='Pathname where the public executables will reside?'
7296 . ./getfile
7297 if $test "X$ansexp" != "X$binexp"; then
7298         installbin=''
7299 fi
7300 prefixvar=bin
7301 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7302 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7303 :     this via initialinstalllocation
7304 . ./setprefixvar
7305
7306 case "$userelocatableinc" in
7307 $define|true|[yY]*)     dflt='y' ;;
7308 *)                      dflt='n' ;;
7309 esac
7310 cat <<EOM
7311
7312 Would you like to build Perl so that the installation is relocatable, so that
7313 library paths in @INC are determined relative to the path of the perl binary?
7314 This is not advised for system Perl installs, or if you need to run setid
7315 scripts or scripts under taint mode.
7316
7317 If this doesn't make any sense to you, just accept the default '$dflt'.
7318 EOM
7319 rp='Use relocatable @INC?'
7320 . ./myread
7321 case "$ans" in
7322 y|Y)    val="$define" ;;
7323 *)      val="$undef"  ;;
7324 esac
7325 set userelocatableinc
7326 eval $setvar
7327
7328 initialinstalllocation="$binexp"
7329 : Default prefix is now "up one level from where the binaries are"
7330 case "$userelocatableinc" in
7331 $define|true|[yY]*)
7332     bin=".../"
7333     binexp=".../"
7334     prefix=".../.."
7335     prefixexp=".../.."
7336     installprefixexp=".../.."
7337     ;;
7338 esac
7339
7340 : determine where private library files go
7341 : Usual default is /usr/local/lib/perl5/$version.
7342 : Also allow things like /opt/perl/lib/$version, since
7343 : /opt/perl/lib/perl5... would be redundant.
7344 : The default "style" setting is made in installstyle.U
7345 case "$installstyle" in
7346 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7347 *)       set dflt privlib lib/$version ;;
7348 esac
7349 eval $prefixit
7350 $cat <<EOM
7351
7352 There are some auxiliary files for $package that need to be put into a
7353 private library directory that is accessible by everyone.
7354
7355 EOM
7356 fn=$binexp
7357 fn=d~+
7358 rp='Pathname where the private library files will reside?'
7359 . ./getfile
7360 prefixvar=privlib
7361 . ./setprefixvar
7362
7363 : set the prefixup variable, to restore leading tilda escape
7364 prefixup='case "$prefixexp" in
7365 "$prefix") ;;
7366 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7367 esac'
7368
7369 : determine where public architecture dependent libraries go
7370 set archlib archlib
7371 eval $prefixit
7372 : privlib default is /usr/local/lib/$package/$version
7373 : archlib default is /usr/local/lib/$package/$version/$archname
7374 : privlib may have an optional trailing /share.
7375 tdflt=`echo $privlib | $sed 's,/share$,,'`
7376 tdflt=$tdflt/$archname
7377 case "$archlib" in
7378 '')     dflt=$tdflt
7379         ;;
7380 *)      dflt="$archlib"
7381     ;;
7382 esac
7383 $cat <<EOM
7384
7385 $spackage contains architecture-dependent library files.  If you are
7386 sharing libraries in a heterogeneous environment, you might store
7387 these files in a separate location.  Otherwise, you can just include
7388 them with the rest of the public library files.
7389
7390 EOM
7391 fn=$binexp
7392 fn=d+~
7393 rp='Where do you want to put the public architecture-dependent libraries?'
7394 . ./getfile
7395 prefixvar=archlib
7396 . ./setprefixvar
7397 if $test X"$archlib" = X"$privlib"; then
7398         d_archlib="$undef"
7399 else
7400         d_archlib="$define"
7401 fi
7402
7403 : see if setuid scripts can be secure
7404 $cat <<EOM
7405
7406 Some kernels have a bug that prevents setuid #! scripts from being
7407 secure.  Some sites have disabled setuid #! scripts because of this.
7408
7409 First let's decide if your kernel supports secure setuid #! scripts.
7410 (If setuid #! scripts would be secure but have been disabled anyway,
7411 don't say that they are secure if asked.)
7412
7413 EOM
7414
7415 val="$undef"
7416 if $test -d /dev/fd; then
7417         echo "#!$ls" >reflect
7418         chmod +x,u+s reflect
7419         ./reflect >flect 2>&1
7420         if $contains "/dev/fd" flect >/dev/null; then
7421                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7422                 val="$define"
7423         else
7424                 $cat <<EOM
7425 If you are not sure if they are secure, I can check but I'll need a
7426 username and password different from the one you are using right now.
7427 If you don't have such a username or don't want me to test, simply
7428 enter 'none'.
7429
7430 EOM
7431                 rp='Other username to test security of setuid scripts with?'
7432                 dflt='none'
7433                 . ./myread
7434                 case "$ans" in
7435                 n|none)
7436                         case "$d_suidsafe" in
7437                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7438                                 dflt=n;;
7439                         "$undef")
7440                                 echo "Well, the $hint value is *not* secure." >&4
7441                                 dflt=n;;
7442                         *)      echo "Well, the $hint value *is* secure." >&4
7443                                 dflt=y;;
7444                         esac
7445                         ;;
7446                 *)
7447                         $rm -f reflect flect
7448                         echo "#!$ls" >reflect
7449                         chmod +x,u+s reflect
7450                         echo >flect
7451                         chmod a+w flect
7452                         echo '"su" will (probably) prompt you for '"$ans's password."
7453                         su $ans -c './reflect >flect'
7454                         if $contains "/dev/fd" flect >/dev/null; then
7455                                 echo "Okay, it looks like setuid scripts are secure." >&4
7456                                 dflt=y
7457                         else
7458                                 echo "I don't think setuid scripts are secure." >&4
7459                                 dflt=n
7460                         fi
7461                         ;;
7462                 esac
7463                 rp='Does your kernel have *secure* setuid scripts?'
7464                 . ./myread
7465                 case "$ans" in
7466                 [yY]*)  val="$define";;
7467                 *)      val="$undef";;
7468                 esac
7469         fi
7470 else
7471         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7472         echo "(That's for file descriptors, not floppy disks.)"
7473         val="$undef"
7474 fi
7475 set d_suidsafe
7476 eval $setvar
7477
7478 $rm -f reflect flect
7479
7480 : now see if they want to do setuid emulation
7481 if $test $patchlevel -lt 11; then
7482 echo " "
7483 val="$undef"
7484 case "$d_suidsafe" in
7485 "$define")
7486         val="$undef"
7487         echo "No need to emulate SUID scripts since they are secure here." >&4
7488         ;;
7489 *)
7490         $cat <<EOM
7491 Some systems have disabled setuid scripts, especially systems where
7492 setuid scripts cannot be secure.  On systems where setuid scripts have
7493 been disabled, the setuid/setgid bits on scripts are currently
7494 useless.  It is possible for $package to detect those bits and emulate
7495 setuid/setgid in a secure fashion.  This emulation will only work if
7496 setuid scripts have been disabled in your kernel.
7497
7498 EOM
7499         case "$d_dosuid" in
7500         "$define") dflt=y ;;
7501         *) dflt=n ;;
7502         esac
7503         rp="Do you want to do setuid/setgid emulation?"
7504         . ./myread
7505         case "$ans" in
7506         [yY]*)  val="$define";;
7507         *)      val="$undef";;
7508         esac
7509         ;;
7510 esac
7511 set d_dosuid
7512 eval $setvar
7513 else
7514     case "$d_dosuid" in
7515         "$define")
7516         cat >&4 <<EOH
7517
7518 SUID emulation has been removed for 5.12
7519 Please re-run Configure without -Dd_dosuid
7520
7521 EOH
7522         exit 1;
7523         ;;
7524     esac
7525     d_dosuid=undef
7526 fi
7527
7528 : Find perl5.005 or later.
7529 echo "Looking for a previously installed perl5.005 or later... "
7530 case "$perl5" in
7531 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7532                 : Check if this perl is recent and can load a simple module
7533                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7534                         perl5=$tdir/perl
7535                         break;
7536                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7537                         perl5=$tdir/perl5
7538                         break;
7539                 fi
7540         done
7541         ;;
7542 *)      perl5="$perl5"
7543         ;;
7544 esac
7545 case "$perl5" in
7546 '')     echo "None found.  That's ok.";;
7547 *)      echo "Using $perl5." ;;
7548 esac
7549
7550 : Set the siteprefix variables
7551 $cat <<EOM
7552
7553 After $package is installed, you may wish to install various
7554 add-on modules and utilities.  Typically, these add-ons will
7555 be installed under $prefix with the rest
7556 of this package.  However, you may wish to install such add-ons
7557 elsewhere under a different prefix.
7558
7559 If you do not wish to put everything under a single prefix, that's
7560 ok.  You will be prompted for the individual locations; this siteprefix
7561 is only used to suggest the defaults.
7562
7563 The default should be fine for most people.
7564
7565 EOM
7566 fn=d~+
7567 rp='Installation prefix to use for add-on modules and utilities?'
7568 : XXX Here might be another good place for an installstyle setting.
7569 case "$siteprefix" in
7570 '') dflt=$prefix ;;
7571 *)  dflt=$siteprefix ;;
7572 esac
7573 . ./getfile
7574 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7575 oldsiteprefix=''
7576 case "$siteprefix" in
7577 '') ;;
7578 *)      case "$ans" in
7579         "$prefix") ;;
7580         *) oldsiteprefix="$prefix";;
7581         esac
7582         ;;
7583 esac
7584 siteprefix="$ans"
7585 siteprefixexp="$ansexp"
7586
7587 : determine where site specific libraries go.
7588 : Usual default is /usr/local/lib/perl5/site_perl/$version
7589 : The default "style" setting is made in installstyle.U
7590 : XXX No longer works with Prefixit stuff.
7591 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7592 case "$sitelib" in
7593 '') case "$installstyle" in
7594         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7595         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7596         esac
7597         ;;
7598 *)      dflt="$sitelib"
7599         ;;
7600 esac
7601 $cat <<EOM
7602
7603 The installation process will create a directory for
7604 site-specific extensions and modules.  Most users find it convenient
7605 to place all site-specific files in this directory rather than in the
7606 main distribution directory.
7607
7608 EOM
7609 fn=d~+
7610 rp='Pathname for the site-specific library files?'
7611 . ./getfile
7612 prefixvar=sitelib
7613 . ./setprefixvar
7614 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7615
7616 : Determine list of previous versions to include in @INC
7617 $cat > getverlist <<EOPL
7618 #!$perl5 -w
7619 use File::Basename;
7620 \$api_versionstring = "$api_versionstring";
7621 \$version = "$version";
7622 \$stem = "$sitelib_stem";
7623 \$archname = "$archname";
7624 EOPL
7625         $cat >> getverlist <<'EOPL'
7626 # The list found is store twice for each entry: the original name, and
7627 # the binary broken down version as pack "sss", so sorting is easy and
7628 # unambiguous. This will work for all versions that have a maximum of
7629 # three digit groups, separate by '.'s or '_'s. Names are extended with
7630 # ".0.0" to ensure at least three elements for the pack.
7631 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7632
7633 # Can't have leading @ because metaconfig interprets it as a command!
7634 ;@inc_version_list=();
7635 # XXX Redo to do opendir/readdir?
7636 if (-d $stem) {
7637     chdir($stem);
7638     ;@candidates = map {
7639         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7640     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7641 }
7642 else {
7643     ;@candidates = ();
7644 }
7645
7646 ($pversion, $aversion, $vsn5005) = map {
7647     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7648 foreach $d (@candidates) {
7649     if ($d->[1] lt $pversion) {
7650         if ($d->[1] ge $aversion) {
7651             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7652         }
7653         elsif ($d->[1] ge $vsn5005) {
7654             unshift(@inc_version_list, grep { -d } $d->[0]);
7655         }
7656     }
7657     else {
7658         # Skip newer version.  I.e. don't look in
7659         # 5.7.0 if we're installing 5.6.1.
7660     }
7661 }
7662
7663 if (@inc_version_list) {
7664     print join(' ', @inc_version_list);
7665 }
7666 else {
7667     # Blank space to preserve value for next Configure run.
7668     print " ";
7669 }
7670 EOPL
7671 chmod +x getverlist
7672 case "$inc_version_list" in
7673 '')     if test -x "$perl5$exe_ext"; then
7674                 dflt=`$perl5 getverlist`
7675         else
7676                 dflt='none'
7677         fi
7678         ;;
7679 $undef) dflt='none' ;;
7680 *)  eval dflt=\"$inc_version_list\" ;;
7681 esac
7682 case "$dflt" in
7683 ''|' ') dflt=none ;;
7684 esac
7685 case "$dflt" in
7686 5.005) dflt=none ;;
7687 esac
7688 $cat <<EOM
7689
7690 In order to ease the process of upgrading, this version of perl
7691 can be configured to use modules built and installed with earlier
7692 versions of perl that were installed under $prefix.  Specify here
7693 the list of earlier versions that this version of perl should check.
7694 If Configure detected no earlier versions of perl installed under
7695 $prefix, then the list will be empty.  Answer 'none' to tell perl
7696 to not search earlier versions.
7697
7698 The default should almost always be sensible, so if you're not sure,
7699 just accept the default.
7700 EOM
7701
7702 rp='List of earlier versions to include in @INC?'
7703 . ./myread
7704 case "$ans" in
7705 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7706 *) inc_version_list="$ans" ;;
7707 esac
7708 case "$inc_version_list" in
7709 ''|' ')
7710         inc_version_list_init='0'
7711         d_inc_version_list="$undef"
7712         ;;
7713 *)      inc_version_list_init=`echo $inc_version_list |
7714                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7715         d_inc_version_list="$define"
7716         ;;
7717 esac
7718 $rm -f getverlist
7719
7720 : see if malloc/malloc.h has to be included
7721 set malloc/malloc.h i_mallocmalloc
7722 eval $inhdr
7723
7724 : see if this is a malloc.h system
7725 : we want a real compile instead of Inhdr because some systems have a
7726 : malloc.h that just gives a compile error saying to use stdlib.h instead
7727 echo " "
7728 $cat >try.c <<EOCP
7729 #include <stdlib.h>
7730 #include <malloc.h>
7731 #$i_mallocmalloc I_MALLOCMALLOC
7732 #ifdef I_MALLOCMALLOC
7733 # include <malloc/malloc.h>
7734 #endif
7735
7736 int main () { return 0; }
7737 EOCP
7738 set try
7739 if eval $compile; then
7740     echo "<malloc.h> found." >&4
7741     val="$define"
7742 else
7743     echo "<malloc.h> NOT found." >&4
7744     val="$undef"
7745 fi
7746 $rm_try
7747 set i_malloc
7748 eval $setvar
7749
7750 : check for length of pointer
7751 echo " "
7752 case "$ptrsize" in
7753 '')
7754         echo "Checking to see how big your pointers are..." >&4
7755         $cat >try.c <<EOCP
7756 #include <stdio.h>
7757 #$i_stdlib I_STDLIB
7758 #ifdef I_STDLIB
7759 #include <stdlib.h>
7760 #endif
7761 int main()
7762 {
7763     printf("%d\n", (int)sizeof(void *));
7764     exit(0);
7765 }
7766 EOCP
7767         set try
7768         if eval $compile_ok; then
7769                 ptrsize=`$run ./try`
7770                 echo "Your pointers are $ptrsize bytes long."
7771         else
7772                 dflt='4'
7773                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7774                 rp="What is the size of a pointer (in bytes)?"
7775                 . ./myread
7776                 ptrsize="$ans"
7777         fi
7778         ;;
7779 esac
7780 $rm_try
7781 case "$use64bitall" in
7782 "$define"|true|[yY]*)
7783         case "$ptrsize" in
7784         4)      cat <<EOM >&4
7785
7786 *** You have chosen a maximally 64-bit build,
7787 *** but your pointers are only 4 bytes wide.
7788 *** Please rerun Configure without -Duse64bitall.
7789 EOM
7790                 case "$d_quad" in
7791                 define)
7792                         cat <<EOM >&4
7793 *** Since you have quads, you could possibly try with -Duse64bitint.
7794 EOM
7795                         ;;
7796                 esac
7797                 cat <<EOM >&4
7798 *** Cannot continue, aborting.
7799
7800 EOM
7801
7802                 exit 1
7803                 ;;
7804         esac
7805         ;;
7806 esac
7807
7808 : determine whether to use malloc wrapping
7809 echo " "
7810 case "$usemallocwrap" in
7811 [yY]*|true|$define)     dflt='y' ;;
7812 [nN]*|false|$undef)     dflt='n' ;;
7813 *)      case "$usedevel" in
7814         [yY]*|true|$define)     dflt='y' ;;
7815         *) dflt='n' ;;
7816         esac
7817         ;;
7818 esac
7819 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7820 . ./myread
7821 usemallocwrap="$ans"
7822 case "$ans" in
7823 y*|true)
7824         usemallocwrap="$define" ;;
7825 *)
7826         usemallocwrap="$undef" ;;
7827 esac
7828
7829 : determine which malloc to compile in
7830 echo " "
7831 case "$usemymalloc" in
7832 [yY]*|true|$define)     dflt='y' ;;
7833 [nN]*|false|$undef)     dflt='n' ;;
7834 *)      case "$ptrsize" in
7835         4) dflt='y' ;;
7836         *) dflt='n' ;;
7837         esac
7838         if test "$useithreads" = "$define"; then dflt='n'; fi
7839         ;;
7840 esac
7841 rp="Do you wish to attempt to use the malloc that comes with $package?"
7842 . ./myread
7843 usemymalloc="$ans"
7844 case "$ans" in
7845 y*|true)
7846         usemymalloc='y'
7847         mallocsrc='malloc.c'
7848         mallocobj="malloc$_o"
7849         d_mymalloc="$define"
7850         case "$libs" in
7851         *-lmalloc*)
7852                 : Remove malloc from list of libraries to use
7853                 echo "Removing unneeded -lmalloc from library list" >&4
7854                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7855                 shift
7856                 libs="$*"
7857                 echo "libs = $libs" >&4
7858                 ;;
7859         esac
7860         ;;
7861 *)
7862         usemymalloc='n'
7863         mallocsrc=''
7864         mallocobj=''
7865         d_mymalloc="$undef"
7866         ;;
7867 esac
7868
7869 : compute the return types of malloc and free
7870 echo " "
7871 $cat >malloc.c <<END
7872 #$i_malloc I_MALLOC
7873 #$i_stdlib I_STDLIB
7874 #include <stdio.h>
7875 #include <sys/types.h>
7876 #ifdef I_MALLOC
7877 #include <malloc.h>
7878 #endif
7879 #ifdef I_STDLIB
7880 #include <stdlib.h>
7881 #endif
7882 #ifdef TRY_MALLOC
7883 void *malloc();
7884 #endif
7885 #ifdef TRY_FREE
7886 void free();
7887 #endif
7888 END
7889 case "$malloctype" in
7890 '')
7891         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7892                 malloctype='void *'
7893         else
7894                 malloctype='char *'
7895         fi
7896         ;;
7897 esac
7898 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7899
7900 case "$freetype" in
7901 '')
7902         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7903                 freetype='void'
7904         else
7905                 freetype='int'
7906         fi
7907         ;;
7908 esac
7909 echo "Your system uses $freetype free(), it would seem." >&4
7910 $rm -f malloc.[co]
7911 : determine where site specific architecture-dependent libraries go.
7912 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7913 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7914 : sitelib may have an optional trailing /share.
7915 case "$sitearch" in
7916 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7917         dflt="$dflt/$archname"
7918         ;;
7919 *)      dflt="$sitearch"
7920         ;;
7921 esac
7922 set sitearch sitearch none
7923 eval $prefixit
7924 $cat <<EOM
7925
7926 The installation process will also create a directory for
7927 architecture-dependent site-specific extensions and modules.
7928
7929 EOM
7930 fn=d~+
7931 rp='Pathname for the site-specific architecture-dependent library files?'
7932 . ./getfile
7933 prefixvar=sitearch
7934 . ./setprefixvar
7935 if $test X"$sitearch" = X"$sitelib"; then
7936         d_sitearch="$undef"
7937 else
7938         d_sitearch="$define"
7939 fi
7940
7941 : Set the vendorprefix variables
7942 $cat <<EOM
7943
7944 The installation process will also create a directory for
7945 vendor-supplied add-ons.  Vendors who supply perl with their system
7946 may find it convenient to place all vendor-supplied files in this
7947 directory rather than in the main distribution directory.  This will
7948 ease upgrades between binary-compatible maintenance versions of perl.
7949
7950 Of course you may also use these directories in whatever way you see
7951 fit.  For example, you might use them to access modules shared over a
7952 company-wide network.
7953
7954 The default answer should be fine for most people.
7955 This causes further questions about vendor add-ons to be skipped
7956 and no vendor-specific directories will be configured for perl.
7957
7958 EOM
7959 rp='Do you want to configure vendor-specific add-on directories?'
7960 case "$usevendorprefix" in
7961 define|true|[yY]*) dflt=y ;;
7962 *)      : User may have set vendorprefix directly on Configure command line.
7963         case "$vendorprefix" in
7964         ''|' ') dflt=n ;;
7965         *)      dflt=y ;;
7966         esac
7967         ;;
7968 esac
7969 . ./myread
7970 case "$ans" in
7971 [yY]*)  fn=d~+
7972         rp='Installation prefix to use for vendor-supplied add-ons?'
7973         case "$vendorprefix" in
7974         '') dflt="$prefix" ;;
7975         *)  dflt=$vendorprefix ;;
7976         esac
7977         . ./getfile
7978         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7979         oldvendorprefix=''
7980         case "$vendorprefix" in
7981         '') ;;
7982         *)      case "$ans" in
7983                 "$prefix") ;;
7984                 *) oldvendorprefix="$prefix";;
7985                 esac
7986                 ;;
7987         esac
7988         usevendorprefix="$define"
7989         vendorprefix="$ans"
7990         vendorprefixexp="$ansexp"
7991         ;;
7992 *)      usevendorprefix="$undef"
7993         vendorprefix=''
7994         vendorprefixexp=''
7995         ;;
7996 esac
7997
7998 : Set the vendorlib variables
7999 case "$vendorprefix" in
8000 '')     d_vendorlib="$undef"
8001         vendorlib=''
8002         vendorlibexp=''
8003         ;;
8004 *)      d_vendorlib="$define"
8005         : determine where vendor-supplied modules go.
8006         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8007         case "$vendorlib" in
8008         '')
8009                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8010                 case "$installstyle" in
8011                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8012                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8013                 esac
8014                 ;;
8015         *)      dflt="$vendorlib"
8016                 ;;
8017         esac
8018         fn=d~+
8019         rp='Pathname for the vendor-supplied library files?'
8020         . ./getfile
8021         vendorlib="$ans"
8022         vendorlibexp="$ansexp"
8023         ;;
8024 esac
8025 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8026 prefixvar=vendorlib
8027 . ./installprefix
8028
8029 : Set the vendorarch variables
8030 case "$vendorprefix" in
8031 '')     d_vendorarch="$undef"
8032         vendorarch=''
8033         vendorarchexp=''
8034         ;;
8035 *)      d_vendorarch="$define"
8036         : determine where vendor-supplied architecture-dependent libraries go.
8037         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8038         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8039         : vendorlib may have an optional trailing /share.
8040         case "$vendorarch" in
8041         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8042                 dflt="$dflt/$archname"
8043                 ;;
8044         *)      dflt="$vendorarch" ;;
8045         esac
8046         fn=d~+
8047         rp='Pathname for vendor-supplied architecture-dependent files?'
8048         . ./getfile
8049         vendorarch="$ans"
8050         vendorarchexp="$ansexp"
8051         ;;
8052 esac
8053 prefixvar=vendorarch
8054 . ./installprefix
8055 if $test X"$vendorarch" = X"$vendorlib"; then
8056         d_vendorarch="$undef"
8057 else
8058         d_vendorarch="$define"
8059 fi
8060
8061 : Final catch-all directories to search
8062 $cat <<EOM
8063
8064 Lastly, you can have perl look in other directories for extensions and
8065 modules in addition to those already specified.
8066 These directories will be searched after
8067         $sitearch
8068         $sitelib
8069 EOM
8070 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8071 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8072 echo ' '
8073 case "$otherlibdirs" in
8074 ''|' ') dflt='none' ;;
8075 *)      dflt="$otherlibdirs" ;;
8076 esac
8077 $cat <<EOM
8078 Enter a colon-separated set of extra paths to include in perl's @INC
8079 search path, or enter 'none' for no extra paths.
8080
8081 EOM
8082
8083 rp='Colon-separated list of additional directories for perl to search?'
8084 . ./myread
8085 case "$ans" in
8086 ' '|''|none)    otherlibdirs=' ' ;;
8087 *)      otherlibdirs="$ans" ;;
8088 esac
8089 case "$otherlibdirs" in
8090 ' ') val=$undef ;;
8091 *)      val=$define ;;
8092 esac
8093 set d_perl_otherlibdirs
8094 eval $setvar
8095
8096 : DTrace support
8097 dflt_dtrace='/usr/sbin/dtrace'
8098 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8099
8100 cat <<EOM
8101
8102 Perl can be built to support DTrace on platforms that support it.
8103 DTrace is a diagnosis and performance analysis tool from Sun.
8104
8105 If this doesn't make any sense to you, just accept the default.
8106 EOM
8107
8108 while $test 1 ; do
8109         case "$usedtrace" in
8110         $define|true|[yY]*)
8111                 dflt='y'
8112                 ;;
8113         ?*)
8114                 dflt='y'
8115                 dflt_dtrace=$usedtrace
8116                 ;;
8117         *)
8118                 dflt='n'
8119                 ;;
8120         esac
8121
8122         rp='Support DTrace if available?'
8123         . ./myread
8124         case "$ans" in
8125         y|Y)    val="$define" ;;
8126         *)      val="$undef" ;;
8127         esac
8128         set usedtrace
8129         eval $setvar
8130
8131         test "X$usedtrace" != "X$define" && break
8132
8133         echo " "
8134         rp='Where is the dtrace executable?'
8135         dflt=$dflt_dtrace
8136         . ./getfile
8137         val="$ans"
8138         set dtrace
8139         eval $setvar
8140
8141         if $test -f $dtrace
8142         then
8143                 if $dtrace -h -s ../perldtrace.d \
8144                         -o perldtrace.tmp >/dev/null 2>&1 \
8145                         && rm -f perldtrace.tmp
8146                 then
8147                         echo " "
8148                         echo "Good: your $dtrace knows about the -h flag."
8149                 else
8150                         cat >&2 <<EOM
8151
8152 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8153 ***
8154 *** Your installed dtrace doesn't support the -h switch to compile a D
8155 *** program into a C header. Can't continue.
8156
8157 EOM
8158                         exit 1
8159                 fi
8160                 break;
8161         fi
8162
8163         case "$fastread" in
8164         yes)
8165                 cat >&2 <<EOM
8166
8167 *** $me:  Fatal Error:  $dtrace not found.
8168 *** Can't continue.
8169
8170 EOM
8171                 exit 1
8172                 ;;
8173         *)
8174                 echo "*** $dtrace was not found."
8175                 echo " "
8176                 ;;
8177         esac
8178 done
8179
8180 : See if we want extra modules installed
8181 echo " "
8182 case "$extras" in
8183 '') dflt='n';;
8184 *) dflt='y';;
8185 esac
8186 cat <<EOM
8187 Perl can be built with extra modules or bundles of modules which
8188 will be fetched from the CPAN and installed alongside Perl.
8189
8190 Notice that you will need access to the CPAN; either via the Internet,
8191 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8192 be asked later to configure the CPAN.pm module which will in turn do
8193 the installation of the rest of the extra modules or bundles.)
8194
8195 Notice also that if the modules require any external software such as
8196 libraries and headers (the libz library and the zlib.h header for the
8197 Compress::Zlib module, for example) you MUST have any such software
8198 already installed, this configuration process will NOT install such
8199 things for you.
8200
8201 If this doesn't make any sense to you, just accept the default '$dflt'.
8202 EOM
8203 rp='Install any extra modules (y or n)?'
8204 . ./myread
8205 case "$ans" in
8206 y|Y)
8207         cat <<EOM
8208
8209 Please list any extra modules or bundles to be installed from CPAN,
8210 with spaces between the names.  The names can be in any format the
8211 'install' command of CPAN.pm will understand.  (Answer 'none',
8212 without the quotes, to install no extra modules or bundles.)
8213 EOM
8214         rp='Extras?'
8215         dflt="$extras"
8216         . ./myread
8217         extras="$ans"
8218 esac
8219 case "$extras" in
8220 ''|'none')
8221         val=''
8222         $rm -f ../extras.lst
8223         ;;
8224 *)      echo "(Saving the list of extras for later...)"
8225         echo "$extras" > ../extras.lst
8226         val="'$extras'"
8227         ;;
8228 esac
8229 set extras
8230 eval $setvar
8231 echo " "
8232
8233 : determine where html pages for programs go
8234 set html1dir html1dir none
8235 eval $prefixit
8236 $cat <<EOM
8237
8238 If you wish to install html files for programs in $spackage, indicate
8239 the appropriate directory here.  To skip installing html files,
8240 answer "none".
8241 EOM
8242 case "$html1dir" in
8243 ''|none|$undef|' ') dflt=none ;;
8244 *) dflt=$html1dir ;;
8245 esac
8246 fn=dn+~
8247 rp="Directory for the main $spackage html pages?"
8248 . ./getfile
8249 prefixvar=html1dir
8250 . ./setprefixvar
8251 : Use ' ' for none so value is preserved next time through Configure
8252 $test X"$html1dir" = "X" && html1dir=' '
8253
8254 : determine where html pages for libraries and modules go
8255 set html3dir html3dir none
8256 eval $prefixit
8257 $cat <<EOM
8258
8259 If you wish to install html files for modules associated with $spackage,
8260 indicate the appropriate directory here.  To skip installing html files,
8261 answer "none".
8262 EOM
8263 : There is no obvious default.  If they have specified html1dir, then
8264 : try to key off that, possibly changing .../html1 into .../html3.
8265 case "$html3dir" in
8266 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8267 *) dflt=$html3dir ;;
8268 esac
8269 fn=dn+~
8270 rp="Directory for the $spackage module html pages?"
8271 . ./getfile
8272 prefixvar=html3dir
8273 . ./setprefixvar
8274 : Use ' ' for none so value is preserved next time through Configure
8275 $test X"$html3dir" = "X" && html3dir=' '
8276
8277 : determine whether to install perl also as /usr/bin/perl
8278
8279 echo " "
8280 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8281         $cat <<EOM
8282 Many scripts expect perl to be installed as /usr/bin/perl.
8283
8284 If you want to, I can install the perl you are about to compile
8285 as /usr/bin/perl (in addition to $bin/perl).
8286 EOM
8287         if test -f /usr/bin/perl; then
8288             $cat <<EOM
8289
8290 However, please note that because you already have a /usr/bin/perl,
8291 overwriting that with a new Perl would very probably cause problems.
8292 Therefore I'm assuming you don't want to do that (unless you insist).
8293
8294 EOM
8295             case "$installusrbinperl" in
8296             "$define"|[yY]*)    dflt='y';;
8297             *)                  dflt='n';;
8298             esac
8299         else
8300             $cat <<EOM
8301
8302 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8303
8304 EOM
8305             case "$installusrbinperl" in
8306             "$undef"|[nN]*)     dflt='n';;
8307             *)                  dflt='y';;
8308             esac
8309         fi
8310         rp="Do you want to install perl as /usr/bin/perl?"
8311         . ./myread
8312         case "$ans" in
8313         [yY]*)  val="$define";;
8314         *)      val="$undef" ;;
8315         esac
8316 else
8317         val="$undef"
8318 fi
8319 set installusrbinperl
8320 eval $setvar
8321
8322 : see if dlopen exists
8323 xxx_runnm="$runnm"
8324 xxx_ccflags="$ccflags"
8325 runnm=false
8326 : with g++ one needs -shared to get is-in-libc to work for dlopen
8327 case "$gccversion" in
8328 '')     ;;
8329 *Clang*)        ;;
8330 *)      case "$d_cplusplus" in
8331         "$define") ccflags="$ccflags -shared" ;;
8332         esac
8333         ;;
8334 esac
8335 set dlopen d_dlopen
8336 eval $inlibc
8337 runnm="$xxx_runnm"
8338 ccflags="$xxx_ccflags"
8339
8340 : see if this is a unistd.h system
8341 set unistd.h i_unistd
8342 eval $inhdr
8343
8344 : determine which dynamic loading, if any, to compile in
8345 echo " "
8346 dldir="ext/DynaLoader"
8347 case "$usedl" in
8348     $define|y|true)
8349         dflt='y'
8350         usedl="$define"
8351         ;;
8352     $undef|n|false)
8353         dflt='n'
8354         usedl="$undef"
8355         ;;
8356     *)
8357         dflt='n'
8358         case "$d_dlopen" in
8359             $define) dflt='y' ;;
8360         esac
8361         : Does a dl_xxx.xs file exist for this operating system
8362         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8363         ;;
8364 esac
8365 rp="Do you wish to use dynamic loading?"
8366 . ./myread
8367 usedl="$ans"
8368 bin_ELF="$undef"
8369 case "$ans" in
8370     y*) usedl="$define"
8371         case "$dlsrc" in
8372             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8373                     dflt="$dldir/dl_${osname}.xs"
8374                 elif $test "$d_dlopen" = "$define" ; then
8375                     dflt="$dldir/dl_dlopen.xs"
8376                 else
8377                     dflt=''
8378                 fi
8379                 ;;
8380             *)  dflt="$dldir/$dlsrc"
8381                 ;;
8382         esac
8383         echo "The following dynamic loading files are available:"
8384         : Can not go over to $dldir because getfile has path hard-coded in.
8385         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8386         rp="Source file to use for dynamic loading"
8387         fn="fne"
8388         gfpth="$src"
8389         . ./getfile
8390         usedl="$define"
8391         : emulate basename
8392         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8393
8394         $cat << EOM
8395
8396 Some systems may require passing special flags to $cc -c to
8397 compile modules that will be used to create a shared library.
8398 To use no flags, say "none".
8399
8400 EOM
8401         case "$cccdlflags" in
8402             '') case "$gccversion" in
8403                 '') case "$osname" in
8404                         hpux)   dflt='+z' ;;
8405                         irix*)  dflt='-KPIC' ;;
8406                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8407                         sunos)  dflt='-pic' ;;
8408                         *)      dflt='none' ;;
8409                     esac
8410                     ;;
8411                 *)  case "$osname" in
8412                         darwin) dflt='none' ;;
8413                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8414                         *)      dflt='-fpic' ;;
8415                     esac ;;
8416                 esac ;;
8417             ' ') dflt='none' ;;
8418             *)   dflt="$cccdlflags" ;;
8419         esac
8420
8421         case "$dflt" in
8422             none) dflt='' ;;
8423         esac
8424
8425         # If -Dsysroot was specified, now's the time to add it
8426         # to cccdlflags
8427         if test "X$sysroot" != X; then
8428             case "$gccversion" in
8429                 '') ;;
8430                 *)  case "$dflt" in
8431                         *sysroot*) ;;
8432                         'undef'|*)
8433                             dflt="$dflt --sysroot=$sysroot" ;;
8434                     esac
8435                     ;;
8436             esac
8437         fi
8438
8439         case "$dflt" in
8440             '') dflt='none';;
8441         esac
8442
8443         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8444         . ./myread
8445         case "$ans" in
8446             none) cccdlflags=' ' ;;
8447             *)    cccdlflags="$ans" ;;
8448         esac
8449
8450         cat << EOM
8451
8452 Some systems use ld to create libraries that can be dynamically loaded,
8453 while other systems (such as those using ELF) use $cc.
8454
8455 EOM
8456
8457 : Determine if this is ELF
8458         $cat >try.c <<EOM
8459 /* Test for whether ELF binaries are produced */
8460 #include <fcntl.h>
8461 #$i_stdlib I_STDLIB
8462 #ifdef I_STDLIB
8463 #include <stdlib.h>
8464 #endif
8465 #$i_unistd I_UNISTD
8466 #ifdef I_UNISTD
8467 #include <unistd.h>
8468 #endif
8469 int main() {
8470     char b[4];
8471     int i = open("a.out",O_RDONLY);
8472     if(i == -1)
8473         exit(1); /* fail */
8474     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8475         exit(0); /* succeed (yes, it is ELF) */
8476     exit(1); /* fail */
8477 }
8478 EOM
8479         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8480             bin_ELF="$define"
8481         fi
8482         $rm_try
8483
8484         case "$ld" in
8485             '') if $test $bin_ELF = "$define"; then
8486                     cat <<EOM
8487 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8488 EOM
8489                     dflt="$cc"
8490                 else
8491                     echo "I'll use ld to build dynamic libraries."
8492                     dflt='ld'
8493                 fi
8494                 ;;
8495             *)  dflt="$ld"
8496                 ;;
8497         esac
8498
8499         rp="What command should be used to create dynamic libraries?"
8500         . ./myread
8501         ld="$ans"
8502
8503         cat << EOM
8504
8505 Some systems may require passing special flags to $ld to create a
8506 library that can be dynamically loaded.  If your ld flags include
8507 -L/other/path options to locate libraries outside your loader's normal
8508 search path, you may need to specify those -L options here as well.  To
8509 use no flags, say "none".
8510
8511 EOM
8512         case "$lddlflags" in
8513             '') case "$osname" in
8514                     haiku) dflt='-shared' ;;
8515                     hpux) dflt='-b';
8516                           case "$gccversion" in
8517                               '') dflt="$dflt +vnocompatwarnings" ;;
8518                           esac
8519                           ;;
8520                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8521                     solaris) # See [perl #66604].
8522                             # On Solaris 11, gcc -m64 on amd64
8523                             # appears not to understand -G.  gcc versions at
8524                             # least as old as 3.4.3 support -shared, so just
8525                             # use that with Solaris 11 and later, but keep
8526                             # the old behavior for older Solaris versions.
8527                             case "$gccversion" in
8528                                 '') dflt='-G' ;;
8529                                 *)  case "$osvers" in
8530                                         2.?|2.10) dflt='-G' ;;
8531                                         *) dflt='-shared' ;;
8532                                     esac
8533                                     ;;
8534                             esac
8535                             ;;
8536                     sunos) dflt='-assert nodefinitions' ;;
8537                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8538                     *)     dflt='none' ;;
8539                 esac
8540                 ;;
8541             *) dflt="$lddlflags" ;;
8542         esac
8543
8544         : Only do this for gcc, since, for example, qcc has no concept
8545         : of --sysroot.
8546         if $test "X$sysroot" != X; then
8547             case "$gccversion" in
8548                 '') ;;
8549                 *)  dflt="$dflt --sysroot $sysroot" ;;
8550             esac
8551         fi
8552
8553         : Try to guess additional flags to pick up local libraries.
8554         : Be careful not to append to a plain 'none'
8555         case "$dflt" in
8556             none) dflt='' ;;
8557         esac
8558         for thisflag in $ldflags; do
8559             case "$thisflag" in
8560                 -L*|-R*|-Wl,-R*)
8561                     case " $dflt " in
8562                         *" $thisflag "*) ;;
8563                         *) dflt="$dflt $thisflag" ;;
8564                     esac
8565                     ;;
8566             esac
8567         done
8568
8569         case "$dflt" in
8570             ''|' ') dflt='none' ;;
8571         esac
8572
8573         case "$ldflags" in
8574             *-fstack-protector-strong*)
8575                 case "$dflt" in
8576                     *-fstack-protector-strong*) ;; # Don't add it again
8577                     *) dflt="$dflt -fstack-protector-strong" ;;
8578                 esac
8579                 ;;
8580             *-fstack-protector*)
8581                 case "$dflt" in
8582                     *-fstack-protector*) ;; # Don't add it again
8583                     *) dflt="$dflt -fstack-protector" ;;
8584                 esac
8585                 ;;
8586         esac
8587
8588         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8589         . ./myread
8590         case "$ans" in
8591             none) lddlflags=' ' ;;
8592             *) lddlflags="$ans" ;;
8593         esac
8594
8595         cat <<EOM
8596
8597 Some systems may require passing special flags to $cc to indicate that
8598 the resulting executable will use dynamic linking.  To use no flags,
8599 say "none".
8600
8601 EOM
8602         case "$ccdlflags" in
8603             '') case "$osname" in
8604                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8605                     sunos)             dflt='none'   ;;
8606                     *)                 dflt='none'   ;;
8607                 esac ;;
8608             ' ') dflt='none' ;;
8609             *)   dflt="$ccdlflags" ;;
8610         esac
8611         rp="Any special flags to pass to $cc to use dynamic linking?"
8612         . ./myread
8613         case "$ans" in
8614             none) ccdlflags=' ' ;;
8615             *)    ccdlflags="$ans" ;;
8616         esac
8617         ;;
8618
8619     *)  usedl="$undef"
8620         ld='ld'
8621         dlsrc='dl_none.xs'
8622         lddlflags=''
8623         ccdlflags=''
8624         ;;
8625 esac
8626
8627 ld_can_script="$undef"
8628 case "$bin_ELF$usedl" in
8629     $define$define)
8630         # Abuse try.h and a.out names for neat cleanup
8631         $cat >try.c <<EOM
8632 void foo() {}
8633 void bar() {}
8634 EOM
8635         $cat >try.h <<EOM
8636 LIBTEST_42 {
8637  global:
8638   foo;
8639  local: *;
8640  };
8641 EOM
8642         if $cc $cccdlflags $ccdlflags $ccflags \
8643                $ldflags $lddlflags -o a.out try.c \
8644                -Wl,--version-script=try.h >/dev/null 2>&1 \
8645            &&  $test -s a.out ; then
8646             echo "ld supports scripting" >&4
8647             ld_can_script="$define"
8648         else
8649             echo "ld does not support scripting" >&4
8650         fi
8651         $rm_try
8652         ;;
8653 esac
8654
8655 : Do we want a shared libperl?
8656 also=''
8657 case "$usedl" in
8658 $undef)
8659         # No dynamic loading being used, so don't bother even to prompt.
8660         useshrplib='false'
8661         ;;
8662 *)      case "$useshrplib" in
8663         '')     case "$osname" in
8664                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8665                         dflt=y
8666                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8667                         ;;
8668                 *)      dflt=n
8669                         ;;
8670                 esac
8671                 ;;
8672         $define|true|[Yy]*)
8673                 dflt=y
8674                 ;;
8675         *)      dflt=n
8676                 ;;
8677         esac
8678         $cat << EOM
8679
8680 The perl executable is normally obtained by linking perlmain.c with
8681 libperl${_a}, any static extensions (usually just DynaLoader), and
8682 any other libraries needed on this system (such as -lm, etc.).  Since
8683 your system supports dynamic loading, it is probably possible to build
8684 a shared libperl.$so.  If you will have more than one executable linked
8685 to libperl.$so, this will significantly reduce the size of each
8686 executable, but it may have a noticeable effect on performance.  The
8687 default is probably sensible for your system.
8688 $also
8689
8690 EOM
8691         rp="Build a shared libperl.$so (y/n)"
8692         . ./myread
8693         case "$ans" in
8694         true|$define|[Yy]*)
8695                 useshrplib='true'  ;;
8696         *)      useshrplib='false' ;;
8697         esac
8698         ;;
8699 esac
8700
8701 case "$useshrplib" in
8702 true)
8703         case "$userelocatableinc" in
8704         true|define)
8705                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8706                 echo "See INSTALL for an explanation why that won't work." >&4
8707                 exit 4
8708                 ;;
8709         esac
8710         case "$libperl" in
8711         '')
8712                 # Figure out a good name for libperl.so.  Since it gets stored in
8713                 # a version-specific architecture-dependent library, the version
8714                 # number isn't really that important, except for making cc/ld happy.
8715                 #
8716                 # A name such as libperl.so.10.1
8717                 majmin="libperl.$so.$patchlevel.$subversion"
8718                 # A name such as libperl.so.100
8719                 majonly=`echo $patchlevel $subversion |
8720                         $awk '{printf "%d%02d", $1, $2}'`
8721                 majonly=libperl.$so.$majonly
8722                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8723                 # rely on figuring it out from the naming of libc.
8724                 case "${osname}${osvers}" in
8725                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8726                         dflt=libperl.$so
8727                         ;;
8728                 cygwin*) # ld links now against the dll directly
8729                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8730                         majonly=`echo $patchlevel $subversion |
8731                                 $awk '{printf "%03d%03d", $1, $2}'`
8732                         majonly=cygperl5.$majonly.$so
8733                         dflt=$majmin
8734                         ;;
8735                 *)      # Try to guess based on whether libc has major.minor.
8736                         case "$libc" in
8737                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8738                         *libc.$so.[0-9]*) dflt=$majonly ;;
8739                         *)      dflt=libperl.$so ;;
8740                         esac
8741                         ;;
8742                 esac
8743                 ;;
8744         *)      dflt=$libperl
8745                 ;;
8746         esac
8747         cat << EOM
8748
8749 I need to select a good name for the shared libperl.  If your system uses
8750 library names with major and minor numbers, then you might want something
8751 like $majmin.  Alternatively, if your system uses a single version
8752 number for shared libraries, then you might want to use $majonly.
8753 Or, your system might be quite happy with a simple libperl.$so.
8754
8755 Since the shared libperl will get installed into a version-specific
8756 architecture-dependent directory, the version number of the shared perl
8757 library probably isn't important, so the default should be o.k.
8758
8759 EOM
8760         rp='What name do you want to give to the shared libperl?'
8761         . ./myread
8762         libperl=$ans
8763         echo "Ok, I'll use $libperl"
8764         ;;
8765 *)
8766         libperl="libperl${_a}"
8767         ;;
8768 esac
8769
8770 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8771 case "$shrpdir" in
8772 '') ;;
8773 *)      $cat >&4 <<EOM
8774 WARNING:  Use of the shrpdir variable for the installation location of
8775 the shared $libperl is not supported.  It was never documented and
8776 will not work in this version.  Let me (perlbug@perl.org)
8777 know of any problems this may cause.
8778
8779 EOM
8780         case "$shrpdir" in
8781         "$archlibexp/CORE")
8782                 $cat >&4 <<EOM
8783 But your current setting of $shrpdir is
8784 the default anyway, so it's harmless.
8785 EOM
8786                 ;;
8787         *)
8788                 $cat >&4 <<EOM
8789 Further, your current attempted setting of $shrpdir
8790 conflicts with the value of $archlibexp/CORE
8791 that installperl will use.
8792 EOM
8793                 ;;
8794         esac
8795         ;;
8796 esac
8797
8798 # How will the perl executable find the installed shared $libperl?
8799 # Add $xxx to ccdlflags.
8800 # If we can't figure out a command-line option, use $shrpenv to
8801 # set env LD_RUN_PATH.  The main perl makefile uses this.
8802 shrpdir=$archlibexp/CORE
8803 xxx=''
8804 tmp_shrpenv=''
8805 if "$useshrplib"; then
8806     case "$osname" in
8807         aix)
8808                 # We'll set it in Makefile.SH...
8809                 ;;
8810         solaris)
8811                 xxx="-R $shrpdir"
8812                 ;;
8813         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8814                 xxx="-Wl,-R$shrpdir"
8815                 ;;
8816         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8817                 xxx="-Wl,-rpath,$shrpdir"
8818                 ;;
8819         hpux*)
8820                 # hpux doesn't like the default, either.
8821                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8822                 ;;
8823         cygwin)
8824                 # cygwin needs only ldlibpth
8825                 ;;
8826         *)
8827                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8828                 ;;
8829         esac
8830         case "$xxx" in
8831         '') ;;
8832         *)
8833                 # Only add $xxx if it isn't already in ccdlflags.
8834                 case " $ccdlflags " in
8835                 *" $xxx "*)     ;;
8836                 *)      ccdlflags="$ccdlflags $xxx"
8837                         cat <<EOM >&4
8838
8839 Adding $xxx to the flags
8840 passed to $ld so that the perl executable will find the
8841 installed shared $libperl.
8842
8843 EOM
8844                         ;;
8845                 esac
8846                 ;;
8847         esac
8848 fi
8849 # Fix ccdlflags in AIX for building external extensions.
8850 # (For building Perl itself bare -bE:perl.exp is needed,
8851 #  Makefile.SH takes care of this.)
8852 case "$osname" in
8853 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8854 esac
8855 # Respect a hint or command-line value.
8856 case "$shrpenv" in
8857 '') shrpenv="$tmp_shrpenv" ;;
8858 esac
8859 case "$ldlibpthname" in
8860 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8861 none)   ldlibpthname='' ;;
8862 esac
8863
8864 : determine where manual pages are on this system
8865 echo " "
8866 case "$sysman" in
8867 '')
8868         syspath='/usr/share/man/man1 /usr/man/man1'
8869         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8870         syspath="$syspath /usr/man/u_man/man1"
8871         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8872         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8873         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8874         sysman=`./loc . /usr/man/man1 $syspath`
8875         ;;
8876 esac
8877 if $test -d "$sysman"; then
8878         echo "System manual is in $sysman." >&4
8879 else
8880         echo "Could not find manual pages in source form." >&4
8881 fi
8882
8883 : determine where manual pages go
8884 set man1dir man1dir none
8885 eval $prefixit
8886 $cat <<EOM
8887
8888 $spackage has manual pages available in source form.
8889 EOM
8890 case "$nroff" in
8891 nroff)
8892         echo "However, you don't have nroff, so they're probably useless to you."
8893         case "$man1dir" in
8894         '') man1dir="none";;
8895         esac;;
8896 esac
8897 echo "If you don't want the manual sources installed, answer 'none'."
8898 case "$man1dir" in
8899 ' ') dflt=none
8900         ;;
8901 '')
8902         lookpath="$prefixexp/share/man/man1"
8903         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8904         lookpath="$lookpath $prefixexp/man/p_man/man1"
8905         lookpath="$lookpath $prefixexp/man/u_man/man1"
8906         lookpath="$lookpath $prefixexp/man/man.1"
8907         case "$sysman" in
8908         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8909         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8910         esac
8911         set dflt
8912         eval $prefixup
8913         ;;
8914 *)  dflt="$man1dir"
8915         ;;
8916 esac
8917 echo " "
8918 fn=dn+~
8919 rp="Where do the main $spackage manual pages (source) go?"
8920 . ./getfile
8921 if $test "X$man1direxp" != "X$ansexp"; then
8922         installman1dir=''
8923 fi
8924 prefixvar=man1dir
8925 . ./setprefixvar
8926
8927 case "$man1dir" in
8928 '')     man1dir=' '
8929         installman1dir='';;
8930 esac
8931
8932 : What suffix to use on installed man pages
8933
8934 case "$man1dir" in
8935 ' ')
8936         man1ext='0'
8937         ;;
8938 *)
8939         rp="What suffix should be used for the main $spackage man pages?"
8940         case "$man1ext" in
8941         '')     case "$man1dir" in
8942                 *1)  dflt=1 ;;
8943                 *1p) dflt=1p ;;
8944                 *1pm) dflt=1pm ;;
8945                 *l) dflt=l;;
8946                 *n) dflt=n;;
8947                 *o) dflt=o;;
8948                 *p) dflt=p;;
8949                 *C) dflt=C;;
8950                 *L) dflt=L;;
8951                 *L1) dflt=L1;;
8952                 *) dflt=1;;
8953                 esac
8954                 ;;
8955         *)      dflt="$man1ext";;
8956         esac
8957         . ./myread
8958         man1ext="$ans"
8959         ;;
8960 esac
8961
8962 : see if we can have long filenames
8963 echo " "
8964 first=123456789abcdef
8965 $rm -f $first
8966 if (echo hi >$first) 2>/dev/null; then
8967         if $test -f 123456789abcde; then
8968                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8969                 val="$undef"
8970         else
8971                 echo 'You can have filenames longer than 14 characters.'>&4
8972                 val="$define"
8973         fi
8974 else
8975         $cat <<'EOM'
8976 You can't have filenames longer than 14 chars.
8977 You can't even think about them!
8978 EOM
8979         val="$undef"
8980 fi
8981 set d_flexfnam
8982 eval $setvar
8983 $rm -rf 123456789abcde*
8984
8985 : determine where library module manual pages go
8986 set man3dir man3dir none
8987 eval $prefixit
8988 $cat <<EOM
8989
8990 $spackage has manual pages for many of the library modules.
8991 EOM
8992
8993 case "$nroff" in
8994 nroff)
8995         $cat <<'EOM'
8996 However, you don't have nroff, so they're probably useless to you.
8997 EOM
8998         case "$man3dir" in
8999         '') man3dir="none";;
9000         esac;;
9001 esac
9002
9003 case "$d_flexfnam" in
9004 undef)
9005         $cat <<'EOM'
9006 However, your system can't handle the long file names like File::Basename.3.
9007 EOM
9008         case "$man3dir" in
9009         '') man3dir="none";;
9010         esac;;
9011 esac
9012
9013 echo "If you don't want the manual sources installed, answer 'none'."
9014 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9015 case "$man3dir" in
9016 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9017         if $test -d "$privlib/man/man3"; then
9018                 cat <<EOM >&4
9019
9020 WARNING:  Previous versions of perl installed man3 pages into
9021 $privlib/man/man3.  This version will suggest a
9022 new default of $dflt.
9023 EOM
9024                 tdflt=$dflt
9025                 dflt='n'
9026                 rp='Do you wish to preserve the old behavior?(y/n)'
9027                 . ./myread
9028                 case "$ans" in
9029                 y*) dflt="$privlib/man/man3" ;;
9030                 *)  dflt=$tdflt ;;
9031                 esac
9032     fi
9033         ;;
9034 *)      dflt="$man3dir" ;;
9035 esac
9036 case "$dflt" in
9037 ' ') dflt=none ;;
9038 esac
9039 echo " "
9040 fn=dn+~
9041 rp="Where do the $package library man pages (source) go?"
9042 . ./getfile
9043 prefixvar=man3dir
9044 . ./setprefixvar
9045
9046 case "$man3dir" in
9047 '')     man3dir=' '
9048         installman3dir='';;
9049 esac
9050
9051 : What suffix to use on installed man pages
9052 case "$man3dir" in
9053 ' ')
9054         man3ext='0'
9055         ;;
9056 *)
9057         rp="What suffix should be used for the $package library man pages?"
9058         case "$man3ext" in
9059         '')     case "$man3dir" in
9060                 *3)  dflt=3 ;;
9061                 *3p) dflt=3p ;;
9062                 *3pm) dflt=3pm ;;
9063                 *l) dflt=l;;
9064                 *n) dflt=n;;
9065                 *o) dflt=o;;
9066                 *p) dflt=p;;
9067                 *C) dflt=C;;
9068                 *L) dflt=L;;
9069                 *L3) dflt=L3;;
9070                 *) dflt=3;;
9071                 esac
9072                 ;;
9073         *)      dflt="$man3ext";;
9074         esac
9075         . ./myread
9076         man3ext="$ans"
9077         ;;
9078 esac
9079
9080 : see if we have to deal with yellow pages, now NIS.
9081 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9082         case "$hostcat" in
9083         nidump*) ;;
9084         *)
9085                 case "$hostcat" in
9086                 *ypcat*) dflt=y;;
9087                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9088                                 dflt=y
9089                         else
9090                                 dflt=n
9091                         fi;;
9092                 *) dflt=n;;
9093                 esac
9094                 echo " "
9095                 rp='Are you getting the hosts file via yellow pages?'
9096                 . ./myread
9097                 case "$ans" in
9098                 y*) hostcat='ypcat hosts';;
9099                 *) hostcat='cat /etc/hosts';;
9100                 esac
9101                 ;;
9102         esac
9103 fi
9104 case "$hostcat" in
9105 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9106 esac
9107 case "$groupcat" in
9108 '') test -f /etc/group && groupcat='cat /etc/group';;
9109 esac
9110 case "$passcat" in
9111 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9112 esac
9113
9114 : now get the host name
9115 echo " "
9116 echo "Figuring out host name..." >&4
9117 case "$myhostname" in
9118 '') cont=true
9119         echo 'Maybe "hostname" will work...'
9120         if tans=`sh -c hostname 2>&1` ; then
9121                 myhostname=$tans
9122                 phostname=hostname
9123                 cont=''
9124         fi
9125         ;;
9126 *) cont='';;
9127 esac
9128 if $test "$cont"; then
9129         if ./xenix; then
9130                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9131                 if tans=`cat /etc/systemid 2>&1` ; then
9132                         myhostname=$tans
9133                         phostname='cat /etc/systemid'
9134                         echo "Whadyaknow.  Xenix always was a bit strange..."
9135                         cont=''
9136                 fi
9137         elif $test -r /etc/systemid; then
9138                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9139         fi
9140 fi
9141 if $test "$cont"; then
9142         echo 'No, maybe "uuname -l" will work...'
9143         if tans=`sh -c 'uuname -l' 2>&1` ; then
9144                 myhostname=$tans
9145                 phostname='uuname -l'
9146         else
9147                 echo 'Strange.  Maybe "uname -n" will work...'
9148                 if tans=`sh -c 'uname -n' 2>&1` ; then
9149                         myhostname=$tans
9150                         phostname='uname -n'
9151                 else
9152                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9153                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9154                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9155                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9156                         else
9157                                 case "$myhostname" in
9158                                 '') echo "Does this machine have an identity crisis or something?"
9159                                         phostname='';;
9160                                 *)
9161                                         echo "Well, you said $myhostname before..."
9162                                         phostname='echo $myhostname';;
9163                                 esac
9164                         fi
9165                 fi
9166         fi
9167 fi
9168 case "$myhostname" in
9169 '') myhostname=noname ;;
9170 esac
9171 : you do not want to know about this
9172 set $myhostname
9173 myhostname=$1
9174
9175 : verify guess
9176 if $test "$myhostname" ; then
9177         dflt=y
9178         rp='Your host name appears to be "'$myhostname'".'" Right?"
9179         . ./myread
9180         case "$ans" in
9181         y*) ;;
9182         *) myhostname='';;
9183         esac
9184 fi
9185
9186 : bad guess or no guess
9187 while $test "X$myhostname" = X ; do
9188         dflt=''
9189         rp="Please type the (one word) name of your host:"
9190         . ./myread
9191         myhostname="$ans"
9192 done
9193
9194 : translate upper to lower if necessary
9195 case "$myhostname" in
9196 *[A-Z]*)
9197         echo "(Normalizing case in your host name)"
9198         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9199         ;;
9200 esac
9201
9202 case "$myhostname" in
9203 *.*)
9204         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9205         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9206         echo "(Trimming domain name from host name--host name is now $myhostname)"
9207         ;;
9208 *) case "$mydomain" in
9209         '')
9210                 {
9211                         test "X$hostcat" = "Xypcat hosts" &&
9212                         ypmatch "$myhostname" hosts 2>/dev/null |\
9213                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9214                         $test -s hosts
9215                 } || {
9216                         test "X$hostcat" != "X" &&
9217                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9218                                         /[       ]$myhostname[  . ]/p" > hosts
9219                 }
9220                 tmp_re="[       . ]"
9221                 if $test -f hosts; then
9222                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9223                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9224                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9225                                 hosts | $sort | $uniq | \
9226                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9227                         case `$echo X$dflt` in
9228                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9229                                 dflt=.
9230                                 ;;
9231                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9232                                 ;;
9233                         esac
9234                 else
9235                         echo "(I cannot locate a hosts database anywhere)"
9236                         dflt=.
9237                 fi
9238                 case "$dflt" in
9239                 .)
9240                         tans=`./loc resolv.conf X /etc /usr/etc`
9241                         if $test -f "$tans"; then
9242                                 echo "(Attempting domain name extraction from $tans)"
9243                                 dflt=.`$sed -n -e 's/   / /g' \
9244                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9245                                   -e 1q 2>/dev/null`
9246                                 case "$dflt" in
9247                                 .) dflt=.`$sed -n -e 's/        / /g' \
9248                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9249                                      -e 1q 2>/dev/null`
9250                                         ;;
9251                                 esac
9252                         fi
9253                         ;;
9254                 esac
9255                 case "$dflt" in
9256                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9257                         dflt=.`sh -c domainname 2>/dev/null`
9258                         case "$dflt" in
9259                         '') dflt='.';;
9260                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9261                         esac
9262                         ;;
9263                 esac
9264                 case "$dflt$osname" in
9265                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9266                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9267                         ;;
9268                 esac
9269                 case "$dflt" in
9270                 .) echo "(Lost all hope -- silly guess then)"
9271                         dflt='.nonet'
9272                         ;;
9273                 esac
9274                 $rm -f hosts
9275                 ;;
9276         *) dflt="$mydomain";;
9277         esac;;
9278 esac
9279 echo " "
9280 rp="What is your domain name?"
9281 . ./myread
9282 tans="$ans"
9283 case "$ans" in
9284 '') ;;
9285 .*) ;;
9286 *) tans=".$tans";;
9287 esac
9288 mydomain="$tans"
9289
9290 : translate upper to lower if necessary
9291 case "$mydomain" in
9292 *[A-Z]*)
9293         echo "(Normalizing case in your domain name)"
9294         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9295         ;;
9296 esac
9297
9298 : a little sanity check here
9299 case "$phostname" in
9300 '') ;;
9301 *)
9302         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9303         $myhostname$mydomain|$myhostname) ;;
9304         *)
9305                 case "$phostname" in
9306                 sed*)
9307                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9308                         ;;
9309                 *)
9310                         echo "(That doesn't agree with your $phostname command, by the way.)"
9311                         ;;
9312                 esac
9313         ;;
9314         esac
9315         ;;
9316 esac
9317
9318 : determine the e-mail address of the user who is running us
9319 $cat <<EOM
9320
9321 I need to get your e-mail address in Internet format if possible, i.e.
9322 something like user@host.domain. Please answer accurately since I have
9323 no easy means to double check it. The default value provided below
9324 is most probably close to reality but may not be valid from outside
9325 your organization...
9326
9327 EOM
9328 cont=x
9329 while test "$cont"; do
9330         case "$MAILDOMAIN" in
9331         '')
9332                 if $test -s /etc/mailname; then
9333                         maildomain=`$cat /etc/mailname`
9334                 else
9335                         maildomain="$myhostname$mydomain"
9336                 fi
9337                 ;;
9338         *)  maildomain="$MAILDOMAIN";;
9339         esac
9340         case "$cf_email" in
9341         '') dflt="$cf_by@$maildomain";;
9342         *)  dflt="$cf_email";;
9343         esac
9344         rp='What is your e-mail address?'
9345         . ./myread
9346         cf_email="$ans"
9347         case "$cf_email" in
9348         *@*.*) cont='' ;;
9349         *)
9350                 rp='Address does not look like an Internet one.  Use it anyway?'
9351                 case "$fastread" in
9352                 yes) dflt=y ;;
9353                 *) dflt=n ;;
9354                 esac
9355                 . ./myread
9356                 case "$ans" in
9357                 y*) cont='' ;;
9358                 *) echo " " ;;
9359                 esac
9360                 ;;
9361         esac
9362 done
9363
9364 : Ask e-mail of administrator
9365 $cat <<EOM
9366
9367 If you or somebody else will be maintaining perl at your site, please
9368 fill in the correct e-mail address here so that they may be contacted
9369 if necessary. Currently, the "perlbug" program included with perl
9370 will send mail to this address in addition to perlbug@perl.org. You may
9371 enter "none" for no administrator.
9372
9373 EOM
9374 case "$perladmin" in
9375 '') dflt="$cf_email";;
9376 *) dflt="$perladmin";;
9377 esac
9378 rp='Perl administrator e-mail address'
9379 . ./myread
9380 perladmin="$ans"
9381
9382 : determine whether to use a version number suffix for installed binaries
9383 echo " "
9384 $cat <<EOM
9385 Do you want to use a version number suffix for installed binaries? This
9386 will install 'perl$version' instead of 'perl', and likewise for other
9387 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9388 to be installed side-by-side. Unless you are a developer, you probably
9389 do *not* want to do this.
9390 EOM
9391 case "$versiononly" in
9392 "$define"|[Yy]*|true) dflt='y' ;;
9393 *) dflt='n';
9394 esac
9395 rp="Do you want to use a version number suffix for installed binaries?"
9396 . ./myread
9397 case "$ans" in
9398 [yY]*)  val="$define";;
9399 *)      val="$undef" ;;
9400 esac
9401 set versiononly
9402 eval $setvar
9403
9404 case "$versiononly" in
9405 "$define") inc_version_list=''
9406            inc_version_list_init=0
9407            ;;
9408 esac
9409
9410 : figure out how to guarantee perl startup
9411 : XXX Note that this currently takes advantage of the bug that binexp ignores
9412 :     the Configure -Dinstallprefix setting, which in turn means that under
9413 :     relocatable @INC, initialinstalllocation is what binexp started as.
9414 case "$startperl" in
9415 '')
9416         case "$sharpbang" in
9417         *!)
9418                 $cat <<EOH
9419
9420 I can use the #! construct to start perl on your system. This will
9421 make startup of perl scripts faster, but may cause problems if you
9422 want to share those scripts and perl is not in a standard place
9423 ($initialinstalllocation/perl) on all your platforms. The alternative
9424 is to force a shell by starting the script with a single ':' character.
9425
9426 EOH
9427                 case "$versiononly" in
9428                 "$define")      dflt="$initialinstalllocation/perl$version";;
9429                 *)              dflt="$initialinstalllocation/perl";;
9430                 esac
9431                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9432                 . ./myread
9433                 case "$ans" in
9434                 none)   startperl=": # use perl";;
9435                 *)      startperl="#!$ans"
9436                         if $test 30 -lt `echo "$ans" | wc -c`; then
9437                                 $cat >&4 <<EOM
9438
9439 WARNING:  Some systems limit the #! command to 32 characters.
9440 If you experience difficulty running Perl scripts with #!, try
9441 installing Perl in a directory with a shorter pathname.
9442
9443 EOM
9444                         fi ;;
9445                 esac
9446                 ;;
9447         *) startperl=": # use perl"
9448                 ;;
9449         esac
9450         ;;
9451 esac
9452 echo "I'll use $startperl to start perl scripts."
9453
9454 : figure best path for perl in scripts
9455 case "$perlpath" in
9456 '')
9457         case "$versiononly" in
9458         "$define")      perlpath="$initialinstalllocation/perl$version";;
9459         *)              perlpath="$initialinstalllocation/perl";;
9460         esac
9461         case "$startperl" in
9462         *!*) ;;
9463         *)
9464                 $cat <<EOH
9465
9466 I will use the "eval 'exec'" idiom to start Perl on your system.
9467 I can use the full path of your Perl binary for this purpose, but
9468 doing so may cause problems if you want to share those scripts and
9469 Perl is not always in a standard place ($initialinstalllocation/perl).
9470
9471 EOH
9472                 dflt="$initialinstalllocation/perl"
9473                 rp="What path shall I use in \"eval 'exec'\"?"
9474                 . ./myread
9475                 perlpath="$ans"
9476                 ;;
9477         esac
9478         ;;
9479 esac
9480 case "$startperl" in
9481 *!*)    ;;
9482 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9483 esac
9484
9485 : determine where public executable scripts go
9486 set scriptdir scriptdir
9487 eval $prefixit
9488 case "$scriptdir" in
9489 '')
9490         dflt="$bin"
9491         : guess some guesses
9492         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9493         $test -d /usr/share/bin     && dflt=/usr/share/bin
9494         $test -d /usr/local/script  && dflt=/usr/local/script
9495         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9496         $test -d $prefixexp/script  && dflt=$prefixexp/script
9497         set dflt
9498         eval $prefixup
9499         ;;
9500 *)  dflt="$scriptdir"
9501         ;;
9502 esac
9503 $cat <<EOM
9504
9505 Some installations have a separate directory just for executable scripts so
9506 that they can mount it across multiple architectures but keep the scripts in
9507 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9508 Or you might just lump your scripts in with all your other executables.
9509
9510 EOM
9511 fn=d~
9512 rp='Where do you keep publicly executable scripts?'
9513 . ./getfile
9514 if $test "X$ansexp" != "X$scriptdirexp"; then
9515         installscript=''
9516 fi
9517 installscriptdir=''
9518 prefixvar=scriptdir
9519 . ./setprefixvar
9520 : A little fix up for an irregularly named variable.
9521 installscript="$installscriptdir"
9522
9523 : determine where add-on public executables go
9524 case "$sitebin" in
9525 '')     dflt=$siteprefix/bin ;;
9526 *)      dflt=$sitebin ;;
9527 esac
9528 fn=d~
9529 rp='Pathname where the add-on public executables should be installed?'
9530 . ./getfile
9531 prefixvar=sitebin
9532 . ./setprefixvar
9533
9534 : determine where add-on html pages go
9535 : There is no standard location, so try to copy the previously-selected
9536 : directory structure for the core html pages.
9537 case "$sitehtml1dir" in
9538 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9539 *)     dflt=$sitehtml1dir ;;
9540 esac
9541 case "$dflt" in
9542 ''|' ') dflt=none ;;
9543 esac
9544 fn=dn+~
9545 rp='Pathname where the site-specific html pages should be installed?'
9546 . ./getfile
9547 prefixvar=sitehtml1dir
9548 . ./setprefixvar
9549
9550 : determine where add-on library html pages go
9551 : There is no standard location, so try to copy the previously-selected
9552 : directory structure for the core html pages.
9553 case "$sitehtml3dir" in
9554 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9555 *)     dflt=$sitehtml3dir ;;
9556 esac
9557 case "$dflt" in
9558 ''|' ') dflt=none ;;
9559 esac
9560 fn=dn+~
9561 rp='Pathname where the site-specific library html pages should be installed?'
9562 . ./getfile
9563 prefixvar=sitehtml3dir
9564 . ./setprefixvar
9565
9566 : determine where add-on manual pages go
9567 case "$siteman1dir" in
9568 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9569 *)      dflt=$siteman1dir ;;
9570 esac
9571 case "$dflt" in
9572 ''|' ') dflt=none ;;
9573 esac
9574 fn=dn+~
9575 rp='Pathname where the site-specific manual pages should be installed?'
9576 . ./getfile
9577 prefixvar=siteman1dir
9578 . ./setprefixvar
9579
9580 : determine where add-on library man pages go
9581 case "$siteman3dir" in
9582 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9583 *)      dflt=$siteman3dir ;;
9584 esac
9585 case "$dflt" in
9586 ''|' ') dflt=none ;;
9587 esac
9588 fn=dn+~
9589 rp='Pathname where the site-specific library manual pages should be installed?'
9590 . ./getfile
9591 prefixvar=siteman3dir
9592 . ./setprefixvar
9593
9594 : determine where add-on public executable scripts go
9595 case "$sitescript" in
9596 '')     dflt=$siteprefix/script
9597         $test -d $dflt || dflt=$sitebin ;;
9598 *)  dflt="$sitescript" ;;
9599 esac
9600 fn=d~+
9601 rp='Pathname where add-on public executable scripts should be installed?'
9602 . ./getfile
9603 prefixvar=sitescript
9604 . ./setprefixvar
9605
9606 : see if backtrace exists
9607 set backtrace d_backtrace
9608 eval $inlibc
9609
9610 : add flags if using c backtrace
9611 case "$usecbacktrace" in
9612   "") usecbacktrace=$undef ;;
9613   [yY]*|true|$define)
9614     case "$d_backtrace" in
9615       [yY]*|true|$define)
9616         case " $ccflags " in
9617           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9618           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9619           esac
9620         ;;
9621       *)
9622         echo "This system does not support backtrace" >&4
9623         usecbacktrace=$undef
9624         ;;
9625       esac
9626     ;;
9627   esac
9628
9629 : Check if faststdio is requested and available
9630 case "$usefaststdio" in
9631 $define|true|[yY]*|'')
9632         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9633         case "$xversion" in
9634         [68])   dflt='y' ;;
9635         *)      dflt='n' ;;
9636         esac
9637         ;;
9638 *) dflt='n';;
9639 esac
9640 cat <<EOM
9641
9642 Perl can be built to use 'fast stdio', which means using the stdio
9643 library but also directly manipulating the stdio buffers to enable
9644 faster I/O.  Using stdio is better for backward compatibility (especially
9645 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9646 interface has been preferred instead of stdio.
9647
9648 If this doesn't make any sense to you, just accept the default '$dflt'.
9649 EOM
9650 rp='Use the "fast stdio" if available?'
9651 . ./myread
9652 case "$ans" in
9653 y|Y)    val="$define" ;;
9654 *)      val="$undef" ;;
9655 esac
9656 set usefaststdio
9657 eval $setvar
9658
9659 : define an is-a-typedef? function
9660 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9661 case "$inclist" in
9662 "") inclist="sys/types.h";;
9663 esac;
9664 eval "varval=\$$var";
9665 case "$varval" in
9666 "")
9667         $rm -f temp.c;
9668         for inc in $inclist; do
9669                 echo "#include <$inc>" >>temp.c;
9670         done;
9671         echo "#ifdef $type" >> temp.c;
9672         echo "printf(\"We have $type\");" >> temp.c;
9673         echo "#endif" >> temp.c;
9674         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9675         if $contains $type temp.E >/dev/null 2>&1; then
9676                 eval "$var=\$type";
9677         else
9678                 eval "$var=\$def";
9679         fi;
9680         $rm -f temp.?;;
9681 *) eval "$var=\$varval";;
9682 esac'
9683
9684 : define an is-a-typedef? function that prompts if the type is not available.
9685 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9686 case "$inclist" in
9687 "") inclist="sys/types.h";;
9688 esac;
9689 eval "varval=\$$var";
9690 case "$varval" in
9691 "")
9692         $rm -f temp.c;
9693         for inc in $inclist; do
9694                 echo "#include <$inc>" >>temp.c;
9695         done;
9696         echo "#ifdef $type" >> temp.c;
9697         echo "printf(\"We have $type\");" >> temp.c;
9698         echo "#endif" >> temp.c;
9699         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9700         echo " " ;
9701         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9702         if $contains $type temp.E >/dev/null 2>&1; then
9703                 echo "$type found." >&4;
9704                 eval "$var=\$type";
9705         else
9706                 echo "$type NOT found." >&4;
9707                 dflt="$def";
9708                 . ./myread ;
9709                 eval "$var=\$ans";
9710         fi;
9711         $rm -f temp.?;;
9712 *) eval "$var=\$varval";;
9713 esac'
9714
9715 : see what type lseek is declared as in the kernel
9716 rp="What is the type used for lseek's offset on this system?"
9717 set off_t lseektype long stdio.h sys/types.h
9718 eval $typedef_ask
9719
9720 echo " "
9721 echo "Checking to see how big your file offsets are..." >&4
9722 $cat >try.c <<EOCP
9723 #include <sys/types.h>
9724 #include <stdio.h>
9725 int main()
9726 {
9727     printf("%d\n", (int)sizeof($lseektype));
9728     return(0);
9729 }
9730 EOCP
9731 set try
9732 if eval $compile_ok; then
9733         lseeksize=`$run ./try`
9734         echo "Your file offsets are $lseeksize bytes long."
9735 else
9736         dflt=$longsize
9737         echo " "
9738         echo "(I can't seem to compile the test program.  Guessing...)"
9739         rp="What is the size of your file offsets (in bytes)?"
9740         . ./myread
9741         lseeksize="$ans"
9742 fi
9743 $rm_try
9744
9745 : see what type file positions are declared as in the library
9746 rp="What is the type for file position used by fsetpos()?"
9747 set fpos_t fpostype long stdio.h sys/types.h
9748 eval $typedef_ask
9749
9750 : Check size for Fpos_t
9751 echo " "
9752 case "$fpostype" in
9753 *_t) zzz="$fpostype"    ;;
9754 *)   zzz="fpos_t"       ;;
9755 esac
9756 echo "Checking the size of $zzz..." >&4
9757 cat > try.c <<EOCP
9758 #include <sys/types.h>
9759 #include <stdio.h>
9760 #$i_stdlib I_STDLIB
9761 #ifdef I_STDLIB
9762 #include <stdlib.h>
9763 #endif
9764 int main() {
9765     printf("%d\n", (int)sizeof($fpostype));
9766     exit(0);
9767 }
9768 EOCP
9769 set try
9770 if eval $compile_ok; then
9771         yyy=`$run ./try`
9772         case "$yyy" in
9773         '')     fpossize=4
9774                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9775                 ;;
9776         *)      fpossize=$yyy
9777                 echo "Your $zzz is $fpossize bytes long."
9778                 ;;
9779         esac
9780 else
9781         dflt="$longsize"
9782         echo " " >&4
9783         echo "(I can't compile the test program.  Guessing...)" >&4
9784         rp="What is the size of your file positions (in bytes)?"
9785         . ./myread
9786         fpossize="$ans"
9787 fi
9788
9789 : Check for large file support
9790 # Backward compatibility (uselfs is deprecated).
9791 case "$uselfs" in
9792 "$define"|true|[yY]*)
9793         cat <<EOM >&4
9794
9795 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9796 EOM
9797         uselargefiles="$define"
9798         ;;
9799 esac
9800
9801 case "$lseeksize:$fpossize" in
9802 8:8) cat <<EOM
9803
9804 You can have files larger than 2 gigabytes.
9805 EOM
9806    val="$define" ;;
9807 *)    case "$uselargefiles" in
9808    "$undef"|false|[nN]*) dflt='n' ;;
9809    *)   dflt='y' ;;
9810    esac
9811    cat <<EOM
9812
9813 Perl can be built to understand large files (files larger than 2 gigabytes)
9814 on some systems.  To do so, Configure can be run with -Duselargefiles.
9815
9816 If this doesn't make any sense to you, just accept the default '$dflt'.
9817 EOM
9818    rp='Try to understand large files, if available?'
9819    . ./myread
9820    case "$ans" in
9821    y|Y) val="$define" ;;
9822    *)   val="$undef"  ;;
9823    esac
9824    ;;
9825 esac
9826 set uselargefiles
9827 eval $setvar
9828 : Look for a hint-file generated 'call-back-unit'.  If the
9829 : user has specified that a large files perl is to be built,
9830 : we may need to set or change some other defaults.
9831 if $test -f uselargefiles.cbu; then
9832         echo "Your platform has some specific hints regarding large file builds, using them..."
9833         . ./uselargefiles.cbu
9834 fi
9835 case "$uselargefiles" in
9836 "$define")
9837         if $test -f uselargefiles.cbu; then
9838                 echo " "
9839                 echo "Rechecking to see how big your file offsets are..." >&4
9840                 $cat >try.c <<EOCP
9841 #include <sys/types.h>
9842 #include <stdio.h>
9843 int main()
9844 {
9845     printf("%d\n", (int)sizeof($lseektype));
9846     return(0);
9847 }
9848 EOCP
9849                 set try
9850                 if eval $compile_ok; then
9851                         lseeksize=`$run ./try`
9852                         $echo "Your file offsets are now $lseeksize bytes long."
9853                 else
9854                         dflt="$lseeksize"
9855                         echo " "
9856                         echo "(I can't seem to compile the test program.  Guessing...)"
9857                         rp="What is the size of your file offsets (in bytes)?"
9858                         . ./myread
9859                         lseeksize="$ans"
9860                 fi
9861                 case "$fpostype" in
9862                 *_t) zzz="$fpostype"    ;;
9863                 *)   zzz="fpos_t"       ;;
9864                 esac
9865                 $echo $n "Rechecking the size of $zzz...$c" >&4
9866                 $cat > try.c <<EOCP
9867 #include <sys/types.h>
9868 #include <stdio.h>
9869 #$i_stdlib I_STDLIB
9870 #ifdef I_STDLIB
9871 #include <stdlib.h>
9872 #endif
9873 int main() {
9874     printf("%d\n", (int)sizeof($fpostype));
9875     return(0);
9876 }
9877 EOCP
9878                 set try
9879                 if eval $compile_ok; then
9880                         yyy=`$run ./try`
9881                         dflt="$lseeksize"
9882                         case "$yyy" in
9883                         '')     echo " "
9884                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9885                                 ;;
9886                         *)      fpossize=$yyy
9887                                 echo " $fpossize bytes." >&4
9888                                 ;;
9889                         esac
9890                 else
9891                         dflt="$fpossize"
9892                         echo " "
9893                         echo "(I can't compile the test program.  Guessing...)" >&4
9894                         rp="What is the size of your file positions (in bytes)?"
9895                         . ./myread
9896                         fpossize="$ans"
9897                 fi
9898                 $rm_try
9899         fi
9900         ;;
9901 esac
9902
9903 : Check if we want perlio
9904 useperlio="$define"
9905
9906 : Set the vendorbin variables
9907 case "$vendorprefix" in
9908 '')     d_vendorbin="$undef"
9909         vendorbin=''
9910         vendorbinexp=''
9911         ;;
9912 *)      d_vendorbin="$define"
9913         : determine where vendor-supplied executables go.
9914         case "$vendorbin" in
9915         '') dflt=$vendorprefix/bin ;;
9916         *)      dflt="$vendorbin" ;;
9917         esac
9918         fn=d~+
9919         rp='Pathname for the vendor-supplied executables directory?'
9920         . ./getfile
9921         vendorbin="$ans"
9922         vendorbinexp="$ansexp"
9923         ;;
9924 esac
9925 prefixvar=vendorbin
9926 . ./installprefix
9927
9928 : Set the vendorhtml1dir variables
9929 case "$vendorprefix" in
9930 '')     vendorhtml1dir=''
9931         vendorhtml1direxp=''
9932         ;;
9933 *)      : determine where vendor-supplied html pages go.
9934         : There is no standard location, so try to copy the previously-selected
9935         : directory structure for the core html pages.
9936         : XXX Better default suggestions would be welcome.
9937         case "$vendorhtml1dir" in
9938         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9939         *)      dflt=$vendorhtml1dir ;;
9940         esac
9941         case "$dflt" in
9942         ''|' ') dflt=none ;;
9943         esac
9944         fn=dn+~
9945         rp='Pathname for the vendor-supplied html pages?'
9946         . ./getfile
9947         vendorhtml1dir="$ans"
9948         vendorhtml1direxp="$ansexp"
9949         ;;
9950 esac
9951 : Use ' ' for none so value is preserved next time through Configure
9952 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9953 prefixvar=vendorhtml1dir
9954 . ./installprefix
9955
9956 : Set the vendorhtml3dir variables
9957 case "$vendorprefix" in
9958 '')     vendorhtml3dir=''
9959         vendorhtml3direxp=''
9960         ;;
9961 *)      : determine where vendor-supplied module html pages go.
9962         : There is no standard location, so try to copy the previously-selected
9963         : directory structure for the core html pages.
9964         : XXX Better default suggestions would be welcome.
9965         case "$vendorhtml3dir" in
9966         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9967         *)      dflt=$vendorhtml3dir ;;
9968         esac
9969         case "$dflt" in
9970         ''|' ') dflt=none ;;
9971         esac
9972         fn=dn+~
9973         rp='Pathname for the vendor-supplied html pages?'
9974         . ./getfile
9975         vendorhtml3dir="$ans"
9976         vendorhtml3direxp="$ansexp"
9977         ;;
9978 esac
9979 : Use ' ' for none so value is preserved next time through Configure
9980 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9981 prefixvar=vendorhtml3dir
9982 . ./installprefix
9983
9984 : Set the vendorman1dir variables
9985 case "$vendorprefix" in
9986 '')     vendorman1dir=''
9987         vendorman1direxp=''
9988         ;;
9989 *)      : determine where vendor-supplied manual pages go.
9990         case "$vendorman1dir" in
9991         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9992         *)      dflt=$vendorman1dir ;;
9993         esac
9994         case "$dflt" in
9995         ''|' ') dflt=none ;;
9996         esac
9997         fn=nd~+
9998         rp='Pathname for the vendor-supplied manual section 1 pages?'
9999         . ./getfile
10000         vendorman1dir="$ans"
10001         vendorman1direxp="$ansexp"
10002         ;;
10003 esac
10004 : Use ' ' for none so value is preserved next time through Configure
10005 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10006 prefixvar=vendorman1dir
10007 . ./installprefix
10008
10009 : Set the vendorman3dir variables
10010 case "$vendorprefix" in
10011 '')     vendorman3dir=''
10012         vendorman3direxp=''
10013         ;;
10014 *)      : determine where vendor-supplied module manual pages go.
10015         case "$vendorman3dir" in
10016         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10017         *)      dflt=$vendorman3dir ;;
10018         esac
10019         case "$dflt" in
10020         ''|' ') dflt=none ;;
10021         esac
10022         fn=nd~+
10023         rp='Pathname for the vendor-supplied manual section 3 pages?'
10024         . ./getfile
10025         vendorman3dir="$ans"
10026         vendorman3direxp="$ansexp"
10027         ;;
10028 esac
10029 : Use ' ' for none so value is preserved next time through Configure
10030 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10031 prefixvar=vendorman3dir
10032 . ./installprefix
10033
10034 : Set the vendorscript variables
10035 case "$vendorprefix" in
10036 '')     d_vendorscript="$undef"
10037         vendorscript=''
10038         vendorscriptexp=''
10039         ;;
10040 *)      d_vendorscript="$define"
10041         : determine where vendor-supplied scripts go.
10042         case "$vendorscript" in
10043         '')     dflt=$vendorprefix/script
10044                 $test -d $dflt || dflt=$vendorbin ;;
10045         *)  dflt="$vendorscript" ;;
10046         esac
10047         $cat <<EOM
10048
10049 The installation process will create a directory for
10050 vendor-supplied scripts.
10051
10052 EOM
10053         fn=d~+
10054         rp='Pathname for the vendor-supplied scripts directory?'
10055         . ./getfile
10056         vendorscript="$ans"
10057         vendorscriptexp="$ansexp"
10058         ;;
10059 esac
10060 prefixvar=vendorscript
10061 . ./installprefix
10062
10063 : see if qgcvt exists
10064 set qgcvt d_qgcvt
10065 eval $inlibc
10066
10067 : Check what kind of doubles your system has
10068 $echo "Checking the kind of doubles you have..." >&4
10069 $cat >try.c <<EOP
10070 #$i_stdlib I_STDLIB
10071 #define DOUBLESIZE $doublesize
10072 #ifdef I_STDLIB
10073 #include <stdlib.h>
10074 #endif
10075 #include <stdio.h>
10076 static const double d = -0.1;
10077 int main() {
10078   unsigned const char* b = (unsigned const char*)(&d);
10079 #if DOUBLESIZE == 4
10080   if (b[0] == 0xCD && b[3] == 0xBD) {
10081     /* IEEE 754 32-bit little-endian */
10082     printf("1\n");
10083     exit(0);
10084   }
10085   if (b[0] == 0xBD && b[3] == 0xCD) {
10086     /* IEEE 754 32-bit big-endian */
10087     printf("2\n");
10088     exit(0);
10089   }
10090   if (b[0] == 0xCC && b[3] == 0xCC) {
10091     /* VAX format F, 32-bit PDP-style mixed endian. */
10092     printf("9\n");
10093     exit(0);
10094   }
10095   if (b[0] == 0xC0 && b[3] == 0x9A) {
10096     /* IBM single 32-bit */
10097     printf("12\n");
10098     exit(0);
10099   }
10100 #endif
10101 #if DOUBLESIZE == 8
10102   if (b[0] == 0x9A && b[7] == 0xBF) {
10103     /* IEEE 754 64-bit little-endian */
10104     printf("3\n");
10105     exit(0);
10106   }
10107   if (b[0] == 0xBF && b[7] == 0x9A) {
10108     /* IEEE 754 64-bit big-endian */
10109     printf("4\n");
10110     exit(0);
10111   }
10112   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10113    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10114     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10115     * 99 99 b9 bf 9a 99 99 99 */
10116     printf("7\n");
10117     exit(0);
10118   }
10119   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10120    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10121     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10122     * 99 99 99 9a bf b9 99 99 */
10123     printf("8\n");
10124     exit(0);
10125   }
10126   if (b[0] == 0xCC && b[7] == 0xCC) {
10127    /* VAX format D, 64-bit PDP-style mixed endian. */
10128     printf("10\n");
10129     exit(0);
10130   }
10131   if (b[0] == 0xD9 && b[7] == 0x99) {
10132    /* VAX format G, 64-bit PDP-style mixed endian. */
10133     printf("11\n");
10134     exit(0);
10135   }
10136   if (b[0] == 0xC0 && b[7] == 0x9A) {
10137     /* IBM double 64-bit */
10138     printf("13\n");
10139     exit(0);
10140   }
10141   if (b[0] == 0xBF && b[7] == 0xCD) {
10142     /* CRAY single 64-bit */
10143     printf("14\n");
10144     exit(0);
10145   }
10146 #endif
10147 #if DOUBLESIZE == 16
10148   if (b[0] == 0x9A && b[15] == 0xBF) {
10149     /* IEEE 754 128-bit little-endian */
10150     printf("5\n");
10151     exit(0);
10152   }
10153   if (b[0] == 0xBF && b[15] == 0x9A) {
10154     /* IEEE 754 128-bit big-endian */
10155     printf("6\n");
10156     exit(0);
10157   }
10158 #endif
10159   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10160    * Whether those environments can still build Perl is debatable. */
10161   printf("-1\n"); /* unknown */
10162   exit(0);
10163 }
10164 EOP
10165 set try
10166 if eval $compile; then
10167     doublekind=`$run ./try`
10168 else
10169     doublekind=-1
10170 fi
10171 case "$doublekind" in
10172 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10173 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10174 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10175 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10176 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10177 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10178 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10179 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10180 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10181 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10182 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10183 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10184 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10185 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10186 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10187 esac
10188 d_double_style_ieee=$undef
10189 d_double_style_vax=$undef
10190 d_double_style_ibm=$undef
10191 d_double_style_cray=$undef
10192 case "$doublekind" in
10193 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10194 9|10|11) d_double_style_vax=$define ;;
10195 12|13) d_double_style_ibm=$define ;;
10196 14) d_double_style_cray=$define ;;
10197 esac
10198 case "$d_double_style_ieee" in
10199 $define)
10200     d_double_has_inf=$define
10201     d_double_has_nan=$define
10202     d_double_has_negative_zero=$define
10203     d_double_has_subnormals=$define
10204     ;;
10205 *)
10206     d_double_has_inf=$undef
10207     d_double_has_nan=$undef
10208     d_double_has_negative_zero=$undef
10209     d_double_has_subnormals=$undef
10210     ;;
10211 esac
10212 $rm_try
10213
10214 : Check print/scan long double stuff
10215 echo " "
10216
10217 if $test X"$d_longdbl" = X"$define"; then
10218
10219 echo "Checking how to print long doubles..." >&4
10220
10221 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10222         $cat >try.c <<'EOCP'
10223 #include <sys/types.h>
10224 #include <stdio.h>
10225 int main() {
10226   double d = 123.456;
10227   printf("%.3f\n", d);
10228 }
10229 EOCP
10230         set try
10231         if eval $compile; then
10232                 yyy=`$run ./try`
10233                 case "$yyy" in
10234                 123.456)
10235                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10236                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10237                         echo "We will use %f."
10238                         ;;
10239                 esac
10240         fi
10241 fi
10242
10243 if $test X"$sPRIfldbl" = X; then
10244         $cat >try.c <<'EOCP'
10245 #include <sys/types.h>
10246 #include <stdio.h>
10247 int main() {
10248   long double d = 123.456;
10249   printf("%.3Lf\n", d);
10250 }
10251 EOCP
10252         set try
10253         if eval $compile; then
10254                 yyy=`$run ./try`
10255                 case "$yyy" in
10256                 123.456)
10257                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10258                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10259                         echo "We will use %Lf."
10260                         ;;
10261                 esac
10262         fi
10263 fi
10264
10265 if $test X"$sPRIfldbl" = X; then
10266         $cat >try.c <<'EOCP'
10267 #include <sys/types.h>
10268 #include <stdio.h>
10269 int main() {
10270   long double d = 123.456;
10271   printf("%.3llf\n", d);
10272 }
10273 EOCP
10274         set try
10275         if eval $compile; then
10276                 yyy=`$run ./try`
10277                 case "$yyy" in
10278                 123.456)
10279                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10280                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10281                         echo "We will use %llf."
10282                         ;;
10283                 esac
10284         fi
10285 fi
10286
10287 if $test X"$sPRIfldbl" = X; then
10288         $cat >try.c <<'EOCP'
10289 #include <sys/types.h>
10290 #include <stdio.h>
10291 int main() {
10292   long double d = 123.456;
10293   printf("%.3lf\n", d);
10294 }
10295 EOCP
10296         set try
10297         if eval $compile; then
10298                 yyy=`$run ./try`
10299                 case "$yyy" in
10300                 123.456)
10301                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10302                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10303                         echo "We will use %lf."
10304                         ;;
10305                 esac
10306         fi
10307 fi
10308
10309 if $test X"$sPRIfldbl" = X; then
10310         echo "Cannot figure out how to print long doubles." >&4
10311 else
10312         sSCNfldbl=$sPRIfldbl    # expect consistency
10313 fi
10314
10315 $rm_try
10316
10317 fi # d_longdbl
10318
10319 case "$sPRIfldbl" in
10320 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10321         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10322         d_SCNfldbl="$undef";
10323         ;;
10324 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10325         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10326         d_SCNfldbl="$define";
10327         ;;
10328 esac
10329
10330 : Before committing on uselongdouble, see whether that looks sane.
10331 if $test "$uselongdouble" = "$define"; then
10332     message=""
10333     echo " "
10334     echo "Checking if your long double math functions work right..." >&4
10335     $cat > try.c <<EOF
10336 #include <math.h>
10337 #include <stdio.h>
10338 int main() {
10339   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10340 }
10341 EOF
10342     case "$osname:$gccversion" in
10343     aix:)       saveccflags="$ccflags"
10344                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10345     esac
10346     set try
10347     if eval $compile_ok; then
10348       yyy=`$run ./try`
10349     fi
10350     case "$yyy" in
10351     3) echo "Your long double math functions are working correctly." >&4 ;;
10352     *) echo "Your long double math functions are broken, not using long doubles." >&4
10353        uselongdouble=$undef
10354        ;;
10355     esac
10356     $rm_try
10357     case "$osname:$gccversion" in
10358     aix:)       ccflags="$saveccflags" ;; # restore
10359     esac
10360 fi
10361
10362 : Check how to convert floats to strings.
10363
10364 if test "X$d_Gconvert" = X; then
10365
10366 echo " "
10367 echo "Checking for an efficient way to convert floats to strings."
10368 echo " " > try.c
10369 case "$uselongdouble" in
10370 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10371 esac
10372 case "$d_longdbl" in
10373 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10374 esac
10375 case "$d_PRIgldbl" in
10376 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10377 esac
10378 $cat >>try.c <<EOP
10379 #ifdef TRY_gconvert
10380 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10381 char *myname = "gconvert";
10382 #endif
10383 #ifdef TRY_gcvt
10384 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10385 char *myname = "gcvt";
10386 #endif
10387 #ifdef TRY_qgcvt
10388 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10389 char *myname = "qgcvt";
10390 #define DOUBLETYPE long double
10391 #endif
10392 #ifdef TRY_sprintf
10393 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10394 #ifdef HAS_PRIgldbl
10395 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10396 #else
10397 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10398 #endif
10399 #else
10400 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10401 #endif
10402 char *myname = "sprintf";
10403 #endif
10404
10405 #ifndef DOUBLETYPE
10406 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10407 #define DOUBLETYPE long double
10408 #else
10409 #define DOUBLETYPE double
10410 #endif
10411 #endif
10412
10413 #include <stdio.h>
10414
10415 #$i_stdlib I_STDLIB
10416 #ifdef I_STDLIB
10417 #include <stdlib.h>
10418 #endif
10419 #include <string.h>
10420
10421 int checkit(char *expect, char *got)
10422 {
10423     if (strcmp(expect, got)) {
10424                 printf("%s oddity:  Expected %s, got %s\n",
10425                         myname, expect, got);
10426                 exit(1);
10427         }
10428 }
10429
10430 int main()
10431 {
10432         char buf[64];
10433         buf[63] = '\0';
10434
10435         /* This must be 1st test on (which?) platform */
10436         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10437         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10438         checkit("0.1", buf);
10439
10440         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10441         checkit("0.01", buf);
10442
10443         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10444         checkit("0.001", buf);
10445
10446         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10447         checkit("0.0001", buf);
10448
10449         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10450         if (strlen(buf) > 5)
10451             checkit("9e-005", buf); /* for Microsoft ?? */
10452         else
10453             checkit("9e-05", buf);
10454
10455         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10456         checkit("1", buf);
10457
10458         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10459         checkit("1.1", buf);
10460
10461         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10462         checkit("1.01", buf);
10463
10464         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10465         checkit("1.001", buf);
10466
10467         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10468         checkit("1.0001", buf);
10469
10470         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10471         checkit("1.00001", buf);
10472
10473         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10474         checkit("1.000001", buf);
10475
10476         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10477         checkit("0", buf);
10478
10479         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10480         checkit("-1", buf);
10481
10482         /* Some Linux gcvt's give 1.e+5 here. */
10483         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10484         checkit("100000", buf);
10485
10486         /* Some Linux gcvt's give -1.e+5 here. */
10487         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10488         checkit("-100000", buf);
10489
10490         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10491         checkit("123.456", buf);
10492
10493         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10494         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10495         /* 34 should be enough to scare even long double
10496          * places into using the e notation. */
10497         if (strlen(buf) > 5)
10498             checkit("1e+034", buf); /* for Microsoft */
10499         else
10500             checkit("1e+34", buf);
10501
10502         /* For Perl, if you add additional tests here, also add them to
10503          * t/base/num.t for benefit of platforms not using Configure or
10504          * overriding d_Gconvert */
10505
10506         exit(0);
10507 }
10508 EOP
10509 : first add preferred functions to our list
10510 xxx_list=""
10511 for xxx_convert in $gconvert_preference; do
10512     case $xxx_convert in
10513     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10514     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10515     esac
10516 done
10517 : then add any others
10518 for xxx_convert in gconvert gcvt sprintf; do
10519     case "$xxx_list" in
10520     *$xxx_convert*) ;;
10521     *) xxx_list="$xxx_list $xxx_convert" ;;
10522     esac
10523 done
10524
10525 case "$d_longdbl$uselongdouble" in
10526 "$define$define")
10527     : again, add preferred functions to our list first
10528     xxx_ld_list=""
10529     for xxx_convert in $gconvert_ld_preference; do
10530         case $xxx_convert in
10531         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10532         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10533         esac
10534     done
10535     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10536     for xxx_convert in qgcvt sprintf $xxx_list; do
10537         case "$xxx_ld_list" in
10538         $xxx_convert*|*" $xxx_convert"*) ;;
10539         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10540         esac
10541     done
10542     : if sprintf cannot do long doubles, move it to the end
10543     if test "$d_PRIgldbl" != "$define"; then
10544         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10545     fi
10546     : if no qgcvt, remove it
10547     if test "$d_qgcvt" != "$define"; then
10548         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10549     fi
10550     : use the ld_list
10551     xxx_list="$xxx_ld_list"
10552     ;;
10553 esac
10554
10555 for xxx_convert in $xxx_list; do
10556         echo "Trying $xxx_convert..."
10557         $rm -f try try$_o core
10558         set try -DTRY_$xxx_convert
10559         if eval $compile; then
10560                 echo "$xxx_convert() found." >&4
10561                 if $run ./try; then
10562                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10563                         break;
10564                 else
10565                         echo "...But $xxx_convert didn't work as I expected."
10566                         xxx_convert=''
10567                 fi
10568         else
10569                 echo "$xxx_convert NOT found." >&4
10570         fi
10571 done
10572
10573 if test X$xxx_convert = X; then
10574     echo "*** WHOA THERE!!! ***" >&4
10575     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10576     xxx_convert=sprintf
10577 fi
10578
10579 case "$xxx_convert" in
10580 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10581 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10582 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10583 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10584    "$define$define$define")
10585       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10586    "$define$define$undef")
10587       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10588    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10589    esac
10590    ;;
10591 esac
10592
10593 fi
10594 $rm_try
10595
10596 : see if _fwalk exists
10597 set fwalk d__fwalk
10598 eval $inlibc
10599
10600 : see if accept4 exists
10601 set accept4 d_accept4
10602 eval $inlibc
10603
10604 : Initialize h_fcntl
10605 h_fcntl=false
10606
10607 : Initialize h_sysfile
10608 h_sysfile=false
10609
10610 : access call always available on UNIX
10611 set access d_access
10612 eval $inlibc
10613
10614 : locate the flags for 'access()'
10615 case "$d_access" in
10616 "$define")
10617         echo " "
10618         $cat >access.c <<EOCP
10619 #include <sys/types.h>
10620 #ifdef I_FCNTL
10621 #include <fcntl.h>
10622 #endif
10623 #ifdef I_SYS_FILE
10624 #include <sys/file.h>
10625 #endif
10626 #ifdef I_UNISTD
10627 #include <unistd.h>
10628 #endif
10629 #$i_stdlib I_STDLIB
10630 #ifdef I_STDLIB
10631 #include <stdlib.h>
10632 #endif
10633 int main() {
10634         exit(R_OK);
10635 }
10636 EOCP
10637         : check sys/file.h first, no particular reason here
10638         if $test `./findhdr sys/file.h` && \
10639                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10640                 h_sysfile=true;
10641                 echo "<sys/file.h> defines the *_OK access constants." >&4
10642         elif $test `./findhdr fcntl.h` && \
10643                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10644                 h_fcntl=true;
10645                 echo "<fcntl.h> defines the *_OK access constants." >&4
10646         elif $test `./findhdr unistd.h` && \
10647                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10648                 echo "<unistd.h> defines the *_OK access constants." >&4
10649         else
10650                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10651         fi
10652         ;;
10653 esac
10654 $rm -f access*
10655
10656 : see if accessx exists
10657 set accessx d_accessx
10658 eval $inlibc
10659
10660 : see if acosh exists
10661 set acosh d_acosh
10662 eval $inlibc
10663
10664 : see if aintl exists
10665 set aintl d_aintl
10666 eval $inlibc
10667
10668 : see if alarm exists
10669 set alarm d_alarm
10670 eval $inlibc
10671
10672 : see if 64bit time functions exists
10673
10674 set ctime64 d_ctime64
10675 eval $inlibc
10676
10677 set localtime64 d_localtime64
10678 eval $inlibc
10679
10680 set gmtime64 d_gmtime64
10681 eval $inlibc
10682
10683 set mktime64 d_mktime64
10684 eval $inlibc
10685
10686 set difftime64 d_difftime64
10687 eval $inlibc
10688
10689 set asctime64 d_asctime64
10690 eval $inlibc
10691
10692 : see if POSIX threads are available
10693 set pthread.h i_pthread
10694 eval $inhdr
10695
10696 : define a function to check prototypes
10697 $cat > protochk <<EOSH
10698 $startsh
10699 cc="$cc"
10700 optimize="$optimize"
10701 ccflags="$ccflags"
10702 define="$define"
10703 rm_try="$rm_try"
10704 usethreads=$usethreads
10705 i_pthread=$i_pthread
10706 pthread_h_first=$pthread_h_first
10707 EOSH
10708
10709 $cat >> protochk <<'EOSH'
10710
10711 $rm_try
10712 foo="$1"
10713 shift
10714 while test $# -ge 2; do
10715         case "$1" in
10716                 $define) echo "#include <$2>" >> try.c ;;
10717                 literal) echo "$2" >> try.c ;;
10718         esac
10719     # Extra magic for the benefit of systems that need pthread.h
10720     # to be included early to correctly detect threadsafe functions.
10721     # Such functions must guarantee themselves, though, that the usethreads
10722     # and i_pthread have been defined, before calling protochk.
10723     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10724         echo "#include <pthread.h>" >> try.c
10725         pthread_h_done=yes
10726     fi
10727     shift 2
10728 done
10729 cat >> try.c <<'EOCP'
10730 #define _(args) args
10731 EOCP
10732 echo "$foo" >> try.c
10733 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10734 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10735 status=$?
10736 $rm_try
10737 exit $status
10738 EOSH
10739 chmod +x protochk
10740 $eunicefix protochk
10741
10742 : Define hasproto macro for Configure internal use
10743 hasproto='varname=$1; func=$2; shift; shift;
10744 while $test $# -ge 2; do
10745         case "$1" in
10746         $define) echo "#include <$2>";;
10747         literal) echo "$2" ;;
10748         esac ;
10749     shift 2;
10750 done > try.c;
10751 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10752 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10753         echo "$func() prototype found.";
10754         val="$define";
10755 else
10756         echo "$func() prototype NOT found.";
10757         val="$undef";
10758 fi;
10759 set $varname;
10760 eval $setvar;
10761 $rm_try tryout.c'
10762
10763 : see if sys/types.h has to be included
10764 set sys/types.h i_systypes
10765 eval $inhdr
10766
10767 : see if sys/select.h has to be included
10768 set sys/select.h i_sysselct
10769 eval $inhdr
10770
10771 : Define hasfield macro for Configure internal use
10772 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10773 while $test $# -ge 2; do
10774         case "$1" in
10775         $define) echo "#include <$2>";;
10776         esac ;
10777     shift 2;
10778 done > try.c;
10779 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10780 set try;
10781 if eval $compile; then
10782         val="$define";
10783 else
10784         val="$undef";
10785 fi;
10786 set $varname;
10787 eval $setvar;
10788 $rm_try'
10789
10790 : see if we should include sys/time.h
10791 echo " "
10792 i_time='define'
10793 if test "X$timeincl" = X; then
10794         echo "Testing to see if we should include <sys/time.h>." >&4
10795         $echo $n "I'm now running the test program...$c"
10796         $cat >try.c <<EOCP
10797 #include <sys/types.h>
10798 #include <time.h>
10799 #ifdef I_SYSTIME
10800 #ifdef SYSTIMEKERNEL
10801 #define KERNEL
10802 #endif
10803 #include <sys/time.h>
10804 #endif
10805 #ifdef I_SYSSELECT
10806 #include <sys/select.h>
10807 #endif
10808 #$i_stdlib I_STDLIB
10809 #ifdef I_STDLIB
10810 #include <stdlib.h>
10811 #endif
10812 int main()
10813 {
10814         struct tm foo;
10815 #ifdef S_TIMEVAL
10816         struct timeval bar;
10817 #endif
10818 #ifdef S_TIMEZONE
10819         struct timezone tzp;
10820 #endif
10821         if (foo.tm_sec == foo.tm_sec)
10822                 exit(0);
10823 #ifdef S_TIMEVAL
10824         if (bar.tv_sec == bar.tv_sec)
10825                 exit(0);
10826 #endif
10827         exit(1);
10828 }
10829 EOCP
10830         flags=''
10831         for s_timezone in '-DS_TIMEZONE' ''; do
10832         sysselect=''
10833         for s_timeval in '-DS_TIMEVAL' ''; do
10834         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10835         for i_systime in '-DI_SYSTIME' ''; do
10836                 case "$flags" in
10837                 '') $echo $n ".$c"
10838                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10839                         if eval $compile; then
10840                                 set X $i_systime $i_systimek $sysselect $s_timeval
10841                                 shift
10842                                 flags="$*"
10843                                 echo " "
10844                                 $echo $n "Succeeded with $flags$c"
10845                         fi
10846                         ;;
10847                 esac
10848         done
10849         done
10850         done
10851         done
10852         timeincl=''
10853         echo " "
10854         case "$flags" in
10855         *SYSTIMEKERNEL*) i_systimek="$define"
10856                 timeincl=`./findhdr sys/time.h`
10857                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10858         *) i_systimek="$undef";;
10859         esac
10860         case "$flags" in
10861         *I_SYSTIME*) i_systime="$define"
10862                 timeincl=`./findhdr sys/time.h`" $timeincl"
10863                 echo "We'll include <sys/time.h>." >&4;;
10864         *) i_systime="$undef";;
10865         esac
10866         $rm_try
10867 fi
10868 : see if struct tm knows about tm_zone
10869 case "$i_systime$i_time" in
10870 *$define*)
10871         echo " "
10872         echo "Checking to see if your struct tm has tm_zone field..." >&4
10873         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10874         eval $hasfield
10875         ;;
10876 *)      val="$undef"
10877         set d_tm_tm_zone
10878         eval $setvar
10879         ;;
10880 esac
10881 case "$d_tm_tm_zone" in
10882 "$define")      echo "Yes, it does."   ;;
10883 *)              echo "No, it doesn't." ;;
10884 esac
10885 : see if struct tm knows about tm_gmtoff
10886 case "$i_systime$i_time" in
10887 *$define*)
10888         echo " "
10889         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10890         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10891         eval $hasfield
10892         ;;
10893 *)      val="$undef"
10894         set d_tm_tm_gmtoff
10895         eval $setvar
10896         ;;
10897 esac
10898 case "$d_tm_tm_gmtoff" in
10899 "$define")      echo "Yes, it does."   ;;
10900 *)              echo "No, it doesn't." ;;
10901 esac
10902
10903 : see if asctime_r exists
10904 set asctime_r d_asctime_r
10905 eval $inlibc
10906 case "$d_asctime_r" in
10907 "$define")
10908         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10909         case "$d_asctime_r_proto:$usethreads" in
10910         ":define")      d_asctime_r_proto=define
10911                 set d_asctime_r_proto asctime_r $hdrs
10912                 eval $hasproto ;;
10913         *)      ;;
10914         esac
10915         case "$d_asctime_r_proto" in
10916         define)
10917         case "$asctime_r_proto" in
10918         ''|0) try='char* asctime_r(const struct tm*, char*);'
10919         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10920         esac
10921         case "$asctime_r_proto" in
10922         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10923         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10924         esac
10925         case "$asctime_r_proto" in
10926         ''|0) try='int asctime_r(const struct tm*, char*);'
10927         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10928         esac
10929         case "$asctime_r_proto" in
10930         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10931         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10932         esac
10933         case "$asctime_r_proto" in
10934         ''|0)   d_asctime_r=undef
10935                 asctime_r_proto=0
10936                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10937         * )     case "$asctime_r_proto" in
10938                 REENTRANT_PROTO*) ;;
10939                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10940                 esac
10941                 echo "Prototype: $try" ;;
10942         esac
10943         ;;
10944         *)      case "$usethreads" in
10945                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10946                 esac
10947                 d_asctime_r=undef
10948                 asctime_r_proto=0
10949                 ;;
10950         esac
10951         ;;
10952 *)      asctime_r_proto=0
10953         ;;
10954 esac
10955
10956 : see if asinh exists
10957 set asinh d_asinh
10958 eval $inlibc
10959
10960 : see if atanh exists
10961 set atanh d_atanh
10962 eval $inlibc
10963
10964 : see if atolf exists
10965 set atolf d_atolf
10966 eval $inlibc
10967
10968 : see if atoll exists
10969 set atoll d_atoll
10970 eval $inlibc
10971
10972 : Look for GCC-style attribute format
10973 case "$d_attribute_format" in
10974 '')
10975 echo " "
10976 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10977 $cat >attrib.c <<'EOCP'
10978 #include <stdio.h>
10979 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10980 EOCP
10981 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10982         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10983                 echo "Your C compiler doesn't support __attribute__((format))."
10984                 val="$undef"
10985         else
10986                 echo "Your C compiler supports __attribute__((format))."
10987                 val="$define"
10988         fi
10989 else
10990         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10991         val="$undef"
10992 fi
10993 ;;
10994 *) val="$d_attribute_format" ;;
10995 esac
10996 set d_attribute_format
10997 eval $setvar
10998 $rm -f attrib*
10999
11000 : Look for GCC-style attribute format with null format allowed
11001 case "$d_printf_format_null" in
11002 '') case "$d_attribute_format" in
11003     $define)
11004         echo " "
11005         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11006 $cat >attrib.c <<EOCP
11007 #include <stdio.h>
11008 #$i_stdlib I_STDLIB
11009 #ifdef I_STDLIB
11010 #include <stdlib.h>
11011 #endif
11012 #$i_inttypes I_INTTYPES
11013 #ifdef I_INTTYPES
11014 #include <inttypes.h>
11015 #endif
11016 #ifndef INTPTR_MAX
11017 #define intptr_t int
11018 #endif
11019 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11020 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11021 int main () { exit(null_printf(NULL)); }
11022 EOCP
11023         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11024             : run the executable in case it produces a run-time warning
11025             if $run ./attrib >>attrib.out 2>&1; then
11026                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11027                     echo "Your C compiler doesn't allow __printf__ format to be null."
11028                     val="$undef"
11029                 else
11030                     echo "Your C compiler allows __printf__ format to be null."
11031                     val="$define"
11032                 fi
11033             else
11034             echo "Your C compiler executable failed with __printf__ format null."
11035             val="$undef"
11036         fi
11037     else
11038         echo "Your C compiler fails with __printf__ format null."
11039         val="$undef"
11040     fi
11041     ;;
11042     *)  val="$undef" ;;
11043     esac
11044 ;;
11045 *)  val="$d_printf_format_null" ;;
11046 esac
11047 set d_printf_format_null
11048 eval $setvar
11049 $rm -f attrib*
11050
11051 : Look for GCC-style attribute malloc
11052 case "$d_attribute_malloc" in
11053 '')
11054 echo " "
11055 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11056 $cat >attrib.c <<'EOCP'
11057 #include <stdio.h>
11058 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11059 EOCP
11060 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11061         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11062                 echo "Your C compiler doesn't support __attribute__((malloc))."
11063                 val="$undef"
11064         else
11065                 echo "Your C compiler supports __attribute__((malloc))."
11066                 val="$define"
11067         fi
11068 else
11069         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11070         val="$undef"
11071 fi
11072 ;;
11073 *) val="$d_attribute_malloc" ;;
11074 esac
11075 set d_attribute_malloc
11076 eval $setvar
11077 $rm -f attrib*
11078
11079 : Look for GCC-style attribute nonnull
11080 case "$d_attribute_nonnull" in
11081 '')
11082 echo " "
11083 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11084 $cat >attrib.c <<'EOCP'
11085 #include <stdio.h>
11086 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11087 EOCP
11088 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11089         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11090                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11091                 val="$undef"
11092         else
11093                 echo "Your C compiler supports __attribute__((nonnull))."
11094                 val="$define"
11095         fi
11096 else
11097         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11098         val="$undef"
11099 fi
11100 ;;
11101 *) val="$d_attribute_nonnull" ;;
11102 esac
11103 set d_attribute_nonnull
11104 eval $setvar
11105 $rm -f attrib*
11106
11107 : Look for GCC-style attribute noreturn
11108 case "$d_attribute_noreturn" in
11109 '')
11110 echo " "
11111 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11112 $cat >attrib.c <<'EOCP'
11113 #include <stdio.h>
11114 void fall_over_dead( void ) __attribute__((noreturn));
11115 EOCP
11116 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11117         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11118                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11119                 val="$undef"
11120         else
11121                 echo "Your C compiler supports __attribute__((noreturn))."
11122                 val="$define"
11123         fi
11124 else
11125         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11126         val="$undef"
11127 fi
11128 ;;
11129 *) val="$d_attribute_noreturn" ;;
11130 esac
11131 set d_attribute_noreturn
11132 eval $setvar
11133 $rm -f attrib*
11134
11135 : Look for GCC-style attribute pure
11136 case "$d_attribute_pure" in
11137 '')
11138 echo " "
11139 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11140 $cat >attrib.c <<'EOCP'
11141 #include <stdio.h>
11142 int square( int n ) __attribute__((pure));
11143 EOCP
11144 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11145         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11146                 echo "Your C compiler doesn't support __attribute__((pure))."
11147                 val="$undef"
11148         else
11149                 echo "Your C compiler supports __attribute__((pure))."
11150                 val="$define"
11151         fi
11152 else
11153         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11154         val="$undef"
11155 fi
11156 ;;
11157 *) val="$d_attribute_pure" ;;
11158 esac
11159 set d_attribute_pure
11160 eval $setvar
11161 $rm -f attrib*
11162
11163 : Look for GCC-style attribute unused
11164 case "$d_attribute_unused" in
11165 '')
11166 echo " "
11167 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11168 $cat >attrib.c <<'EOCP'
11169 #include <stdio.h>
11170 int do_something( int dummy __attribute__((unused)), int n );
11171 EOCP
11172 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11173         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11174                 echo "Your C compiler doesn't support __attribute__((unused))."
11175                 val="$undef"
11176         else
11177                 echo "Your C compiler supports __attribute__((unused))."
11178                 val="$define"
11179         fi
11180 else
11181         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11182         val="$undef"
11183 fi
11184 ;;
11185 *) val="$d_attribute_unused" ;;
11186 esac
11187 set d_attribute_unused
11188 eval $setvar
11189 $rm -f attrib*
11190
11191 : Look for GCC-style attribute deprecated
11192 case "$d_attribute_deprecated" in
11193 '')
11194 echo " "
11195 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11196 $cat >attrib.c <<'EOCP'
11197 #include <stdio.h>
11198 int I_am_deprecated(void) __attribute__((deprecated));
11199 EOCP
11200 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11201         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11202                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11203                 val="$undef"
11204         else
11205                 echo "Your C compiler supports __attribute__((deprecated))."
11206                 val="$define"
11207         fi
11208 else
11209         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11210         val="$undef"
11211 fi
11212 ;;
11213 *) val="$d_attribute_deprecated" ;;
11214 esac
11215 set d_attribute_deprecated
11216 eval $setvar
11217 $rm -f attrib*
11218
11219 : Look for GCC-style attribute warn_unused_result
11220 case "$d_attribute_warn_unused_result" in
11221 '')
11222 echo " "
11223 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11224 $cat >attrib.c <<'EOCP'
11225 #include <stdio.h>
11226 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11227 EOCP
11228 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11229         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11230                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11231                 val="$undef"
11232         else
11233                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11234                 val="$define"
11235         fi
11236 else
11237         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11238         val="$undef"
11239 fi
11240 ;;
11241 *) val="$d_attribute_warn_unused_result" ;;
11242 esac
11243 set d_attribute_warn_unused_result
11244 eval $setvar
11245 $rm -f attrib*
11246
11247 : see if getpgrp exists
11248 set getpgrp d_getpgrp
11249 eval $inlibc
11250
11251 case "$d_getpgrp" in
11252 "$define")
11253         echo " "
11254         echo "Checking to see which flavor of getpgrp is in use..."
11255         $cat >try.c <<EOP
11256 #$i_unistd I_UNISTD
11257 #include <sys/types.h>
11258 #ifdef I_UNISTD
11259 #  include <unistd.h>
11260 #endif
11261 #$i_stdlib I_STDLIB
11262 #ifdef I_STDLIB
11263 #include <stdlib.h>
11264 #endif
11265 int main()
11266 {
11267         if (getuid() == 0) {
11268                 printf("(I see you are running Configure as super-user...)\n");
11269                 setuid(1);
11270         }
11271 #ifdef TRY_BSD_PGRP
11272         if (getpgrp(1) == 0)
11273                 exit(0);
11274 #else
11275         if (getpgrp() > 0)
11276                 exit(0);
11277 #endif
11278         exit(1);
11279 }
11280 EOP
11281         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11282                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11283                 val="$define"
11284         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11285                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11286                 val="$undef"
11287         else
11288                 echo "I can't seem to compile and run the test program."
11289                 if ./usg; then
11290                         xxx="a USG one, i.e. you use getpgrp()."
11291                 else
11292                         # SVR4 systems can appear rather BSD-ish.
11293                         case "$i_unistd" in
11294                         $undef)
11295                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11296                                 val="$define"
11297                                 ;;
11298                         $define)
11299                                 xxx="probably a USG one, i.e. you use getpgrp()."
11300                                 val="$undef"
11301                                 ;;
11302                         esac
11303                 fi
11304                 echo "Assuming your getpgrp is $xxx" >&4
11305         fi
11306         ;;
11307 *) val="$undef";;
11308 esac
11309 set d_bsdgetpgrp
11310 eval $setvar
11311 $rm_try
11312
11313 : see if setpgrp exists
11314 set setpgrp d_setpgrp
11315 eval $inlibc
11316
11317 case "$d_setpgrp" in
11318 "$define")
11319         echo " "
11320         echo "Checking to see which flavor of setpgrp is in use..."
11321         $cat >try.c <<EOP
11322 #$i_unistd I_UNISTD
11323 #include <sys/types.h>
11324 #ifdef I_UNISTD
11325 #  include <unistd.h>
11326 #endif
11327 #$i_stdlib I_STDLIB
11328 #ifdef I_STDLIB
11329 #include <stdlib.h>
11330 #endif
11331 int main()
11332 {
11333         if (getuid() == 0) {
11334                 printf("(I see you are running Configure as super-user...)\n");
11335                 setuid(1);
11336         }
11337 #ifdef TRY_BSD_PGRP
11338         if (-1 == setpgrp(1, 1))
11339                 exit(0);
11340 #else
11341         if (setpgrp() != -1)
11342                 exit(0);
11343 #endif
11344         exit(1);
11345 }
11346 EOP
11347         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11348                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11349                 val="$define"
11350         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11351                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11352                 val="$undef"
11353         else
11354                 echo "(I can't seem to compile and run the test program.)"
11355                 if ./usg; then
11356                         xxx="a USG one, i.e. you use setpgrp()."
11357                 else
11358                         # SVR4 systems can appear rather BSD-ish.
11359                         case "$i_unistd" in
11360                         $undef)
11361                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11362                                 val="$define"
11363                                 ;;
11364                         $define)
11365                                 xxx="probably a USG one, i.e. you use setpgrp()."
11366                                 val="$undef"
11367                                 ;;
11368                         esac
11369                 fi
11370                 echo "Assuming your setpgrp is $xxx" >&4
11371         fi
11372         ;;
11373 *) val="$undef";;
11374 esac
11375 set d_bsdsetpgrp
11376 eval $setvar
11377 $rm_try
11378
11379 : Look for GCC-style __builtin_add_overflow
11380 case "$d_builtin_add_overflow" in
11381 '')
11382     echo " "
11383     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11384     $cat >try.c <<'EOCP'
11385 int main(void) {
11386     const unsigned int uint_max = ~0u;
11387     int target_int = 0;
11388     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11389         return 1;
11390     }
11391     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11392         return 1;
11393     }
11394     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11395         return 1;
11396     }
11397     return 0;
11398 }
11399 EOCP
11400     set try
11401     if eval $compile && $run ./try; then
11402         echo "Your C compiler supports __builtin_add_overflow."
11403         val="$define"
11404     else
11405         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11406         val="$undef"
11407     fi
11408     ;;
11409 *) val="$d_builtin_add_overflow" ;;
11410 esac
11411
11412 set d_builtin_add_overflow
11413 eval $setvar
11414 $rm_try
11415
11416 : Look for GCC-style __builtin_sub_overflow
11417 case "$d_builtin_sub_overflow" in
11418 '')
11419     echo " "
11420     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11421     $cat >try.c <<'EOCP'
11422 int main(void) {
11423     const unsigned int uint_max = ~0u;
11424     int target_int = 0;
11425     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11426         return 1;
11427     }
11428     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11429         return 1;
11430     }
11431     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11432         return 1;
11433     }
11434     return 0;
11435 }
11436 EOCP
11437     set try
11438     if eval $compile && $run ./try; then
11439         echo "Your C compiler supports __builtin_sub_overflow."
11440         val="$define"
11441     else
11442         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11443         val="$undef"
11444     fi
11445     ;;
11446 *) val="$d_builtin_sub_overflow" ;;
11447 esac
11448
11449 set d_builtin_sub_overflow
11450 eval $setvar
11451 $rm_try
11452
11453 : Look for GCC-style __builtin_mul_overflow
11454 case "$d_builtin_mul_overflow" in
11455 '')
11456     echo " "
11457     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11458     $cat >try.c <<'EOCP'
11459 int main(void) {
11460     const unsigned int uint_max = ~0u;
11461     int target_int = 0;
11462     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11463         return 1;
11464     }
11465     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11466         return 1;
11467     }
11468     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11469         return 1;
11470     }
11471     return 0;
11472 }
11473 EOCP
11474     set try
11475     if eval $compile && $run ./try; then
11476         echo "Your C compiler supports __builtin_mul_overflow."
11477         val="$define"
11478     else
11479         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11480         val="$undef"
11481     fi
11482     ;;
11483 *) val="$d_builtin_mul_overflow" ;;
11484 esac
11485
11486 set d_builtin_mul_overflow
11487 eval $setvar
11488 $rm_try
11489
11490 : Look for GCC-style __builtin_choose_expr
11491 case "$d_builtin_choose_expr" in
11492 '')
11493     echo " "
11494     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11495     $cat >try.c <<'EOCP'
11496 #include <assert.h>
11497 #include <stdlib.h>
11498 #include <stdio.h>
11499
11500 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11501
11502 int main(void) {
11503     assert( SYRINX(1) == 2112 );
11504     assert( SYRINX(1) != 5150 );
11505     assert( SYRINX(0) == 5150 );
11506     assert( SYRINX(0) != 2112 );
11507     puts( "All good!" );
11508     exit(0);
11509 }
11510
11511 EOCP
11512     set try
11513     if eval $compile && $run ./try; then
11514         echo "Your C compiler supports __builtin_choose_expr."
11515         val="$define"
11516     else
11517         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11518         val="$undef"
11519     fi
11520 ;;
11521 *) val="$d_builtin_choose_expr" ;;
11522 esac
11523
11524 set d_builtin_choose_expr
11525 eval $setvar
11526 $rm_try
11527
11528 : Look for GCC-style __builtin_expect
11529 case "$d_builtin_expect" in
11530 '')
11531     echo " "
11532     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11533     $cat >try.c <<'EOCP'
11534 int main(void) {
11535     int n = 50;
11536     if ( __builtin_expect(n, 0) ) n = 1;
11537     /* Remember shell exit code truth is 0, C truth is non-zero */
11538     return !(n == 1);
11539 }
11540 EOCP
11541     set try
11542     if eval $compile && $run ./try; then
11543         echo "Your C compiler supports __builtin_expect."
11544         val="$define"
11545     else
11546         echo "Your C compiler doesn't seem to understand __builtin_expect."
11547         val="$undef"
11548     fi
11549     ;;
11550 *) val="$d_builtin_expect" ;;
11551 esac
11552
11553 set d_builtin_expect
11554 eval $setvar
11555 $rm_try
11556
11557 : see if the Compiler supports C99 variadic macros
11558 echo "Checking for C99 variadic macros." >&4
11559 $cat >try.c <<EOCP
11560 #include <stdio.h>
11561 #include <stdarg.h>
11562
11563 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11564
11565 int main() {
11566   char buf[20];
11567   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11568   puts(buf);
11569   return 0;
11570 }
11571 EOCP
11572 set try
11573 if eval $compile && $run ./try 2>&1 >/dev/null; then
11574     case "`$run ./try`" in
11575         "123 456 789")
11576         echo "You have C99 variadic macros." >&4
11577         d_c99_variadic_macros="$define"
11578         ;;
11579         *)
11580         echo "You don't have functional C99 variadic macros." >&4
11581         d_c99_variadic_macros="$undef"
11582         ;;
11583     esac
11584 else
11585     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11586     d_c99_variadic_macros="$undef"
11587 fi
11588 $rm_try
11589
11590 : see if signal is declared as pointer to function returning int or void
11591 echo " "
11592 xxx=`./findhdr signal.h`
11593 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11594 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11595         echo "You have int (*signal())() instead of void." >&4
11596         val="$undef"
11597 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11598         echo "You have void (*signal())()." >&4
11599         val="$define"
11600 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11601         echo "You have int (*signal())() instead of void." >&4
11602         val="$undef"
11603 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11604         echo "You have void (*signal())()." >&4
11605         val="$define"
11606 else
11607         case "$d_voidsig" in
11608         '')
11609         echo "I can't determine whether signal handler returns void or int..." >&4
11610                 dflt=void
11611                 rp="What type does your signal handler return?"
11612                 . ./myread
11613                 case "$ans" in
11614                 v*) val="$define";;
11615                 *) val="$undef";;
11616                 esac;;
11617         "$define")
11618                 echo "As you already told me, signal handler returns void." >&4
11619                 val="$define"
11620                 ;;
11621         *)      echo "As you already told me, signal handler returns int." >&4
11622                 val="$undef"
11623                 ;;
11624         esac
11625 fi
11626 set d_voidsig
11627 eval $setvar
11628 case "$d_voidsig" in
11629 "$define") signal_t="void";;
11630 *) signal_t="int";;
11631 esac
11632 $rm -f $$.tmp
11633
11634 : check for ability to cast large floats to 32-bit ints.
11635 echo " "
11636 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11637 if $test "$intsize" -ge 4; then
11638         xxx=int
11639 else
11640         xxx=long
11641 fi
11642 $cat >try.c <<EOCP
11643 #include <stdio.h>
11644 #$i_stdlib I_STDLIB
11645 #ifdef I_STDLIB
11646 #include <stdlib.h>
11647 #endif
11648 #include <sys/types.h>
11649 #include <signal.h>
11650 $signal_t blech(int s) { exit(3); }
11651 int main()
11652 {
11653         $xxx i32;
11654         double f, g;
11655         int result = 0;
11656         char str[16];
11657         signal(SIGFPE, blech);
11658
11659         /* Don't let compiler optimize the test away.  Store the number
11660            in a writable string for gcc to pass to sscanf under HP-UX.
11661         */
11662         sprintf(str, "2147483647");
11663         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11664         g = 10 * f;
11665         i32  = ($xxx) g;
11666
11667         /* x86 processors will probably give 0x8000 0000, which is a
11668            sign change.  We don't want that.  We want to mimic SPARC
11669            behavior here, which is to preserve the sign and give
11670            back 0x7fff ffff.
11671         */
11672         if (i32 != ($xxx) f)
11673                 result |= 1;
11674         exit(result);
11675 }
11676 EOCP
11677 set try
11678 if eval $compile_ok; then
11679         $run ./try 2>/dev/null
11680         yyy=$?
11681 else
11682         echo "(I can't seem to compile the test program--assuming it can't)"
11683         yyy=1
11684 fi
11685 case "$yyy" in
11686 0)      val="$define"
11687         echo "Yup, it can."
11688         ;;
11689 *)      val="$undef"
11690         echo "Nope, it can't."
11691         ;;
11692 esac
11693 set d_casti32
11694 eval $setvar
11695 $rm_try
11696
11697 : check for ability to cast negative floats to unsigned
11698 echo " "
11699 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11700 $cat >try.c <<EOCP
11701 #include <stdio.h>
11702 #$i_stdlib I_STDLIB
11703 #ifdef I_STDLIB
11704 #include <stdlib.h>
11705 #endif
11706 #include <sys/types.h>
11707 #include <signal.h>
11708 $signal_t blech(int s) { exit(7); }
11709 $signal_t blech_in_list(int s) { exit(4); }
11710 unsigned long dummy_long(unsigned long p) { return p; }
11711 unsigned int dummy_int(unsigned int p) { return p; }
11712 unsigned short dummy_short(unsigned short p) { return p; }
11713 int main()
11714 {
11715         double f;
11716         unsigned long along;
11717         unsigned int aint;
11718         unsigned short ashort;
11719         int result = 0;
11720         char str[16];
11721
11722         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11723            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11724            optimized the whole file away
11725         */
11726         /* Store the number in a writable string for gcc to pass to
11727            sscanf under HP-UX.
11728         */
11729         sprintf(str, "-123");
11730         sscanf(str, "%lf", &f);  /* f = -123.; */
11731
11732         signal(SIGFPE, blech);
11733         along = (unsigned long)f;
11734         aint = (unsigned int)f;
11735         ashort = (unsigned short)f;
11736         if (along != (unsigned long)-123)
11737                 result |= 1;
11738         if (aint != (unsigned int)-123)
11739                 result |= 1;
11740         if (ashort != (unsigned short)-123)
11741                 result |= 1;
11742         sprintf(str, "1073741824.");
11743         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11744         f = f + f;
11745         along = 0;
11746         along = (unsigned long)f;
11747         if (along != 0x80000000)
11748                 result |= 2;
11749         f -= 1.;
11750         along = 0;
11751         along = (unsigned long)f;
11752         if (along != 0x7fffffff)
11753                 result |= 1;
11754         f += 2.;
11755         along = 0;
11756         along = (unsigned long)f;
11757         if (along != 0x80000001)
11758                 result |= 2;
11759         if (result)
11760                 exit(result);
11761         signal(SIGFPE, blech_in_list);
11762         sprintf(str, "123.");
11763         sscanf(str, "%lf", &f);  /* f = 123.; */
11764         along = dummy_long((unsigned long)f);
11765         aint = dummy_int((unsigned int)f);
11766         ashort = dummy_short((unsigned short)f);
11767         if (along != (unsigned long)123)
11768                 result |= 4;
11769         if (aint != (unsigned int)123)
11770                 result |= 4;
11771         if (ashort != (unsigned short)123)
11772                 result |= 4;
11773         exit(result);
11774
11775 }
11776 EOCP
11777 set try
11778 if eval $compile_ok; then
11779         $run ./try 2>/dev/null
11780         castflags=$?
11781 else
11782         echo "(I can't seem to compile the test program--assuming it can't)"
11783         castflags=7
11784 fi
11785 case "$castflags" in
11786 0)      val="$define"
11787         echo "Yup, it can."
11788         ;;
11789 *)      val="$undef"
11790         echo "Nope, it can't."
11791         ;;
11792 esac
11793 set d_castneg
11794 eval $setvar
11795 $rm_try
11796
11797 : see if cbrt exists
11798 set cbrt d_cbrt
11799 eval $inlibc
11800
11801 : see if chown exists
11802 set chown d_chown
11803 eval $inlibc
11804
11805 : see if chroot exists
11806 set chroot d_chroot
11807 eval $inlibc
11808
11809 : see if chsize exists
11810 set chsize d_chsize
11811 eval $inlibc
11812
11813 : see if class exists
11814 set class d_class
11815 eval $inlibc
11816
11817 : see if clearenv exists
11818 set clearenv d_clearenv
11819 eval $inlibc
11820
11821 : Define hasstruct macro for Configure internal use
11822 hasstruct='varname=$1; struct=$2; shift; shift;
11823 while $test $# -ge 2; do
11824         case "$1" in
11825         $define) echo "#include <$2>";;
11826         esac ;
11827     shift 2;
11828 done > try.c;
11829 echo "int main () { struct $struct foo; }" >> try.c;
11830 set try;
11831 if eval $compile; then
11832         val="$define";
11833 else
11834         val="$undef";
11835 fi;
11836 set $varname;
11837 eval $setvar;
11838 $rm_try'
11839
11840 : see whether socket exists
11841 socketlib=''
11842 sockethdr=''
11843 echo " "
11844 $echo $n "Hmm... $c" >&4
11845 if set socket val -f d_socket; eval $csym; $val; then
11846     echo "Looks like you have Berkeley networking support." >&4
11847     d_socket="$define"
11848     if set setsockopt val -f; eval $csym; $val; then
11849         d_oldsock="$undef"
11850     else
11851         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11852         d_oldsock="$define"
11853     fi
11854 else
11855     if $contains socklib libc.list >/dev/null 2>&1; then
11856         echo "Looks like you have Berkeley networking support." >&4
11857         d_socket="$define"
11858         : we will have to assume that it supports the 4.2 BSD interface
11859         d_oldsock="$undef"
11860     else
11861         echo "You don't have Berkeley networking in libc$_a..." >&4
11862         if test "X$d_socket" = "X$define"; then
11863             echo "...but you seem to believe that you have sockets." >&4
11864         else
11865             for net in net socket
11866             do
11867                 if test -f $sysroot/usr/lib/lib$net$_a; then
11868                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11869                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11870                     if $contains socket libc.list >/dev/null 2>&1; then
11871                         d_socket="$define"
11872                         socketlib="-l$net"
11873                         case "$net" in
11874                         net)
11875                             echo "...but the Wollongong group seems to have hacked it in." >&4
11876                             sockethdr="-I$sysroot/usr/netinclude"
11877                             ;;
11878                         esac
11879                         echo "Found Berkeley sockets interface in lib$net." >&4
11880                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11881                             d_oldsock="$undef"
11882                         else
11883                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11884                             d_oldsock="$define"
11885                         fi
11886                         break
11887                     fi
11888                 fi
11889             done
11890             if test "X$d_socket" != "X$define"; then
11891                echo "or anywhere else I see." >&4
11892                d_socket="$undef"
11893                d_oldsock="$undef"
11894             fi
11895         fi
11896     fi
11897 fi
11898
11899 : see if socketpair exists
11900 set socketpair d_sockpair
11901 eval $inlibc
11902
11903
11904 echo " "
11905 echo "Checking the availability sa_len in the sock struct ..." >&4
11906 $cat >try.c <<EOF
11907 #include <sys/types.h>
11908 #include <sys/socket.h>
11909 int main() {
11910 struct sockaddr sa;
11911 return (sa.sa_len);
11912 }
11913 EOF
11914 val="$undef"
11915 set try; if eval $compile; then
11916     val="$define"
11917 fi
11918 set d_sockaddr_sa_len; eval $setvar
11919 $rm_try
11920
11921 echo " "
11922 echo "Checking the availability struct sockaddr_in6 ..." >&4
11923 $cat >try.c <<EOF
11924 #include <sys/types.h>
11925 #include <sys/socket.h>
11926 #include <netinet/in.h>
11927 int main() {
11928 struct sockaddr_in6 sin6;
11929 return (sin6.sin6_family);
11930 }
11931 EOF
11932 val="$undef"
11933 set try; if eval $compile; then
11934     val="$define"
11935 fi
11936 set d_sockaddr_in6; eval $setvar
11937 $rm_try
11938
11939 echo " "
11940 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11941 $cat >try.c <<EOF
11942 #include <sys/types.h>
11943 #include <sys/socket.h>
11944 #include <netinet/in.h>
11945 int main() {
11946 struct sockaddr_in6 sin6;
11947 return (sin6.sin6_scope_id);
11948 }
11949 EOF
11950 val="$undef"
11951 set try; if eval $compile; then
11952     val="$define"
11953 fi
11954 set d_sin6_scope_id; eval $setvar
11955 $rm_try
11956
11957 echo " "
11958 echo "Checking the availability struct ip_mreq ..." >&4
11959 $cat >try.c <<EOF
11960 #include <sys/types.h>
11961 #include <sys/socket.h>
11962 #include <netinet/in.h>
11963 int main() {
11964 struct ip_mreq mreq;
11965 return (mreq.imr_multiaddr.s_addr);
11966 }
11967 EOF
11968 val="$undef"
11969 set try; if eval $compile; then
11970        val="$define"
11971 fi
11972 set d_ip_mreq; eval $setvar
11973 $rm_try
11974
11975 echo " "
11976 echo "Checking the availability struct ip_mreq_source ..." >&4
11977 $cat >try.c <<EOF
11978 #include <sys/types.h>
11979 #include <sys/socket.h>
11980 #include <netinet/in.h>
11981 int main() {
11982 struct ip_mreq_source mreq;
11983 return (mreq.imr_multiaddr.s_addr);
11984 }
11985 EOF
11986 val="$undef"
11987 set try; if eval $compile; then
11988        val="$define"
11989 fi
11990 set d_ip_mreq_source; eval $setvar
11991 $rm_try
11992
11993 echo " "
11994 echo "Checking the availability struct ipv6_mreq ..." >&4
11995 $cat >try.c <<EOF
11996 #include <sys/types.h>
11997 #include <sys/socket.h>
11998 #include <netinet/in.h>
11999 int main() {
12000 struct ipv6_mreq mreq;
12001 return (mreq.ipv6mr_interface);
12002 }
12003 EOF
12004 val="$undef"
12005 set try; if eval $compile; then
12006     val="$define"
12007 fi
12008 set d_ipv6_mreq; eval $setvar
12009 $rm_try
12010
12011 echo " "
12012 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12013 $cat >try.c <<EOF
12014 #include <sys/types.h>
12015 #include <sys/socket.h>
12016 #include <netinet/in.h>
12017 int main() {
12018 struct ipv6_mreq_source mreq;
12019 return (mreq.imr_multiaddr.s_addr);
12020 }
12021 EOF
12022 val="$undef"
12023 set try; if eval $compile; then
12024        val="$define"
12025 fi
12026 set d_ipv6_mreq_source; eval $setvar
12027 $rm_try
12028
12029 echo " "
12030 echo "Checking the availability of certain socket constants..." >&4
12031 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12032     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12033     $cat >try.c <<EOF
12034 #include <sys/types.h>
12035 #include <sys/socket.h>
12036 int main() {
12037     int i = $ENUM;
12038 }
12039 EOF
12040     val="$undef"
12041     set try; if eval $compile; then
12042         val="$define"
12043     fi
12044     set d_${enum}; eval $setvar
12045     $rm_try
12046 done
12047
12048 : see if this is a sys/uio.h system
12049 set sys/uio.h i_sysuio
12050 eval $inhdr
12051
12052 : Check for cmsghdr support
12053 echo " "
12054 echo "Checking to see if your system supports struct cmsghdr..." >&4
12055 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12056 eval $hasstruct
12057 case "$d_cmsghdr_s" in
12058 "$define")      echo "Yes, it does."   ;;
12059 *)              echo "No, it doesn't." ;;
12060 esac
12061
12062 : see if copysign exists
12063 set copysign d_copysign
12064 eval $inlibc
12065
12066 : see if copysignl exists
12067 set copysignl d_copysignl
12068 eval $inlibc
12069
12070 : see if crypt exists
12071 echo " "
12072 set crypt d_crypt
12073 eval $inlibc
12074 case "$d_crypt" in
12075 $define) cryptlib='' ;;
12076 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12077                 echo 'crypt() found.' >&4
12078                 val="$define"
12079                 cryptlib=''
12080         else
12081                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12082                 if $test -z "$cryptlib"; then
12083                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12084                 else
12085                         cryptlib=-lcrypt
12086                 fi
12087                 if $test -z "$cryptlib"; then
12088                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12089                 else
12090                         cryptlib=-lcrypt
12091                 fi
12092                 if $test -z "$cryptlib"; then
12093                         cryptlib=`./loc libcrypt$_a "" $libpth`
12094                 else
12095                         cryptlib=-lcrypt
12096                 fi
12097                 if $test -z "$cryptlib"; then
12098                         echo 'crypt() NOT found.' >&4
12099                         val="$undef"
12100                 else
12101                         val="$define"
12102                 fi
12103         fi
12104         set d_crypt
12105         eval $setvar
12106         ;;
12107 esac
12108
12109 : see if this is a crypt.h system
12110 set crypt.h i_crypt
12111 eval $inhdr
12112
12113 : see if crypt_r exists
12114 set crypt_r d_crypt_r
12115 eval $inlibc
12116 case "$d_crypt_r" in
12117 "$define")
12118         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12119         case "$d_crypt_r_proto:$usethreads" in
12120         ":define")      d_crypt_r_proto=define
12121                 set d_crypt_r_proto crypt_r $hdrs
12122                 eval $hasproto ;;
12123         *)      ;;
12124         esac
12125         case "$d_crypt_r_proto" in
12126         define)
12127         case "$crypt_r_proto" in
12128         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12129         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12130         esac
12131         case "$crypt_r_proto" in
12132         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12133         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12134         esac
12135         case "$crypt_r_proto" in
12136         ''|0)   d_crypt_r=undef
12137                 crypt_r_proto=0
12138                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12139         * )     case "$crypt_r_proto" in
12140                 REENTRANT_PROTO*) ;;
12141                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12142                 esac
12143                 echo "Prototype: $try" ;;
12144         esac
12145         ;;
12146         *)      case "$usethreads" in
12147                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12148                 esac
12149                 d_crypt_r=undef
12150                 crypt_r_proto=0
12151                 ;;
12152         esac
12153         ;;
12154 *)      crypt_r_proto=0
12155         ;;
12156 esac
12157
12158 : get csh whereabouts
12159 case "$csh" in
12160 'csh') val="$undef" ;;
12161 *) val="$define" ;;
12162 esac
12163 set d_csh
12164 eval $setvar
12165 : Respect a hint or command line value for full_csh.
12166 case "$full_csh" in
12167 '') full_csh=$csh ;;
12168 esac
12169
12170 : see if ctermid exists
12171 set ctermid d_ctermid
12172 eval $inlibc
12173
12174 : see if ctermid_r exists
12175 set ctermid_r d_ctermid_r
12176 eval $inlibc
12177 case "$d_ctermid_r" in
12178 "$define")
12179         hdrs="$i_systypes sys/types.h define stdio.h "
12180         case "$d_ctermid_r_proto:$usethreads" in
12181         ":define")      d_ctermid_r_proto=define
12182                 set d_ctermid_r_proto ctermid_r $hdrs
12183                 eval $hasproto ;;
12184         *)      ;;
12185         esac
12186         case "$d_ctermid_r_proto" in
12187         define)
12188         case "$ctermid_r_proto" in
12189         ''|0) try='char* ctermid_r(char*);'
12190         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12191         esac
12192         case "$ctermid_r_proto" in
12193         ''|0)   d_ctermid_r=undef
12194                 ctermid_r_proto=0
12195                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12196         * )     case "$ctermid_r_proto" in
12197                 REENTRANT_PROTO*) ;;
12198                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12199                 esac
12200                 echo "Prototype: $try" ;;
12201         esac
12202         ;;
12203         *)      case "$usethreads" in
12204                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12205                 esac
12206                 d_ctermid_r=undef
12207                 ctermid_r_proto=0
12208                 ;;
12209         esac
12210         ;;
12211 *)      ctermid_r_proto=0
12212         ;;
12213 esac
12214
12215 : see if ctime_r exists
12216 set ctime_r d_ctime_r
12217 eval $inlibc
12218 case "$d_ctime_r" in
12219 "$define")
12220         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12221         case "$d_ctime_r_proto:$usethreads" in
12222         ":define")      d_ctime_r_proto=define
12223                 set d_ctime_r_proto ctime_r $hdrs
12224                 eval $hasproto ;;
12225         *)      ;;
12226         esac
12227         case "$d_ctime_r_proto" in
12228         define)
12229         case "$ctime_r_proto" in
12230         ''|0) try='char* ctime_r(const time_t*, char*);'
12231         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12232         esac
12233         case "$ctime_r_proto" in
12234         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12235         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12236         esac
12237         case "$ctime_r_proto" in
12238         ''|0) try='int ctime_r(const time_t*, char*);'
12239         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12240         esac
12241         case "$ctime_r_proto" in
12242         ''|0) try='int ctime_r(const time_t*, char*, int);'
12243         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12244         esac
12245         case "$ctime_r_proto" in
12246         ''|0)   d_ctime_r=undef
12247                 ctime_r_proto=0
12248                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12249         * )     case "$ctime_r_proto" in
12250                 REENTRANT_PROTO*) ;;
12251                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12252                 esac
12253                 echo "Prototype: $try" ;;
12254         esac
12255         ;;
12256         *)      case "$usethreads" in
12257                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12258                 esac
12259                 d_ctime_r=undef
12260                 ctime_r_proto=0
12261                 ;;
12262         esac
12263         ;;
12264 *)      ctime_r_proto=0
12265         ;;
12266 esac
12267
12268 : see if cuserid exists
12269 set cuserid d_cuserid
12270 eval $inlibc
12271
12272 : see if dbm.h is available
12273 : see if dbmclose exists
12274 set dbmclose d_dbmclose
12275 eval $inlibc
12276
12277 case "$d_dbmclose" in
12278 $define)
12279         set dbm.h i_dbm
12280         eval $inhdr
12281         case "$i_dbm" in
12282         $define)
12283                 val="$undef"
12284                 set i_rpcsvcdbm
12285                 eval $setvar
12286                 ;;
12287         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12288                 eval $inhdr
12289                 ;;
12290         esac
12291         ;;
12292 *)      echo "We won't be including <dbm.h>"
12293         val="$undef"
12294         set i_dbm
12295         eval $setvar
12296         val="$undef"
12297         set i_rpcsvcdbm
12298         eval $setvar
12299         ;;
12300 esac
12301
12302 : see if prototype for dbminit is available
12303 echo " "
12304 set d_dbminitproto dbminit $i_dbm dbm.h
12305 eval $hasproto
12306
12307 : see if difftime exists
12308 set difftime d_difftime
12309 eval $inlibc
12310
12311 : see if this is a dirent system
12312 echo " "
12313 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12314         val="$define"
12315         echo "<dirent.h> found." >&4
12316 else
12317         val="$undef"
12318         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12319                 echo "<sys/dir.h> found." >&4
12320                 echo " "
12321         else
12322                 xinc=`./findhdr sys/ndir.h`
12323         fi
12324         echo "<dirent.h> NOT found." >&4
12325 fi
12326 set i_dirent
12327 eval $setvar
12328
12329 : Look for type of directory structure.
12330 echo " "
12331 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12332
12333 case "$direntrytype" in
12334 ''|' ')
12335         case "$i_dirent" in
12336         $define) guess1='struct dirent' ;;
12337         *) guess1='struct direct'  ;;
12338         esac
12339         ;;
12340 *)      guess1="$direntrytype"
12341         ;;
12342 esac
12343
12344 case "$guess1" in
12345 'struct dirent') guess2='struct direct' ;;
12346 *) guess2='struct dirent' ;;
12347 esac
12348
12349 if $contains "$guess1" try.c >/dev/null 2>&1; then
12350         direntrytype="$guess1"
12351         echo "Your directory entries are $direntrytype." >&4
12352 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12353         direntrytype="$guess2"
12354         echo "Your directory entries seem to be $direntrytype." >&4
12355 else
12356         echo "I don't recognize your system's directory entries." >&4
12357         rp="What type is used for directory entries on this system?"
12358         dflt="$guess1"
12359         . ./myread
12360         direntrytype="$ans"
12361 fi
12362 $rm_try
12363
12364 : see if the directory entry stores field length
12365 echo " "
12366 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12367 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12368         echo "Good, your directory entry keeps length information in d_namlen." >&4
12369         val="$define"
12370 else
12371         echo "Your directory entry does not know about the d_namlen field." >&4
12372         val="$undef"
12373 fi
12374 set d_dirnamlen
12375 eval $setvar
12376 $rm_try
12377
12378 : Look for DIR.dd_fd
12379 case "$i_dirent" in
12380 "$define")
12381     echo "Checking to see if DIR has a dd_fd member variable" >&4
12382     $cat >try.c <<EOCP
12383 #$i_stdlib I_STDLIB
12384 #ifdef I_STDLIB
12385 #include <stdlib.h>
12386 #endif
12387 #include <dirent.h>
12388
12389 int main() {
12390     DIR dir;
12391     dir.dd_fd = 1;
12392     return 0;
12393 }
12394 EOCP
12395     val=$undef
12396     set try
12397     if eval $compile; then
12398         echo "Yes, it does."
12399         val="$define"
12400     else
12401         echo "No, it does not."
12402         val="$undef"
12403     fi
12404     ;;
12405 *)
12406     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12407     val="$undef"
12408     ;;
12409 esac
12410 set d_dir_dd_fd
12411 eval $setvar
12412 $rm_try
12413
12414 : see if this is an sysdir system
12415 set sys/dir.h i_sysdir
12416 eval $inhdr
12417
12418 : see if this is an sysndir system
12419 set sys/ndir.h i_sysndir
12420 eval $inhdr
12421
12422 : Look for dirfd
12423 echo " "
12424 $cat >dirfd.c <<EOM
12425 #include <stdio.h>
12426 #$i_stdlib I_STDLIB
12427 #ifdef I_STDLIB
12428 #include <stdlib.h>
12429 #endif
12430 #$i_dirent I_DIRENT             /**/
12431 #$i_sysdir I_SYS_DIR            /**/
12432 #$i_sysndir I_SYS_NDIR          /**/
12433 #$i_systypes I_SYS_TYPES        /**/
12434 #if defined(I_SYS_TYPES)
12435 #include <sys/types.h>
12436 #endif
12437 #if defined(I_DIRENT)
12438 #include <dirent.h>
12439 #else
12440 #ifdef I_SYS_NDIR
12441 #include <sys/ndir.h>
12442 #else
12443 #ifdef I_SYS_DIR
12444 #include <sys/dir.h>
12445 #endif
12446 #endif
12447 #endif
12448 int main() {
12449         DIR *dirp = opendir(".");
12450         if (dirfd(dirp) >= 0)
12451                 exit(0);
12452         else
12453                 exit(1);
12454 }
12455 EOM
12456 val=$undef
12457 set dirfd
12458 if eval $compile; then
12459         val="$define"
12460 fi
12461 case "$val" in
12462 $define)        echo "dirfd() found." >&4       ;;
12463 *)              echo "dirfd() NOT found." >&4   ;;
12464 esac
12465 set d_dirfd
12466 eval $setvar
12467 $rm -f dirfd*
12468
12469 : see if dladdr exists
12470 set dladdr d_dladdr
12471 eval $inlibc
12472
12473 : see if dlerror exists
12474 xxx_runnm="$runnm"
12475 runnm=false
12476 set dlerror d_dlerror
12477 eval $inlibc
12478 runnm="$xxx_runnm"
12479
12480 : see if dlfcn is available
12481 set dlfcn.h i_dlfcn
12482 eval $inhdr
12483
12484 : Check what extension to use for shared libs
12485 case "$usedl" in
12486 $define|y|true)
12487         $cat << EOM
12488
12489 On a few systems, the dynamically loaded modules that perl generates and uses
12490 will need a different extension than shared libs. The default will probably
12491 be appropriate.
12492
12493 EOM
12494         case "$dlext" in
12495         '')     dflt="$so" ;;
12496         *)      dflt="$dlext" ;;
12497         esac
12498         rp='What is the extension of dynamically loaded modules'
12499         . ./myread
12500         dlext="$ans"
12501         ;;
12502 *)
12503         dlext="none"
12504         ;;
12505 esac
12506
12507 : Check if dlsym need a leading underscore
12508 echo " "
12509 val="$undef"
12510
12511 case "$dlsrc" in
12512 dl_dlopen.xs)
12513         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12514         $cat >dyna.c <<'EOM'
12515 fred () { }
12516 EOM
12517
12518 $cat >fred.c<<EOM
12519
12520 #include <stdio.h>
12521 #$i_stdlib I_STDLIB
12522 #ifdef I_STDLIB
12523 #include <stdlib.h>
12524 #endif
12525 #$i_dlfcn I_DLFCN
12526 #ifdef I_DLFCN
12527 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12528 #else
12529 #include <sys/types.h>
12530 #include <nlist.h>
12531 #include <link.h>
12532 #endif
12533
12534 extern int fred() ;
12535
12536 int main()
12537 {
12538     void * handle ;
12539     void * symbol ;
12540 #ifndef RTLD_LAZY
12541     int mode = 1 ;
12542 #else
12543     int mode = RTLD_LAZY ;
12544 #endif
12545     handle = dlopen("./dyna.$dlext", mode) ;
12546     if (handle == NULL) {
12547         printf ("1\n") ;
12548         fflush (stdout) ;
12549         exit(0);
12550     }
12551     symbol = dlsym(handle, "fred") ;
12552     if (symbol == NULL) {
12553         /* try putting a leading underscore */
12554         symbol = dlsym(handle, "_fred") ;
12555         if (symbol == NULL) {
12556             printf ("2\n") ;
12557             fflush (stdout) ;
12558             exit(0);
12559         }
12560         printf ("3\n") ;
12561     }
12562     else
12563         printf ("4\n") ;
12564     fflush (stdout) ;
12565     exit(0);
12566 }
12567 EOM
12568         : Call the object file tmp-dyna.o in case dlext=o.
12569         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12570                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12571                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12572                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12573                 xxx=`$run ./fred`
12574                 case $xxx in
12575                 1)      echo "Test program failed using dlopen." >&4
12576                         echo "Perhaps you should not use dynamic loading." >&4;;
12577                 2)      echo "Test program failed using dlsym." >&4
12578                         echo "Perhaps you should not use dynamic loading." >&4;;
12579                 3)      echo "dlsym needs a leading underscore" >&4
12580                         val="$define" ;;
12581                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12582                 esac
12583         else
12584                 echo "I can't compile and run the test program." >&4
12585                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12586         fi
12587         ;;
12588 esac
12589
12590 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12591
12592 set d_dlsymun
12593 eval $setvar
12594
12595 : see if drand48_r exists
12596 set drand48_r d_drand48_r
12597 eval $inlibc
12598 case "$d_drand48_r" in
12599 "$define")
12600         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12601         case "$d_drand48_r_proto:$usethreads" in
12602         ":define")      d_drand48_r_proto=define
12603                 set d_drand48_r_proto drand48_r $hdrs
12604                 eval $hasproto ;;
12605         *)      ;;
12606         esac
12607         case "$d_drand48_r_proto" in
12608         define)
12609         case "$drand48_r_proto" in
12610         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12611         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12612         esac
12613         case "$drand48_r_proto" in
12614         ''|0)   d_drand48_r=undef
12615                 drand48_r_proto=0
12616                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12617         * )     case "$drand48_r_proto" in
12618                 REENTRANT_PROTO*) ;;
12619                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12620                 esac
12621                 echo "Prototype: $try" ;;
12622         esac
12623         ;;
12624         *)      case "$usethreads" in
12625                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12626                 esac
12627                 d_drand48_r=undef
12628                 drand48_r_proto=0
12629                 ;;
12630         esac
12631         ;;
12632 *)      drand48_r_proto=0
12633         ;;
12634 esac
12635
12636 : see if prototype for drand48 is available
12637 echo " "
12638 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12639 eval $hasproto
12640
12641 : see if dup2 exists
12642 set dup2 d_dup2
12643 eval $inlibc
12644
12645 : see if dup3 exists
12646 set dup3 d_dup3
12647 eval $inlibc
12648
12649 : see if this is an xlocale.h system
12650 set xlocale.h i_xlocale
12651 eval $inhdr
12652
12653 : see if newlocale exists
12654 set newlocale d_newlocale
12655 eval $inlibc
12656
12657 : see if freelocale exists
12658 set freelocale d_freelocale
12659 eval $inlibc
12660
12661 : see if uselocale exists
12662 set uselocale d_uselocale
12663 eval $inlibc
12664
12665 : see if duplocale exists
12666 set duplocale d_duplocale
12667 eval $inlibc
12668
12669 : see if querylocale exists
12670 set querylocale d_querylocale
12671 eval $inlibc
12672
12673 : see if eaccess exists
12674 set eaccess d_eaccess
12675 eval $inlibc
12676
12677 : see if endgrent exists
12678 set endgrent d_endgrent
12679 eval $inlibc
12680
12681 : see if this is an grp system
12682 set grp.h i_grp
12683 eval $inhdr
12684
12685 case "$i_grp" in
12686 $define)
12687         xxx=`./findhdr grp.h`
12688         $cppstdin $cppflags $cppminus < $xxx >$$.h
12689
12690         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12691                 val="$define"
12692         else
12693                 val="$undef"
12694         fi
12695         set d_grpasswd
12696         eval $setvar
12697
12698         $rm -f $$.h
12699         ;;
12700 *)
12701         val="$undef";
12702         set d_grpasswd; eval $setvar
12703         ;;
12704 esac
12705
12706 : see if endgrent_r exists
12707 set endgrent_r d_endgrent_r
12708 eval $inlibc
12709 case "$d_endgrent_r" in
12710 "$define")
12711         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12712         case "$d_endgrent_r_proto:$usethreads" in
12713         ":define")      d_endgrent_r_proto=define
12714                 set d_endgrent_r_proto endgrent_r $hdrs
12715                 eval $hasproto ;;
12716         *)      ;;
12717         esac
12718         case "$d_endgrent_r_proto" in
12719         define)
12720         case "$endgrent_r_proto" in
12721         ''|0) try='int endgrent_r(FILE**);'
12722         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12723         esac
12724         case "$endgrent_r_proto" in
12725         ''|0) try='void endgrent_r(FILE**);'
12726         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12727         esac
12728         case "$endgrent_r_proto" in
12729         ''|0)   d_endgrent_r=undef
12730                 endgrent_r_proto=0
12731                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12732         * )     case "$endgrent_r_proto" in
12733                 REENTRANT_PROTO*) ;;
12734                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12735                 esac
12736                 echo "Prototype: $try" ;;
12737         esac
12738         ;;
12739         *)      case "$usethreads" in
12740                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12741                 esac
12742                 d_endgrent_r=undef
12743                 endgrent_r_proto=0
12744                 ;;
12745         esac
12746         ;;
12747 *)      endgrent_r_proto=0
12748         ;;
12749 esac
12750
12751 : see if endhostent exists
12752 set endhostent d_endhent
12753 eval $inlibc
12754
12755 : see if this is a netdb.h system
12756 set netdb.h i_netdb
12757 eval $inhdr
12758
12759 : see if endhostent_r exists
12760 set endhostent_r d_endhostent_r
12761 eval $inlibc
12762 case "$d_endhostent_r" in
12763 "$define")
12764         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12765         case "$d_endhostent_r_proto:$usethreads" in
12766         ":define")      d_endhostent_r_proto=define
12767                 set d_endhostent_r_proto endhostent_r $hdrs
12768                 eval $hasproto ;;
12769         *)      ;;
12770         esac
12771         case "$d_endhostent_r_proto" in
12772         define)
12773         case "$endhostent_r_proto" in
12774         ''|0) try='int endhostent_r(struct hostent_data*);'
12775         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12776         esac
12777         case "$endhostent_r_proto" in
12778         ''|0) try='void endhostent_r(struct hostent_data*);'
12779         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12780         esac
12781         case "$endhostent_r_proto" in
12782         ''|0)   d_endhostent_r=undef
12783                 endhostent_r_proto=0
12784                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12785         * )     case "$endhostent_r_proto" in
12786                 REENTRANT_PROTO*) ;;
12787                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12788                 esac
12789                 echo "Prototype: $try" ;;
12790         esac
12791         ;;
12792         *)      case "$usethreads" in
12793                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12794                 esac
12795                 d_endhostent_r=undef
12796                 endhostent_r_proto=0
12797                 ;;
12798         esac
12799         ;;
12800 *)      endhostent_r_proto=0
12801         ;;
12802 esac
12803
12804 : see if endnetent exists
12805 set endnetent d_endnent
12806 eval $inlibc
12807
12808 : see if endnetent_r exists
12809 set endnetent_r d_endnetent_r
12810 eval $inlibc
12811 case "$d_endnetent_r" in
12812 "$define")
12813         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12814         case "$d_endnetent_r_proto:$usethreads" in
12815         ":define")      d_endnetent_r_proto=define
12816                 set d_endnetent_r_proto endnetent_r $hdrs
12817                 eval $hasproto ;;
12818         *)      ;;
12819         esac
12820         case "$d_endnetent_r_proto" in
12821         define)
12822         case "$endnetent_r_proto" in
12823         ''|0) try='int endnetent_r(struct netent_data*);'
12824         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12825         esac
12826         case "$endnetent_r_proto" in
12827         ''|0) try='void endnetent_r(struct netent_data*);'
12828         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12829         esac
12830         case "$endnetent_r_proto" in
12831         ''|0)   d_endnetent_r=undef
12832                 endnetent_r_proto=0
12833                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12834         * )     case "$endnetent_r_proto" in
12835                 REENTRANT_PROTO*) ;;
12836                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12837                 esac
12838                 echo "Prototype: $try" ;;
12839         esac
12840         ;;
12841         *)      case "$usethreads" in
12842                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12843                 esac
12844                 d_endnetent_r=undef
12845                 endnetent_r_proto=0
12846                 ;;
12847         esac
12848         ;;
12849 *)      endnetent_r_proto=0
12850         ;;
12851 esac
12852
12853 : see if endprotoent exists
12854 set endprotoent d_endpent
12855 eval $inlibc
12856
12857 : see if endprotoent_r exists
12858 set endprotoent_r d_endprotoent_r
12859 eval $inlibc
12860 case "$d_endprotoent_r" in
12861 "$define")
12862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12863         case "$d_endprotoent_r_proto:$usethreads" in
12864         ":define")      d_endprotoent_r_proto=define
12865                 set d_endprotoent_r_proto endprotoent_r $hdrs
12866                 eval $hasproto ;;
12867         *)      ;;
12868         esac
12869         case "$d_endprotoent_r_proto" in
12870         define)
12871         case "$endprotoent_r_proto" in
12872         ''|0) try='int endprotoent_r(struct protoent_data*);'
12873         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12874         esac
12875         case "$endprotoent_r_proto" in
12876         ''|0) try='void endprotoent_r(struct protoent_data*);'
12877         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12878         esac
12879         case "$endprotoent_r_proto" in
12880         ''|0)   d_endprotoent_r=undef
12881                 endprotoent_r_proto=0
12882                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12883         * )     case "$endprotoent_r_proto" in
12884                 REENTRANT_PROTO*) ;;
12885                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12886                 esac
12887                 echo "Prototype: $try" ;;
12888         esac
12889         ;;
12890         *)      case "$usethreads" in
12891                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12892                 esac
12893                 d_endprotoent_r=undef
12894                 endprotoent_r_proto=0
12895                 ;;
12896         esac
12897         ;;
12898 *)      endprotoent_r_proto=0
12899         ;;
12900 esac
12901
12902 : see if endpwent exists
12903 set endpwent d_endpwent
12904 eval $inlibc
12905
12906 : see if this is a pwd.h system
12907 set pwd.h i_pwd
12908 eval $inhdr
12909
12910 case "$i_pwd" in
12911 $define)
12912         xxx=`./findhdr pwd.h`
12913         $cppstdin $cppflags $cppminus < $xxx >$$.h
12914
12915         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12916                 val="$define"
12917         else
12918                 val="$undef"
12919         fi
12920         set d_pwquota
12921         eval $setvar
12922
12923         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12924                 val="$define"
12925         else
12926                 val="$undef"
12927         fi
12928         set d_pwage
12929         eval $setvar
12930
12931         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12932                 val="$define"
12933         else
12934                 val="$undef"
12935         fi
12936         set d_pwchange
12937         eval $setvar
12938
12939         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12940                 val="$define"
12941         else
12942                 val="$undef"
12943         fi
12944         set d_pwclass
12945         eval $setvar
12946
12947         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12948                 val="$define"
12949         else
12950                 val="$undef"
12951         fi
12952         set d_pwexpire
12953         eval $setvar
12954
12955         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12956                 val="$define"
12957         else
12958                 val="$undef"
12959         fi
12960         set d_pwcomment
12961         eval $setvar
12962
12963         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12964                 val="$define"
12965         else
12966                 val="$undef"
12967         fi
12968         set d_pwgecos
12969         eval $setvar
12970
12971         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12972                 val="$define"
12973         else
12974                 val="$undef"
12975         fi
12976         set d_pwpasswd
12977         eval $setvar
12978
12979         $rm -f $$.h
12980         ;;
12981 *)
12982         val="$undef";
12983         set d_pwquota; eval $setvar
12984         set d_pwage; eval $setvar
12985         set d_pwchange; eval $setvar
12986         set d_pwclass; eval $setvar
12987         set d_pwexpire; eval $setvar
12988         set d_pwcomment; eval $setvar
12989         set d_pwgecos; eval $setvar
12990         set d_pwpasswd; eval $setvar
12991         ;;
12992 esac
12993
12994 : see if endpwent_r exists
12995 set endpwent_r d_endpwent_r
12996 eval $inlibc
12997 case "$d_endpwent_r" in
12998 "$define")
12999         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13000         case "$d_endpwent_r_proto:$usethreads" in
13001         ":define")      d_endpwent_r_proto=define
13002                 set d_endpwent_r_proto endpwent_r $hdrs
13003                 eval $hasproto ;;
13004         *)      ;;
13005         esac
13006         case "$d_endpwent_r_proto" in
13007         define)
13008         case "$endpwent_r_proto" in
13009         ''|0) try='int endpwent_r(FILE**);'
13010         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13011         esac
13012         case "$endpwent_r_proto" in
13013         ''|0) try='void endpwent_r(FILE**);'
13014         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13015         esac
13016         case "$endpwent_r_proto" in
13017         ''|0)   d_endpwent_r=undef
13018                 endpwent_r_proto=0
13019                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13020         * )     case "$endpwent_r_proto" in
13021                 REENTRANT_PROTO*) ;;
13022                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13023                 esac
13024                 echo "Prototype: $try" ;;
13025         esac
13026         ;;
13027         *)      case "$usethreads" in
13028                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13029                 esac
13030                 d_endpwent_r=undef
13031                 endpwent_r_proto=0
13032                 ;;
13033         esac
13034         ;;
13035 *)      endpwent_r_proto=0
13036         ;;
13037 esac
13038
13039 : see if endservent exists
13040 set endservent d_endsent
13041 eval $inlibc
13042
13043 : see if endservent_r exists
13044 set endservent_r d_endservent_r
13045 eval $inlibc
13046 case "$d_endservent_r" in
13047 "$define")
13048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13049         case "$d_endservent_r_proto:$usethreads" in
13050         ":define")      d_endservent_r_proto=define
13051                 set d_endservent_r_proto endservent_r $hdrs
13052                 eval $hasproto ;;
13053         *)      ;;
13054         esac
13055         case "$d_endservent_r_proto" in
13056         define)
13057         case "$endservent_r_proto" in
13058         ''|0) try='int endservent_r(struct servent_data*);'
13059         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13060         esac
13061         case "$endservent_r_proto" in
13062         ''|0) try='void endservent_r(struct servent_data*);'
13063         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13064         esac
13065         case "$endservent_r_proto" in
13066         ''|0)   d_endservent_r=undef
13067                 endservent_r_proto=0
13068                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13069         * )     case "$endservent_r_proto" in
13070                 REENTRANT_PROTO*) ;;
13071                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13072                 esac
13073                 echo "Prototype: $try" ;;
13074         esac
13075         ;;
13076         *)      case "$usethreads" in
13077                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13078                 esac
13079                 d_endservent_r=undef
13080                 endservent_r_proto=0
13081                 ;;
13082         esac
13083         ;;
13084 *)      endservent_r_proto=0
13085         ;;
13086 esac
13087
13088 : Locate the flags for 'open()'
13089 echo " "
13090 $cat >try.c <<EOCP
13091 #include <sys/types.h>
13092 #ifdef I_FCNTL
13093 #include <fcntl.h>
13094 #endif
13095 #ifdef I_SYS_FILE
13096 #include <sys/file.h>
13097 #endif
13098 #$i_stdlib I_STDLIB
13099 #ifdef I_STDLIB
13100 #include <stdlib.h>
13101 #endif
13102 int main() {
13103         if(O_RDONLY);
13104 #ifdef O_TRUNC
13105         exit(0);
13106 #else
13107         exit(1);
13108 #endif
13109 }
13110 EOCP
13111 : check sys/file.h first to get FREAD on Sun
13112 if $test `./findhdr sys/file.h` && \
13113                 set try -DI_SYS_FILE && eval $compile; then
13114         h_sysfile=true;
13115         echo "<sys/file.h> defines the O_* constants..." >&4
13116         if $run ./try; then
13117                 echo "and you have the 3 argument form of open()." >&4
13118                 val="$define"
13119         else
13120                 echo "but not the 3 argument form of open().  Oh, well." >&4
13121                 val="$undef"
13122         fi
13123 elif $test `./findhdr fcntl.h` && \
13124                 set try -DI_FCNTL && eval $compile; then
13125         h_fcntl=true;
13126         echo "<fcntl.h> defines the O_* constants..." >&4
13127         if $run ./try; then
13128                 echo "and you have the 3 argument form of open()." >&4
13129                 val="$define"
13130         else
13131                 echo "but not the 3 argument form of open().  Oh, well." >&4
13132                 val="$undef"
13133         fi
13134 else
13135         val="$undef"
13136         echo "I can't find the O_* constant definitions!  You got problems." >&4
13137 fi
13138 set d_open3
13139 eval $setvar
13140 $rm_try
13141
13142 : see if this is a sys/file.h system
13143 val=''
13144 set sys/file.h val
13145 eval $inhdr
13146
13147 : do we need to include sys/file.h ?
13148 case "$val" in
13149 "$define")
13150         echo " "
13151         if $h_sysfile; then
13152                 val="$define"
13153                 echo "We'll be including <sys/file.h>." >&4
13154         else
13155                 val="$undef"
13156                 echo "We won't be including <sys/file.h>." >&4
13157         fi
13158         ;;
13159 *)
13160         h_sysfile=false
13161         ;;
13162 esac
13163 set i_sysfile
13164 eval $setvar
13165
13166 : see if fcntl.h is there
13167 val=''
13168 set fcntl.h val
13169 eval $inhdr
13170
13171 : see if we can include fcntl.h
13172 case "$val" in
13173 "$define")
13174         echo " "
13175         if $h_fcntl; then
13176                 val="$define"
13177                 echo "We'll be including <fcntl.h>." >&4
13178         else
13179                 val="$undef"
13180                 if $h_sysfile; then
13181         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13182                 else
13183                         echo "We won't be including <fcntl.h>." >&4
13184                 fi
13185         fi
13186         ;;
13187 *)
13188         h_fcntl=false
13189         val="$undef"
13190         ;;
13191 esac
13192 set i_fcntl
13193 eval $setvar
13194
13195 : see if fork exists
13196 set fork d_fork
13197 eval $inlibc
13198
13199 : see if pipe exists
13200 set pipe d_pipe
13201 eval $inlibc
13202
13203 : check for non-blocking I/O stuff
13204 case "$h_sysfile" in
13205 true) echo "#include <sys/file.h>" > head.c;;
13206 *)
13207        case "$h_fcntl" in
13208        true) echo "#include <fcntl.h>" > head.c;;
13209        *) echo "#include <sys/fcntl.h>" > head.c;;
13210        esac
13211        ;;
13212 esac
13213 echo " "
13214 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13215 case "$o_nonblock" in
13216 '')
13217         $cat head.c > try.c
13218         $cat >>try.c <<EOCP
13219 #include <stdio.h>
13220 #$i_stdlib I_STDLIB
13221 #ifdef I_STDLIB
13222 #include <stdlib.h>
13223 #endif
13224 #$i_fcntl I_FCNTL
13225 #ifdef I_FCNTL
13226 #include <fcntl.h>
13227 #endif
13228 int main() {
13229 #ifdef O_NONBLOCK
13230         printf("O_NONBLOCK\n");
13231         exit(0);
13232 #endif
13233 #ifdef O_NDELAY
13234         printf("O_NDELAY\n");
13235         exit(0);
13236 #endif
13237 #ifdef FNDELAY
13238         printf("FNDELAY\n");
13239         exit(0);
13240 #endif
13241         exit(0);
13242 }
13243 EOCP
13244         set try
13245         if eval $compile_ok; then
13246                 o_nonblock=`$run ./try`
13247                 case "$o_nonblock" in
13248                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13249                 *) echo "Seems like we can use $o_nonblock.";;
13250                 esac
13251         else
13252                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13253         fi
13254         ;;
13255 *) echo "Using $hint value $o_nonblock.";;
13256 esac
13257 $rm_try
13258
13259 echo " "
13260 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13261 case "$eagain" in
13262 '')
13263         case "$d_fork:$d_pipe:$d_alarm" in
13264         define:define:define)
13265         $cat head.c > try.c
13266         $cat >>try.c <<EOCP
13267 #include <errno.h>
13268 #include <sys/types.h>
13269 #include <signal.h>
13270 #include <stdio.h>
13271 #$i_stdlib I_STDLIB
13272 #ifdef I_STDLIB
13273 #include <stdlib.h>
13274 #endif
13275 #$i_fcntl I_FCNTL
13276 #ifdef I_FCNTL
13277 #include <fcntl.h>
13278 #endif
13279 #define MY_O_NONBLOCK $o_nonblock
13280 #ifndef errno  /* XXX need better Configure test */
13281 extern int errno;
13282 #endif
13283 #$i_unistd I_UNISTD
13284 #ifdef I_UNISTD
13285 #include <unistd.h>
13286 #endif
13287 #include <string.h>
13288 $signal_t blech(int x) { exit(3); }
13289 EOCP
13290         $cat >> try.c <<'EOCP'
13291 int main()
13292 {
13293         int pd[2];
13294         int pu[2];
13295         char buf[1];
13296         char string[100];
13297         int ret;
13298
13299         ret = pipe(pd); /* Down: child -> parent */
13300         if (ret != 0)
13301                 exit(3);
13302         ret = pipe(pu); /* Up: parent -> child */
13303         if (ret != 0)
13304                 exit(3);
13305         if (0 != fork()) {
13306                 close(pd[1]);   /* Parent reads from pd[0] */
13307                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13308 #ifdef F_SETFL
13309                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13310                         exit(1);
13311 #else
13312                 exit(4);
13313 #endif
13314                 signal(SIGALRM, blech);
13315                 alarm(5);
13316                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13317                         exit(2);
13318                 sprintf(string, "%d\n", ret);
13319                 ret = write(2, string, strlen(string));
13320                 if (ret != strlen(string))
13321                         exit(3);
13322                 alarm(0);
13323 #ifdef EAGAIN
13324                 if (errno == EAGAIN) {
13325                         printf("EAGAIN\n");
13326                         goto ok;
13327                 }
13328 #endif
13329 #ifdef EWOULDBLOCK
13330                 if (errno == EWOULDBLOCK)
13331                         printf("EWOULDBLOCK\n");
13332 #endif
13333         ok:
13334                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13335                 if (ret != 1)
13336                         exit(3);
13337                 sleep(2);                               /* Give it time to close our pipe */
13338                 alarm(5);
13339                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13340                 alarm(0);
13341                 sprintf(string, "%d\n", ret);
13342                 ret = write(4, string, strlen(string));
13343                 if (ret != strlen(string))
13344                         exit(3);
13345                 exit(0);
13346         }
13347
13348         close(pd[0]);                   /* We write to pd[1] */
13349         close(pu[1]);                   /* We read from pu[0] */
13350         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13351         if (ret != 1)
13352                 exit(3);
13353         close(pd[1]);                   /* Pipe pd is now fully closed! */
13354         exit(0);                                /* Bye bye, thank you for playing! */
13355 }
13356 EOCP
13357         set try
13358         if eval $compile_ok; then
13359                 echo "$startsh" >mtry
13360                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13361                 chmod +x mtry
13362                 $run ./mtry >/dev/null 2>&1
13363                 case $? in
13364                 0) eagain=`$cat try.out`;;
13365                 1) echo "Could not perform non-blocking setting!";;
13366                 2) echo "I did a successful read() for something that was not there!";;
13367                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13368                 4) echo "Could not find F_SETFL!";;
13369                 *) echo "Something terribly wrong happened during testing.";;
13370                 esac
13371                 rd_nodata=`$cat try.ret`
13372                 echo "A read() system call with no data present returns $rd_nodata."
13373                 case "$rd_nodata" in
13374                 0|-1) ;;
13375                 *)
13376                         echo "(That's peculiar, fixing that to be -1.)"
13377                         rd_nodata=-1
13378                         ;;
13379                 esac
13380                 case "$eagain" in
13381                 '')
13382                         echo "Forcing errno EAGAIN on read() with no data available."
13383                         eagain=EAGAIN
13384                         ;;
13385                 *)
13386                         echo "Your read() sets errno to $eagain when no data is available."
13387                         ;;
13388                 esac
13389                 status=`$cat try.err`
13390                 case "$status" in
13391                 0) echo "And it correctly returns 0 to signal EOF.";;
13392                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13393                 *) echo "However, your read() returns '$status' on EOF??";;
13394                 esac
13395                 val="$define"
13396                 if test "$status" = "$rd_nodata"; then
13397                         echo "WARNING: you can't distinguish between EOF and no data!"
13398                         val="$undef"
13399                 fi
13400         else
13401                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13402                 eagain=EAGAIN
13403         fi
13404         ;;
13405         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13406                 eagain=EAGAIN
13407                 val="$define"
13408                 ;;
13409         esac
13410         set d_eofnblk
13411         eval $setvar
13412         ;;
13413 *)
13414         echo "Using $hint value $eagain."
13415         echo "Your read() returns $rd_nodata when no data is present."
13416         case "$d_eofnblk" in
13417         "$define") echo "And you can see EOF because read() returns 0.";;
13418         "$undef") echo "But you can't see EOF status from read() returned value.";;
13419         *)
13420                 echo "(Assuming you can't see EOF status from read anyway.)"
13421                 d_eofnblk=$undef
13422                 ;;
13423         esac
13424         ;;
13425 esac
13426 $rm_try head.c mtry
13427
13428 : see if erf exists
13429 set erf d_erf
13430 eval $inlibc
13431
13432 : see if erfc exists
13433 set erfc d_erfc
13434 eval $inlibc
13435
13436 : see if exp2 exists
13437 set exp2 d_exp2
13438 eval $inlibc
13439
13440 : see if expm1 exists
13441 set expm1 d_expm1
13442 eval $inlibc
13443
13444 : see if _ptr and _cnt from stdio act std
13445 echo " "
13446
13447 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13448         echo "(Looks like you have stdio.h from BSD.)"
13449         case "$stdio_ptr" in
13450         '') stdio_ptr='((fp)->_p)'
13451                 ptr_lval=$define
13452                 ;;
13453         *)      ptr_lval=$d_stdio_ptr_lval;;
13454         esac
13455         case "$stdio_cnt" in
13456         '') stdio_cnt='((fp)->_r)'
13457                 cnt_lval=$define
13458                 ;;
13459         *)      cnt_lval=$d_stdio_cnt_lval;;
13460         esac
13461         case "$stdio_base" in
13462         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13463         esac
13464         case "$stdio_bufsiz" in
13465         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13466         esac
13467 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13468         echo "(Looks like you have stdio.h from Linux.)"
13469         case "$stdio_ptr" in
13470         '') stdio_ptr='((fp)->_IO_read_ptr)'
13471                 ptr_lval=$define
13472                 ;;
13473         *)      ptr_lval=$d_stdio_ptr_lval;;
13474         esac
13475         case "$stdio_cnt" in
13476         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13477                 cnt_lval=$undef
13478                 ;;
13479         *)      cnt_lval=$d_stdio_cnt_lval;;
13480         esac
13481         case "$stdio_base" in
13482         '') stdio_base='((fp)->_IO_read_base)';;
13483         esac
13484         case "$stdio_bufsiz" in
13485         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13486         esac
13487 else
13488         case "$stdio_ptr" in
13489         '') stdio_ptr='((fp)->_ptr)'
13490                 ptr_lval=$define
13491                 ;;
13492         *)      ptr_lval=$d_stdio_ptr_lval;;
13493         esac
13494         case "$stdio_cnt" in
13495         '') stdio_cnt='((fp)->_cnt)'
13496                 cnt_lval=$define
13497                 ;;
13498         *)      cnt_lval=$d_stdio_cnt_lval;;
13499         esac
13500         case "$stdio_base" in
13501         '') stdio_base='((fp)->_base)';;
13502         esac
13503         case "$stdio_bufsiz" in
13504         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13505         esac
13506 fi
13507
13508 : test whether _ptr and _cnt really work
13509 echo "Checking how std your stdio is..." >&4
13510 $cat >try.c <<EOP
13511 #include <stdio.h>
13512 #$i_stdlib I_STDLIB
13513 #ifdef I_STDLIB
13514 #include <stdlib.h>
13515 #endif
13516 #define FILE_ptr(fp)    $stdio_ptr
13517 #define FILE_cnt(fp)    $stdio_cnt
13518 int main() {
13519         FILE *fp = fopen("try.c", "r");
13520         char c = getc(fp);
13521         if (
13522                 18 <= FILE_cnt(fp) &&
13523                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13524         )
13525                 exit(0);
13526         exit(1);
13527 }
13528 EOP
13529 val="$undef"
13530 set try
13531 if eval $compile && $to try.c; then
13532         if $run ./try; then
13533                 echo "Your stdio acts pretty std."
13534                 val="$define"
13535         else
13536                 echo "Your stdio isn't very std."
13537         fi
13538 else
13539         echo "Your stdio doesn't appear very std."
13540 fi
13541 $rm_try
13542
13543 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13544 # direct buffer manipulation no longer works.  The Configure tests
13545 # should be changed to correctly detect this, but until then,
13546 # the following check should at least let perl compile and run.
13547 # (This quick fix should be updated before 5.8.1.)
13548 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13549 # A. Dougherty, June 3, 2002.
13550 case "$d_gnulibc" in
13551 $define)
13552         case "$gnulibc_version" in
13553         2.[01]*)  ;;
13554         2.2) ;;
13555         2.2.[0-9]) ;;
13556         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13557                 val="$undef"
13558                 ;;
13559         esac
13560         ;;
13561 esac
13562 set d_stdstdio
13563 eval $setvar
13564
13565 : Can _ptr be used as an lvalue?
13566 case "$d_stdstdio$ptr_lval" in
13567 $define$define) val=$define ;;
13568 *) val=$undef ;;
13569 esac
13570 set d_stdio_ptr_lval
13571 eval $setvar
13572
13573 : Can _cnt be used as an lvalue?
13574 case "$d_stdstdio$cnt_lval" in
13575 $define$define) val=$define ;;
13576 *) val=$undef ;;
13577 esac
13578 set d_stdio_cnt_lval
13579 eval $setvar
13580
13581
13582 : test whether setting _ptr sets _cnt as a side effect
13583 d_stdio_ptr_lval_sets_cnt="$undef"
13584 d_stdio_ptr_lval_nochange_cnt="$undef"
13585 case "$d_stdio_ptr_lval$d_stdstdio" in
13586 $define$define)
13587         echo "Checking to see what happens if we set the stdio ptr..." >&4
13588 $cat >try.c <<EOP
13589 #include <stdio.h>
13590 /* Can we scream? */
13591 /* Eat dust sed :-) */
13592 /* In the buffer space, no one can hear you scream. */
13593 #$i_stdlib I_STDLIB
13594 #ifdef I_STDLIB
13595 #include <stdlib.h>
13596 #endif
13597 #define FILE_ptr(fp)    $stdio_ptr
13598 #define FILE_cnt(fp)    $stdio_cnt
13599 #include <sys/types.h>
13600 int main() {
13601         FILE *fp = fopen("try.c", "r");
13602         int c;
13603         char *ptr;
13604         size_t cnt;
13605         if (!fp) {
13606             puts("Fail even to read");
13607             exit(1);
13608         }
13609         c = getc(fp); /* Read away the first # */
13610         if (c == EOF) {
13611             puts("Fail even to read");
13612             exit(1);
13613         }
13614         if (!(
13615                 18 <= FILE_cnt(fp) &&
13616                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13617         )) {
13618                 puts("Fail even to read");
13619                 exit (1);
13620         }
13621         ptr = (char*) FILE_ptr(fp);
13622         cnt = (size_t)FILE_cnt(fp);
13623
13624         FILE_ptr(fp) += 42;
13625
13626         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13627                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13628                 exit (1);
13629         }
13630         if (FILE_cnt(fp) <= 20) {
13631                 printf ("Fail (<20 chars to test)");
13632                 exit (1);
13633         }
13634         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13635                 puts("Fail compare");
13636                 exit (1);
13637         }
13638         if (cnt == FILE_cnt(fp)) {
13639                 puts("Pass_unchanged");
13640                 exit (0);
13641         }
13642         if (FILE_cnt(fp) == (cnt - 42)) {
13643                 puts("Pass_changed");
13644                 exit (0);
13645         }
13646         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13647         return 1;
13648
13649 }
13650 EOP
13651         set try
13652         if eval $compile && $to try.c; then
13653                 case `$run ./try` in
13654                 Pass_changed)
13655                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13656                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13657                 Pass_unchanged)
13658                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13659                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13660                 Fail*)
13661                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13662                 *)
13663                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13664         esac
13665         else
13666                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13667         fi
13668         $rm_try
13669         ;;
13670 esac
13671
13672 : see if _base is also standard
13673 val="$undef"
13674 case "$d_stdstdio" in
13675 $define)
13676         $cat >try.c <<EOP
13677 #include <stdio.h>
13678 #$i_stdlib I_STDLIB
13679 #ifdef I_STDLIB
13680 #include <stdlib.h>
13681 #endif
13682 #define FILE_base(fp)   $stdio_base
13683 #define FILE_bufsiz(fp) $stdio_bufsiz
13684 int main() {
13685         FILE *fp = fopen("try.c", "r");
13686         char c = getc(fp);
13687         if (
13688                 19 <= FILE_bufsiz(fp) &&
13689                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13690         )
13691                 exit(0);
13692         exit(1);
13693 }
13694 EOP
13695         set try
13696         if eval $compile && $to try.c; then
13697                 if $run ./try; then
13698                         echo "And its _base field acts std."
13699                         val="$define"
13700                 else
13701                         echo "But its _base field isn't std."
13702                 fi
13703         else
13704                 echo "However, it seems to be lacking the _base field."
13705         fi
13706         $rm_try
13707         ;;
13708 esac
13709 set d_stdiobase
13710 eval $setvar
13711
13712 : see if fast_stdio exists
13713 val="$undef"
13714 case "$d_stdstdio:$d_stdio_ptr_lval" in
13715 "$define:$define")
13716         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13717         *$define*)
13718                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13719                 val="$define"
13720                 ;;
13721         esac
13722         ;;
13723 esac
13724 set d_faststdio
13725 eval $setvar
13726
13727 : see if fchdir exists
13728 set fchdir d_fchdir
13729 eval $inlibc
13730
13731 : see if fchmod exists
13732 set fchmod d_fchmod
13733 eval $inlibc
13734
13735 : check for openat, unlinkat, renameat, linkat, fchmodat
13736 set openat d_openat
13737 eval $inlibc
13738
13739 set unlinkat d_unlinkat
13740 eval $inlibc
13741
13742 set renameat d_renameat
13743 eval $inlibc
13744
13745 set linkat d_linkat
13746 eval $inlibc
13747
13748 set fchmodat d_fchmodat
13749 eval $inlibc
13750
13751 : see if fchown exists
13752 set fchown d_fchown
13753 eval $inlibc
13754
13755 : see if this is an fcntl system
13756 set fcntl d_fcntl
13757 eval $inlibc
13758
13759 : See if fcntl-based locking works.
13760 echo " "
13761 $cat >try.c <<EOCP
13762 #$i_stdlib I_STDLIB
13763 #ifdef I_STDLIB
13764 #include <stdlib.h>
13765 #endif
13766 #include <unistd.h>
13767 #include <fcntl.h>
13768 #include <signal.h>
13769 $signal_t blech(int x) { exit(3); }
13770 int main() {
13771 #if defined(F_SETLK) && defined(F_SETLKW)
13772      struct flock flock;
13773      int retval, fd;
13774      fd = open("try.c", O_RDONLY);
13775      flock.l_type = F_RDLCK;
13776      flock.l_whence = SEEK_SET;
13777      flock.l_start = flock.l_len = 0;
13778      signal(SIGALRM, blech);
13779      alarm(10);
13780      retval = fcntl(fd, F_SETLK, &flock);
13781      close(fd);
13782      (retval < 0 ? exit(2) : exit(0));
13783 #else
13784      exit(2);
13785 #endif
13786 }
13787 EOCP
13788 echo "Checking if fcntl-based file locking works... "
13789 case "$d_fcntl" in
13790 "$define")
13791         set try
13792         if eval $compile_ok; then
13793                 if $run ./try; then
13794                         echo "Yes, it seems to work."
13795                         val="$define"
13796                 else
13797                         echo "Nope, it didn't work."
13798                         val="$undef"
13799                         case "$?" in
13800                         3) $cat >&4 <<EOM
13801 ***
13802 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13803 *** This is (almost) impossible.
13804 *** If your NFS lock daemons are not feeling well, something like
13805 *** this may happen, please investigate.  Cannot continue, aborting.
13806 ***
13807 EOM
13808                                 exit 1
13809                                 ;;
13810                         esac
13811                 fi
13812         else
13813                 echo "I'm unable to compile the test program, so I'll assume not."
13814                 val="$undef"
13815         fi
13816         ;;
13817 *) val="$undef";
13818         echo "Nope, since you don't even have fcntl()."
13819         ;;
13820 esac
13821 set d_fcntl_can_lock
13822 eval $setvar
13823 $rm_try
13824
13825 : check for fd_set items
13826 $cat <<EOM
13827
13828 Checking to see how well your C compiler handles fd_set and friends ...
13829 EOM
13830 $cat >try.c <<EOCP
13831 #$i_stdlib I_STDLIB
13832 #ifdef I_STDLIB
13833 #include <stdlib.h>
13834 #endif
13835 #$i_systime I_SYS_TIME
13836 #$i_sysselct I_SYS_SELECT
13837 #$d_socket HAS_SOCKET
13838 #include <sys/types.h>
13839 #ifdef HAS_SOCKET
13840 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13841 #endif
13842 #ifdef I_SYS_TIME
13843 #include <sys/time.h>
13844 #endif
13845 #ifdef I_SYS_SELECT
13846 #include <sys/select.h>
13847 #endif
13848 int main() {
13849         fd_set fds;
13850
13851 #ifdef TRYBITS
13852         if(fds.fds_bits);
13853 #endif
13854
13855 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13856         exit(0);
13857 #else
13858         exit(1);
13859 #endif
13860 }
13861 EOCP
13862 set try -DTRYBITS
13863 if eval $compile; then
13864         d_fds_bits="$define"
13865         d_fd_set="$define"
13866         echo "Well, your system knows about the normal fd_set typedef..." >&4
13867         if $run ./try; then
13868                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13869                 d_fd_macros="$define"
13870         else
13871                 $cat >&4 <<'EOM'
13872 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13873 EOM
13874                 d_fd_macros="$undef"
13875         fi
13876 else
13877         $cat <<'EOM'
13878 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13879 EOM
13880         set try
13881         if eval $compile; then
13882                 d_fds_bits="$undef"
13883                 d_fd_set="$define"
13884                 echo "Well, your system has some sort of fd_set available..." >&4
13885                 if $run ./try; then
13886                         echo "and you have the normal fd_set macros." >&4
13887                         d_fd_macros="$define"
13888                 else
13889                         $cat <<'EOM'
13890 but not the normal fd_set macros!  Gross!  More work for me...
13891 EOM
13892                         d_fd_macros="$undef"
13893                 fi
13894         else
13895         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13896                 d_fd_set="$undef"
13897                 d_fds_bits="$undef"
13898                 d_fd_macros="$undef"
13899         fi
13900 fi
13901 $rm_try
13902
13903 : see if fdclose exists
13904 set fdclose d_fdclose
13905 eval $inlibc
13906
13907 : see if fdim exists
13908 set fdim d_fdim
13909 eval $inlibc
13910
13911 : see if fegetround exists
13912 set fegetround d_fegetround
13913 eval $inlibc
13914
13915 : see if fgetpos exists
13916 set fgetpos d_fgetpos
13917 eval $inlibc
13918
13919 : see if finite exists
13920 set finite d_finite
13921 eval $inlibc
13922
13923 : see if finitel exists
13924 set finitel d_finitel
13925 eval $inlibc
13926
13927 : see if flock exists
13928 set flock d_flock
13929 eval $inlibc
13930
13931 : see if prototype for flock is available
13932 echo " "
13933 set d_flockproto flock $i_sysfile sys/file.h
13934 eval $hasproto
13935
13936 : see if fma exists
13937 set fma d_fma
13938 eval $inlibc
13939
13940 : see if fmax exists
13941 set fmax d_fmax
13942 eval $inlibc
13943
13944 : see if fmin exists
13945 set fmin d_fmin
13946 eval $inlibc
13947
13948 : see if fp_class exists
13949 set fp_class d_fp_class
13950 eval $inlibc
13951
13952 : check for fpclassify
13953 echo "Checking to see if you have fpclassify..." >&4
13954 $cat >try.c <<EOCP
13955 #include <math.h>
13956 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13957 EOCP
13958 set try
13959 if eval $compile; then
13960         val="$define"
13961         echo "You have fpclassify."
13962 else
13963         val="$undef"
13964         echo "You do not have fpclassify."
13965 fi
13966 $rm_try
13967 set d_fpclassify
13968 eval $setvar
13969
13970 : see if fp_classify exists
13971 set fp_classify d_fp_classify
13972 eval $inlibc
13973
13974 : see if fp_classl exists
13975 set fp_classl d_fp_classl
13976 eval $inlibc
13977
13978 : see if pathconf exists
13979 set pathconf d_pathconf
13980 eval $inlibc
13981
13982 : see if fpathconf exists
13983 set fpathconf d_fpathconf
13984 eval $inlibc
13985
13986 : see if fpclass exists
13987 set fpclass d_fpclass
13988 eval $inlibc
13989
13990 : see if fpclassl exists
13991 set fpclassl d_fpclassl
13992 eval $inlibc
13993
13994 : see if fpgetround exists
13995 set fpgetround d_fpgetround
13996 eval $inlibc
13997
13998 : check for fpos64_t
13999 echo " "
14000 echo "Checking to see if you have fpos64_t..." >&4
14001 $cat >try.c <<EOCP
14002 #include <stdio.h>
14003 int main() { fpos64_t x = 7; }
14004 EOCP
14005 set try
14006 if eval $compile; then
14007         val="$define"
14008         echo "You have fpos64_t."
14009 else
14010         val="$undef"
14011         echo "You do not have fpos64_t."
14012         case "$fpossize" in
14013         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14014         esac
14015 fi
14016 $rm_try
14017 set d_fpos64_t
14018 eval $setvar
14019
14020 : see if frexpl exists
14021 set frexpl d_frexpl
14022 eval $inlibc
14023
14024 : see if this is a sys/param system
14025 set sys/param.h i_sysparam
14026 eval $inhdr
14027
14028 : see if this is a sys/mount.h system
14029 set sys/mount.h i_sysmount
14030 eval $inhdr
14031
14032 : Check for fs_data_s
14033 echo " "
14034 echo "Checking to see if your system supports struct fs_data..." >&4
14035 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14036 eval $hasstruct
14037 case "$d_fs_data_s" in
14038 "$define")      echo "Yes, it does."   ;;
14039 *)              echo "No, it doesn't." ;;
14040 esac
14041
14042 : see if fseeko exists
14043 set fseeko d_fseeko
14044 eval $inlibc
14045 case "$longsize" in
14046 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14047 esac
14048
14049 : see if fsetpos exists
14050 set fsetpos d_fsetpos
14051 eval $inlibc
14052
14053 : see if fstatfs exists
14054 set fstatfs d_fstatfs
14055 eval $inlibc
14056
14057 : see if statvfs exists
14058 set statvfs d_statvfs
14059 eval $inlibc
14060
14061 : see if fstatvfs exists
14062 set fstatvfs d_fstatvfs
14063 eval $inlibc
14064
14065 : see if fsync exists
14066 set fsync d_fsync
14067 eval $inlibc
14068
14069 : see if ftello exists
14070 set ftello d_ftello
14071 eval $inlibc
14072 case "$longsize" in
14073 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14074 esac
14075
14076 : check for a working futimes
14077 d_futimes="$undef"
14078 echo " "
14079 echo "Checking if you have a working futimes()" >&4
14080 $cat >try.c <<EOCP
14081 #include <stdio.h>
14082 #include <sys/time.h>
14083 #include <errno.h>
14084 #include <fcntl.h>
14085
14086 int main ()
14087 {
14088     int fd, rv;
14089     fd = open ("try.c", O_RDWR);
14090     if (-1 == fd) exit (1);
14091     rv = futimes (fd, NULL);
14092     exit (rv == -1 ? errno : 0);
14093 }
14094 EOCP
14095 set try
14096 if eval $compile; then
14097     `$run ./try`
14098     rc=$?
14099     case "$rc" in
14100         0)  echo "Yes, you have" >&4
14101             d_futimes="$define"
14102             ;;
14103         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14104             ;;
14105     esac
14106 else
14107     echo "No, it does not (probably harmless)" >&4
14108 fi
14109 $rm_try
14110
14111 : look for gai_strerror
14112 echo " "
14113 $cat >try.c <<'EOCP'
14114 #include <sys/types.h>
14115 #include <sys/socket.h>
14116 #include <netdb.h>
14117 int main ()
14118 {
14119     return (gai_strerror (0) ? 0 : 1);
14120     }
14121 EOCP
14122 set try
14123 val="$undef"
14124 if eval $compile; then
14125     `$run ./try`
14126     case "$?" in
14127         0)  echo "A working gai_strerror() found." >&4
14128             val="$define" ;;
14129         *)  echo "gai_strerror() found, but it doesn't work" >&4
14130             ;;
14131         esac
14132 else
14133     echo "gai_strerror() NOT found." >&4
14134     fi
14135 set d_gai_strerror
14136 eval $setvar
14137 $rm_try
14138
14139 : see if ndbm.h is available
14140 set ndbm.h i_ndbm
14141 eval $inhdr
14142 : Compatibility location for RedHat 7.1
14143 set gdbm/ndbm.h i_gdbmndbm
14144 eval $inhdr
14145 : Compatibility location for Debian 4.0
14146 set gdbm-ndbm.h i_gdbm_ndbm
14147 eval $inhdr
14148
14149 val="$undef"
14150 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14151         : see if dbm_open exists
14152         set dbm_open d_dbm_open
14153         eval $inlibc
14154         case "$d_dbm_open" in
14155         $undef)
14156                 i_ndbm="$undef"
14157                 i_gdbmndbm="$undef"
14158                 i_gdbm_ndbm="$undef"
14159                 echo "We won't be including <ndbm.h>"
14160                 val="$undef"
14161                 ;;
14162         *) val="$define"
14163            ;;
14164         esac
14165 fi
14166 set d_ndbm
14167 eval $setvar
14168
14169 ndbm_hdr_protochk='name=$1; hdr=$2;
14170 eval "ihdr=\$""i_$name";
14171 val="$undef";
14172 if $test "$ihdr" = "$define"; then
14173         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14174         case "$d_cplusplus" in
14175         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14176         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14177         esac;
14178         case "$val" in
14179         $define) $echo "Your <$hdr> seems to have prototypes";;
14180         *) $echo "Your <$hdr> does not seem to have prototypes";;
14181         esac;
14182 fi;
14183 set "d_${name}_h_uses_prototypes";
14184 eval $setvar'
14185
14186 set ndbm ndbm.h
14187 eval $ndbm_hdr_protochk
14188 set gdbmndbm gdbm/ndbm.h
14189 eval $ndbm_hdr_protochk
14190 set gdbm_ndbm gdbm-ndbm.h
14191 eval $ndbm_hdr_protochk
14192
14193 : see if getaddrinfo exists
14194 set getaddrinfo d_getaddrinfo
14195 eval $inlibc
14196
14197 : see if getcwd exists
14198 set getcwd d_getcwd
14199 eval $inlibc
14200
14201 : see if getespwnam exists
14202 set getespwnam d_getespwnam
14203 eval $inlibc
14204
14205 : see if getfsstat exists
14206 set getfsstat d_getfsstat
14207 eval $inlibc
14208
14209 : see if getgrent exists
14210 set getgrent d_getgrent
14211 eval $inlibc
14212
14213 : see if getgrent_r exists
14214 set getgrent_r d_getgrent_r
14215 eval $inlibc
14216 case "$d_getgrent_r" in
14217 "$define")
14218         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14219         case "$d_getgrent_r_proto:$usethreads" in
14220         ":define")      d_getgrent_r_proto=define
14221                 set d_getgrent_r_proto getgrent_r $hdrs
14222                 eval $hasproto ;;
14223         *)      ;;
14224         esac
14225         case "$d_getgrent_r_proto" in
14226         define)
14227         case "$getgrent_r_proto" in
14228         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14229         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14230         esac
14231         case "$getgrent_r_proto" in
14232         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14233         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14234         esac
14235         case "$getgrent_r_proto" in
14236         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='int getgrent_r(struct group*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0)   d_getgrent_r=undef
14253                 getgrent_r_proto=0
14254                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14255         * )     case "$getgrent_r_proto" in
14256                 REENTRANT_PROTO*) ;;
14257                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14258                 esac
14259                 echo "Prototype: $try" ;;
14260         esac
14261         ;;
14262         *)      case "$usethreads" in
14263                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14264                 esac
14265                 d_getgrent_r=undef
14266                 getgrent_r_proto=0
14267                 ;;
14268         esac
14269         ;;
14270 *)      getgrent_r_proto=0
14271         ;;
14272 esac
14273
14274 : see if getgrgid_r exists
14275 set getgrgid_r d_getgrgid_r
14276 eval $inlibc
14277 case "$d_getgrgid_r" in
14278 "$define")
14279         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14280         case "$d_getgrgid_r_proto:$usethreads" in
14281         ":define")      d_getgrgid_r_proto=define
14282                 set d_getgrgid_r_proto getgrgid_r $hdrs
14283                 eval $hasproto ;;
14284         *)      ;;
14285         esac
14286         case "$d_getgrgid_r_proto" in
14287         define)
14288         case "$getgrgid_r_proto" in
14289         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14290         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14291         esac
14292         case "$getgrgid_r_proto" in
14293         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14294         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14295         esac
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14303         esac
14304         case "$getgrgid_r_proto" in
14305         ''|0)   d_getgrgid_r=undef
14306                 getgrgid_r_proto=0
14307                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14308         * )     case "$getgrgid_r_proto" in
14309                 REENTRANT_PROTO*) ;;
14310                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14311                 esac
14312                 echo "Prototype: $try" ;;
14313         esac
14314         ;;
14315         *)      case "$usethreads" in
14316                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14317                 esac
14318                 d_getgrgid_r=undef
14319                 getgrgid_r_proto=0
14320                 ;;
14321         esac
14322         ;;
14323 *)      getgrgid_r_proto=0
14324         ;;
14325 esac
14326
14327 : see if getgrnam_r exists
14328 set getgrnam_r d_getgrnam_r
14329 eval $inlibc
14330 case "$d_getgrnam_r" in
14331 "$define")
14332         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14333         case "$d_getgrnam_r_proto:$usethreads" in
14334         ":define")      d_getgrnam_r_proto=define
14335                 set d_getgrnam_r_proto getgrnam_r $hdrs
14336                 eval $hasproto ;;
14337         *)      ;;
14338         esac
14339         case "$d_getgrnam_r_proto" in
14340         define)
14341         case "$getgrnam_r_proto" in
14342         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14343         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14344         esac
14345         case "$getgrnam_r_proto" in
14346         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14347         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14348         esac
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0)   d_getgrnam_r=undef
14363                 getgrnam_r_proto=0
14364                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14365         * )     case "$getgrnam_r_proto" in
14366                 REENTRANT_PROTO*) ;;
14367                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14368                 esac
14369                 echo "Prototype: $try" ;;
14370         esac
14371         ;;
14372         *)      case "$usethreads" in
14373                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14374                 esac
14375                 d_getgrnam_r=undef
14376                 getgrnam_r_proto=0
14377                 ;;
14378         esac
14379         ;;
14380 *)      getgrnam_r_proto=0
14381         ;;
14382 esac
14383
14384 : see if gethostbyaddr exists
14385 set gethostbyaddr d_gethbyaddr
14386 eval $inlibc
14387
14388 : see if gethostbyname exists
14389 set gethostbyname d_gethbyname
14390 eval $inlibc
14391
14392 : see if gethostent exists
14393 set gethostent d_gethent
14394 eval $inlibc
14395
14396 : see how we will look up host name
14397 echo " "
14398 call=''
14399 if set gethostname val -f d_gethname; eval $csym; $val; then
14400         echo 'gethostname() found.' >&4
14401         d_gethname="$define"
14402         call=gethostname
14403 fi
14404 if set uname val -f d_uname; eval $csym; $val; then
14405         if ./xenix; then
14406                 $cat <<'EOM'
14407 uname() was found, but you're running xenix, and older versions of xenix
14408 have a broken uname(). If you don't really know whether your xenix is old
14409 enough to have a broken system call, use the default answer.
14410
14411 EOM
14412                 dflt=y
14413                 case "$d_uname" in
14414                 "$define") dflt=n;;
14415                 esac
14416                 rp='Is your uname() broken?'
14417                 . ./myread
14418                 case "$ans" in
14419                 n*) d_uname="$define"; call=uname;;
14420                 esac
14421         else
14422                 echo 'uname() found.' >&4
14423                 d_uname="$define"
14424                 case "$call" in
14425                 '') call=uname ;;
14426                 esac
14427         fi
14428 fi
14429 case "$d_gethname" in
14430 '') d_gethname="$undef";;
14431 esac
14432 case "$d_uname" in
14433 '') d_uname="$undef";;
14434 esac
14435 case "$d_uname$d_gethname" in
14436 *define*)
14437         dflt=n
14438         cat <<EOM
14439
14440 Every now and then someone has a $call() that lies about the hostname
14441 but can't be fixed for political or economic reasons.  If you wish, I can
14442 pretend $call() isn't there and maybe compute hostname at run-time
14443 thanks to the '$phostname' command.
14444
14445 EOM
14446         rp="Shall I ignore $call() from now on?"
14447         . ./myread
14448         case "$ans" in
14449         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14450         esac;;
14451 esac
14452 case "$phostname" in
14453 '') aphostname='';;
14454 *) case "$aphostname" in
14455         /*) ;;
14456         *) set X $phostname
14457                 shift
14458                 file=$1
14459                 shift
14460                 file=`./loc $file $file $pth`
14461                 aphostname=`echo $file $*`
14462                 ;;
14463         esac
14464         ;;
14465 esac
14466 case "$d_uname$d_gethname" in
14467 *define*) ;;
14468 *)
14469         case "$phostname" in
14470         '')
14471                 echo "There will be no way for $package to get your hostname." >&4;;
14472         *)
14473         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14474                 ;;
14475         esac;;
14476 esac
14477 case "$d_phostname" in
14478 '') d_phostname="$undef";;
14479 esac
14480
14481 : see if gethostbyaddr_r exists
14482 set gethostbyaddr_r d_gethostbyaddr_r
14483 eval $inlibc
14484 case "$d_gethostbyaddr_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14487         case "$d_gethostbyaddr_r_proto:$usethreads" in
14488         ":define")      d_gethostbyaddr_r_proto=define
14489                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_gethostbyaddr_r_proto" in
14494         define)
14495         case "$gethostbyaddr_r_proto" in
14496         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14497         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14498         esac
14499         case "$gethostbyaddr_r_proto" in
14500         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14501         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14502         esac
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0)   d_gethostbyaddr_r=undef
14541                 gethostbyaddr_r_proto=0
14542                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14543         * )     case "$gethostbyaddr_r_proto" in
14544                 REENTRANT_PROTO*) ;;
14545                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14546                 esac
14547                 echo "Prototype: $try" ;;
14548         esac
14549         ;;
14550         *)      case "$usethreads" in
14551                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14552                 esac
14553                 d_gethostbyaddr_r=undef
14554                 gethostbyaddr_r_proto=0
14555                 ;;
14556         esac
14557         ;;
14558 *)      gethostbyaddr_r_proto=0
14559         ;;
14560 esac
14561
14562 : see if gethostbyname_r exists
14563 set gethostbyname_r d_gethostbyname_r
14564 eval $inlibc
14565 case "$d_gethostbyname_r" in
14566 "$define")
14567         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14568         case "$d_gethostbyname_r_proto:$usethreads" in
14569         ":define")      d_gethostbyname_r_proto=define
14570                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14571                 eval $hasproto ;;
14572         *)      ;;
14573         esac
14574         case "$d_gethostbyname_r_proto" in
14575         define)
14576         case "$gethostbyname_r_proto" in
14577         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14578         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14579         esac
14580         case "$gethostbyname_r_proto" in
14581         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14582         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14583         esac
14584         case "$gethostbyname_r_proto" in
14585         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14586         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14587         esac
14588         case "$gethostbyname_r_proto" in
14589         ''|0)   d_gethostbyname_r=undef
14590                 gethostbyname_r_proto=0
14591                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14592         * )     case "$gethostbyname_r_proto" in
14593                 REENTRANT_PROTO*) ;;
14594                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14595                 esac
14596                 echo "Prototype: $try" ;;
14597         esac
14598         ;;
14599         *)      case "$usethreads" in
14600                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14601                 esac
14602                 d_gethostbyname_r=undef
14603                 gethostbyname_r_proto=0
14604                 ;;
14605         esac
14606         ;;
14607 *)      gethostbyname_r_proto=0
14608         ;;
14609 esac
14610
14611 : see if gethostent_r exists
14612 set gethostent_r d_gethostent_r
14613 eval $inlibc
14614 case "$d_gethostent_r" in
14615 "$define")
14616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14617         case "$d_gethostent_r_proto:$usethreads" in
14618         ":define")      d_gethostent_r_proto=define
14619                 set d_gethostent_r_proto gethostent_r $hdrs
14620                 eval $hasproto ;;
14621         *)      ;;
14622         esac
14623         case "$d_gethostent_r_proto" in
14624         define)
14625         case "$gethostent_r_proto" in
14626         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14628         esac
14629         case "$gethostent_r_proto" in
14630         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14632         esac
14633         case "$gethostent_r_proto" in
14634         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0)   d_gethostent_r=undef
14651                 gethostent_r_proto=0
14652                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14653         * )     case "$gethostent_r_proto" in
14654                 REENTRANT_PROTO*) ;;
14655                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14656                 esac
14657                 echo "Prototype: $try" ;;
14658         esac
14659         ;;
14660         *)      case "$usethreads" in
14661                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14662                 esac
14663                 d_gethostent_r=undef
14664                 gethostent_r_proto=0
14665                 ;;
14666         esac
14667         ;;
14668 *)      gethostent_r_proto=0
14669         ;;
14670 esac
14671
14672 : see if prototypes for various gethostxxx netdb.h functions are available
14673 echo " "
14674 set d_gethostprotos gethostent $i_netdb netdb.h
14675 eval $hasproto
14676
14677 : see if getitimer exists
14678 set getitimer d_getitimer
14679 eval $inlibc
14680
14681 : see if getlogin exists
14682 set getlogin d_getlogin
14683 eval $inlibc
14684
14685 : see if getlogin_r exists
14686 set getlogin_r d_getlogin_r
14687 eval $inlibc
14688 case "$d_getlogin_r" in
14689 "$define")
14690         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14691         case "$d_getlogin_r_proto:$usethreads" in
14692         ":define")      d_getlogin_r_proto=define
14693                 set d_getlogin_r_proto getlogin_r $hdrs
14694                 eval $hasproto ;;
14695         *)      ;;
14696         esac
14697         case "$d_getlogin_r_proto" in
14698         define)
14699         case "$getlogin_r_proto" in
14700         ''|0) try='int getlogin_r(char*, size_t);'
14701         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14702         esac
14703         case "$getlogin_r_proto" in
14704         ''|0) try='int getlogin_r(char*, int);'
14705         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14706         esac
14707         case "$getlogin_r_proto" in
14708         ''|0) try='char* getlogin_r(char*, size_t);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0) try='char* getlogin_r(char*, int);'
14713         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14714         esac
14715         case "$getlogin_r_proto" in
14716         ''|0)   d_getlogin_r=undef
14717                 getlogin_r_proto=0
14718                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14719         * )     case "$getlogin_r_proto" in
14720                 REENTRANT_PROTO*) ;;
14721                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14722                 esac
14723                 echo "Prototype: $try" ;;
14724         esac
14725         ;;
14726         *)      case "$usethreads" in
14727                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14728                 esac
14729                 d_getlogin_r=undef
14730                 getlogin_r_proto=0
14731                 ;;
14732         esac
14733         ;;
14734 *)      getlogin_r_proto=0
14735         ;;
14736 esac
14737
14738 : see if getmnt exists
14739 set getmnt d_getmnt
14740 eval $inlibc
14741
14742 : see if getmntent exists
14743 set getmntent d_getmntent
14744 eval $inlibc
14745
14746 : see if getnameinfo exists
14747 set getnameinfo d_getnameinfo
14748 eval $inlibc
14749
14750 : see if getnetbyaddr exists
14751 set getnetbyaddr d_getnbyaddr
14752 eval $inlibc
14753
14754 : see if getnetbyname exists
14755 set getnetbyname d_getnbyname
14756 eval $inlibc
14757
14758 : see if getnetent exists
14759 set getnetent d_getnent
14760 eval $inlibc
14761
14762 : see if getnetbyaddr_r exists
14763 set getnetbyaddr_r d_getnetbyaddr_r
14764 eval $inlibc
14765 case "$d_getnetbyaddr_r" in
14766 "$define")
14767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14768         case "$d_getnetbyaddr_r_proto:$usethreads" in
14769         ":define")      d_getnetbyaddr_r_proto=define
14770                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14771                 eval $hasproto ;;
14772         *)      ;;
14773         esac
14774         case "$d_getnetbyaddr_r_proto" in
14775         define)
14776         case "$getnetbyaddr_r_proto" in
14777         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14778         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14779         esac
14780         case "$getnetbyaddr_r_proto" in
14781         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14782         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14783         esac
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0)   d_getnetbyaddr_r=undef
14810                 getnetbyaddr_r_proto=0
14811                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14812         * )     case "$getnetbyaddr_r_proto" in
14813                 REENTRANT_PROTO*) ;;
14814                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14815                 esac
14816                 echo "Prototype: $try" ;;
14817         esac
14818         ;;
14819         *)      case "$usethreads" in
14820                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14821                 esac
14822                 d_getnetbyaddr_r=undef
14823                 getnetbyaddr_r_proto=0
14824                 ;;
14825         esac
14826         ;;
14827 *)      getnetbyaddr_r_proto=0
14828         ;;
14829 esac
14830
14831 : see if getnetbyname_r exists
14832 set getnetbyname_r d_getnetbyname_r
14833 eval $inlibc
14834 case "$d_getnetbyname_r" in
14835 "$define")
14836         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14837         case "$d_getnetbyname_r_proto:$usethreads" in
14838         ":define")      d_getnetbyname_r_proto=define
14839                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14840                 eval $hasproto ;;
14841         *)      ;;
14842         esac
14843         case "$d_getnetbyname_r_proto" in
14844         define)
14845         case "$getnetbyname_r_proto" in
14846         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14847         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14848         esac
14849         case "$getnetbyname_r_proto" in
14850         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14851         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14852         esac
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14859         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14860         esac
14861         case "$getnetbyname_r_proto" in
14862         ''|0)   d_getnetbyname_r=undef
14863                 getnetbyname_r_proto=0
14864                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14865         * )     case "$getnetbyname_r_proto" in
14866                 REENTRANT_PROTO*) ;;
14867                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14868                 esac
14869                 echo "Prototype: $try" ;;
14870         esac
14871         ;;
14872         *)      case "$usethreads" in
14873                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14874                 esac
14875                 d_getnetbyname_r=undef
14876                 getnetbyname_r_proto=0
14877                 ;;
14878         esac
14879         ;;
14880 *)      getnetbyname_r_proto=0
14881         ;;
14882 esac
14883
14884 : see if getnetent_r exists
14885 set getnetent_r d_getnetent_r
14886 eval $inlibc
14887 case "$d_getnetent_r" in
14888 "$define")
14889         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14890         case "$d_getnetent_r_proto:$usethreads" in
14891         ":define")      d_getnetent_r_proto=define
14892                 set d_getnetent_r_proto getnetent_r $hdrs
14893                 eval $hasproto ;;
14894         *)      ;;
14895         esac
14896         case "$d_getnetent_r_proto" in
14897         define)
14898         case "$getnetent_r_proto" in
14899         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14900         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14901         esac
14902         case "$getnetent_r_proto" in
14903         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14904         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14905         esac
14906         case "$getnetent_r_proto" in
14907         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0)   d_getnetent_r=undef
14924                 getnetent_r_proto=0
14925                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14926         * )     case "$getnetent_r_proto" in
14927                 REENTRANT_PROTO*) ;;
14928                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14929                 esac
14930                 echo "Prototype: $try" ;;
14931         esac
14932         ;;
14933         *)      case "$usethreads" in
14934                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14935                 esac
14936                 d_getnetent_r=undef
14937                 getnetent_r_proto=0
14938                 ;;
14939         esac
14940         ;;
14941 *)      getnetent_r_proto=0
14942         ;;
14943 esac
14944
14945 : see if prototypes for various getnetxxx netdb.h functions are available
14946 echo " "
14947 set d_getnetprotos getnetent $i_netdb netdb.h
14948 eval $hasproto
14949
14950 : see if getpagesize exists
14951 set getpagesize d_getpagsz
14952 eval $inlibc
14953
14954 : Optional checks for getprotobyname and getprotobynumber
14955
14956 : see if getprotobyname exists
14957 set getprotobyname d_getpbyname
14958 eval $inlibc
14959
14960 : see if getprotobynumber exists
14961 set getprotobynumber d_getpbynumber
14962 eval $inlibc
14963
14964 : see if getprotoent exists
14965 set getprotoent d_getpent
14966 eval $inlibc
14967
14968 : see if getpgid exists
14969 set getpgid d_getpgid
14970 eval $inlibc
14971
14972 : see if getpgrp2 exists
14973 set getpgrp2 d_getpgrp2
14974 eval $inlibc
14975
14976 : see if getppid exists
14977 set getppid d_getppid
14978 eval $inlibc
14979
14980 : see if getpriority exists
14981 set getpriority d_getprior
14982 eval $inlibc
14983
14984 : see if getprotobyname_r exists
14985 set getprotobyname_r d_getprotobyname_r
14986 eval $inlibc
14987 case "$d_getprotobyname_r" in
14988 "$define")
14989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14990         case "$d_getprotobyname_r_proto:$usethreads" in
14991         ":define")      d_getprotobyname_r_proto=define
14992                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14993                 eval $hasproto ;;
14994         *)      ;;
14995         esac
14996         case "$d_getprotobyname_r_proto" in
14997         define)
14998         case "$getprotobyname_r_proto" in
14999         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15000         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15001         esac
15002         case "$getprotobyname_r_proto" in
15003         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15004         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15005         esac
15006         case "$getprotobyname_r_proto" in
15007         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15008         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15009         esac
15010         case "$getprotobyname_r_proto" in
15011         ''|0)   d_getprotobyname_r=undef
15012                 getprotobyname_r_proto=0
15013                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15014         * )     case "$getprotobyname_r_proto" in
15015                 REENTRANT_PROTO*) ;;
15016                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15017                 esac
15018                 echo "Prototype: $try" ;;
15019         esac
15020         ;;
15021         *)      case "$usethreads" in
15022                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15023                 esac
15024                 d_getprotobyname_r=undef
15025                 getprotobyname_r_proto=0
15026                 ;;
15027         esac
15028         ;;
15029 *)      getprotobyname_r_proto=0
15030         ;;
15031 esac
15032
15033 : see if getprotobynumber_r exists
15034 set getprotobynumber_r d_getprotobynumber_r
15035 eval $inlibc
15036 case "$d_getprotobynumber_r" in
15037 "$define")
15038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15039         case "$d_getprotobynumber_r_proto:$usethreads" in
15040         ":define")      d_getprotobynumber_r_proto=define
15041                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15042                 eval $hasproto ;;
15043         *)      ;;
15044         esac
15045         case "$d_getprotobynumber_r_proto" in
15046         define)
15047         case "$getprotobynumber_r_proto" in
15048         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15049         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15050         esac
15051         case "$getprotobynumber_r_proto" in
15052         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15053         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15054         esac
15055         case "$getprotobynumber_r_proto" in
15056         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15057         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15058         esac
15059         case "$getprotobynumber_r_proto" in
15060         ''|0)   d_getprotobynumber_r=undef
15061                 getprotobynumber_r_proto=0
15062                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15063         * )     case "$getprotobynumber_r_proto" in
15064                 REENTRANT_PROTO*) ;;
15065                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15066                 esac
15067                 echo "Prototype: $try" ;;
15068         esac
15069         ;;
15070         *)      case "$usethreads" in
15071                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15072                 esac
15073                 d_getprotobynumber_r=undef
15074                 getprotobynumber_r_proto=0
15075                 ;;
15076         esac
15077         ;;
15078 *)      getprotobynumber_r_proto=0
15079         ;;
15080 esac
15081
15082 : see if getprotoent_r exists
15083 set getprotoent_r d_getprotoent_r
15084 eval $inlibc
15085 case "$d_getprotoent_r" in
15086 "$define")
15087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15088         case "$d_getprotoent_r_proto:$usethreads" in
15089         ":define")      d_getprotoent_r_proto=define
15090                 set d_getprotoent_r_proto getprotoent_r $hdrs
15091                 eval $hasproto ;;
15092         *)      ;;
15093         esac
15094         case "$d_getprotoent_r_proto" in
15095         define)
15096         case "$getprotoent_r_proto" in
15097         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15098         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15099         esac
15100         case "$getprotoent_r_proto" in
15101         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15102         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15103         esac
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15110         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15111         esac
15112         case "$getprotoent_r_proto" in
15113         ''|0)   d_getprotoent_r=undef
15114                 getprotoent_r_proto=0
15115                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15116         * )     case "$getprotoent_r_proto" in
15117                 REENTRANT_PROTO*) ;;
15118                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15119                 esac
15120                 echo "Prototype: $try" ;;
15121         esac
15122         ;;
15123         *)      case "$usethreads" in
15124                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15125                 esac
15126                 d_getprotoent_r=undef
15127                 getprotoent_r_proto=0
15128                 ;;
15129         esac
15130         ;;
15131 *)      getprotoent_r_proto=0
15132         ;;
15133 esac
15134
15135 : see if prototypes for various getprotoxxx netdb.h functions are available
15136 echo " "
15137 set d_getprotoprotos getprotoent $i_netdb netdb.h
15138 eval $hasproto
15139
15140 : see if getprpwnam exists
15141 set getprpwnam d_getprpwnam
15142 eval $inlibc
15143
15144 : see if getpwent exists
15145 set getpwent d_getpwent
15146 eval $inlibc
15147
15148 : see if getpwent_r exists
15149 set getpwent_r d_getpwent_r
15150 eval $inlibc
15151 case "$d_getpwent_r" in
15152 "$define")
15153         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15154         case "$d_getpwent_r_proto:$usethreads" in
15155         ":define")      d_getpwent_r_proto=define
15156                 set d_getpwent_r_proto getpwent_r $hdrs
15157                 eval $hasproto ;;
15158         *)      ;;
15159         esac
15160         case "$d_getpwent_r_proto" in
15161         define)
15162         case "$getpwent_r_proto" in
15163         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15164         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15165         esac
15166         case "$getpwent_r_proto" in
15167         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15168         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15169         esac
15170         case "$getpwent_r_proto" in
15171         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0)   d_getpwent_r=undef
15188                 getpwent_r_proto=0
15189                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15190         * )     case "$getpwent_r_proto" in
15191                 REENTRANT_PROTO*) ;;
15192                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15193                 esac
15194                 echo "Prototype: $try" ;;
15195         esac
15196         ;;
15197         *)      case "$usethreads" in
15198                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15199                 esac
15200                 d_getpwent_r=undef
15201                 getpwent_r_proto=0
15202                 ;;
15203         esac
15204         ;;
15205 *)      getpwent_r_proto=0
15206         ;;
15207 esac
15208
15209 : see if getpwnam_r exists
15210 set getpwnam_r d_getpwnam_r
15211 eval $inlibc
15212 case "$d_getpwnam_r" in
15213 "$define")
15214         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15215         case "$d_getpwnam_r_proto:$usethreads" in
15216         ":define")      d_getpwnam_r_proto=define
15217                 set d_getpwnam_r_proto getpwnam_r $hdrs
15218                 eval $hasproto ;;
15219         *)      ;;
15220         esac
15221         case "$d_getpwnam_r_proto" in
15222         define)
15223         case "$getpwnam_r_proto" in
15224         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15225         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15226         esac
15227         case "$getpwnam_r_proto" in
15228         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15229         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15230         esac
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15237         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15238         esac
15239         case "$getpwnam_r_proto" in
15240         ''|0)   d_getpwnam_r=undef
15241                 getpwnam_r_proto=0
15242                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15243         * )     case "$getpwnam_r_proto" in
15244                 REENTRANT_PROTO*) ;;
15245                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15246                 esac
15247                 echo "Prototype: $try" ;;
15248         esac
15249         ;;
15250         *)      case "$usethreads" in
15251                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15252                 esac
15253                 d_getpwnam_r=undef
15254                 getpwnam_r_proto=0
15255                 ;;
15256         esac
15257         ;;
15258 *)      getpwnam_r_proto=0
15259         ;;
15260 esac
15261
15262 : see if getpwuid_r exists
15263 set getpwuid_r d_getpwuid_r
15264 eval $inlibc
15265 case "$d_getpwuid_r" in
15266 "$define")
15267         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15268         case "$d_getpwuid_r_proto:$usethreads" in
15269         ":define")      d_getpwuid_r_proto=define
15270                 set d_getpwuid_r_proto getpwuid_r $hdrs
15271                 eval $hasproto ;;
15272         *)      ;;
15273         esac
15274         case "$d_getpwuid_r_proto" in
15275         define)
15276         case "$getpwuid_r_proto" in
15277         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15278         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15279         esac
15280         case "$getpwuid_r_proto" in
15281         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15282         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15283         esac
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15290         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15291         esac
15292         case "$getpwuid_r_proto" in
15293         ''|0)   d_getpwuid_r=undef
15294                 getpwuid_r_proto=0
15295                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15296         * )     case "$getpwuid_r_proto" in
15297                 REENTRANT_PROTO*) ;;
15298                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15299                 esac
15300                 echo "Prototype: $try" ;;
15301         esac
15302         ;;
15303         *)      case "$usethreads" in
15304                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15305                 esac
15306                 d_getpwuid_r=undef
15307                 getpwuid_r_proto=0
15308                 ;;
15309         esac
15310         ;;
15311 *)      getpwuid_r_proto=0
15312         ;;
15313 esac
15314
15315 : Optional checks for getsbyname and getsbyport
15316
15317 : see if getservbyname exists
15318 set getservbyname d_getsbyname
15319 eval $inlibc
15320
15321 : see if getservbyport exists
15322 set getservbyport d_getsbyport
15323 eval $inlibc
15324
15325 : see if getservent exists
15326 set getservent d_getsent
15327 eval $inlibc
15328
15329 : see if getservbyname_r exists
15330 set getservbyname_r d_getservbyname_r
15331 eval $inlibc
15332 case "$d_getservbyname_r" in
15333 "$define")
15334         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15335         case "$d_getservbyname_r_proto:$usethreads" in
15336         ":define")      d_getservbyname_r_proto=define
15337                 set d_getservbyname_r_proto getservbyname_r $hdrs
15338                 eval $hasproto ;;
15339         *)      ;;
15340         esac
15341         case "$d_getservbyname_r_proto" in
15342         define)
15343         case "$getservbyname_r_proto" in
15344         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15345         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15346         esac
15347         case "$getservbyname_r_proto" in
15348         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15349         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15350         esac
15351         case "$getservbyname_r_proto" in
15352         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15353         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15354         esac
15355         case "$getservbyname_r_proto" in
15356         ''|0)   d_getservbyname_r=undef
15357                 getservbyname_r_proto=0
15358                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15359         * )     case "$getservbyname_r_proto" in
15360                 REENTRANT_PROTO*) ;;
15361                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15362                 esac
15363                 echo "Prototype: $try" ;;
15364         esac
15365         ;;
15366         *)      case "$usethreads" in
15367                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15368                 esac
15369                 d_getservbyname_r=undef
15370                 getservbyname_r_proto=0
15371                 ;;
15372         esac
15373         ;;
15374 *)      getservbyname_r_proto=0
15375         ;;
15376 esac
15377
15378 : see if getservbyport_r exists
15379 set getservbyport_r d_getservbyport_r
15380 eval $inlibc
15381 case "$d_getservbyport_r" in
15382 "$define")
15383         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15384         case "$d_getservbyport_r_proto:$usethreads" in
15385         ":define")      d_getservbyport_r_proto=define
15386                 set d_getservbyport_r_proto getservbyport_r $hdrs
15387                 eval $hasproto ;;
15388         *)      ;;
15389         esac
15390         case "$d_getservbyport_r_proto" in
15391         define)
15392         case "$getservbyport_r_proto" in
15393         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15394         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15395         esac
15396         case "$getservbyport_r_proto" in
15397         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15398         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15399         esac
15400         case "$getservbyport_r_proto" in
15401         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15402         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15403         esac
15404         case "$getservbyport_r_proto" in
15405         ''|0)   d_getservbyport_r=undef
15406                 getservbyport_r_proto=0
15407                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15408         * )     case "$getservbyport_r_proto" in
15409                 REENTRANT_PROTO*) ;;
15410                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15411                 esac
15412                 echo "Prototype: $try" ;;
15413         esac
15414         ;;
15415         *)      case "$usethreads" in
15416                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15417                 esac
15418                 d_getservbyport_r=undef
15419                 getservbyport_r_proto=0
15420                 ;;
15421         esac
15422         ;;
15423 *)      getservbyport_r_proto=0
15424         ;;
15425 esac
15426
15427 : see if getservent_r exists
15428 set getservent_r d_getservent_r
15429 eval $inlibc
15430 case "$d_getservent_r" in
15431 "$define")
15432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15433         case "$d_getservent_r_proto:$usethreads" in
15434         ":define")      d_getservent_r_proto=define
15435                 set d_getservent_r_proto getservent_r $hdrs
15436                 eval $hasproto ;;
15437         *)      ;;
15438         esac
15439         case "$d_getservent_r_proto" in
15440         define)
15441         case "$getservent_r_proto" in
15442         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15443         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15444         esac
15445         case "$getservent_r_proto" in
15446         ''|0) try='int getservent_r(struct servent*, char*, int);'
15447         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15448         esac
15449         case "$getservent_r_proto" in
15450         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15455         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15456         esac
15457         case "$getservent_r_proto" in
15458         ''|0)   d_getservent_r=undef
15459                 getservent_r_proto=0
15460                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15461         * )     case "$getservent_r_proto" in
15462                 REENTRANT_PROTO*) ;;
15463                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15464                 esac
15465                 echo "Prototype: $try" ;;
15466         esac
15467         ;;
15468         *)      case "$usethreads" in
15469                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15470                 esac
15471                 d_getservent_r=undef
15472                 getservent_r_proto=0
15473                 ;;
15474         esac
15475         ;;
15476 *)      getservent_r_proto=0
15477         ;;
15478 esac
15479
15480 : see if prototypes for various getservxxx netdb.h functions are available
15481 echo " "
15482 set d_getservprotos getservent $i_netdb netdb.h
15483 eval $hasproto
15484
15485 : see if getspnam exists
15486 set getspnam d_getspnam
15487 eval $inlibc
15488
15489 : see if this is a shadow.h system
15490 set shadow.h i_shadow
15491 eval $inhdr
15492
15493 : see if getspnam_r exists
15494 set getspnam_r d_getspnam_r
15495 eval $inlibc
15496 case "$d_getspnam_r" in
15497 "$define")
15498         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15499         case "$d_getspnam_r_proto:$usethreads" in
15500         ":define")      d_getspnam_r_proto=define
15501                 set d_getspnam_r_proto getspnam_r $hdrs
15502                 eval $hasproto ;;
15503         *)      ;;
15504         esac
15505         case "$d_getspnam_r_proto" in
15506         define)
15507         case "$getspnam_r_proto" in
15508         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15509         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15510         esac
15511         case "$getspnam_r_proto" in
15512         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15513         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15514         esac
15515         case "$getspnam_r_proto" in
15516         ''|0)   d_getspnam_r=undef
15517                 getspnam_r_proto=0
15518                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15519         * )     case "$getspnam_r_proto" in
15520                 REENTRANT_PROTO*) ;;
15521                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15522                 esac
15523                 echo "Prototype: $try" ;;
15524         esac
15525         ;;
15526         *)      case "$usethreads" in
15527                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15528                 esac
15529                 d_getspnam_r=undef
15530                 getspnam_r_proto=0
15531                 ;;
15532         esac
15533         ;;
15534 *)      getspnam_r_proto=0
15535         ;;
15536 esac
15537
15538 : see if gettimeofday or ftime exists
15539 set gettimeofday d_gettimeod
15540 eval $inlibc
15541 case "$d_gettimeod" in
15542 "$undef")
15543         set ftime d_ftime 
15544         eval $inlibc
15545         ;;
15546 *)
15547         val="$undef"; set d_ftime; eval $setvar
15548         ;;
15549 esac
15550 case "$d_gettimeod$d_ftime" in
15551 "$undef$undef")
15552         echo " "
15553         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15554         ;;
15555 esac
15556
15557 : see if gmtime_r exists
15558 set gmtime_r d_gmtime_r
15559 eval $inlibc
15560 case "$d_gmtime_r" in
15561 "$define")
15562         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15563         case "$d_gmtime_r_proto:$usethreads" in
15564         ":define")      d_gmtime_r_proto=define
15565                 set d_gmtime_r_proto gmtime_r $hdrs
15566                 eval $hasproto ;;
15567         *)      ;;
15568         esac
15569         case "$d_gmtime_r_proto" in
15570         define)
15571         case "$gmtime_r_proto" in
15572         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15573         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15574         esac
15575         case "$gmtime_r_proto" in
15576         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15577         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15578         esac
15579         case "$gmtime_r_proto" in
15580         ''|0)   d_gmtime_r=undef
15581                 gmtime_r_proto=0
15582                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15583         * )     case "$gmtime_r_proto" in
15584                 REENTRANT_PROTO*) ;;
15585                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15586                 esac
15587                 echo "Prototype: $try" ;;
15588         esac
15589         ;;
15590         *)      case "$usethreads" in
15591                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15592                 esac
15593                 d_gmtime_r=undef
15594                 gmtime_r_proto=0
15595                 ;;
15596         esac
15597         ;;
15598 *)      gmtime_r_proto=0
15599         ;;
15600 esac
15601
15602 : see if hasmntopt exists
15603 set hasmntopt d_hasmntopt
15604 eval $inlibc
15605
15606 : see if this is a netinet/in.h or sys/in.h system
15607 set netinet/in.h i_niin sys/in.h i_sysin
15608 eval $inhdr
15609
15610 : see if arpa/inet.h has to be included
15611 set arpa/inet.h i_arpainet
15612 eval $inhdr
15613
15614 : see if htonl --and friends-- exists
15615 val=''
15616 set htonl val
15617 eval $inlibc
15618
15619 : Maybe they are macros.
15620 case "$val" in
15621 $undef)
15622         $cat >htonl.c <<EOM
15623 #include <stdio.h>
15624 #include <sys/types.h>
15625 #$i_niin I_NETINET_IN
15626 #$i_sysin I_SYS_IN
15627 #$i_arpainet I_ARPA_INET
15628 #ifdef I_NETINET_IN
15629 #include <netinet/in.h>
15630 #endif
15631 #ifdef I_SYS_IN
15632 #include <sys/in.h>
15633 #endif
15634 #ifdef I_ARPA_INET
15635 #include <arpa/inet.h>
15636 #endif
15637 #ifdef htonl
15638 printf("Defined as a macro.");
15639 #endif
15640 EOM
15641         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15642         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15643                 val="$define"
15644                 echo "But it seems to be defined as a macro." >&4
15645         fi
15646         $rm -f htonl.?
15647         ;;
15648 esac
15649 set d_htonl
15650 eval $setvar
15651
15652 : see if hypot exists
15653 set hypot d_hypot
15654 eval $inlibc
15655
15656 : see if ilogb exists
15657 set ilogb d_ilogb
15658 eval $inlibc
15659
15660 : see if ilogbl exists
15661 set ilogbl d_ilogbl
15662 eval $inlibc
15663
15664 : check whether inet_aton exists
15665 set inet_aton d_inetaton
15666 eval $inlibc
15667
15668 : see if inet_ntop exists
15669 set inet_ntop d_inetntop
15670 eval $inlibc
15671
15672 : see if inet_pton exists
15673 set inet_pton d_inetpton
15674 eval $inlibc
15675
15676 : Look for isascii
15677 echo " "
15678 $cat >isascii.c <<EOCP
15679 #include <stdio.h>
15680 #include <ctype.h>
15681 #$i_stdlib I_STDLIB
15682 #ifdef I_STDLIB
15683 #include <stdlib.h>
15684 #endif
15685 int main() {
15686         int c = 'A';
15687         if (isascii(c))
15688                 exit(0);
15689         else
15690                 exit(1);
15691 }
15692 EOCP
15693 set isascii
15694 if eval $compile; then
15695         echo "isascii() found." >&4
15696         val="$define"
15697 else
15698         echo "isascii() NOT found." >&4
15699         val="$undef"
15700 fi
15701 set d_isascii
15702 eval $setvar
15703 $rm -f isascii*
15704
15705 : Look for isblank
15706 echo " "
15707 $cat >isblank.c <<'EOCP'
15708 #include <stdio.h>
15709 #include <ctype.h>
15710 int main() {
15711         int c = ' ';
15712         if (isblank(c))
15713                 return 0 ;
15714         else
15715                 return 1 ;
15716 }
15717 EOCP
15718 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15719         echo "isblank() found." >&4
15720         val="$define"
15721 else
15722         echo "isblank() NOT found." >&4
15723         val="$undef"
15724 fi
15725 set d_isblank
15726 eval $setvar
15727 $rm -f isblank*
15728
15729 : check for isfinite
15730 echo "Checking to see if you have isfinite..." >&4
15731 $cat >try.c <<EOCP
15732 #include <math.h>
15733 int main() { return isfinite(0.0); }
15734 EOCP
15735 set try
15736 if eval $compile; then
15737         val="$define"
15738         echo "You have isfinite."
15739 else
15740         val="$undef"
15741         echo "You do not have isfinite."
15742 fi
15743 $rm_try
15744 set d_isfinite
15745 eval $setvar
15746
15747 : see if isfinitel exists
15748 set isfinitel d_isfinitel
15749 eval $inlibc
15750
15751 : check for isinf
15752 echo "Checking to see if you have isinf..." >&4
15753 $cat >try.c <<EOCP
15754 #include <math.h>
15755 int main() { return isinf(0.0); }
15756 EOCP
15757 set try
15758 if eval $compile; then
15759         val="$define"
15760         echo "You have isinf."
15761 else
15762         val="$undef"
15763         echo "You do not have isinf."
15764 fi
15765 $rm_try
15766 set d_isinf
15767 eval $setvar
15768
15769 : see if isinfl exists
15770 set isinfl d_isinfl
15771 eval $inlibc
15772
15773 : check for isless
15774 echo "Checking to see if you have isless..." >&4
15775 $cat >try.c <<EOCP
15776 #include <math.h>
15777 int main() { return isless(0.0); }
15778 EOCP
15779 set try
15780 if eval $compile; then
15781         val="$define"
15782         echo "You have isless."
15783 else
15784         val="$undef"
15785         echo "You do not have isless."
15786 fi
15787 $rm_try
15788 set d_isless
15789 eval $setvar
15790
15791 : check for isnan
15792 echo "Checking to see if you have isnan..." >&4
15793 $cat >try.c <<EOCP
15794 #include <math.h>
15795 int main() { return isnan(0.0); }
15796 EOCP
15797 set try
15798 if eval $compile; then
15799         val="$define"
15800         echo "You have isnan."
15801 else
15802         val="$undef"
15803         echo "You do not have isnan."
15804 fi
15805 $rm_try
15806 set d_isnan
15807 eval $setvar
15808
15809 : see if isnanl exists
15810 set isnanl d_isnanl
15811 eval $inlibc
15812
15813 : check for isnormal
15814 echo "Checking to see if you have isnormal..." >&4
15815 $cat >try.c <<EOCP
15816 #include <math.h>
15817 int main() { return isnormal(0.0); }
15818 EOCP
15819 set try
15820 if eval $compile; then
15821         val="$define"
15822         echo "You have isnormal."
15823 else
15824         val="$undef"
15825         echo "You do not have isnormal."
15826 fi
15827 $rm_try
15828 set d_isnormal
15829 eval $setvar
15830
15831 : see if j0 exists
15832 set j0 d_j0
15833 eval $inlibc
15834
15835 : see if j0l exists
15836 set j0l d_j0l
15837 eval $inlibc
15838
15839 : see if killpg exists
15840 set killpg d_killpg
15841 eval $inlibc
15842
15843 : see if localeconv exists
15844 set localeconv d_locconv
15845 eval $inlibc
15846
15847 : see if libc has the POSIX.1-2008 currency locale rules
15848 case "$d_locconv:$d_lc_monetary_2008" in
15849 $define:)
15850         $cat >try.c <<EOCP
15851 #include <locale.h>
15852 int main() {
15853         struct lconv *lc = localeconv();
15854         char int_p_cs_precedes = lc->int_p_cs_precedes;
15855         return 0;
15856 }
15857 EOCP
15858         set try
15859         if eval $compile; then
15860                 d_lc_monetary_2008="$define"
15861         else
15862                 d_lc_monetary_2008="$undef"
15863         fi;
15864         $rm_try
15865         ;;
15866 esac
15867
15868 : see if lchown exists
15869 echo " "
15870 $cat > try.c <<'EOCP'
15871 /* System header to define __stub macros and hopefully few prototypes,
15872     which can conflict with char lchown(); below.  */
15873 #include <assert.h>
15874 /* Override any gcc2 internal prototype to avoid an error.  */
15875 /* We use char because int might match the return type of a gcc2
15876    builtin and then its argument prototype would still apply.  */
15877 char lchown();
15878 int main() {
15879     /*  The GNU C library defines this for functions which it implements
15880         to always fail with ENOSYS.  Some functions are actually named
15881         something starting with __ and the normal name is an alias.  */
15882 #if defined (__stub_lchown) || defined (__stub___lchown)
15883 choke me
15884 #else
15885 lchown();
15886 #endif
15887 ; return 0; }
15888 EOCP
15889 set try
15890 if eval $compile; then
15891     $echo "lchown() found." >&4
15892     val="$define"
15893 else
15894     $echo "lchown() NOT found." >&4
15895     val="$undef"
15896 fi
15897 set d_lchown
15898 eval $setvar
15899
15900 : See if number of significant digits in a double precision number is known
15901 echo " "
15902 $cat >ldbl_dig.c <<EOM
15903 #include <limits.h>
15904 #include <float.h>
15905 #ifdef LDBL_DIG
15906 printf("Contains LDBL_DIG");
15907 #endif
15908 EOM
15909 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15910 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15911         echo "LDBL_DIG found." >&4
15912         val="$define"
15913 else
15914         echo "LDBL_DIG NOT found." >&4
15915         val="$undef"
15916 fi
15917 $rm -f ldbl_dig.?
15918 set d_ldbl_dig
15919 eval $setvar
15920
15921 : see if lgamma exists
15922 set lgamma d_lgamma
15923 eval $inlibc
15924
15925 : see if lgamma_r exists
15926 set lgamma_r d_lgamma_r
15927 eval $inlibc
15928
15929 : check to see if math.h defines _LIB_VERSION
15930 d_libm_lib_version="$undef"
15931 echo " "
15932 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15933 $cat >try.c <<EOCP
15934 #include <unistd.h>
15935 #include <math.h>
15936 int main (int argc, char *argv[])
15937 {
15938     printf ("%d\n", _LIB_VERSION);
15939     return (0);
15940     } /* main */
15941 EOCP
15942 set try
15943 if eval $compile; then
15944     foo=`$run ./try`
15945     echo "Yes, it does ($foo)" >&4
15946     d_libm_lib_version="$define"
15947 else
15948     echo "No, it does not (probably harmless)" >&4
15949     fi
15950 $rm_try
15951
15952 : see if link exists
15953 set link d_link
15954 eval $inlibc
15955
15956 : see if llrint exists
15957 set llrint d_llrint
15958 eval $inlibc
15959
15960 : see if llrintl exists
15961 set llrintl d_llrintl
15962 eval $inlibc
15963
15964 : see if llround exists
15965 set llround d_llround
15966 eval $inlibc
15967
15968 : see if llroundl exists
15969 set llroundl d_llroundl
15970 eval $inlibc
15971
15972 : see if localeconv_l exists
15973 set localeconv_l d_localeconv_l
15974 eval $inlibc
15975
15976 : see if localtime_r exists
15977 set localtime_r d_localtime_r
15978 eval $inlibc
15979 case "$d_localtime_r" in
15980 "$define")
15981         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15982         case "$d_localtime_r_proto:$usethreads" in
15983         ":define")      d_localtime_r_proto=define
15984                 set d_localtime_r_proto localtime_r $hdrs
15985                 eval $hasproto ;;
15986         *)      ;;
15987         esac
15988         case "$d_localtime_r_proto" in
15989         define)
15990         case "$localtime_r_proto" in
15991         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15992         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15993         esac
15994         case "$localtime_r_proto" in
15995         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15996         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15997         esac
15998         case "$localtime_r_proto" in
15999         ''|0)   d_localtime_r=undef
16000                 localtime_r_proto=0
16001                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16002         * )     case "$localtime_r_proto" in
16003                 REENTRANT_PROTO*) ;;
16004                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16005                 esac
16006                 echo "Prototype: $try" ;;
16007         esac
16008         ;;
16009         *)      case "$usethreads" in
16010                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16011                 esac
16012                 d_localtime_r=undef
16013                 localtime_r_proto=0
16014                 ;;
16015         esac
16016         ;;
16017 *)      localtime_r_proto=0
16018         ;;
16019 esac
16020
16021 : see if localtime_r calls tzset
16022 case "$localtime_r_proto" in
16023 REENTRANT_PROTO*)
16024         $cat >try.c <<EOCP
16025 /*  Does our libc's localtime_r call tzset ?
16026  *  return 0 if so, 1 otherwise.
16027  */
16028 #$i_systypes    I_SYS_TYPES
16029 #$i_unistd      I_UNISTD
16030 #$i_time        I_TIME
16031 #$i_stdlib      I_STDLIB
16032 #$i_malloc      I_MALLOC
16033 #ifdef I_SYS_TYPES
16034 #  include <sys/types.h>
16035 #endif
16036 #ifdef I_UNISTD
16037 #  include <unistd.h>
16038 #endif
16039 #ifdef I_TIME
16040 #  include <time.h>
16041 #endif
16042 #ifdef I_STDLIB
16043 #include <stdlib.h>
16044 #endif
16045 #include <string.h>
16046 #ifdef I_MALLOC
16047 #  include <malloc.h>
16048 #endif
16049 int main()
16050 {
16051     time_t t = time(0L);
16052     char w_tz[]="TZ" "=GMT+5",
16053          e_tz[]="TZ" "=GMT-5",
16054         *tz_e = (char*)malloc(16),
16055         *tz_w = (char*)malloc(16);
16056     struct tm tm_e, tm_w;
16057     memset(&tm_e,'\0',sizeof(struct tm));
16058     memset(&tm_w,'\0',sizeof(struct tm));
16059     strcpy(tz_e,e_tz);
16060     strcpy(tz_w,w_tz);
16061
16062     putenv(tz_e);
16063     localtime_r(&t, &tm_e);
16064
16065     putenv(tz_w);
16066     localtime_r(&t, &tm_w);
16067
16068     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16069         return 1;
16070     return 0;
16071 }
16072 EOCP
16073         set try
16074         if eval $compile; then
16075             if $run ./try; then
16076                 d_localtime_r_needs_tzset=undef;
16077             else
16078                 d_localtime_r_needs_tzset=define;
16079             fi;
16080         else
16081             d_localtime_r_needs_tzset=undef;
16082         fi;
16083      ;;
16084   *)
16085      d_localtime_r_needs_tzset=undef;
16086      ;;
16087 esac
16088 $rm_try
16089
16090 : see if lockf exists
16091 set lockf d_lockf
16092 eval $inlibc
16093
16094 : see if log1p exists
16095 set log1p d_log1p
16096 eval $inlibc
16097
16098 : see if log2 exists
16099 set log2 d_log2
16100 eval $inlibc
16101
16102 : see if logb exists
16103 set logb d_logb
16104 eval $inlibc
16105
16106 : see if lrint exists
16107 set lrint d_lrint
16108 eval $inlibc
16109
16110 : see if lrintl exists
16111 set lrintl d_lrintl
16112 eval $inlibc
16113
16114 : see if lround exists
16115 set lround d_lround
16116 eval $inlibc
16117
16118 : see if lroundl exists
16119 set lroundl d_lroundl
16120 eval $inlibc
16121
16122 : see if prototype for lseek is available
16123 echo " "
16124 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16125 eval $hasproto
16126
16127 : see if lstat exists
16128 set lstat d_lstat
16129 eval $inlibc
16130
16131 : see if madvise exists
16132 set madvise d_madvise
16133 eval $inlibc
16134
16135 : see if malloc_size exists
16136 set malloc_size d_malloc_size
16137 eval $inlibc
16138
16139 : see if malloc_size_good exists
16140 set malloc_good_size d_malloc_good_size
16141 eval $inlibc
16142
16143 : see if mblen exists
16144 set mblen d_mblen
16145 eval $inlibc
16146
16147 : see if mbrlen exists
16148 set mbrlen d_mbrlen
16149 eval $inlibc
16150
16151 : see if mbrtowc exists
16152 set mbrtowc d_mbrtowc
16153 eval $inlibc
16154
16155 : see if mbstowcs exists
16156 set mbstowcs d_mbstowcs
16157 eval $inlibc
16158
16159 : see if mbtowc exists
16160 set mbtowc d_mbtowc
16161 eval $inlibc
16162
16163 : see if memmem exists
16164 : We need both a prototype in string.h and the symbol in libc.
16165 echo " "
16166 d_memmem_proto=''
16167 xx1="#$d_gnulibc HAS_GNULIBC"
16168 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16169 xx3='#   define _GNU_SOURCE'
16170 xx4='#endif'
16171 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16172 eval $hasproto
16173 case "$d_memmem_proto" in
16174     define) # see if memmem exists
16175         set memmem d_memmem
16176         eval $inlibc
16177         ;;
16178     *)  val=$undef
16179         set d_memmem
16180         eval $setvar
16181         ;;
16182 esac
16183
16184 : see if memrchr exists
16185 : We need both a prototype in string.h and the symbol in libc.
16186 echo " "
16187 d_memrchr_proto=''
16188 xx1="#$d_gnulibc HAS_GNULIBC"
16189 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16190 xx3='#   define _GNU_SOURCE'
16191 xx4='#endif'
16192 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16193 eval $hasproto
16194 case "$d_memrchr_proto" in
16195     define) # see if memrchr exists
16196         set memrchr d_memrchr
16197         eval $inlibc
16198         ;;
16199     *)  val=$undef
16200         set d_memrchr
16201         eval $setvar
16202         ;;
16203 esac
16204
16205 : see if mkdir exists
16206 set mkdir d_mkdir
16207 eval $inlibc
16208
16209 : see if mkdtemp exists
16210 set mkdtemp d_mkdtemp
16211 eval $inlibc
16212
16213 : see if mkfifo exists
16214 set mkfifo d_mkfifo
16215 eval $inlibc
16216
16217 : see if mkostemp exists
16218 set mkostemp d_mkostemp
16219 eval $inlibc
16220
16221 : see if mkstemp exists
16222 set mkstemp d_mkstemp
16223 eval $inlibc
16224
16225 : see if mkstemps exists
16226 set mkstemps d_mkstemps
16227 eval $inlibc
16228
16229 : see if mktime exists
16230 set mktime d_mktime
16231 eval $inlibc
16232
16233 : see if sys/mman.h has to be included
16234 set sys/mman.h i_sysmman
16235 eval $inhdr
16236
16237 : see if mmap exists
16238 set mmap d_mmap
16239 eval $inlibc
16240 : see what shmat returns
16241 : default to something harmless
16242 mmaptype='void *'
16243 case "$i_sysmman$d_mmap" in
16244 "$define$define")
16245         $cat >mmap.c <<'END'
16246 #include <sys/mman.h>
16247 void *mmap();
16248 END
16249         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16250                 mmaptype='void *'
16251         else
16252                 mmaptype='caddr_t'
16253         fi
16254         echo "and it returns ($mmaptype)." >&4
16255         ;;
16256 esac
16257
16258 : see if sqrtl exists
16259 set sqrtl d_sqrtl
16260 eval $inlibc
16261
16262 : see if scalbnl exists
16263 set scalbnl d_scalbnl
16264 eval $inlibc
16265
16266 : see if truncl exists
16267 set truncl d_truncl
16268 eval $inlibc
16269
16270 : see if modfl exists
16271 set modfl d_modfl
16272 eval $inlibc
16273
16274 : see if prototype for modfl is available
16275 echo " "
16276 set d_modflproto modfl define math.h
16277 eval $hasproto
16278
16279 if $test "$uselongdouble" = "$define"; then
16280     message=""
16281     if $test "$d_sqrtl" != "$define"; then
16282         message="$message sqrtl"
16283     fi
16284     if $test "$d_modfl" != "$define"; then
16285         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16286             echo "You have both truncl and copysignl, so I can emulate modfl."
16287         else
16288             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16289                 echo "You have both aintl and copysignl, so I can emulate modfl."
16290             else
16291                 message="$message modfl"
16292             fi
16293         fi
16294     fi
16295     if $test "$d_frexpl" != "$define"; then
16296         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16297             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16298         else
16299             message="$message frexpl"
16300         fi
16301     fi
16302     if $test "$d_ldexpl" != "$define"; then
16303         message="$message ldexpl"
16304     fi
16305
16306     if $test "$message" != ""; then
16307         $cat <<EOM >&4
16308
16309 *** You requested the use of long doubles but you do not seem to have
16310 *** the following mathematical functions needed for long double support:
16311 ***    $message
16312 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16313 *** Cannot continue, aborting.
16314
16315 EOM
16316
16317         exit 1
16318     fi
16319 fi
16320
16321 : see if mprotect exists
16322 set mprotect d_mprotect
16323 eval $inlibc
16324
16325 : see if msgctl exists
16326 set msgctl d_msgctl
16327 eval $inlibc
16328
16329 : see if msgget exists
16330 set msgget d_msgget
16331 eval $inlibc
16332
16333 : see if msgsnd exists
16334 set msgsnd d_msgsnd
16335 eval $inlibc
16336
16337 : see if msgrcv exists
16338 set msgrcv d_msgrcv
16339 eval $inlibc
16340
16341 : see how much of the 'msg*(2)' library is present.
16342 h_msg=true
16343 echo " "
16344 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16345 *"$undef"*) h_msg=false;;
16346 esac
16347 case "$osname" in
16348 freebsd)
16349     case "`ipcs 2>&1`" in
16350     "SVID messages"*"not configured"*)
16351         echo "Your $osname does not have the msg*(2) configured." >&4
16352         h_msg=false
16353         val="$undef"
16354         set msgctl d_msgctl
16355         eval $setvar
16356         set msgget d_msgget
16357         eval $setvar
16358         set msgsnd d_msgsnd
16359         eval $setvar
16360         set msgrcv d_msgrcv
16361         eval $setvar
16362         ;;
16363     esac
16364     ;;
16365 esac
16366 : we could also check for sys/ipc.h ...
16367 if $h_msg && $test `./findhdr sys/msg.h`; then
16368         echo "You have the full msg*(2) library." >&4
16369         val="$define"
16370 else
16371         echo "You don't have the full msg*(2) library." >&4
16372         val="$undef"
16373 fi
16374 set d_msg
16375 eval $setvar
16376
16377 : Check for msghdr_s
16378 echo " "
16379 echo "Checking to see if your system supports struct msghdr..." >&4
16380 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16381 eval $hasstruct
16382 case "$d_msghdr_s" in
16383 "$define")      echo "Yes, it does."   ;;
16384 *)              echo "No, it doesn't." ;;
16385 esac
16386
16387 : see if msync exists
16388 set msync d_msync
16389 eval $inlibc
16390
16391 : see if munmap exists
16392 set munmap d_munmap
16393 eval $inlibc
16394
16395 : see if nan exists
16396 set nan d_nan
16397 eval $inlibc
16398
16399 : see if nanosleep exists
16400 set nanosleep d_nanosleep
16401 eval $inlibc
16402
16403 : see if nearbyint exists
16404 set nearbyint d_nearbyint
16405 eval $inlibc
16406
16407 : see if nextafter exists
16408 set nextafter d_nextafter
16409 eval $inlibc
16410
16411 : see if nexttoward exists
16412 set nexttoward d_nexttoward
16413 eval $inlibc
16414
16415 : see if nice exists
16416 set nice d_nice
16417 eval $inlibc
16418
16419 : see if this is a langinfo.h system
16420 set langinfo.h i_langinfo
16421 eval $inhdr
16422
16423 : see if nl_langinfo exists
16424 set nl_langinfo d_nl_langinfo
16425 eval $inlibc
16426
16427 : see if this is a quadmath.h system
16428 set quadmath.h i_quadmath
16429 eval $inhdr
16430
16431 : Check basic sizes
16432 echo " "
16433 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16434
16435 case "$use64bitint:$d_quad:$quadtype" in
16436 define:define:?*)
16437         ivtype="$quadtype"
16438         uvtype="$uquadtype"
16439         ivsize=8
16440         uvsize=8
16441         ;;
16442 *)      ivtype="long"
16443         uvtype="unsigned long"
16444         ivsize=$longsize
16445         uvsize=$longsize
16446         ;;
16447 esac
16448
16449 case "$uselongdouble:$d_longdbl" in
16450 define:define)
16451         nvtype="long double"
16452         nvsize=$longdblsize
16453         ;;
16454 *)      nvtype=double
16455         nvsize=$doublesize
16456         ;;
16457 esac
16458
16459 case "$usequadmath:$i_quadmath" in
16460 define:define)
16461   nvtype="__float128"
16462   nvsize=16
16463   case "$libs" in
16464   *quadmath*) ;;
16465   *) $cat <<EOM >&4
16466
16467 *** You requested the use of the quadmath library, but you
16468 *** do not seem to have the quadmath library installed.
16469 *** Cannot continue, aborting.
16470 EOM
16471     exit 1
16472     ;;
16473   esac
16474   ;;
16475 define:*) $cat <<EOM >&4
16476
16477 *** You requested the use of the quadmath library, but you
16478 *** do not seem to have the required header, <quadmath.h>.
16479 EOM
16480   case "$gccversion" in
16481   [23].*|4.[0-5]*)
16482    $cat <<EOM >&4
16483 *** Your gcc looks a bit old:
16484 *** $gccversion
16485 EOM
16486     ;;
16487   '')
16488    $cat <<EOM >&4
16489 *** You are not running a gcc.
16490 EOM
16491     ;;
16492   esac
16493   $cat <<EOM >&4
16494 *** For the quadmath library you need at least gcc 4.6.
16495 *** Cannot continue, aborting.
16496 EOM
16497   exit 1
16498   ;;
16499 esac
16500
16501 $echo "(IV will be "$ivtype", $ivsize bytes)"
16502 $echo "(UV will be "$uvtype", $uvsize bytes)"
16503 $echo "(NV will be "$nvtype", $nvsize bytes)"
16504
16505 $cat >try.c <<EOCP
16506 #$i_inttypes I_INTTYPES
16507 #ifdef I_INTTYPES
16508 #include <inttypes.h>
16509 #endif
16510 #include <stdio.h>
16511 int main() {
16512 #ifdef INT8
16513    int8_t i =  INT8_MAX;
16514   uint8_t u = UINT8_MAX;
16515   printf("int8_t\n");
16516 #endif
16517 #ifdef INT16
16518    int16_t i =  INT16_MAX;
16519   uint16_t u = UINT16_MAX;
16520   printf("int16_t\n");
16521 #endif
16522 #ifdef INT32
16523    int32_t i =  INT32_MAX;
16524   uint32_t u = UINT32_MAX;
16525   printf("int32_t\n");
16526 #endif
16527 }
16528 EOCP
16529
16530 i8type="signed char"
16531 u8type="unsigned char"
16532 i8size=1
16533 u8size=1
16534
16535 case "$i16type" in
16536 '')     case "$shortsize" in
16537         2)      i16type=short
16538                 u16type="unsigned short"
16539                 i16size=$shortsize
16540                 u16size=$shortsize
16541                 ;;
16542         esac
16543         ;;
16544 esac
16545 case "$i16type" in
16546 '')     set try -DINT16
16547         if eval $compile; then
16548                 case "`$run ./try`" in
16549                 int16_t)
16550                         i16type=int16_t
16551                         u16type=uint16_t
16552                         i16size=2
16553                         u16size=2
16554                         ;;
16555                 esac
16556         fi
16557         ;;
16558 esac
16559 case "$i16type" in
16560 '')     if $test $shortsize -ge 2; then
16561                 i16type=short
16562                 u16type="unsigned short"
16563                 i16size=$shortsize
16564                 u16size=$shortsize
16565         fi
16566         ;;
16567 esac
16568
16569 case "$i32type" in
16570 '')     case "$longsize" in
16571         4)      i32type=long
16572                 u32type="unsigned long"
16573                 i32size=$longsize
16574                 u32size=$longsize
16575                 ;;
16576         *)      case "$intsize" in
16577                 4)      i32type=int
16578                         u32type="unsigned int"
16579                         i32size=$intsize
16580                         u32size=$intsize
16581                         ;;
16582                 esac
16583                 ;;
16584         esac
16585         ;;
16586 esac
16587 case "$i32type" in
16588 '')     set try -DINT32
16589         if eval $compile; then
16590                 case "`$run ./try`" in
16591                 int32_t)
16592                         i32type=int32_t
16593                         u32type=uint32_t
16594                         i32size=4
16595                         u32size=4
16596                         ;;
16597                 esac
16598         fi
16599         ;;
16600 esac
16601 case "$i32type" in
16602 '')     if $test $intsize -ge 4; then
16603                 i32type=int
16604                 u32type="unsigned int"
16605                 i32size=$intsize
16606                 u32size=$intsize
16607         fi
16608         ;;
16609 esac
16610
16611 case "$i64type" in
16612 '')     case "$d_quad:$quadtype" in
16613         define:?*)
16614                 i64type="$quadtype"
16615                 u64type="$uquadtype"
16616                 i64size=8
16617                 u64size=8
16618                 ;;
16619         esac
16620         ;;
16621 esac
16622
16623 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16624 $cat <<EOP >try.c
16625 #include <stdio.h>
16626 #$i_stdlib I_STDLIB
16627 #ifdef I_STDLIB
16628 #include <stdlib.h>
16629 #endif
16630 #include <sys/types.h>
16631 #include <signal.h>
16632 #ifdef SIGFPE
16633 /* volatile so that the compiler has to store it out to memory */
16634 volatile int bletched = 0;
16635 $signal_t blech(int s) { bletched = 1; }
16636 #endif
16637 int main() {
16638     $uvtype u = 0;
16639     $nvtype d;
16640     int     n = 8 * $uvsize;
16641     int     i;
16642 #ifdef SIGFPE
16643     signal(SIGFPE, blech);
16644 #endif
16645
16646     for (i = 0; i < n; i++) {
16647       u = u << 1 | ($uvtype)1;
16648       d = ($nvtype)u;
16649       if (($uvtype)d != u)
16650         break;
16651       if (d <= 0)
16652         break;
16653       d = ($nvtype)(u - 1);
16654       if (($uvtype)d != (u - 1))
16655         break;
16656 #ifdef SIGFPE
16657       if (bletched)
16658         break;
16659 #endif
16660     }
16661     printf("%d\n", ((i == n) ? -n : i));
16662     exit(0);
16663 }
16664 EOP
16665 set try
16666
16667 d_nv_preserves_uv="$undef"
16668 if eval $compile; then
16669         nv_preserves_uv_bits="`$run ./try`"
16670 fi
16671 case "$nv_preserves_uv_bits" in
16672 \-[1-9]*)
16673         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16674         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16675         d_nv_preserves_uv="$define"
16676         ;;
16677 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16678         d_nv_preserves_uv="$undef" ;;
16679 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16680         nv_preserves_uv_bits="0" ;;
16681 esac
16682 $rm_try
16683
16684 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16685 $cat <<EOP >try.c
16686 #include <stdio.h>
16687
16688 typedef $nvtype NV;
16689
16690 int
16691 main() {
16692   NV value = 2;
16693   int count = 1;
16694
16695   while(count < 256) {
16696     /* volatile so that the compiler has to store it out to memory */
16697     volatile NV up = value + 1.0;
16698     volatile NV negated = -value;
16699     volatile NV down = negated - 1.0;
16700     volatile NV got_up = up - value;
16701     int up_good = got_up == 1.0;
16702     int got_down = down - negated;
16703     int down_good = got_down == -1.0;
16704
16705     if (down_good != up_good) {
16706       fprintf(stderr,
16707               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16708               up_good, (double) got_up, down_good, (double) got_down,
16709               count, (double) value);
16710       return 1;
16711     }
16712     if (!up_good) {
16713       while (1) {
16714         if (count > 8) {
16715           count -= 8;
16716           fputs("256.0", stdout);
16717         } else {
16718           count--;
16719           fputs("2.0", stdout);
16720         }
16721         if (!count) {
16722           puts("");
16723           return 0;
16724         }
16725         fputs("*", stdout);
16726       }
16727     }
16728     value *= 2;
16729     ++count;
16730   }
16731   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16732           count, (double) value);
16733   return 1;
16734 }
16735 EOP
16736 set try
16737
16738 nv_overflows_integers_at='0'
16739 if eval $compile; then
16740     xxx="`$run ./try`"
16741     case "$?" in
16742         0)
16743             case "$xxx" in
16744                 2*)  cat >&4 <<EOM
16745 The largest integer your NVs can preserve is equal to $xxx
16746 EOM
16747                     nv_overflows_integers_at="$xxx"
16748                     ;;
16749                 *)  cat >&4 <<EOM
16750 Cannot determine the largest integer value your NVs can hold, unexpected output
16751 '$xxx'
16752 EOM
16753                     ;;
16754             esac
16755             ;;
16756         *)  cat >&4 <<EOM
16757 Cannot determine the largest integer value your NVs can hold
16758 EOM
16759             ;;
16760     esac
16761 fi
16762 $rm_try
16763
16764 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16765 $cat <<EOP >try.c
16766 #include <stdio.h>
16767 #$i_stdlib I_STDLIB
16768 #ifdef I_STDLIB
16769 #include <stdlib.h>
16770 #endif
16771 #include <string.h>
16772 #include <sys/types.h>
16773 #include <signal.h>
16774 #ifdef SIGFPE
16775 /* volatile so that the compiler has to store it out to memory */
16776 volatile int bletched = 0;
16777 $signal_t blech(int s) { bletched = 1; }
16778 #endif
16779
16780 int checkit($nvtype d, const char *where) {
16781     void *v = &d;
16782     unsigned char *p = (unsigned char *)v;
16783     unsigned char *end = p + sizeof(d);
16784     int fail = 0;
16785
16786     while (p < end)
16787         fail += *p++;
16788
16789     if (!fail)
16790         return 0;
16791
16792     p = (unsigned char *)v;
16793     printf("No - %s: 0x", where);
16794     while (p < end)
16795         printf ("%02X", *p++);
16796     printf("\n");
16797     return 1;
16798 }
16799
16800 int main(int argc, char **argv) {
16801     $nvtype d = 0.0;
16802     int fail = 0;
16803     fail += checkit(d, "0.0");
16804
16805     /* The compiler shouldn't be assuming that bletched is 0  */
16806     d = bletched;
16807
16808     fail += checkit(d, "bleched");
16809
16810 #ifdef SIGFPE
16811     signal(SIGFPE, blech);
16812 #endif
16813
16814     /* Paranoia - the compiler should have no way of knowing that ANSI says
16815        that argv[argc] will always be NULL.  Actually, if it did assume this it
16816        would be buggy, as this is C and main() can be called from elsewhere in
16817        the program.  */
16818     d = argv[argc] ? 1 : 0;
16819
16820     if (d) {
16821         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16822     }
16823
16824     fail += checkit(d, "ternary");
16825
16826     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16827
16828     if (d != 0.0) {
16829         printf("No - memset doesn't give 0.0\n");
16830         /* This might just blow up:  */
16831         printf("(gives %g)\n", d);
16832         return 1;
16833     }
16834
16835 #ifdef SIGFPE
16836     if (bletched) {
16837         printf("No - something bleched\n");
16838         return 1;
16839     }
16840 #endif
16841     if (fail) {
16842       printf("No - %d fail(s)\n", fail);
16843       return 1;
16844     }
16845     printf("Yes\n");
16846     return 0;
16847 }
16848 EOP
16849 set try
16850
16851 d_nv_zero_is_allbits_zero="$undef"
16852 if eval $compile; then
16853     xxx="`$run ./try`"
16854     case "$?" in
16855         0)
16856             case "$xxx" in
16857                 Yes)  cat >&4 <<EOM
16858 0.0 is represented as all bits zero in memory
16859 EOM
16860                     d_nv_zero_is_allbits_zero="$define"
16861                     ;;
16862                 *)  cat >&4 <<EOM
16863 0.0 is not represented as all bits zero in memory
16864 EOM
16865                     d_nv_zero_is_allbits_zero="$undef"
16866                     ;;
16867             esac
16868             ;;
16869         *)  cat >&4 <<EOM
16870 0.0 is not represented as all bits zero in memory
16871 EOM
16872             d_nv_zero_is_allbits_zero="$undef"
16873             ;;
16874     esac
16875 fi
16876 $rm_try
16877
16878 : check for off64_t
16879 echo " "
16880 echo "Checking to see if you have off64_t..." >&4
16881 $cat >try.c <<EOCP
16882 #include <sys/types.h>
16883 #include <unistd.h>
16884 int main() { off64_t x = 7; }
16885 EOCP
16886 set try
16887 if eval $compile; then
16888         val="$define"
16889         echo "You have off64_t."
16890 else
16891         val="$undef"
16892         echo "You do not have off64_t."
16893         case "$lseeksize" in
16894         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16895         esac
16896 fi
16897 $rm_try
16898 set d_off64_t
16899 eval $setvar
16900
16901 : how to create joinable pthreads
16902 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16903         echo " "
16904         echo "Checking what constant to use for creating joinable pthreads..." >&4
16905         $cat >try.c <<'EOCP'
16906 #include <pthread.h>
16907 int main() {
16908     int detachstate = JOINABLE;
16909 }
16910 EOCP
16911         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16912         if eval $compile; then
16913                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16914                 val="$undef" # Yes, undef.
16915                 set d_old_pthread_create_joinable
16916                 eval $setvar
16917                 val=""
16918                 set old_pthread_create_joinable
16919                 eval $setvar
16920         else
16921                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16922                 if eval $compile; then
16923                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16924                         val="$define"
16925                         set d_old_pthread_create_joinable
16926                         eval $setvar
16927                         val=PTHREAD_CREATE_UNDETACHED
16928                         set old_pthread_create_joinable
16929                         eval $setvar
16930                 else
16931                         set try -DJOINABLE=__UNDETACHED
16932                         if eval $compile; then
16933                                 echo "You seem to use __UNDETACHED." >&4
16934                                 val="$define"
16935                                 set d_old_pthread_create_joinable
16936                                 eval $setvar
16937                                 val=__UNDETACHED
16938                                 set old_pthread_create_joinable
16939                                 eval $setvar
16940                         else
16941                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16942                                 val="$define"
16943                                 set d_old_pthread_create_joinable
16944                                 eval $setvar
16945                                 val=0
16946                                 set old_pthread_create_joinable
16947                                 eval $setvar
16948                         fi
16949                 fi
16950         fi
16951         $rm_try
16952 else
16953     d_old_pthread_create_joinable="$undef"
16954     old_pthread_create_joinable=""
16955 fi
16956
16957 : see if pause exists
16958 set pause d_pause
16959 eval $inlibc
16960
16961 : see if pipe2 exists
16962 set pipe2 d_pipe2
16963 eval $inlibc
16964
16965 : see if poll exists
16966 set poll d_poll
16967 eval $inlibc
16968
16969 : see if prctl exists
16970 set prctl d_prctl
16971 eval $inlibc
16972
16973 : see if prctl supports PR_SET_NAME
16974 d_prctl_set_name=$undef
16975 case $d_prctl in
16976     $define)
16977         $cat >try.c <<EOM
16978 #ifdef __ANDROID__
16979 #include <unistd.h>
16980 #endif
16981 #include <sys/prctl.h>
16982
16983 int main (int argc, char *argv[])
16984 {
16985     return (prctl (PR_SET_NAME, "Test"));
16986     } /* main */
16987 EOM
16988         set try
16989         if eval $compile_ok && $run ./try; then
16990             echo "Your prctl (PR_SET_NAME, ...) works"
16991             d_prctl_set_name=$define
16992             fi
16993         $rm_try
16994         ;;
16995     esac
16996
16997 : see if readlink exists
16998 set readlink d_readlink
16999 eval $inlibc
17000
17001 : Check if there is a /proc symlink to the abs path of
17002 : the executing program.  We will honor hints of d_procselfexe=$undef
17003 : or procselfexe being non-empty, otherwise will try to determine both
17004 : if we have readlink.
17005 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17006 : referenced, and AmigaOS does not have a proc filesystem anyway.
17007 echo " "
17008 val="$undef"
17009 if $test "X$d_procselfexe" = Xundef; then
17010         procselfexe=''
17011 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17012         val="$define"
17013 elif $test "X$d_readlink" = Xdefine; then
17014         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17015         : and it feels more tidy to avoid an extra level of symlink
17016         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17017         while test $# -gt 0; do
17018             type=$1; try=$2
17019             shift; shift
17020             if $issymlink $try; then
17021                 $ls -l $try > reflect
17022                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17023                     echo "You have $type-like $try."
17024                     procselfexe='"'$try'"'
17025                     val="$define"
17026                     : This will break out of the loop
17027                     set X; shift
17028                 fi
17029             fi
17030         done
17031 fi
17032 $rm -f reflect
17033 set d_procselfexe
17034 eval $setvar
17035
17036 : backward compatibility for d_hvfork
17037 if test X$d_hvfork != X; then
17038         d_vfork="$d_hvfork"
17039         d_hvfork=''
17040 fi
17041 : see if there is a vfork
17042 val=''
17043 set vfork val
17044 eval $inlibc
17045
17046 d_pseudofork=$undef
17047
17048 : Ok, but do we want to use it. vfork is reportedly unreliable in
17049 : perl on Solaris 2.x, and probably elsewhere.
17050 case "$val" in
17051 $define)
17052         echo " "
17053         case "$usevfork" in
17054         false) dflt='n';;
17055         *) dflt='y';;
17056         esac
17057         cat <<'EOM'
17058
17059 Perl can only use a vfork() that doesn't suffer from strict
17060 restrictions on calling functions or modifying global data in
17061 the child.  For example, glibc-2.1 contains such a vfork()
17062 that is unsuitable.  If your system provides a proper fork()
17063 call, chances are that you do NOT want perl to use vfork().
17064
17065 EOM
17066         rp="Do you still want to use vfork()?"
17067         . ./myread
17068         case "$ans" in
17069         y|Y) ;;
17070         *)
17071                 echo "Ok, we won't use vfork()."
17072                 val="$undef"
17073                 ;;
17074         esac
17075         ;;
17076 esac
17077 set d_vfork
17078 eval $setvar
17079 case "$d_vfork" in
17080 $define) usevfork='true';;
17081 *) usevfork='false';;
17082 esac
17083
17084 : see whether the pthread_atfork exists
17085 $cat >try.c <<EOP
17086 #include <pthread.h>
17087 #include <stdio.h>
17088 int main() {
17089 #ifdef  PTHREAD_ATFORK
17090         pthread_atfork(NULL,NULL,NULL);
17091 #endif
17092 }
17093 EOP
17094
17095 : see if pthread_atfork exists
17096 set try -DPTHREAD_ATFORK
17097 if eval $compile; then
17098     val="$define"
17099 else
17100     val="$undef"
17101 fi
17102 case "$usethreads" in
17103 $define)
17104         case "$val" in
17105         $define) echo 'pthread_atfork found.' >&4        ;;
17106         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17107         esac
17108 esac
17109 set d_pthread_atfork
17110 eval $setvar
17111
17112 : see if pthread_attr_setscope exists
17113 set pthread_attr_setscope d_pthread_attr_setscope
17114 eval $inlibc
17115
17116 : see whether the various POSIXish _yields exist
17117 $cat >try.c <<EOP
17118 #include <pthread.h>
17119 #include <stdio.h>
17120 int main() {
17121 #ifdef SCHED_YIELD
17122         sched_yield();
17123 #else
17124 #ifdef PTHREAD_YIELD
17125         pthread_yield();
17126 #else
17127 #ifdef PTHREAD_YIELD_NULL
17128         pthread_yield(NULL);
17129 #endif
17130 #endif
17131 #endif
17132 }
17133 EOP
17134 : see if sched_yield exists
17135 set try -DSCHED_YIELD
17136 if eval $compile; then
17137     val="$define"
17138     sched_yield='sched_yield()'
17139 else
17140     val="$undef"
17141 fi
17142 case "$usethreads" in
17143 $define)
17144         case "$val" in
17145         $define) echo 'sched_yield() found.' >&4        ;;
17146         *)       echo 'sched_yield() NOT found.' >&4    ;;
17147         esac
17148 esac
17149 set d_sched_yield
17150 eval $setvar
17151
17152 : see if pthread_yield exists
17153 set try -DPTHREAD_YIELD
17154 if eval $compile; then
17155     val="$define"
17156     case "$sched_yield" in
17157     '') sched_yield='pthread_yield()' ;;
17158     esac
17159 else
17160     set try -DPTHREAD_YIELD_NULL
17161     if eval $compile; then
17162         val="$define"
17163         case "$sched_yield" in
17164         '') sched_yield='pthread_yield(NULL)' ;;
17165         esac
17166     else
17167         val="$undef"
17168     fi
17169 fi
17170 case "$usethreads" in
17171 $define)
17172         case "$val" in
17173         $define) echo 'pthread_yield() found.' >&4      ;;
17174         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17175         esac
17176         ;;
17177 esac
17178 set d_pthread_yield
17179 eval $setvar
17180 case "$sched_yield" in
17181 '') sched_yield=undef ;;
17182 esac
17183 $rm_try
17184
17185 : check for ptrdiff_t
17186 echo " "
17187 echo "Checking to see if you have ptrdiff_t..." >&4
17188 $cat >try.c <<EOCP
17189 #include <stddef.h>
17190 int main() { ptrdiff_t x = 7; }
17191 EOCP
17192 set try
17193 if eval $compile; then
17194         val="$define"
17195         echo "You have ptrdiff_t."
17196 else
17197         val="$undef"
17198         echo "You do not have ptrdiff_t."
17199 fi
17200 $rm_try
17201 set d_ptrdiff_t
17202 eval $setvar
17203
17204 : see if random_r exists
17205 set random_r d_random_r
17206 eval $inlibc
17207 case "$d_random_r" in
17208 "$define")
17209         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17210         case "$d_random_r_proto:$usethreads" in
17211         ":define")      d_random_r_proto=define
17212                 set d_random_r_proto random_r $hdrs
17213                 eval $hasproto ;;
17214         *)      ;;
17215         esac
17216         case "$d_random_r_proto" in
17217         define)
17218         case "$random_r_proto" in
17219         ''|0) try='int random_r(int*, struct random_data*);'
17220         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17221         esac
17222         case "$random_r_proto" in
17223         ''|0) try='int random_r(long*, struct random_data*);'
17224         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17225         esac
17226         case "$random_r_proto" in
17227         ''|0) try='int random_r(struct random_data*, int32_t*);'
17228         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17229         esac
17230         case "$random_r_proto" in
17231         ''|0)   d_random_r=undef
17232                 random_r_proto=0
17233                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17234         * )     case "$random_r_proto" in
17235                 REENTRANT_PROTO*) ;;
17236                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17237                 esac
17238                 echo "Prototype: $try" ;;
17239         esac
17240         ;;
17241         *)      case "$usethreads" in
17242                 define) echo "random_r has no prototype, not using it." >&4 ;;
17243                 esac
17244                 d_random_r=undef
17245                 random_r_proto=0
17246                 ;;
17247         esac
17248         ;;
17249 *)      random_r_proto=0
17250         ;;
17251 esac
17252
17253 : see if readdir and friends exist
17254 set readdir d_readdir
17255 eval $inlibc
17256 set seekdir d_seekdir
17257 eval $inlibc
17258 set telldir d_telldir
17259 eval $inlibc
17260 set rewinddir d_rewinddir
17261 eval $inlibc
17262
17263 : see if readdir64_r exists
17264 set readdir64_r d_readdir64_r
17265 eval $inlibc
17266 case "$d_readdir64_r" in
17267 "$define")
17268         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17269         case "$d_readdir64_r_proto:$usethreads" in
17270         ":define")      d_readdir64_r_proto=define
17271                 set d_readdir64_r_proto readdir64_r $hdrs
17272                 eval $hasproto ;;
17273         *)      ;;
17274         esac
17275         case "$d_readdir64_r_proto" in
17276         define)
17277         case "$readdir64_r_proto" in
17278         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17279         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17280         esac
17281         case "$readdir64_r_proto" in
17282         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17283         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17284         esac
17285         case "$readdir64_r_proto" in
17286         ''|0)   d_readdir64_r=undef
17287                 readdir64_r_proto=0
17288                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17289         * )     case "$readdir64_r_proto" in
17290                 REENTRANT_PROTO*) ;;
17291                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17292                 esac
17293                 echo "Prototype: $try" ;;
17294         esac
17295         ;;
17296         *)      case "$usethreads" in
17297                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17298                 esac
17299                 d_readdir64_r=undef
17300                 readdir64_r_proto=0
17301                 ;;
17302         esac
17303         ;;
17304 *)      readdir64_r_proto=0
17305         ;;
17306 esac
17307
17308 : see if readdir_r exists
17309 set readdir_r d_readdir_r
17310 eval $inlibc
17311 case "$d_readdir_r" in
17312 "$define")
17313         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17314         case "$d_readdir_r_proto:$usethreads" in
17315         ":define")      d_readdir_r_proto=define
17316                 set d_readdir_r_proto readdir_r $hdrs
17317                 eval $hasproto ;;
17318         *)      ;;
17319         esac
17320         case "$d_readdir_r_proto" in
17321         define)
17322         case "$readdir_r_proto" in
17323         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17324         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17325         esac
17326         case "$readdir_r_proto" in
17327         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17328         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17329         esac
17330         case "$readdir_r_proto" in
17331         ''|0)   d_readdir_r=undef
17332                 readdir_r_proto=0
17333                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17334         * )     case "$readdir_r_proto" in
17335                 REENTRANT_PROTO*) ;;
17336                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17337                 esac
17338                 echo "Prototype: $try" ;;
17339         esac
17340         ;;
17341         *)      case "$usethreads" in
17342                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17343                 esac
17344                 d_readdir_r=undef
17345                 readdir_r_proto=0
17346                 ;;
17347         esac
17348         ;;
17349 *)      readdir_r_proto=0
17350         ;;
17351 esac
17352
17353 : see if readv exists
17354 set readv d_readv
17355 eval $inlibc
17356
17357 : see if recvmsg exists
17358 set recvmsg d_recvmsg
17359 eval $inlibc
17360
17361 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17362 echo " "
17363 if set regcomp val -f d_regcomp; eval $csym; $val; then
17364         echo 'regcomp() found.' >&4
17365         d_regcomp="$define"
17366         d_regcmp="$undef"
17367         d_re_comp="$undef"
17368 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17369         echo 'regcmp() found.' >&4
17370         d_regcmp="$define"
17371         d_regcomp="$undef"
17372         d_re_comp="$undef"
17373 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17374         echo 're_comp() found, assuming re_exec() also exists.' >&4
17375         d_re_comp="$define"
17376         d_regcomp="$undef"
17377         d_regcmp="$undef"
17378 else
17379         $cat >&4 <<EOM
17380 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17381 EOM
17382         d_regcmp="$undef"
17383         d_re_comp="$undef"
17384         d_regcomp="$undef"
17385 fi
17386
17387 : see if remainder exists
17388 set remainder d_remainder
17389 eval $inlibc
17390
17391 : see if remquo exists
17392 set remquo d_remquo
17393 eval $inlibc
17394
17395 : see if rename exists
17396 set rename d_rename
17397 eval $inlibc
17398
17399 : see if rint exists
17400 set rint d_rint
17401 eval $inlibc
17402
17403 : see if rmdir exists
17404 set rmdir d_rmdir
17405 eval $inlibc
17406
17407 : see if round exists
17408 set round d_round
17409 eval $inlibc
17410
17411 : see if prototype for sbrk is available
17412 echo " "
17413 set d_sbrkproto sbrk $i_unistd unistd.h
17414 eval $hasproto
17415
17416 : see if scalbn exists
17417 set scalbn d_scalbn
17418 eval $inlibc
17419
17420 : see if select exists
17421 set select d_select
17422 eval $inlibc
17423
17424 : see if semctl exists
17425 set semctl d_semctl
17426 eval $inlibc
17427
17428 : see if semget exists
17429 set semget d_semget
17430 eval $inlibc
17431
17432 : see if semop exists
17433 set semop d_semop
17434 eval $inlibc
17435
17436 : see how much of the 'sem*(2)' library is present.
17437 h_sem=true
17438 echo " "
17439 case "$d_semctl$d_semget$d_semop" in
17440 *"$undef"*) h_sem=false;;
17441 esac
17442 case "$osname" in
17443 freebsd)
17444     case "`ipcs 2>&1`" in
17445     "SVID messages"*"not configured"*)
17446         echo "Your $osname does not have the sem*(2) configured." >&4
17447         h_sem=false
17448         val="$undef"
17449         set semctl d_semctl
17450         eval $setvar
17451         set semget d_semget
17452         eval $setvar
17453         set semop d_semop
17454         eval $setvar
17455         ;;
17456     esac
17457     ;;
17458 esac
17459 : we could also check for sys/ipc.h ...
17460 if $h_sem && $test `./findhdr sys/sem.h`; then
17461         echo "You have the full sem*(2) library." >&4
17462         val="$define"
17463 else
17464         echo "You don't have the full sem*(2) library." >&4
17465         val="$undef"
17466 fi
17467 set d_sem
17468 eval $setvar
17469
17470 : see whether sys/sem.h defines union semun
17471 echo " "
17472 $cat > try.c <<'END'
17473 #include <sys/types.h>
17474 #include <sys/ipc.h>
17475 #include <sys/sem.h>
17476 int main () { union semun semun; semun.buf = 0; }
17477 END
17478 set try
17479 if eval $compile; then
17480     echo "You have union semun in <sys/sem.h>." >&4
17481     val="$define"
17482 else
17483     echo "You do not have union semun in <sys/sem.h>." >&4
17484     val="$undef"
17485 fi
17486 $rm_try
17487 set d_union_semun
17488 eval $setvar
17489
17490 : see how to do semctl IPC_STAT
17491 case "$d_sem" in
17492 $define)
17493     echo " "
17494     $cat > tryh.h <<END
17495 #ifndef S_IRUSR
17496 #   ifdef S_IREAD
17497 #       define S_IRUSR S_IREAD
17498 #       define S_IWUSR S_IWRITE
17499 #       define S_IXUSR S_IEXEC
17500 #   else
17501 #       define S_IRUSR 0400
17502 #       define S_IWUSR 0200
17503 #       define S_IXUSR 0100
17504 #   endif
17505 #   define S_IRGRP (S_IRUSR>>3)
17506 #   define S_IWGRP (S_IWUSR>>3)
17507 #   define S_IXGRP (S_IXUSR>>3)
17508 #   define S_IROTH (S_IRUSR>>6)
17509 #   define S_IWOTH (S_IWUSR>>6)
17510 #   define S_IXOTH (S_IXUSR>>6)
17511 #endif
17512 #ifndef S_IRWXU
17513 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17514 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17515 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17516 #endif
17517 END
17518     : see whether semctl IPC_STAT can use union semun
17519     case "$d_semctl_semun" in
17520     '')
17521       val="$undef"
17522       $cat > try.c <<END
17523 #include <sys/types.h>
17524 #include <sys/ipc.h>
17525 #include <sys/sem.h>
17526 #include <sys/stat.h>
17527 #include <stdio.h>
17528 #include <errno.h>
17529 #include "tryh.h"
17530 #ifndef errno
17531 extern int errno;
17532 #endif
17533 #$d_union_semun HAS_UNION_SEMUN
17534 int main() {
17535     union semun
17536 #ifndef HAS_UNION_SEMUN
17537     {
17538         int val;
17539         struct semid_ds *buf;
17540         unsigned short *array;
17541     }
17542 #endif
17543     arg;
17544     int sem, st;
17545
17546 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17547     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17548     if (sem > -1) {
17549         struct semid_ds argbuf;
17550         arg.buf = &argbuf;
17551 #       ifdef IPC_STAT
17552         st = semctl(sem, 0, IPC_STAT, arg);
17553         if (st == 0)
17554             printf("semun\n");
17555         else
17556 #       endif /* IPC_STAT */
17557             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17558 #       ifdef IPC_RMID
17559         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17560 #       endif /* IPC_RMID */
17561             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17562     } else
17563 #endif /* IPC_PRIVATE && ... */
17564         printf("semget failed: errno = %d\n", errno);
17565   return 0;
17566 }
17567 END
17568       set try
17569       if eval $compile; then
17570           xxx=`$run ./try`
17571           case "$xxx" in
17572           semun) val="$define" ;;
17573           esac
17574       fi
17575       $rm_try
17576       set d_semctl_semun
17577       eval $setvar
17578       ;;
17579     esac
17580     case "$d_semctl_semun" in
17581     $define)
17582         echo "You can use union semun for semctl IPC_STAT." >&4
17583         also='also'
17584         ;;
17585     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17586         also=''
17587         ;;
17588     esac
17589
17590     : see whether semctl IPC_STAT can use struct semid_ds pointer
17591     case "$d_semctl_semid_ds" in
17592     '')
17593       val="$undef"
17594       $cat > try.c <<'END'
17595 #include <sys/types.h>
17596 #include <sys/ipc.h>
17597 #include <sys/sem.h>
17598 #include <sys/stat.h>
17599 #include "tryh.h"
17600 #include <stdio.h>
17601 #include <errno.h>
17602 #ifndef errno
17603 extern int errno;
17604 #endif
17605 int main() {
17606     union semun
17607 #ifndef HAS_UNION_SEMUN
17608     {
17609         int val;
17610         struct semid_ds *buf;
17611         unsigned short *array;
17612     }
17613 #endif
17614     arg;
17615     struct semid_ds argbuf;
17616     int sem, st;
17617
17618 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17619     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17620     if (sem > -1) {
17621         arg.buf = &argbuf;
17622 #       ifdef IPC_STAT
17623         st = semctl(sem, 0, IPC_STAT, arg);
17624         if (st == 0)
17625             printf("semid_ds\n");
17626         else
17627 #       endif /* IPC_STAT */
17628             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17629 #       ifdef IPC_RMID
17630         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17631 #       endif /* IPC_RMID */
17632             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17633     } else
17634 #endif /* IPC_PRIVATE && ... */
17635         printf("semget failed: errno = %d\n", errno);
17636
17637     return 0;
17638 }
17639 END
17640       set try
17641       if eval $compile; then
17642           xxx=`$run ./try`
17643           case "$xxx" in
17644           semid_ds) val="$define" ;;
17645           esac
17646       fi
17647       $rm_try
17648       set d_semctl_semid_ds
17649       eval $setvar
17650       ;;
17651     esac
17652     case "$d_semctl_semid_ds" in
17653     $define)
17654         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17655         ;;
17656     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17657         ;;
17658     esac
17659     ;;
17660 *)  val="$undef"
17661
17662     # We do not have the full sem*(2) library, so assume we can not
17663     # use either.
17664
17665     set d_semctl_semun
17666     eval $setvar
17667
17668     set d_semctl_semid_ds
17669     eval $setvar
17670     ;;
17671 esac
17672 $rm_try tryh.h
17673
17674 : see if sendmsg exists
17675 set sendmsg d_sendmsg
17676 eval $inlibc
17677
17678 : see if setegid exists
17679 set setegid d_setegid
17680 eval $inlibc
17681
17682 : see if seteuid exists
17683 set seteuid d_seteuid
17684 eval $inlibc
17685
17686 : see if setgrent exists
17687 set setgrent d_setgrent
17688 eval $inlibc
17689
17690 : see if setgrent_r exists
17691 set setgrent_r d_setgrent_r
17692 eval $inlibc
17693 case "$d_setgrent_r" in
17694 "$define")
17695         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17696         case "$d_setgrent_r_proto:$usethreads" in
17697         ":define")      d_setgrent_r_proto=define
17698                 set d_setgrent_r_proto setgrent_r $hdrs
17699                 eval $hasproto ;;
17700         *)      ;;
17701         esac
17702         case "$d_setgrent_r_proto" in
17703         define)
17704         case "$setgrent_r_proto" in
17705         ''|0) try='int setgrent_r(FILE**);'
17706         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17707         esac
17708         case "$setgrent_r_proto" in
17709         ''|0) try='void setgrent_r(FILE**);'
17710         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17711         esac
17712         case "$setgrent_r_proto" in
17713         ''|0)   d_setgrent_r=undef
17714                 setgrent_r_proto=0
17715                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17716         * )     case "$setgrent_r_proto" in
17717                 REENTRANT_PROTO*) ;;
17718                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17719                 esac
17720                 echo "Prototype: $try" ;;
17721         esac
17722         ;;
17723         *)      case "$usethreads" in
17724                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17725                 esac
17726                 d_setgrent_r=undef
17727                 setgrent_r_proto=0
17728                 ;;
17729         esac
17730         ;;
17731 *)      setgrent_r_proto=0
17732         ;;
17733 esac
17734
17735 : see if sethostent exists
17736 set sethostent d_sethent
17737 eval $inlibc
17738
17739 : see if sethostent_r exists
17740 set sethostent_r d_sethostent_r
17741 eval $inlibc
17742 case "$d_sethostent_r" in
17743 "$define")
17744         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17745         case "$d_sethostent_r_proto:$usethreads" in
17746         ":define")      d_sethostent_r_proto=define
17747                 set d_sethostent_r_proto sethostent_r $hdrs
17748                 eval $hasproto ;;
17749         *)      ;;
17750         esac
17751         case "$d_sethostent_r_proto" in
17752         define)
17753         case "$sethostent_r_proto" in
17754         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17755         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17756         esac
17757         case "$sethostent_r_proto" in
17758         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17759         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17760         esac
17761         case "$sethostent_r_proto" in
17762         ''|0)   d_sethostent_r=undef
17763                 sethostent_r_proto=0
17764                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17765         * )     case "$sethostent_r_proto" in
17766                 REENTRANT_PROTO*) ;;
17767                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17768                 esac
17769                 echo "Prototype: $try" ;;
17770         esac
17771         ;;
17772         *)      case "$usethreads" in
17773                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17774                 esac
17775                 d_sethostent_r=undef
17776                 sethostent_r_proto=0
17777                 ;;
17778         esac
17779         ;;
17780 *)      sethostent_r_proto=0
17781         ;;
17782 esac
17783
17784 : see if setitimer exists
17785 set setitimer d_setitimer
17786 eval $inlibc
17787
17788 : see if setlinebuf exists
17789 set setlinebuf d_setlinebuf
17790 eval $inlibc
17791
17792 : see if locale.h is available
17793 set locale.h i_locale
17794 eval $inhdr
17795
17796 : see if this system has wctype.h
17797 set wctype.h i_wctype
17798 eval $inhdr
17799
17800 : see if towupper exists
17801 set towupper d_towupper
17802 eval $inlibc
17803
17804 : check for setlocale function and behavior
17805 $cat <<EOM
17806
17807 Checking to see if you have setlocale() and its behavior
17808 EOM
17809 $cat >try.c <<EOCP
17810 #include <stdlib.h>
17811 #include <string.h>
17812 #$i_locale I_LOCALE
17813 #ifdef I_LOCALE
17814 #  include <locale.h>
17815 #endif
17816 #$i_wctype I_WCTYPE
17817 #ifdef I_WCTYPE
17818 #  include <wctype.h>
17819 #endif
17820
17821 int main() {
17822     const char * invalid_name = "\a";   /* This is really invalid! */
17823     int accepts_any_locale_name = 0;
17824     int has_C_UTF8 = 0;
17825     unsigned char bad_setlocale = 255;
17826
17827     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17828      * disabled.  It's hard to imagine an instance where meaningful locale
17829      * handling could be done without LC_CTYPE */
17830     const char *  name = setlocale(LC_CTYPE, "C");
17831
17832     if (name == NULL || strcmp(name, "C") != 0) {
17833         exit(bad_setlocale);
17834     }
17835
17836     name = setlocale(LC_CTYPE, invalid_name);
17837     if (name != NULL) {
17838
17839         /* Let it pass if it accepts the name but gives back one of the C
17840          * locales */
17841         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17842             accepts_any_locale_name = 1;
17843         }
17844     }
17845
17846     name = setlocale(LC_CTYPE, "C.UTF-8");
17847     if (name != NULL) {
17848         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17849
17850 #$d_towupper HAS_TOWUPPER
17851 #ifdef HAS_TOWUPPER
17852
17853         /* We assume that if the machine doesn't have the C99 towupper, it
17854          * doesn't have C.UTF-8, even if we successfully changed locales to
17855          * include it.  This seems safer even on platforms that didn't accept
17856          * the really invalid name */
17857
17858         if (towupper(y_with_diaeresis) == 0x178) {
17859             has_C_UTF8 = 1;
17860         }
17861
17862 #endif
17863
17864     }
17865
17866 #if 0
17867
17868     /* Currently unused code to determine if LC_ALL with disparate values uses
17869      * category = value pairs or positional, and to determine the separator
17870      * between the categories.  We could add code so that if the separator were
17871      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17872      * every possible ASCII separator would fit in the 5 bits available in the
17873      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17874      * positional, we probably would want to know the order of the categories.
17875      * Using a file between the C program and the shell script would really be
17876      * require to do that */
17877 #ifdef LC_ALL
17878
17879     unsigned char min_separator = ' ' - 1;
17880     unsigned char separator = min_separator;
17881     int uses_name_value_pair_names = 0;
17882
17883     name = setlocale(LC_ALL, "C");
17884     if (name == NULL || strcmp(name, "C") != 0) {
17885         exit(bad_setlocale);
17886     }
17887
17888     if (has_C_UTF8) {
17889         char * pos;
17890
17891         name = setlocale(LC_CTYPE, "C.UTF-8");
17892         if (name == NULL) {
17893             exit(bad_setlocale);
17894         }
17895         name = setlocale(LC_ALL, NULL);
17896         if (name == NULL) {
17897             exit(bad_setlocale);
17898         }
17899
17900         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17901         if (pos != NULL) {
17902             uses_name_value_pair_names = 1;
17903             if (pos == name) {
17904                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17905             }
17906             else {
17907                 separator = *(pos - 1);
17908             }
17909         }
17910         else {
17911             pos = strstr(name, "C.UTF-8");
17912             if (pos == NULL) {
17913                 /* bad */
17914             }
17915             else if (pos == name) {
17916                 separator = name[sizeof("C.UTF-8") - 1];
17917             }
17918             else {
17919                 separator = *(pos - 1);
17920             }
17921         }
17922     }
17923
17924 #endif
17925 #endif
17926
17927     exit( 0 /* (separator - min_separator) << 3
17928         | uses_name_value_pair_names      << 2
17929           */
17930         | has_C_UTF8                      << 1
17931         | accepts_any_locale_name);
17932
17933 }
17934 EOCP
17935 set try
17936 if eval $compile; then
17937     echo "Your system has setlocale()..." >&4
17938     $run ./try
17939     case $? in
17940         0) echo "and it seems sane" >&4
17941            d_setlocale="$define"
17942            d_setlocale_accepts_any_locale_name="$undef"
17943            d_has_C_UTF8="false"
17944            ;;
17945         1) echo "and it seems sane, but accepts any locale name as valid" >&4
17946            d_setlocale="$define"
17947            d_setlocale_accepts_any_locale_name="$define"
17948            d_has_C_UTF8="false"
17949            ;;
17950         2) echo "and it seems sane" >&4
17951            d_setlocale="$define"
17952            d_setlocale_accepts_any_locale_name="$undef"
17953            d_has_C_UTF8="true"
17954            ;;
17955         3) 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="true"
17959            ;;
17960         *) echo "but it doesn't seem to work, so we won't use it." >&4
17961            d_setlocale="$undef"
17962            d_setlocale_accepts_any_locale_name="$undef"
17963            d_has_C_UTF8="false"
17964            ;;
17965     esac
17966 else
17967     echo "your system does not have setlocale()" >&4
17968     d_setlocale="$undef"
17969     d_setlocale_accepts_any_locale_name="$undef"
17970     d_has_C_UTF8="false"
17971 fi
17972 $rm_try
17973
17974 : see if setlocale_r exists
17975 set setlocale_r d_setlocale_r
17976 eval $inlibc
17977 case "$d_setlocale_r" in
17978 "$define")
17979         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17980         case "$d_setlocale_r_proto:$usethreads" in
17981         ":define")      d_setlocale_r_proto=define
17982                 set d_setlocale_r_proto setlocale_r $hdrs
17983                 eval $hasproto ;;
17984         *)      ;;
17985         esac
17986         case "$d_setlocale_r_proto" in
17987         define)
17988         case "$setlocale_r_proto" in
17989         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17990         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17991         esac
17992         case "$setlocale_r_proto" in
17993         ''|0)   d_setlocale_r=undef
17994                 setlocale_r_proto=0
17995                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17996         * )     case "$setlocale_r_proto" in
17997                 REENTRANT_PROTO*) ;;
17998                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17999                 esac
18000                 echo "Prototype: $try" ;;
18001         esac
18002         ;;
18003         *)      case "$usethreads" in
18004                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18005                 esac
18006                 d_setlocale_r=undef
18007                 setlocale_r_proto=0
18008                 ;;
18009         esac
18010         ;;
18011 *)      setlocale_r_proto=0
18012         ;;
18013 esac
18014
18015 : see if setnetent exists
18016 set setnetent d_setnent
18017 eval $inlibc
18018
18019 : see if setnetent_r exists
18020 set setnetent_r d_setnetent_r
18021 eval $inlibc
18022 case "$d_setnetent_r" in
18023 "$define")
18024         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18025         case "$d_setnetent_r_proto:$usethreads" in
18026         ":define")      d_setnetent_r_proto=define
18027                 set d_setnetent_r_proto setnetent_r $hdrs
18028                 eval $hasproto ;;
18029         *)      ;;
18030         esac
18031         case "$d_setnetent_r_proto" in
18032         define)
18033         case "$setnetent_r_proto" in
18034         ''|0) try='int setnetent_r(int, struct netent_data*);'
18035         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18036         esac
18037         case "$setnetent_r_proto" in
18038         ''|0) try='void setnetent_r(int, struct netent_data*);'
18039         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18040         esac
18041         case "$setnetent_r_proto" in
18042         ''|0)   d_setnetent_r=undef
18043                 setnetent_r_proto=0
18044                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18045         * )     case "$setnetent_r_proto" in
18046                 REENTRANT_PROTO*) ;;
18047                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18048                 esac
18049                 echo "Prototype: $try" ;;
18050         esac
18051         ;;
18052         *)      case "$usethreads" in
18053                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18054                 esac
18055                 d_setnetent_r=undef
18056                 setnetent_r_proto=0
18057                 ;;
18058         esac
18059         ;;
18060 *)      setnetent_r_proto=0
18061         ;;
18062 esac
18063
18064 : see if setprotoent exists
18065 set setprotoent d_setpent
18066 eval $inlibc
18067
18068 : see if setpgid exists
18069 set setpgid d_setpgid
18070 eval $inlibc
18071
18072 : see if setpgrp2 exists
18073 set setpgrp2 d_setpgrp2
18074 eval $inlibc
18075
18076 : see if setpriority exists
18077 set setpriority d_setprior
18078 eval $inlibc
18079
18080 : see if setproctitle exists
18081 set setproctitle d_setproctitle
18082 eval $inlibc
18083
18084 : see if setprotoent_r exists
18085 set setprotoent_r d_setprotoent_r
18086 eval $inlibc
18087 case "$d_setprotoent_r" in
18088 "$define")
18089         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18090         case "$d_setprotoent_r_proto:$usethreads" in
18091         ":define")      d_setprotoent_r_proto=define
18092                 set d_setprotoent_r_proto setprotoent_r $hdrs
18093                 eval $hasproto ;;
18094         *)      ;;
18095         esac
18096         case "$d_setprotoent_r_proto" in
18097         define)
18098         case "$setprotoent_r_proto" in
18099         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18100         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18101         esac
18102         case "$setprotoent_r_proto" in
18103         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18104         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18105         esac
18106         case "$setprotoent_r_proto" in
18107         ''|0)   d_setprotoent_r=undef
18108                 setprotoent_r_proto=0
18109                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18110         * )     case "$setprotoent_r_proto" in
18111                 REENTRANT_PROTO*) ;;
18112                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18113                 esac
18114                 echo "Prototype: $try" ;;
18115         esac
18116         ;;
18117         *)      case "$usethreads" in
18118                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18119                 esac
18120                 d_setprotoent_r=undef
18121                 setprotoent_r_proto=0
18122                 ;;
18123         esac
18124         ;;
18125 *)      setprotoent_r_proto=0
18126         ;;
18127 esac
18128
18129 : see if setpwent exists
18130 set setpwent d_setpwent
18131 eval $inlibc
18132
18133 : see if setpwent_r exists
18134 set setpwent_r d_setpwent_r
18135 eval $inlibc
18136 case "$d_setpwent_r" in
18137 "$define")
18138         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18139         case "$d_setpwent_r_proto:$usethreads" in
18140         ":define")      d_setpwent_r_proto=define
18141                 set d_setpwent_r_proto setpwent_r $hdrs
18142                 eval $hasproto ;;
18143         *)      ;;
18144         esac
18145         case "$d_setpwent_r_proto" in
18146         define)
18147         case "$setpwent_r_proto" in
18148         ''|0) try='int setpwent_r(FILE**);'
18149         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18150         esac
18151         case "$setpwent_r_proto" in
18152         ''|0) try='void setpwent_r(FILE**);'
18153         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18154         esac
18155         case "$setpwent_r_proto" in
18156         ''|0)   d_setpwent_r=undef
18157                 setpwent_r_proto=0
18158                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18159         * )     case "$setpwent_r_proto" in
18160                 REENTRANT_PROTO*) ;;
18161                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18162                 esac
18163                 echo "Prototype: $try" ;;
18164         esac
18165         ;;
18166         *)      case "$usethreads" in
18167                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18168                 esac
18169                 d_setpwent_r=undef
18170                 setpwent_r_proto=0
18171                 ;;
18172         esac
18173         ;;
18174 *)      setpwent_r_proto=0
18175         ;;
18176 esac
18177
18178 : see if setregid exists
18179 set setregid d_setregid
18180 eval $inlibc
18181 set setresgid d_setresgid
18182 eval $inlibc
18183
18184 : see if setreuid exists
18185 set setreuid d_setreuid
18186 eval $inlibc
18187 set setresuid d_setresuid
18188 eval $inlibc
18189
18190 : see if setrgid exists
18191 set setrgid d_setrgid
18192 eval $inlibc
18193
18194 : see if setruid exists
18195 set setruid d_setruid
18196 eval $inlibc
18197
18198 : see if setservent exists
18199 set setservent d_setsent
18200 eval $inlibc
18201
18202 : see if setservent_r exists
18203 set setservent_r d_setservent_r
18204 eval $inlibc
18205 case "$d_setservent_r" in
18206 "$define")
18207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18208         case "$d_setservent_r_proto:$usethreads" in
18209         ":define")      d_setservent_r_proto=define
18210                 set d_setservent_r_proto setservent_r $hdrs
18211                 eval $hasproto ;;
18212         *)      ;;
18213         esac
18214         case "$d_setservent_r_proto" in
18215         define)
18216         case "$setservent_r_proto" in
18217         ''|0) try='int setservent_r(int, struct servent_data*);'
18218         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18219         esac
18220         case "$setservent_r_proto" in
18221         ''|0) try='void setservent_r(int, struct servent_data*);'
18222         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18223         esac
18224         case "$setservent_r_proto" in
18225         ''|0)   d_setservent_r=undef
18226                 setservent_r_proto=0
18227                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18228         * )     case "$setservent_r_proto" in
18229                 REENTRANT_PROTO*) ;;
18230                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18231                 esac
18232                 echo "Prototype: $try" ;;
18233         esac
18234         ;;
18235         *)      case "$usethreads" in
18236                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18237                 esac
18238                 d_setservent_r=undef
18239                 setservent_r_proto=0
18240                 ;;
18241         esac
18242         ;;
18243 *)      setservent_r_proto=0
18244         ;;
18245 esac
18246
18247 : see if setsid exists
18248 set setsid d_setsid
18249 eval $inlibc
18250
18251 : see if setvbuf exists
18252 set setvbuf d_setvbuf
18253 eval $inlibc
18254
18255 : see if shmctl exists
18256 set shmctl d_shmctl
18257 eval $inlibc
18258
18259 : see if shmget exists
18260 set shmget d_shmget
18261 eval $inlibc
18262
18263 : see if shmat exists
18264 set shmat d_shmat
18265 eval $inlibc
18266 : see what shmat returns
18267 case "$d_shmat" in
18268 "$define")
18269         $cat >shmat.c <<'END'
18270 #include <sys/shm.h>
18271 void *shmat();
18272 END
18273         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18274                 shmattype='void *'
18275         else
18276                 shmattype='char *'
18277         fi
18278         echo "and it returns ($shmattype)." >&4
18279         : see if a prototype for shmat is available
18280         xxx=`./findhdr sys/shm.h`
18281         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18282         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18283                 val="$define"
18284         else
18285                 val="$undef"
18286         fi
18287         $rm -f shmat.[co]
18288         ;;
18289 *)
18290         val="$undef"
18291         ;;
18292 esac
18293 set d_shmatprototype
18294 eval $setvar
18295
18296 : see if shmdt exists
18297 set shmdt d_shmdt
18298 eval $inlibc
18299
18300 : see how much of the 'shm*(2)' library is present.
18301 h_shm=true
18302 echo " "
18303 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18304 *"$undef"*) h_shm=false;;
18305 esac
18306 case "$osname" in
18307 freebsd)
18308     case "`ipcs 2>&1`" in
18309     "SVID shared memory"*"not configured"*)
18310         echo "Your $osname does not have the shm*(2) configured." >&4
18311         h_shm=false
18312         val="$undef"
18313         set shmctl d_shmctl
18314         eval $setvar
18315         set shmget d_shmget
18316         eval $setvar
18317         set shmat d_shmat
18318         eval $setvar
18319         set shmdt d_shmdt
18320         eval $setvar
18321         ;;
18322     esac
18323     ;;
18324 esac
18325 : we could also check for sys/ipc.h ...
18326 if $h_shm && $test `./findhdr sys/shm.h`; then
18327         echo "You have the full shm*(2) library." >&4
18328         val="$define"
18329 else
18330         echo "You don't have the full shm*(2) library." >&4
18331         val="$undef"
18332 fi
18333 set d_shm
18334 eval $setvar
18335
18336 : see if we have sigaction
18337 echo " "
18338 if set sigaction val -f d_sigaction; eval $csym; $val; then
18339         echo 'sigaction() found.' >&4
18340         $cat > try.c <<EOP
18341 #include <stdio.h>
18342 #include <sys/types.h>
18343 #include <signal.h>
18344 #$i_stdlib I_STDLIB
18345 #ifdef I_STDLIB
18346 #include <stdlib.h>
18347 #endif
18348 int main()
18349 {
18350     struct sigaction act, oact;
18351     act.sa_flags = 0;
18352     oact.sa_handler = 0;
18353     /* so that act and oact are used */
18354     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18355 }
18356 EOP
18357         set try
18358         if eval $compile_ok; then
18359                 val="$define"
18360         else
18361                 echo "But you don't seem to have a usable struct sigaction." >&4
18362                 val="$undef"
18363         fi
18364 else
18365         echo 'sigaction NOT found.' >&4
18366         val="$undef"
18367 fi
18368 set d_sigaction; eval $setvar
18369 $rm_try
18370
18371 : see what type pids are declared as in the kernel
18372 rp="What is the type of process ids on this system?"
18373 set pid_t pidtype int stdio.h sys/types.h
18374 eval $typedef_ask
18375
18376 : see what type uids are declared as in the kernel
18377 echo " "
18378 echo "Looking for the type for user ids returned by getuid()."
18379 set uid_t uidtype xxx stdio.h sys/types.h
18380 eval $typedef
18381 case "$uidtype" in
18382 xxx)
18383         xxx=`./findhdr sys/user.h`
18384         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18385         case $1 in
18386         unsigned) dflt="$1 $2" ;;
18387         *) dflt="$1" ;;
18388         esac
18389         ;;
18390 *) dflt="$uidtype";;
18391 esac
18392 case "$uidtype" in
18393 uid_t)  echo "uid_t found." ;;
18394 *)      rp="What is the type for user ids returned by getuid()?"
18395         . ./myread
18396         uidtype="$ans"
18397         ;;
18398 esac
18399
18400 : Define hasfield_t macro for Configure internal use
18401 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18402 while $test $# -ge 2; do
18403     case "$1" in
18404         $define) echo "#include <$2>";;
18405     esac ;
18406     shift 2;
18407 done > try.c;
18408 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18409 set try;
18410 if eval $compile; then
18411         val="$define";
18412 else
18413         val="$undef";
18414 fi;
18415 set $varname;
18416 eval $setvar;
18417 $rm_try'
18418
18419 : see what siginfo fields we have
18420 case "$d_sigaction" in
18421 "$define")
18422         echo "Checking if your siginfo_t has si_errno field...">&4
18423         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18424         eval $hasfield_t;
18425
18426         echo "Checking if your siginfo_t has si_pid field...">&4
18427         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18428         eval $hasfield_t;
18429
18430         echo "Checking if your siginfo_t has si_uid field...">&4
18431         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18432         eval $hasfield_t;
18433
18434         echo "Checking if your siginfo_t has si_addr field...">&4
18435         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18436         eval $hasfield_t;
18437
18438         echo "Checking if your siginfo_t has si_status field...">&4
18439         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18440         eval $hasfield_t;
18441
18442         echo "Checking if your siginfo_t has si_band field...">&4
18443         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18444         eval $hasfield_t;
18445
18446         echo "Checking if your siginfo_t has si_value field...">&4
18447         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18448         eval $hasfield_t;
18449
18450         echo "Checking if your siginfo_t has si_fd field...">&4
18451         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18452         eval $hasfield_t;
18453
18454         ;;
18455 *)
18456         d_siginfo_si_errno="$undef"
18457         d_siginfo_si_pid="$undef"
18458         d_siginfo_si_uid="$undef"
18459         d_siginfo_si_addr="$undef"
18460         d_siginfo_si_status="$undef"
18461         d_siginfo_si_band="$undef"
18462         d_siginfo_si_value="$undef"
18463         d_siginfo_si_fd="$undef"
18464         ;;
18465 esac
18466
18467 : see if this is a sunmath.h system
18468 set sunmath.h i_sunmath
18469 eval $inhdr
18470
18471 : see if signbit exists
18472 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18473 $cat >try.c <<EOCP
18474 #$i_sunmath I_SUNMATH
18475 #include <math.h>
18476 #ifdef I_SUNMATH  /* Solaris special math library */
18477 #  include <sunmath.h>
18478 #endif
18479 #define NV $nvtype
18480 int main(int argc, char **argv)
18481 {
18482     NV x = 0.0;
18483     NV y = -1.0;
18484     if ((signbit(x) == 0) && (signbit(y) != 0))
18485         return 0;
18486     else
18487         return 1;
18488 }
18489 EOCP
18490 val="$undef"
18491 set try
18492 if eval $compile; then
18493     if $run ./try; then
18494         $echo "Yes." >&4
18495         val="$define"
18496     else
18497         $echo "Signbit seems to be available, but doesn't work as I expected."
18498         $echo "I won't use it." >&4
18499         val="$undef"
18500     fi
18501 else
18502     $echo "Nope." >&4
18503     dflt="$undef"
18504 fi
18505 set d_signbit
18506 eval $setvar
18507 $rm_try
18508
18509 : see if sigprocmask exists
18510 set sigprocmask d_sigprocmask
18511 eval $inlibc
18512
18513 : see if sigsetjmp exists
18514 echo " "
18515 case "$d_sigsetjmp" in
18516 '')
18517         $cat >try.c <<EOP
18518 #include <setjmp.h>
18519 #$i_stdlib I_STDLIB
18520 #ifdef I_STDLIB
18521 #include <stdlib.h>
18522 #endif
18523 sigjmp_buf env;
18524 int set = 1;
18525 int main()
18526 {
18527         if (sigsetjmp(env,1))
18528                 exit(set);
18529         set = 0;
18530         siglongjmp(env, 1);
18531         exit(1);
18532 }
18533 EOP
18534         set try
18535         if eval $compile; then
18536                 if $run ./try >/dev/null 2>&1; then
18537                         echo "POSIX sigsetjmp found." >&4
18538                         val="$define"
18539                 else
18540                         $cat >&4 <<EOM
18541 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18542 I'll ignore them.
18543 EOM
18544                         val="$undef"
18545                 fi
18546         else
18547                 echo "sigsetjmp not found." >&4
18548                 val="$undef"
18549         fi
18550         ;;
18551 *) val="$d_sigsetjmp"
18552         case "$d_sigsetjmp" in
18553         $define) echo "POSIX sigsetjmp found." >&4;;
18554         $undef) echo "sigsetjmp not found." >&4;;
18555         esac
18556         ;;
18557 esac
18558 set d_sigsetjmp
18559 eval $setvar
18560 $rm_try
18561
18562 : see if snprintf exists
18563 set snprintf d_snprintf
18564 eval $inlibc
18565
18566 : see if vsnprintf exists
18567 set vsnprintf d_vsnprintf
18568 eval $inlibc
18569
18570 case "$d_snprintf-$d_vsnprintf" in
18571 "$define-$define")
18572     $cat <<EOM
18573 Checking whether your snprintf() and vsnprintf() work okay...
18574 EOM
18575     $cat >try.c <<'EOCP'
18576 /* v?snprintf testing logic courtesy of Russ Allbery.
18577  * According to C99:
18578  * - if the buffer is too short it still must be \0-terminated
18579  * - if the buffer is too short the potentially required length
18580  *   must be returned and not -1
18581  * - if the buffer is NULL the potentially required length
18582  *   must be returned and not -1 or core dump
18583  */
18584 #include <stdio.h>
18585 #include <stdarg.h>
18586
18587 char buf[2];
18588
18589 int test (char *format, ...)
18590 {
18591     va_list args;
18592     int count;
18593
18594     va_start (args, format);
18595     count = vsnprintf (buf, sizeof buf, format, args);
18596     va_end (args);
18597     return count;
18598 }
18599
18600 int main ()
18601 {
18602     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18603              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18604 }
18605 EOCP
18606     set try
18607     if eval $compile; then
18608         `$run ./try`
18609         case "$?" in
18610         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18611         *) cat <<EOM >&4
18612 Your snprintf() and snprintf() don't seem to be working okay.
18613 EOM
18614            d_snprintf="$undef"
18615            d_vsnprintf="$undef"
18616            ;;
18617         esac
18618     else
18619         echo "(I can't seem to compile the test program--assuming they don't)"
18620         d_snprintf="$undef"
18621         d_vsnprintf="$undef"
18622     fi
18623     $rm_try
18624     ;;
18625 esac
18626
18627 : see if sockatmark exists
18628 set sockatmark d_sockatmark
18629 eval $inlibc
18630
18631 : see if prototype for sockatmark is available
18632 echo " "
18633 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18634 eval $hasproto
18635
18636 : see if socks5_init exists
18637 set socks5_init d_socks5_init
18638 eval $inlibc
18639
18640 : see if srand48_r exists
18641 set srand48_r d_srand48_r
18642 eval $inlibc
18643 case "$d_srand48_r" in
18644 "$define")
18645         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18646         case "$d_srand48_r_proto:$usethreads" in
18647         ":define")      d_srand48_r_proto=define
18648                 set d_srand48_r_proto srand48_r $hdrs
18649                 eval $hasproto ;;
18650         *)      ;;
18651         esac
18652         case "$d_srand48_r_proto" in
18653         define)
18654         case "$srand48_r_proto" in
18655         ''|0) try='int srand48_r(long, struct drand48_data*);'
18656         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18657         esac
18658         case "$srand48_r_proto" in
18659         ''|0)   d_srand48_r=undef
18660                 srand48_r_proto=0
18661                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18662         * )     case "$srand48_r_proto" in
18663                 REENTRANT_PROTO*) ;;
18664                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18665                 esac
18666                 echo "Prototype: $try" ;;
18667         esac
18668         ;;
18669         *)      case "$usethreads" in
18670                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18671                 esac
18672                 d_srand48_r=undef
18673                 srand48_r_proto=0
18674                 ;;
18675         esac
18676         ;;
18677 *)      srand48_r_proto=0
18678         ;;
18679 esac
18680
18681 : see if srandom_r exists
18682 set srandom_r d_srandom_r
18683 eval $inlibc
18684 case "$d_srandom_r" in
18685 "$define")
18686         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18687         case "$d_srandom_r_proto:$usethreads" in
18688         ":define")      d_srandom_r_proto=define
18689                 set d_srandom_r_proto srandom_r $hdrs
18690                 eval $hasproto ;;
18691         *)      ;;
18692         esac
18693         case "$d_srandom_r_proto" in
18694         define)
18695         case "$srandom_r_proto" in
18696         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18697         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18698         esac
18699         case "$srandom_r_proto" in
18700         ''|0)   d_srandom_r=undef
18701                 srandom_r_proto=0
18702                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18703         * )     case "$srandom_r_proto" in
18704                 REENTRANT_PROTO*) ;;
18705                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18706                 esac
18707                 echo "Prototype: $try" ;;
18708         esac
18709         ;;
18710         *)      case "$usethreads" in
18711                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18712                 esac
18713                 d_srandom_r=undef
18714                 srandom_r_proto=0
18715                 ;;
18716         esac
18717         ;;
18718 *)      srandom_r_proto=0
18719         ;;
18720 esac
18721
18722 : see if prototype for setresgid is available
18723 echo " "
18724 set d_sresgproto setresgid $i_unistd unistd.h
18725 eval $hasproto
18726
18727 : see if prototype for setresuid is available
18728 echo " "
18729 set d_sresuproto setresuid $i_unistd unistd.h
18730 eval $hasproto
18731
18732 : see if stat exists
18733 set stat d_stat
18734 eval $inlibc
18735
18736 : see if sys/stat.h is available
18737 set sys/stat.h i_sysstat
18738 eval $inhdr
18739
18740 : see if stat knows about block sizes
18741 echo " "
18742 echo "Checking to see if your struct stat has st_blocks field..." >&4
18743 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18744 eval $hasfield
18745
18746 : see if this is a sys/vfs.h system
18747 set sys/vfs.h i_sysvfs
18748 eval $inhdr
18749
18750 : see if this is a sys/statfs.h system
18751 set sys/statfs.h i_sysstatfs
18752 eval $inhdr
18753
18754 : Check for statfs_s
18755 echo " "
18756 echo "Checking to see if your system supports struct statfs..." >&4
18757 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
18758 eval $hasstruct
18759 case "$d_statfs_s" in
18760 "$define")      echo "Yes, it does."   ;;
18761 *)              echo "No, it doesn't." ;;
18762 esac
18763
18764 : see if struct statfs knows about f_flags
18765 case "$d_statfs_s" in
18766 define)
18767         echo " "
18768         echo "Checking to see if your struct statfs has f_flags field..." >&4
18769         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
18770         eval $hasfield
18771         ;;
18772 *)      val="$undef"
18773         set d_statfs_f_flags
18774         eval $setvar
18775         ;;
18776 esac
18777 case "$d_statfs_f_flags" in
18778 "$define")      echo "Yes, it does."   ;;
18779 *)              echo "No, it doesn't." ;;
18780 esac
18781
18782 : see what flavor, if any, of static inline is supported
18783 echo " "
18784 echo "Checking to see if your system supports static inline..."
18785 $cat > try.c <<'EOCP'
18786 #include <stdlib.h>
18787 extern int f_via_a(int x);
18788 extern int f_via_b(int x);
18789 int main(int argc, char **argv)
18790 {
18791     int y;
18792
18793     y = f_via_a(0);
18794 #ifdef USE_B
18795     y = f_via_b(0);
18796 #endif
18797     if (y == 42) {
18798         return EXIT_SUCCESS;
18799     }
18800     else {
18801         return EXIT_FAILURE;
18802     }
18803 }
18804 EOCP
18805 $cat > a.c <<'EOCP'
18806 static INLINE int f(int x) {
18807     int y;
18808     y = x + 42;
18809     return y;
18810 }
18811
18812 int f_via_a(int x)
18813 {
18814     return f(x);
18815 }
18816 EOCP
18817 $cat > b.c <<'EOCP'
18818 extern int f(int x);
18819
18820 int f_via_b(int x)
18821 {
18822     return f(x);
18823 }
18824 EOCP
18825
18826 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18827 case "$perl_static_inline" in
18828 '')     # Check the various possibilities, and break out on success.
18829         # For gcc, prefer __inline__, which will still permit
18830         # cflags.SH to add in -ansi.
18831         case "$gccversion" in
18832                 '') xxx="inline __inline__ __inline _inline";;
18833                 *)  xxx="__inline__ inline __inline _inline";;
18834         esac
18835         for inline in $xxx; do
18836                 set try -DINLINE=$inline a.c
18837                 if eval $compile && $run ./try; then
18838                         # Now make sure there is no external linkage of static
18839                         # functions
18840                         set try -DINLINE=$inline -DUSE_B a.c b.c
18841                         if eval $compile && $run ./try; then
18842                                 $echo "Your compiler supports static $inline, " >&4
18843                                 $echo "but it also creates an external definition," >&4
18844                                 $echo "so I won't use it." >&4
18845                                 val=$undef
18846                         else
18847                                 $echo "Your compiler supports static $inline." >&4
18848                                 val=$define
18849                                 perl_static_inline="static $inline";
18850                                 break;
18851                         fi
18852                 else
18853                         $echo "Your compiler does NOT support static $inline." >&4
18854                         val="$undef"
18855                 fi
18856         done
18857         ;;
18858 *inline*) # Some variant of inline exists.
18859         echo "Keeping your $hint value of $perl_static_inline."
18860         val=$define
18861         ;;
18862 static)  # No inline capabilities
18863         echo "Keeping your $hint value of $perl_static_inline."
18864         val=$undef
18865         ;;
18866 *)  # Unrecognized previous value -- blindly trust the supplied
18867         # value and hope it makes sense.  Use old value for
18868         # d_static_inline, if there is one.
18869         echo "Keeping your $hint value of $perl_static_inline."
18870         case "$d_static_inline" in
18871                 '') val=$define ;;
18872                 *)  val=$d_static_inline ;;
18873         esac
18874         ;;
18875 esac
18876 # Fallback to plain 'static' if nothing worked.
18877 case "$perl_static_inline" in
18878 '')
18879         perl_static_inline="static"
18880         val=$undef
18881         ;;
18882 esac
18883 set d_static_inline
18884 eval $setvar
18885 $rm -f a.[co] b.[co]
18886 $rm_try
18887
18888 : Check stream access
18889 $cat >&4 <<EOM
18890 Checking how to access stdio streams by file descriptor number...
18891 EOM
18892 case "$stdio_stream_array" in
18893 '')     $cat >try.c <<EOCP
18894 #include <stdio.h>
18895 int main() {
18896   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18897     printf("yes\n");
18898 }
18899 EOCP
18900         for s in _iob __iob __sF
18901         do
18902                 set try -DSTDIO_STREAM_ARRAY=$s
18903                 if eval $compile; then
18904                         case "`$run ./try`" in
18905                         yes)    stdio_stream_array=$s; break ;;
18906                         esac
18907                 fi
18908         done
18909         $rm_try
18910 esac
18911 case "$stdio_stream_array" in
18912 '')     $cat >&4 <<EOM
18913 I can't figure out how to access stdio streams by file descriptor number.
18914 EOM
18915         d_stdio_stream_array="$undef"
18916         ;;
18917 *)      $cat >&4 <<EOM
18918 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18919 EOM
18920         d_stdio_stream_array="$define"
18921         ;;
18922 esac
18923
18924 : see if strcoll exists
18925 set strcoll d_strcoll
18926 eval $inlibc
18927
18928 : see if strerror_l exists
18929 set strerror_l d_strerror_l
18930 eval $inlibc
18931
18932 : see if strerror_r exists
18933 set strerror_r d_strerror_r
18934 eval $inlibc
18935 case "$d_strerror_r" in
18936 "$define")
18937         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18938         case "$d_strerror_r_proto:$usethreads" in
18939         ":define")      d_strerror_r_proto=define
18940                 set d_strerror_r_proto strerror_r $hdrs
18941                 eval $hasproto ;;
18942         *)      ;;
18943         esac
18944         case "$d_strerror_r_proto" in
18945         define)
18946         case "$strerror_r_proto" in
18947         ''|0) try='int strerror_r(int, char*, size_t);'
18948         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18949         esac
18950         case "$strerror_r_proto" in
18951         ''|0) try='int strerror_r(int, char*, int);'
18952         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18953         esac
18954         case "$strerror_r_proto" in
18955         ''|0) try='char* strerror_r(int, char*, size_t);'
18956         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18957         esac
18958         case "$strerror_r_proto" in
18959         ''|0)   d_strerror_r=undef
18960                 strerror_r_proto=0
18961                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18962         * )     case "$strerror_r_proto" in
18963                 REENTRANT_PROTO*) ;;
18964                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18965                 esac
18966                 echo "Prototype: $try" ;;
18967         esac
18968         ;;
18969         *)      case "$usethreads" in
18970                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18971                 esac
18972                 d_strerror_r=undef
18973                 strerror_r_proto=0
18974                 ;;
18975         esac
18976         ;;
18977 *)      strerror_r_proto=0
18978         ;;
18979 esac
18980
18981 : see if strftime exists
18982 set strftime d_strftime
18983 eval $inlibc
18984
18985 : see if strlcat exists
18986 : We need both a prototype in string.h and the symbol in libc.
18987 echo " "
18988 d_strlcat_proto=''
18989 xx1="#$d_gnulibc HAS_GNULIBC"
18990 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
18991 xx3='#   define _GNU_SOURCE'
18992 xx4='#endif'
18993 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
18994 eval $hasproto
18995 case "$d_strlcat_proto" in
18996     define) # see if strlcat exists
18997         set strlcat d_strlcat
18998         eval $inlibc
18999         ;;
19000     *)  val=$undef
19001         set d_strlcat
19002         eval $setvar
19003         ;;
19004 esac
19005
19006 : see if strlcpy exists
19007 : We need both a prototype in string.h and the symbol in libc.
19008 echo " "
19009 d_strlcpy_proto=''
19010 xx1="#$d_gnulibc HAS_GNULIBC"
19011 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19012 xx3='#   define _GNU_SOURCE'
19013 xx4='#endif'
19014 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19015 eval $hasproto
19016 case "$d_strlcpy_proto" in
19017     define) # see if strlcpy exists
19018         set strlcpy d_strlcpy
19019         eval $inlibc
19020         ;;
19021     *)  val=$undef
19022         set d_strlcpy
19023         eval $setvar
19024         ;;
19025 esac
19026
19027 : see if strnlen exists
19028 set strnlen d_strnlen
19029 eval $inlibc
19030
19031 : see if strtod exists
19032 set strtod d_strtod
19033 eval $inlibc
19034
19035 : see if strtod_l exists
19036 set strtod_l d_strtod_l
19037 eval $inlibc
19038
19039 : see if strtol exists
19040 set strtol d_strtol
19041 eval $inlibc
19042
19043 : see if strtold exists
19044 set strtold d_strtold
19045 eval $inlibc
19046
19047 : see if strtold_l exists
19048 set strtold_l d_strtold_l
19049 eval $inlibc
19050
19051 : see if strtoll exists
19052 set strtoll d_strtoll
19053 eval $inlibc
19054
19055 case "$d_longlong-$d_strtoll" in
19056 "$define-$define")
19057         $cat <<EOM
19058 Checking whether your strtoll() works okay...
19059 EOM
19060         $cat >try.c <<'EOCP'
19061 #include <errno.h>
19062 #ifdef __hpux
19063 #define strtoll __strtoll
19064 #endif
19065 #ifdef __EMX__
19066 #define strtoll _strtoll
19067 #endif
19068 #include <stdio.h>
19069 extern long long int strtoll(char *s, char **, int);
19070 static int bad = 0;
19071 int check(char *s, long long ell, int een) {
19072         long long gll;
19073         errno = 0;
19074         gll = strtoll(s, 0, 10);
19075         if (!((gll == ell) && (errno == een)))
19076                 bad++;
19077 }
19078 int main() {
19079         check(" 1",                                      1LL, 0);
19080         check(" 0",                                      0LL, 0);
19081         check("-1",                                     -1LL, 0);
19082         check("-9223372036854775808", -9223372036854775808LL, 0);
19083         check("-9223372036854775808", -9223372036854775808LL, 0);
19084         check(" 9223372036854775807",  9223372036854775807LL, 0);
19085         check("-9223372036854775808", -9223372036854775808LL, 0);
19086         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19087         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19088         if (!bad)
19089                 printf("ok\n");
19090 }
19091 EOCP
19092         set try
19093         if eval $compile; then
19094                 yyy=`$run ./try`
19095                 case "$yyy" in
19096                 ok) echo "Your strtoll() seems to be working okay." ;;
19097                 *) cat <<EOM >&4
19098 Your strtoll() doesn't seem to be working okay.
19099 EOM
19100                    d_strtoll="$undef"
19101                    ;;
19102                 esac
19103         else
19104                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19105                 d_strtoll="$undef"
19106         fi
19107         ;;
19108 esac
19109
19110 : see if strtoq exists
19111 set strtoq d_strtoq
19112 eval $inlibc
19113
19114 : see if strtoul exists
19115 set strtoul d_strtoul
19116 eval $inlibc
19117
19118 case "$d_strtoul" in
19119 "$define")
19120         $cat <<EOM
19121 Checking whether your strtoul() works okay...
19122 EOM
19123         $cat >try.c <<'EOCP'
19124 #include <errno.h>
19125 #include <stdio.h>
19126 extern unsigned long int strtoul(char *s, char **, int);
19127 static int bad = 0;
19128 void check(char *s, unsigned long eul, int een) {
19129         unsigned long gul;
19130         errno = 0;
19131         gul = strtoul(s, 0, 10);
19132         if (!((gul == eul) && (errno == een)))
19133                 bad++;
19134 }
19135 int main() {
19136         check(" 1", 1L, 0);
19137         check(" 0", 0L, 0);
19138 EOCP
19139         case "$longsize" in
19140         8)
19141             $cat >>try.c <<'EOCP'
19142         check("18446744073709551615", 18446744073709551615UL, 0);
19143         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19144 #if 0 /* strtoul() for /^-/ strings is undefined. */
19145         check("-1", 18446744073709551615UL, 0);
19146         check("-18446744073709551614", 2, 0);
19147         check("-18446744073709551615", 1, 0);
19148         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19149         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19150 #endif
19151 EOCP
19152                 ;;
19153         4)
19154                     $cat >>try.c <<'EOCP'
19155         check("4294967295", 4294967295UL, 0);
19156         check("4294967296", 4294967295UL, ERANGE);
19157 #if 0 /* strtoul() for /^-/ strings is undefined. */
19158         check("-1", 4294967295UL, 0);
19159         check("-4294967294", 2, 0);
19160         check("-4294967295", 1, 0);
19161         check("-4294967296", 4294967295UL, ERANGE);
19162         check("-4294967297", 4294967295UL, ERANGE);
19163 #endif
19164 EOCP
19165                 ;;
19166         *)
19167 : Should we write these tests to be more portable by sprintf-ing
19168 : ~0 and then manipulating that char string as input for strtol?
19169                 ;;
19170         esac
19171         $cat >>try.c <<'EOCP'
19172         if (!bad)
19173                 printf("ok\n");
19174         return 0;
19175 }
19176 EOCP
19177         set try
19178         if eval $compile; then
19179                 case "`$run ./try`" in
19180                 ok) echo "Your strtoul() seems to be working okay." ;;
19181                 *) cat <<EOM >&4
19182 Your strtoul() doesn't seem to be working okay.
19183 EOM
19184                    d_strtoul="$undef"
19185                    ;;
19186                 esac
19187         else
19188                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19189                 d_strtoul="$undef"
19190         fi
19191         ;;
19192 esac
19193
19194 : see if strtoull exists
19195 set strtoull d_strtoull
19196 eval $inlibc
19197
19198 case "$d_longlong-$d_strtoull" in
19199 "$define-$define")
19200         $cat <<EOM
19201 Checking whether your strtoull() works okay...
19202 EOM
19203         $cat >try.c <<'EOCP'
19204 #include <errno.h>
19205 #ifdef __hpux
19206 #define strtoull __strtoull
19207 #endif
19208 #include <stdio.h>
19209 extern unsigned long long int strtoull(char *s, char **, int);
19210 static int bad = 0;
19211 int check(char *s, long long eull, int een) {
19212         long long gull;
19213         errno = 0;
19214         gull = strtoull(s, 0, 10);
19215         if (!((gull == eull) && (errno == een)))
19216                 bad++;
19217 }
19218 int main() {
19219         check(" 1",                                        1LL, 0);
19220         check(" 0",                                        0LL, 0);
19221         check("18446744073709551615",  18446744073709551615ULL, 0);
19222         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19223 #if 0 /* strtoull() for /^-/ strings is undefined. */
19224         check("-1",                    18446744073709551615ULL, 0);
19225         check("-18446744073709551614",                     2LL, 0);
19226         check("-18446744073709551615",                     1LL, 0);
19227         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19228         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19229 #endif
19230         if (!bad)
19231                 printf("ok\n");
19232 }
19233 EOCP
19234         set try
19235         if eval $compile; then
19236                 case "`$run ./try`" in
19237                 ok) echo "Your strtoull() seems to be working okay." ;;
19238                 *) cat <<EOM >&4
19239 Your strtoull() doesn't seem to be working okay.
19240 EOM
19241                    d_strtoull="$undef"
19242                    ;;
19243                 esac
19244         else
19245                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19246                 d_strtoull="$undef"
19247         fi
19248         ;;
19249 esac
19250
19251 : see if strtouq exists
19252 set strtouq d_strtouq
19253 eval $inlibc
19254
19255 case "$d_strtouq" in
19256 "$define")
19257         $cat <<EOM
19258 Checking whether your strtouq() works okay...
19259 EOM
19260         $cat >try.c <<'EOCP'
19261 #include <errno.h>
19262 #include <stdio.h>
19263 extern unsigned long long int strtouq(char *s, char **, int);
19264 static int bad = 0;
19265 void check(char *s, unsigned long long eull, int een) {
19266         unsigned long long gull;
19267         errno = 0;
19268         gull = strtouq(s, 0, 10);
19269         if (!((gull == eull) && (errno == een)))
19270                 bad++;
19271 }
19272 int main() {
19273         check(" 1",                                        1LL, 0);
19274         check(" 0",                                        0LL, 0);
19275         check("18446744073709551615",  18446744073709551615ULL, 0);
19276         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19277 #if 0 /* strtouq() for /^-/ strings is undefined. */
19278         check("-1",                    18446744073709551615ULL, 0);
19279         check("-18446744073709551614",                     2LL, 0);
19280         check("-18446744073709551615",                     1LL, 0);
19281         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19282         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19283 #endif
19284         if (!bad)
19285                 printf("ok\n");
19286         return 0;
19287 }
19288 EOCP
19289         set try
19290         if eval $compile; then
19291                 case "`$run ./try`" in
19292                 ok) echo "Your strtouq() seems to be working okay." ;;
19293                 *) cat <<EOM >&4
19294 Your strtouq() doesn't seem to be working okay.
19295 EOM
19296                    d_strtouq="$undef"
19297                    ;;
19298                 esac
19299         else
19300                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19301                 d_strtouq="$undef"
19302         fi
19303         ;;
19304 esac
19305
19306 : see if strxfrm exists
19307 set strxfrm d_strxfrm
19308 eval $inlibc
19309
19310 : see if symlink exists
19311 set symlink d_symlink
19312 eval $inlibc
19313
19314 : see if syscall exists
19315 set syscall d_syscall
19316 eval $inlibc
19317
19318 : see if prototype for syscall is available
19319 echo " "
19320 set d_syscallproto syscall $i_unistd unistd.h
19321 eval $hasproto
19322
19323 : see if sysconf exists
19324 set sysconf d_sysconf
19325 eval $inlibc
19326
19327 : see if sys_errlist[] exists
19328 echo " "
19329 if test "X$d_syserrlst" = X; then
19330         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19331                 echo "You have sys_errlist[], so we could roll our own strerror."
19332                 d_syserrlst="$define"
19333         else
19334                 echo "You don't have sys_errlist[], so strerror() is welcome."
19335                 d_syserrlst="$undef"
19336         fi
19337 fi
19338
19339 : see if system exists
19340 set system d_system
19341 eval $inlibc
19342
19343 : see if tcgetpgrp exists
19344 set tcgetpgrp d_tcgetpgrp
19345 eval $inlibc
19346
19347 : see if tcsetpgrp exists
19348 set tcsetpgrp d_tcsetpgrp
19349 eval $inlibc
19350
19351 : see if prototype for telldir is available
19352 echo " "
19353 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19354 eval $hasproto
19355
19356 : see if tgamma exists
19357 set tgamma d_tgamma
19358 eval $inlibc
19359
19360 : check for thread_safe_nl_langinfo_l item
19361 $cat <<EOM
19362
19363 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19364 EOM
19365 $cat >try.c <<EOCP
19366 #$i_stdlib I_STDLIB
19367 #ifdef I_STDLIB
19368 #  include <stdlib.h>
19369 #endif
19370 #include <string.h>
19371 #$i_langinfo I_LANGINFO
19372 #ifdef I_LANGINFO
19373 #  include <langinfo.h>
19374 #endif
19375 #$i_pthread I_PTHREAD
19376 #ifdef I_PTHREAD
19377 #  include <pthread.h>
19378 #endif
19379 #$i_locale I_LOCALE
19380 #ifdef I_LOCALE
19381 #  include <locale.h>
19382 #endif
19383
19384 void *
19385 thread_start(void * arg)
19386 {
19387     nl_langinfo(RADIXCHAR);
19388 }
19389
19390 int main() {
19391     char * main_buffer;
19392     char save_main_buffer[1000];
19393     pthread_t subthread;
19394     pthread_attr_t attr;
19395
19396     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19397
19398     /* If too large for our generous allowance, just assume we don't have
19399      * it. */
19400     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19401         exit(1);
19402     }
19403
19404     strcpy(save_main_buffer, main_buffer);
19405
19406     if (pthread_attr_init(&attr) != 0) {
19407         exit(1);
19408     }
19409
19410     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19411         exit(1);
19412     }
19413
19414     if (pthread_join(subthread, NULL) != 0) {
19415         exit(1);
19416     }
19417
19418     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19419 }
19420 EOCP
19421 case "$usethreads" in
19422     define)
19423         set try
19424         if eval $compile; then
19425             echo "Your system has nl_langinfo_l()..." >&4
19426             if $run ./try; then
19427                 echo "and it is thread-safe (just as I'd hoped)." >&4
19428                 d_thread_safe_nl_langinfo_l="$define"
19429                 echo "$d_thread_safe_nl_langinfo_l" >&4
19430             else
19431                 echo "but it isn't thread-safe, so we won't use it." >&4
19432             fi
19433         else
19434             echo "your system does not have nl_langinfo_l()" >&4
19435         fi
19436         ;;
19437     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19438 esac
19439 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19440         d_thread_safe_nl_langinfo_l="$undef"
19441 fi
19442 $rm_try
19443
19444 : see if time exists
19445 echo " "
19446 if test "X$d_time" = X -o X"$timetype" = X; then
19447     if set time val -f d_time; eval $csym; $val; then
19448                 echo 'time() found.' >&4
19449                 val="$define"
19450                 rp="What is the type returned by time() on this system?"
19451                 set time_t timetype long stdio.h sys/types.h
19452                 eval $typedef_ask
19453     else
19454                 echo 'time() not found, hope that will do.' >&4
19455                 val="$undef"
19456                 timetype='int';
19457     fi
19458     set d_time
19459     eval $setvar
19460 fi
19461
19462 : see if timegm exists
19463 set timegm d_timegm
19464 eval $inlibc
19465
19466 : see if this is a sys/times.h system
19467 set sys/times.h i_systimes
19468 eval $inhdr
19469
19470 : see if times exists
19471 echo " "
19472 if set times val -f d_times; eval $csym; $val; then
19473         echo 'times() found.' >&4
19474         d_times="$define"
19475         inc=''
19476         case "$i_systimes" in
19477         "$define") inc='sys/times.h';;
19478         esac
19479         rp="What is the type returned by times() on this system?"
19480         set clock_t clocktype long stdio.h sys/types.h $inc
19481         eval $typedef_ask
19482 else
19483         echo 'times() NOT found, hope that will do.' >&4
19484         d_times="$undef"
19485         clocktype='int'
19486 fi
19487
19488 : see if tmpnam_r exists
19489 set tmpnam_r d_tmpnam_r
19490 eval $inlibc
19491 case "$d_tmpnam_r" in
19492 "$define")
19493         hdrs="$i_systypes sys/types.h define stdio.h "
19494         case "$d_tmpnam_r_proto:$usethreads" in
19495         ":define")      d_tmpnam_r_proto=define
19496                 set d_tmpnam_r_proto tmpnam_r $hdrs
19497                 eval $hasproto ;;
19498         *)      ;;
19499         esac
19500         case "$d_tmpnam_r_proto" in
19501         define)
19502         case "$tmpnam_r_proto" in
19503         ''|0) try='char* tmpnam_r(char*);'
19504         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19505         esac
19506         case "$tmpnam_r_proto" in
19507         ''|0)   d_tmpnam_r=undef
19508                 tmpnam_r_proto=0
19509                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19510         * )     case "$tmpnam_r_proto" in
19511                 REENTRANT_PROTO*) ;;
19512                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19513                 esac
19514                 echo "Prototype: $try" ;;
19515         esac
19516         ;;
19517         *)      case "$usethreads" in
19518                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19519                 esac
19520                 d_tmpnam_r=undef
19521                 tmpnam_r_proto=0
19522                 ;;
19523         esac
19524         ;;
19525 *)      tmpnam_r_proto=0
19526         ;;
19527 esac
19528
19529 : see if towlower exists
19530 set towlower d_towlower
19531 eval $inlibc
19532
19533 : see if trunc exists
19534 set trunc d_trunc
19535 eval $inlibc
19536
19537 : see if truncate exists
19538 set truncate d_truncate
19539 eval $inlibc
19540
19541 : see if ttyname_r exists
19542 set ttyname_r d_ttyname_r
19543 eval $inlibc
19544 case "$d_ttyname_r" in
19545 "$define")
19546         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19547         case "$d_ttyname_r_proto:$usethreads" in
19548         ":define")      d_ttyname_r_proto=define
19549                 set d_ttyname_r_proto ttyname_r $hdrs
19550                 eval $hasproto ;;
19551         *)      ;;
19552         esac
19553         case "$d_ttyname_r_proto" in
19554         define)
19555         case "$ttyname_r_proto" in
19556         ''|0) try='int ttyname_r(int, char*, size_t);'
19557         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19558         esac
19559         case "$ttyname_r_proto" in
19560         ''|0) try='int ttyname_r(int, char*, int);'
19561         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19562         esac
19563         case "$ttyname_r_proto" in
19564         ''|0) try='char* ttyname_r(int, char*, int);'
19565         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19566         esac
19567         case "$ttyname_r_proto" in
19568         ''|0)   d_ttyname_r=undef
19569                 ttyname_r_proto=0
19570                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19571         * )     case "$ttyname_r_proto" in
19572                 REENTRANT_PROTO*) ;;
19573                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19574                 esac
19575                 echo "Prototype: $try" ;;
19576         esac
19577         ;;
19578         *)      case "$usethreads" in
19579                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19580                 esac
19581                 d_ttyname_r=undef
19582                 ttyname_r_proto=0
19583                 ;;
19584         esac
19585         ;;
19586 *)      ttyname_r_proto=0
19587         ;;
19588 esac
19589
19590 : see if tzname[] exists
19591 echo " "
19592 if set tzname val -a d_tzname; eval $csym; $val; then
19593         val="$define"
19594         echo 'tzname[] found.' >&4
19595 else
19596         val="$undef"
19597         echo 'tzname[] NOT found.' >&4
19598 fi
19599 set d_tzname
19600 eval $setvar
19601
19602 : Check if is a multiplatform env
19603 case "$osname" in
19604 darwin) multiarch="$define" ;;
19605 esac
19606 case "$multiarch" in
19607 ''|[nN]*) multiarch="$undef" ;;
19608 esac
19609
19610 : check for ordering of bytes in a UV
19611 echo " "
19612 case "$multiarch" in
19613 *$define*)
19614         $cat <<EOM
19615 You seem to be doing a multiarchitecture build,
19616 skipping the byteorder check.
19617
19618 EOM
19619         byteorder='ffff'
19620         ;;
19621 *)
19622         case "$byteorder" in
19623         '')
19624                 $cat <<'EOM'
19625 In the following, larger digits indicate more significance.  A big-endian
19626 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19627 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19628 machines may have weird orders like 3412.  A Cray will report 87654321,
19629 an Alpha will report 12345678. If the test program works the default is
19630 probably right.
19631 I'm now running the test program...
19632 EOM
19633                 $cat >try.c <<EOCP
19634 #include <stdio.h>
19635 #$i_stdlib I_STDLIB
19636 #ifdef I_STDLIB
19637 #include <stdlib.h>
19638 #endif
19639 #include <sys/types.h>
19640 typedef $uvtype UV;
19641 int main()
19642 {
19643         int i;
19644         union {
19645                 UV l;
19646                 char c[$uvsize];
19647         } u;
19648
19649         if ($uvsize > 4)
19650                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19651         else
19652                 u.l = (UV)0x04030201;
19653         for (i = 0; i < $uvsize; i++)
19654                 printf("%c", u.c[i]+'0');
19655         printf("\n");
19656         exit(0);
19657 }
19658 EOCP
19659                 xxx_prompt=y
19660                 set try
19661                 if eval $compile && $run ./try > /dev/null; then
19662                         dflt=`$run ./try`
19663                         case "$dflt" in
19664                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19665                                 echo "(The test program ran ok.)"
19666                                 echo "byteorder=$dflt"
19667                                 xxx_prompt=n
19668                         ;;
19669                         ????|????????) echo "(The test program ran ok.)" ;;
19670                         *) echo "(The test program didn't run right for some reason.)" ;;
19671                         esac
19672                 else
19673                         dflt='4321'
19674                         cat <<'EOM'
19675 (I can't seem to compile the test program.  Guessing big-endian...)
19676 EOM
19677                 fi
19678                 case "$xxx_prompt" in
19679                 y)
19680                         rp="What is the order of bytes in $uvtype?"
19681                         . ./myread
19682                         byteorder="$ans"
19683                         ;;
19684                 *)      byteorder=$dflt
19685                         ;;
19686                 esac
19687                 ;;
19688         esac
19689         $rm_try
19690         ;;
19691 esac
19692
19693 : Checking 32bit alignedness
19694 $cat <<EOM
19695
19696 Checking to see whether you can access character data unalignedly...
19697 EOM
19698 case "$d_u32align" in
19699 '')   $cat >try.c <<EOCP
19700 #include <stdio.h>
19701 #$i_stdlib I_STDLIB
19702 #ifdef I_STDLIB
19703 #include <stdlib.h>
19704 #endif
19705 #define U32 $u32type
19706 #define BYTEORDER 0x$byteorder
19707 #define U8 $u8type
19708 #include <signal.h>
19709 #ifdef SIGBUS
19710 $signal_t bletch(int s) { exit(4); }
19711 #endif
19712 int main() {
19713 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19714     volatile U8 buf[8];
19715     volatile U32 *up;
19716     int i;
19717
19718     if (sizeof(U32) != 4) {
19719         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19720         exit(1);
19721     }
19722
19723     fflush(stdout);
19724
19725 #ifdef SIGBUS
19726     signal(SIGBUS, bletch);
19727 #endif
19728
19729     buf[0] = 0;
19730     buf[1] = 0;
19731     buf[2] = 0;
19732     buf[3] = 1;
19733     buf[4] = 0;
19734     buf[5] = 0;
19735     buf[6] = 0;
19736     buf[7] = 1;
19737
19738     for (i = 0; i < 4; i++) {
19739         up = (U32*)(buf + i);
19740         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19741                (*up == 1 << (8*(3-i)))  /* little-endian */
19742               )
19743            )
19744         {
19745             printf("read failed (%x)\n", *up);
19746             exit(2);
19747         }
19748     }
19749
19750     /* write test */
19751     for (i = 0; i < 4; i++) {
19752         up = (U32*)(buf + i);
19753         *up = 0xBeef;
19754         if (*up != 0xBeef) {
19755             printf("write failed (%x)\n", *up);
19756             exit(3);
19757         }
19758     }
19759
19760     exit(0);
19761 #else
19762     printf("1\n");
19763     exit(1);
19764 #endif
19765     return 0;
19766 }
19767 EOCP
19768 set try
19769 if eval $compile_ok; then
19770         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19771         $run ./try 2>&1 >/dev/null
19772         case "$?" in
19773         0)      cat >&4 <<EOM
19774 You can access character data pretty unalignedly.
19775 EOM
19776                 d_u32align="$undef"
19777                 ;;
19778         *)      cat >&4 <<EOM
19779 It seems that you must access character data in an aligned manner.
19780 EOM
19781                 d_u32align="$define"
19782                 ;;
19783         esac
19784 else
19785         rp='Can you access character data at unaligned addresses?'
19786         dflt='n'
19787         . ./myread
19788         case "$ans" in
19789         [yY]*)  d_u32align="$undef"  ;;
19790         *)      d_u32align="$define" ;;
19791         esac
19792 fi
19793 $rm_try
19794 ;;
19795 esac
19796
19797 : see if ualarm exists
19798 set ualarm d_ualarm
19799 eval $inlibc
19800
19801 : see if umask exists
19802 set umask d_umask
19803 eval $inlibc
19804
19805 : see if unordered exists
19806 set unordered d_unordered
19807 eval $inlibc
19808
19809 : see if unsetenv exists
19810 set unsetenv d_unsetenv
19811 eval $inlibc
19812
19813 : see if usleep exists
19814 set usleep d_usleep
19815 eval $inlibc
19816
19817 : see if prototype for usleep is available
19818 echo " "
19819 set d_usleepproto usleep $i_unistd unistd.h
19820 eval $hasproto
19821
19822 : see if ustat exists
19823 set ustat d_ustat
19824 eval $inlibc
19825
19826 : see if closedir exists
19827 set closedir d_closedir
19828 eval $inlibc
19829
19830 case "$d_closedir" in
19831 "$define")
19832         echo " "
19833         echo "Checking whether closedir() returns a status..." >&4
19834         cat > try.c <<EOM
19835 #$i_dirent I_DIRENT             /**/
19836 #$i_sysdir I_SYS_DIR            /**/
19837 #$i_sysndir I_SYS_NDIR          /**/
19838 #$i_systypes I_SYS_TYPES        /**/
19839
19840 #if defined(I_SYS_TYPES)
19841 #include <sys/types.h>
19842 #endif
19843 #if defined(I_DIRENT)
19844 #include <dirent.h>
19845 #else
19846 #ifdef I_SYS_NDIR
19847 #include <sys/ndir.h>
19848 #else
19849 #ifdef I_SYS_DIR
19850 #include <sys/dir.h>
19851 #endif
19852 #endif
19853 #endif
19854 int main() { return closedir(opendir(".")); }
19855 EOM
19856         set try
19857         if eval $compile_ok; then
19858                 if $run ./try > /dev/null 2>&1 ; then
19859                         echo "Yes, it does."
19860                         val="$undef"
19861                 else
19862                         echo "No, it doesn't."
19863                         val="$define"
19864                 fi
19865         else
19866                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19867                 val="$define"
19868         fi
19869         ;;
19870 *)
19871         val="$undef";
19872         ;;
19873 esac
19874 set d_void_closedir
19875 eval $setvar
19876 $rm_try
19877
19878 : see if there is a wait4
19879 set wait4 d_wait4
19880 eval $inlibc
19881
19882 : see if waitpid exists
19883 set waitpid d_waitpid
19884 eval $inlibc
19885
19886 : look for wcscmp
19887 echo " "
19888 $cat >try.c <<'EOCP'
19889 #include <stdio.h>
19890 #include <wchar.h>
19891 int main ()
19892 {
19893     wchar_t *s = L" ";
19894     return (wcscmp (s, s) ? 1 : 0);
19895     }
19896 EOCP
19897 set try
19898 val="$undef"
19899 if eval $compile; then
19900     `$run ./try`
19901     case "$?" in
19902         0)  echo "A working wcscmp() found." >&4
19903             val="$define" ;;
19904         *)  echo "wcscmp() found, but it doesn't work" >&4
19905             ;;
19906         esac
19907 else
19908     echo "wcscmp() NOT found." >&4
19909     fi
19910 set d_wcscmp
19911 eval $setvar
19912 $rm_try
19913
19914 : see if wcstombs exists
19915 set wcstombs d_wcstombs
19916 eval $inlibc
19917
19918 : look for wcsxfrm
19919 echo " "
19920 $cat >try.c <<'EOCP'
19921 #include <errno.h>
19922 #include <wchar.h>
19923 int main ()
19924 {
19925     wchar_t dst[4], *src = L" ";
19926     errno = 0;
19927     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19928     }
19929 EOCP
19930 set try
19931 val="$undef"
19932 if eval $compile; then
19933     `$run ./try`
19934     case "$?" in
19935         0)  echo "A working wcsxfrm() found." >&4
19936             val="$define" ;;
19937         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19938             ;;
19939         esac
19940 else
19941     echo "wcsxfrm() NOT found." >&4
19942     fi
19943 set d_wcsxfrm
19944 eval $setvar
19945 $rm_try
19946
19947 : see if wctomb exists
19948 set wctomb d_wctomb
19949 eval $inlibc
19950
19951 : see if writev exists
19952 set writev d_writev
19953 eval $inlibc
19954
19955 : check for alignment requirements
19956 echo " "
19957 case "$alignbytes" in
19958     '') echo "Checking alignment constraints..." >&4
19959         $cat >try.c <<EOCP
19960 #include <stdio.h>
19961 struct foobar {
19962     char foo;
19963     $nvtype bar;
19964 } try_algn;
19965 int main()
19966 {
19967     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19968     return(0);
19969 }
19970 EOCP
19971         set try
19972         if eval $compile_ok; then
19973             dflt=`$run ./try`
19974         else
19975             dflt='8'
19976             echo "(I can't seem to compile the test program...)"
19977         fi
19978         case "$multiarch" in
19979             *$define*)
19980                 : The usual safe value is 8, but Darwin with -Duselongdouble
19981                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19982                 : Configure to pick a larger value if needed.
19983                 if $test "$dflt" -lt 8; then
19984                     dflt='8'
19985                     echo "Setting alignment to 8 for multiarch support.">&4
19986                 fi
19987                 ;;
19988         esac
19989         ;;
19990     *) dflt="$alignbytes"
19991         ;;
19992 esac
19993 rp="Doubles must be aligned on a how-many-byte boundary?"
19994 . ./myread
19995 alignbytes="$ans"
19996 $rm_try
19997
19998 : set the base revision
19999 baserev=5.0
20000
20001 : length of character in bytes. Is always 1, otherwise it is not C
20002 : This used to be a test using sizeof
20003 charsize=1
20004
20005 : Check for the number of bits in a character
20006 case "$charbits" in
20007 '')     echo "Checking how long a character is (in bits)..." >&4
20008         $cat >try.c <<EOCP
20009 #include <stdio.h>
20010 int main ()
20011 {
20012     int n;
20013     unsigned char c;
20014     for (c = 1, n = 0; c; c <<= 1, n++) ;
20015     printf ("%d\n", n);
20016     return (0);
20017     }
20018 EOCP
20019         set try
20020         if eval $compile_ok; then
20021                 dflt=`$run ./try`
20022         else
20023                 dflt='8'
20024                 echo "(I can't seem to compile the test program.  Guessing...)"
20025         fi
20026         ;;
20027 *)
20028         dflt="$charbits"
20029         ;;
20030 esac
20031 rp="What is the length of a character (in bits)?"
20032 . ./myread
20033 charbits="$ans"
20034 $rm_try
20035 case "$charbits" in
20036 8)      ;;
20037 *)      cat >&4 << EOM
20038 Your system has an unsigned character size of $charbits bits, which
20039 is rather unusual (normally it is 8 bits).  Perl likely will not work
20040 correctly on your system, with subtle bugs in various places.
20041 EOM
20042         rp='Do you really want to continue?'
20043         dflt='n'
20044         . ./myread
20045         case "$ans" in
20046                 [yY])   echo >&4 "Okay, continuing."    ;;
20047                 *)      exit 1                          ;;
20048         esac
20049 esac
20050
20051 : how do we concatenate cpp tokens here?
20052 echo " "
20053 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20054 $cat >cpp_stuff.c <<'EOCP'
20055 #define RCAT(a,b)a/**/b
20056 #define ACAT(a,b)a ## b
20057 RCAT(Rei,ser)
20058 ACAT(Cir,cus)
20059 EOCP
20060 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20061 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20062         echo "Oh!  Smells like ANSI's been here." >&4
20063         echo "We can catify or stringify, separately or together!"
20064         cpp_stuff=42
20065 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20066         echo "Ah, yes!  The good old days!" >&4
20067         echo "However, in the good old days we don't know how to stringify and"
20068         echo "catify at the same time."
20069         cpp_stuff=1
20070 else
20071         $cat >&4 <<EOM
20072 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20073 You're going to have to edit the values of CAT[2-5] in config.h...
20074 EOM
20075         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20076 fi
20077 $rm -f cpp_stuff.*
20078
20079 : see if this is a db.h system
20080 set db.h i_db
20081 eval $inhdr
20082
20083 case "$i_db" in
20084 $define)
20085         : Check db version.
20086         echo " "
20087         echo "Checking Berkeley DB version ..." >&4
20088         $cat >try.c <<EOCP
20089 #include <sys/types.h>
20090 #include <stdio.h>
20091 #$i_stdlib I_STDLIB
20092 #ifdef I_STDLIB
20093 #include <stdlib.h>
20094 #endif
20095 #include <db.h>
20096 int main(int argc, char *argv[])
20097 {
20098 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20099     int Major, Minor, Patch ;
20100     unsigned long Version ;
20101     (void)db_version(&Major, &Minor, &Patch) ;
20102     if (argc == 2) {
20103         printf("%d %d %d %d %d %d\n",
20104                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20105                Major, Minor, Patch);
20106         exit(0);
20107     }
20108     printf("You have Berkeley DB Version 2 or greater.\n");
20109
20110     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20111                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20112     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20113                 Major, Minor, Patch) ;
20114
20115     /* check that db.h & libdb are compatible */
20116     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20117         printf("db.h and libdb are incompatible.\n") ;
20118         exit(3);
20119     }
20120
20121     printf("db.h and libdb are compatible.\n") ;
20122
20123     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20124                 + DB_VERSION_PATCH ;
20125
20126     /* needs to be >= 2.3.4 */
20127     if (Version < 2003004) {
20128     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20129         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20130         exit(2);
20131     }
20132
20133     exit(0);
20134 #else
20135 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20136     if (argc == 2) {
20137         printf("1 0 0\n");
20138         exit(0);
20139     }
20140     printf("You have Berkeley DB Version 1.\n");
20141     exit(0);    /* DB version < 2: the coast is clear. */
20142 #else
20143     exit(1);    /* <db.h> not Berkeley DB? */
20144 #endif
20145 #endif
20146 }
20147 EOCP
20148         set try
20149         if eval $compile_ok && $run ./try; then
20150                 echo 'Looks OK.' >&4
20151                 set `$run ./try 1`
20152                 db_version_major=$1
20153                 db_version_minor=$2
20154                 db_version_patch=$3
20155         else
20156                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20157                 i_db=$undef
20158                 case " $libs " in
20159                 *"-ldb "*)
20160                         : Remove db from list of libraries to use
20161                         echo "Removing unusable -ldb from library list" >&4
20162                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20163                         shift
20164                         libs="$*"
20165                         echo "libs = $libs" >&4
20166                         ;;
20167                 esac
20168         fi
20169         $rm_try
20170         ;;
20171 esac
20172
20173 case "$i_db" in
20174 define)
20175         : Check the return type needed for hash
20176         echo " "
20177         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20178         $cat >try.c <<EOCP
20179 #include <sys/types.h>
20180 #include <db.h>
20181
20182 #ifndef DB_VERSION_MAJOR
20183 u_int32_t hash_cb (const void* ptr, size_t size)
20184 {
20185         return 0;
20186 }
20187 HASHINFO info;
20188 int main()
20189 {
20190         info.hash = hash_cb;
20191 }
20192 #endif
20193 EOCP
20194         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20195                 if $contains warning try.out >>/dev/null 2>&1 ; then
20196                         db_hashtype='int'
20197                 else
20198                         db_hashtype='u_int32_t'
20199                 fi
20200         else
20201                 : XXX Maybe we should just give up here.
20202                 db_hashtype=u_int32_t
20203                 $cat try.out >&4
20204                 echo "Help:  I can't seem to compile the db test program." >&4
20205                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20206         fi
20207         $rm_try
20208         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20209         ;;
20210 *)      db_hashtype=u_int32_t
20211         ;;
20212 esac
20213 case "$i_db" in
20214 define)
20215         : Check the return type needed for prefix
20216         echo " "
20217         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20218         cat >try.c <<EOCP
20219 #include <sys/types.h>
20220 #include <db.h>
20221
20222 #ifndef DB_VERSION_MAJOR
20223 size_t prefix_cb (const DBT *key1, const DBT *key2)
20224 {
20225         return 0;
20226 }
20227 BTREEINFO info;
20228 int main()
20229 {
20230         info.prefix = prefix_cb;
20231 }
20232 #endif
20233 EOCP
20234         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20235                 if $contains warning try.out >>/dev/null 2>&1 ; then
20236                         db_prefixtype='int'
20237                 else
20238                         db_prefixtype='size_t'
20239                 fi
20240         else
20241                 db_prefixtype='size_t'
20242                 : XXX Maybe we should just give up here.
20243                 $cat try.out >&4
20244                 echo "Help:  I can't seem to compile the db test program." >&4
20245                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20246         fi
20247         $rm_try
20248         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20249         ;;
20250 *)      db_prefixtype='size_t'
20251         ;;
20252 esac
20253
20254 : Include . in @INC
20255 $cat <<EOM
20256
20257 Historically Perl has provided a final fallback of the current working
20258 directory '.' when searching for a library. This, however, can lead to
20259 problems when a Perl program which loads optional modules is called from
20260 a shared directory. This can lead to executing unexpected code.
20261
20262 EOM
20263
20264 # When changing to exclude by default:
20265 case "$default_inc_excludes_dot" in
20266     $undef|false|[nN]*) dflt="n" ;;
20267     *)                  dflt="y" ;;
20268 esac
20269 # To turn exclude off by default:
20270 #case "$default_inc_excludes_dot" in
20271 #    $define|true|[yY]*) dflt="y" ;;
20272 #    *)                  dflt="n" ;;
20273 #esac
20274
20275 rp='Exclude '.' from @INC by default? '
20276 . ./myread
20277 case "$ans" in
20278     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20279     *)          default_inc_excludes_dot="$define" ;;
20280 esac
20281
20282 : Check what kind of inf/nan your system has
20283 $echo "Checking the kind of infinities and nans you have..." >&4
20284 $echo "(The following tests may crash.  That's okay.)" >&4
20285 $cat >try.c <<EOP
20286 #define DOUBLESIZE $doublesize
20287 #$d_longdbl HAS_LONG_DOUBLE
20288 #ifdef HAS_LONG_DOUBLE
20289 #define LONG_DOUBLESIZE $longdblsize
20290 #define LONG_DOUBLEKIND $longdblkind
20291 #endif
20292 #include <math.h>
20293 #include <string.h>
20294 #include <stdio.h>
20295 /* Note that whether the sign bit is on or off
20296  * for NaN depends on the CPU/FPU, and possibly
20297  * can be affected by the build toolchain.
20298  *
20299  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20300  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20301  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20302  * (respectively) as opposed to the more usual
20303  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20304  *
20305  * Pre-IEEE-754 floating point format do not even have inf/nan support
20306  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20307  * to even mention, causing immediate SIGFPE or equivalent: this is
20308  * the case with VAX floating point, for example.
20309  */
20310 static void bytes(void *v, unsigned int n) {
20311   unsigned char *p = (unsigned char *)v;
20312   int i;
20313   for (i = 0; i < n; i++) {
20314     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20315   }
20316 }
20317 int main(int argc, char *argv[]) {
20318    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20319     * because some compilers are 'smart' and not only warn but refuse to
20320     * compile such 'illegal' values. */
20321    double dinf = exp(1e9);
20322    double dnan = sqrt(-1.0);
20323 #ifdef HAS_LONG_DOUBLE
20324    long double ldinf = (long double)exp(1e9);
20325    long double ldnan = (long double)sqrt(-1.0);
20326 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20327 /* the 80-bit long doubles might have garbage in their excess bytes */
20328     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20329     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20330 # endif
20331   if (argc == 2) {
20332     switch (argv[1][0]) {
20333     case '1': bytes(&dinf, sizeof(dinf)); break;
20334     case '2': bytes(&dnan, sizeof(dnan)); break;
20335     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20336     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20337 #endif
20338     }
20339   }
20340   return 0;
20341 }
20342 EOP
20343 set try
20344 if eval $compile; then
20345     doubleinfbytes=`$run ./try 1`
20346     doublenanbytes=`$run ./try 2`
20347     case "$d_longdbl" in
20348     $define)
20349       longdblinfbytes=`$run ./try 3`
20350       longdblnanbytes=`$run ./try 4`
20351       ;;
20352     esac
20353 else
20354     # Defaults in case the above test program failed.
20355     case "$doublekind" in
20356     1) # IEEE 754 32-bit LE
20357        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20358        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20359        ;;
20360     2) # IEEE 754 32-bit BE
20361        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20362        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20363        ;;
20364     3) # IEEE 754 64-bit LE
20365        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20366        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20367        ;;
20368     4) # IEEE 754 64-bit BE
20369        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20370        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20371        ;;
20372     5) # IEEE 754 128-bit LE
20373        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20374        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20375        ;;
20376     6) # IEEE 754 128-bit BE
20377        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20378        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20379        ;;
20380     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20381        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20382        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20383        ;;
20384     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20385        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20386        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20387        ;;
20388     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20389        doubleinfbytes=$undef
20390        doublenanbytes=$undef
20391        ;;
20392     *) # No idea.
20393        doubleinfbytes=$undef
20394        doublenanbytes=$undef
20395        ;;
20396     esac
20397     case "$longdblkind" in
20398     1) # IEEE 754 128-bit LE
20399        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20400        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20401        ;;
20402     2) # IEEE 754 128-bit BE
20403        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20404        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20405        ;;
20406     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20407        case "$longdblsize" in
20408        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20409            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20410            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20411            ;;
20412        16) # x86_64
20413            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20414            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20415            ;;
20416        *)  # No idea.
20417            longdblinfbytes=$undef
20418            longdblnanbytes=$undef
20419        ;;
20420        esac
20421        ;;
20422     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20423        case "$longdblsize" in
20424        12) # 32-bit system
20425            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20426            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20427            ;;
20428        16) # 64-bit system
20429            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20430            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20431            ;;
20432        *)  # No idea.
20433            longdblinfbytes=$undef
20434            longdblnanbytes=$undef
20435        ;;
20436        esac
20437        ;;
20438     5) # 128-bit LE-LE "double double"
20439        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20440        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20441        ;;
20442     6) # 128-bit BE-BE "double double"
20443        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20444        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20445        ;;
20446     7) # 128-bit LE-BE "double double"
20447        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20448        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20449        ;;
20450     8) # 128-bit BE-LE "double double"
20451        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20452        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20453        ;;
20454     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20455        longdblinfbytes=$undef
20456        longdblnanbytes=$undef
20457        ;;
20458     *) # No idea.
20459        longdblinfbytes=$undef
20460        longdblnanbytes=$undef
20461        ;;
20462     esac
20463 fi
20464 # In case the program crashed the values are empty, turn them undef.
20465 case "$doubleinfbytes" in
20466 '') doubleinfbytes=$undef ;;
20467 esac
20468 case "$doublenanbytes" in
20469 '') doublenanbytes=$undef ;;
20470 esac
20471 case "$longdblinfbytes" in
20472 '') longdblinfbytes=$undef ;;
20473 esac
20474 case "$longdblnanbytes" in
20475 '') longdblnanbytes=$undef ;;
20476 esac
20477 $rm_try
20478
20479 : Check the length of the double mantissa
20480 $echo "Checking how many mantissa bits your doubles have..." >&4
20481 $cat >try.c <<EOP
20482 #$i_sunmath I_SUNMATH
20483 #include <float.h>
20484 #ifdef I_SUNMATH
20485 # include <sunmath.h>
20486 #endif
20487 #ifdef DBL_MANT_DIG
20488 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20489 #endif
20490 #include <stdio.h>
20491 int main(int argc, char *argv[]) {
20492 #ifdef BITS
20493   printf("%d\n", BITS);
20494 #endif
20495   return 0;
20496 }
20497 EOP
20498 set try
20499 if eval $compile; then
20500     doublemantbits=`$run ./try`
20501 else
20502     doublemantbits="$undef"
20503 fi
20504 $rm_try
20505
20506 : Check the length of the longdouble mantissa
20507 $echo "Checking how many mantissa bits your long doubles have..." >&4
20508 $cat >try.c <<EOP
20509 #$i_sunmath I_SUNMATH
20510 #include <float.h>
20511 #ifdef I_SUNMATH
20512 # include <sunmath.h>
20513 #endif
20514 #$d_longdbl HAS_LONG_DOUBLE
20515 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20516 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20517 /* This format has no implicit bit.  Beware, however, that for
20518  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20519  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20520  * and the top bit must have been one since 387, zero is plain invalid.
20521  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20522 #  define BITS LDBL_MANT_DIG
20523 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20524 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20525  * reason e.g. Irix thinks 107.  But in any case, we want only
20526  * the number of real bits, the implicit bits are of no interest.  */
20527 #  define BITS 2 * (DBL_MANT_DIG - 1)
20528 # else
20529 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20530 # endif
20531 #endif
20532 #include <stdio.h>
20533 int main(int argc, char *argv[]) {
20534 #ifdef BITS
20535   printf("%d\n", BITS);
20536 #endif
20537   return 0;
20538 }
20539 EOP
20540 set try
20541 if eval $compile; then
20542     longdblmantbits=`$run ./try`
20543 else
20544     longdblmantbits="$undef"
20545 fi
20546 $rm_try
20547
20548 : Check the length of the NV mantissa
20549 $echo "Checking how many mantissa bits your NVs have..." >&4
20550 if test "X$usequadmath" = "X$define"; then
20551   nvmantbits=112 # 128-1-15
20552 else
20553   if test "X$nvsize" = "X$doublesize"; then
20554     nvmantbits="$doublemantbits"
20555   else
20556      if test "X$nvsize" = "X$longdblsize"; then
20557        nvmantbits="$longdblmantbits"
20558      else
20559        nvmantbits="$undef"
20560      fi
20561   fi
20562 fi
20563
20564 : How can we generate normalized random numbers ?
20565 echo " "
20566 echo "Using our internal random number implementation..." >&4
20567
20568 case "$ccflags" in
20569 *-Dmy_rand=*|*-Dmy_srand=*)
20570         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20571         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20572         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20573         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20574         ;;
20575 esac
20576
20577 randfunc=Perl_drand48
20578 drand01="Perl_drand48()"
20579 seedfunc="Perl_drand48_init"
20580 randbits=48
20581 randseedtype=U32
20582
20583 : Probe whether dtrace builds an object, as newer Illumos requires an input
20584 : object file that uses at least one of the probes defined in the .d file
20585 case "$usedtrace" in
20586 $define)
20587     case "$dtracexnolibs" in
20588     $define|true|[yY]*)
20589         dtracexnolibs=$define
20590         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20591         ;;
20592     ' '|'')
20593         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20594              dtracexnolibs=$define
20595              echo "Your dtrace accepts -xnolibs"
20596         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20597              dtracexnolibs=$undef
20598              echo "Your dtrace doesn't accept -xnolibs"
20599         else
20600              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20601              exit 1
20602         fi
20603         ;;
20604     *)
20605         dtracexnolibs=$undef
20606         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20607         ;;
20608     esac
20609     case $dtracexnolibs in
20610     $define) xnolibs=-xnolibs ;;
20611     *) xnolibs= ;;
20612     esac
20613
20614     case "$dtraceobject" in
20615     $define|true|[yY]*)
20616         dtraceobject=$define
20617         ;;
20618     ' '|'')
20619         $cat >try.c <<EOM
20620 #include "perldtrace.h"
20621 int main(void) {
20622     PERL_LOADED_FILE("dummy");
20623     return 0;
20624 }
20625 EOM
20626         dtraceobject=$undef
20627         if $cc -c -o try.o $optimize $ccflags try.c \
20628                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20629                 dtraceobject=$define
20630             echo "Your dtrace builds an object file"
20631         fi
20632         ;;
20633     *) dtraceobject=$undef ;;
20634     esac
20635     $rm_try perldtrace.o perldtrace.h
20636 esac
20637
20638 : Determine if this is an EBCDIC system
20639 echo " "
20640 echo "Determining whether or not we are on an EBCDIC system..." >&4
20641 $cat >try.c <<'EOM'
20642 int main()
20643 {
20644   if ('M'==0xd4) return 0;
20645   return 1;
20646 }
20647 EOM
20648
20649 val=$undef
20650 set try
20651 if eval $compile_ok; then
20652         if $run ./try; then
20653                 echo "You seem to speak EBCDIC." >&4
20654                 val="$define"
20655         else
20656                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20657         fi
20658 else
20659         echo "I'm unable to compile the test program." >&4
20660         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20661 fi
20662 $rm_try
20663 set ebcdic
20664 eval $setvar
20665
20666 : Check how to flush
20667 echo " "
20668 $cat >&4 <<EOM
20669 Checking how to flush all pending stdio output...
20670 EOM
20671 # I only know how to find the first 32 possibly open files on SunOS.
20672 # See also hints/sunos_4_1.sh and util.c  --AD
20673 case "$osname" in
20674 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20675 esac
20676 $cat >>try.c <<EOCP
20677 #include <stdio.h>
20678 #$i_stdlib I_STDLIB
20679 #ifdef I_STDLIB
20680 #include <stdlib.h>
20681 #endif
20682 #$i_unistd I_UNISTD
20683 #ifdef I_UNISTD
20684 # include <unistd.h>
20685 #endif
20686 #$d_sysconf HAS_SYSCONF
20687 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20688 #ifdef HAS_STDIO_STREAM_ARRAY
20689 # define STDIO_STREAM_ARRAY $stdio_stream_array
20690 #endif
20691 int main() {
20692   FILE* p;
20693   unlink("try.out");
20694   p = fopen("try.out", "w");
20695 #ifdef TRY_FPUTC
20696   fputc('x', p);
20697 #else
20698 # ifdef TRY_FPRINTF
20699   fprintf(p, "x");
20700 # endif
20701 #endif
20702 #ifdef TRY_FFLUSH_NULL
20703   fflush(NULL);
20704 #endif
20705 #ifdef TRY_FFLUSH_ALL
20706   {
20707     long open_max = -1;
20708 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20709     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20710 # else
20711 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20712     open_max = sysconf(_SC_OPEN_MAX);
20713 #  else
20714 #   ifdef FOPEN_MAX
20715     open_max = FOPEN_MAX;
20716 #   else
20717 #    ifdef OPEN_MAX
20718     open_max = OPEN_MAX;
20719 #    else
20720 #     ifdef _NFILE
20721     open_max = _NFILE;
20722 #     endif
20723 #    endif
20724 #   endif
20725 #  endif
20726 # endif
20727 # ifdef HAS_STDIO_STREAM_ARRAY
20728     if (open_max > 0) {
20729       long i;
20730       for (i = 0; i < open_max; i++)
20731             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20732                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20733                 STDIO_STREAM_ARRAY[i]._flag)
20734                 fflush(&STDIO_STREAM_ARRAY[i]);
20735     }
20736   }
20737 # endif
20738 #endif
20739   _exit(42);
20740 }
20741 EOCP
20742 : first we have to find out how _not_ to flush
20743 $to try.c
20744 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20745     output=''
20746     set try -DTRY_FPUTC
20747     if eval $compile; then
20748             $run ./try 2>/dev/null
20749             code="$?"
20750             $from try.out
20751             if $test ! -s try.out -a "X$code" = X42; then
20752                 output=-DTRY_FPUTC
20753             fi
20754     fi
20755     case "$output" in
20756     '')
20757             set try -DTRY_FPRINTF
20758             if eval $compile; then
20759                     $run ./try 2>/dev/null
20760                     code="$?"
20761                     $from try.out
20762                     if $test ! -s try.out -a "X$code" = X42; then
20763                         output=-DTRY_FPRINTF
20764                     fi
20765             fi
20766         ;;
20767     esac
20768 fi
20769 : check for fflush NULL behavior
20770 case "$fflushNULL" in
20771 '')     set try -DTRY_FFLUSH_NULL $output
20772         if eval $compile; then
20773                 $run ./try 2>/dev/null
20774                 code="$?"
20775                 $from try.out
20776                 if $test -s try.out -a "X$code" = X42; then
20777                         fflushNULL="`$cat try.out`"
20778                 else
20779                         if $test "X$code" != X42; then
20780                                 $cat >&4 <<EOM
20781 (If this test failed, don't worry, we'll try another method shortly.)
20782 EOM
20783                         fi
20784                 fi
20785         fi
20786         $rm -f core try.core core.try.*
20787         case "$fflushNULL" in
20788         x)      $cat >&4 <<EOM
20789 Your fflush(NULL) works okay for output streams.
20790 Let's see if it clobbers input pipes...
20791 EOM
20792 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20793 # bug that improperly flushes the input end of pipes.  So we avoid the
20794 # autoflush on fork/system/exec support for now. :-(
20795 $cat >tryp.c <<EOCP
20796 #include <stdio.h>
20797 int
20798 main(int argc, char **argv)
20799 {
20800     char buf[1024];
20801     int i;
20802     char *bp = buf;
20803     while (1) {
20804         while ((i = getc(stdin)) != -1
20805                && (*bp++ = i) != '\n'
20806                && bp < &buf[1024])
20807         /* DO NOTHING */ ;
20808         *bp = '\0';
20809         fprintf(stdout, "%s", buf);
20810         fflush(NULL);
20811         if (i == -1)
20812             return 0;
20813         bp = buf;
20814     }
20815 }
20816 EOCP
20817                 fflushNULL="$define"
20818                 set tryp
20819                 if eval $compile; then
20820                     $rm -f tryp.out
20821                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20822                     if $test "X$targethost" != X; then
20823                         $to tryp.c
20824                         $to tryp
20825                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20826                     else
20827                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20828                     fi
20829                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20830                        $cat >&4 <<EOM
20831 fflush(NULL) seems to behave okay with input streams.
20832 EOM
20833                         fflushNULL="$define"
20834                     else
20835                         $cat >&4 <<EOM
20836 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20837 EOM
20838                         fflushNULL="$undef"
20839                     fi
20840                 fi
20841                 $rm -f core tryp.c tryp.core core.tryp.*
20842                 ;;
20843         '')     $cat >&4 <<EOM
20844 Your fflush(NULL) isn't working (contrary to ANSI C).
20845 EOM
20846                 fflushNULL="$undef"
20847                 ;;
20848         *)      $cat >&4 <<EOM
20849 Cannot figure out whether your fflush(NULL) works or not.
20850 I'm assuming it doesn't (contrary to ANSI C).
20851 EOM
20852                 fflushNULL="$undef"
20853                 ;;
20854         esac
20855         ;;
20856 $define|true|[yY]*)
20857         fflushNULL="$define"
20858         ;;
20859 *)
20860         fflushNULL="$undef"
20861         ;;
20862 esac
20863 : check explicit looping only if NULL did not work, and if the pipe
20864 : bug does not show up on an explicit flush too
20865 case "$fflushNULL" in
20866 "$undef")
20867         $cat >tryp.c <<EOCP
20868 #include <stdio.h>
20869 int
20870 main(int argc, char **argv)
20871 {
20872     char buf[1024];
20873     int i;
20874     char *bp = buf;
20875     while (1) {
20876         while ((i = getc(stdin)) != -1
20877                && (*bp++ = i) != '\n'
20878                && bp < &buf[1024])
20879         /* DO NOTHING */ ;
20880         *bp = '\0';
20881         fprintf(stdout, "%s", buf);
20882         fflush(stdin);
20883         if (i == -1)
20884             return 0;
20885         bp = buf;
20886     }
20887 }
20888 EOCP
20889         set tryp
20890         if eval $compile; then
20891             $rm -f tryp.out
20892             if $test "X$targethost" != X; then
20893                 $to tryp.c
20894                 $to tryp
20895                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20896             else
20897                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20898             fi
20899             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20900                $cat >&4 <<EOM
20901 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20902 EOM
20903                 : now check for fflushall behaviour
20904                 case "$fflushall" in
20905                 '')     set try -DTRY_FFLUSH_ALL $output
20906                         if eval $compile; then
20907                                 $cat >&4 <<EOM
20908 (Now testing the other method--but note that this also may fail.)
20909 EOM
20910                                 $run ./try 2>/dev/null
20911                                 code=$?
20912                                 $from try.out
20913                                 if $test -s try.out -a "X$code" = X42; then
20914                                         fflushall="`$cat try.out`"
20915                                 fi
20916                         fi
20917                         $rm_try
20918                         case "$fflushall" in
20919                         x)      $cat >&4 <<EOM
20920 Whew. Flushing explicitly all the stdio streams works.
20921 EOM
20922                                 fflushall="$define"
20923                                 ;;
20924                         '')     $cat >&4 <<EOM
20925 Sigh. Flushing explicitly all the stdio streams doesn't work.
20926 EOM
20927                                 fflushall="$undef"
20928                                 ;;
20929                         *)      $cat >&4 <<EOM
20930 Cannot figure out whether flushing stdio streams explicitly works or not.
20931 I'm assuming it doesn't.
20932 EOM
20933                                 fflushall="$undef"
20934                                 ;;
20935                         esac
20936                         ;;
20937                 "$define"|true|[yY]*)
20938                         fflushall="$define"
20939                         ;;
20940                 *)
20941                         fflushall="$undef"
20942                         ;;
20943                 esac
20944             else
20945                 $cat >&4 <<EOM
20946 All is futile.  Even fflush(stdin) clobbers input pipes!
20947 EOM
20948                 fflushall="$undef"
20949             fi
20950         else
20951             fflushall="$undef"
20952         fi
20953         $rm -f core tryp.c tryp.core core.tryp.*
20954         ;;
20955 *)      fflushall="$undef"
20956         ;;
20957 esac
20958
20959 case "$fflushNULL$fflushall" in
20960 undefundef)
20961         $cat <<EOM
20962 OK, I give up.  I cannot figure out how to flush pending stdio output.
20963 We won't be flushing handles at all before fork/exec/popen.
20964 EOM
20965         ;;
20966 esac
20967 $rm_try tryp
20968
20969 : Store the full pathname to the ar program for use in the C program
20970 : Respect a hint or command line value for full_ar.
20971 case "$full_ar" in
20972 '') full_ar=$ar ;;
20973 esac
20974
20975 : Store the full pathname to the sed program for use in the C program
20976 full_sed=$sed
20977
20978 : see what type gids are declared as in the kernel
20979 echo " "
20980 echo "Looking for the type for group ids returned by getgid()."
20981 set gid_t gidtype xxx stdio.h sys/types.h
20982 eval $typedef
20983 case "$gidtype" in
20984 xxx)
20985         xxx=`./findhdr sys/user.h`
20986         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20987         case $1 in
20988         unsigned) dflt="$1 $2" ;;
20989         *) dflt="$1" ;;
20990         esac
20991         ;;
20992 *) dflt="$gidtype";;
20993 esac
20994 case "$gidtype" in
20995 gid_t) echo "gid_t found." ;;
20996 *)      rp="What is the type for group ids returned by getgid()?"
20997         . ./myread
20998         gidtype="$ans"
20999         ;;
21000 esac
21001
21002 : Check the size of GID
21003 echo " "
21004 case "$gidtype" in
21005 *_t) zzz="$gidtype"     ;;
21006 *)   zzz="gid"          ;;
21007 esac
21008 echo "Checking the size of $zzz..." >&4
21009 cat > try.c <<EOCP
21010 #include <sys/types.h>
21011 #include <stdio.h>
21012 #$i_stdlib I_STDLIB
21013 #ifdef I_STDLIB
21014 #include <stdlib.h>
21015 #endif
21016 int main() {
21017     printf("%d\n", (int)sizeof($gidtype));
21018     exit(0);
21019 }
21020 EOCP
21021 set try
21022 if eval $compile_ok; then
21023         yyy=`$run ./try`
21024         case "$yyy" in
21025         '')     gidsize=4
21026                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21027                 ;;
21028         *)      gidsize=$yyy
21029                 echo "Your $zzz is $gidsize bytes long."
21030                 ;;
21031         esac
21032 else
21033         gidsize=4
21034         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21035 fi
21036
21037 : Check if GID is signed
21038 echo " "
21039 case "$gidtype" in
21040 *_t) zzz="$gidtype"     ;;
21041 *)   zzz="gid"          ;;
21042 esac
21043 echo "Checking the sign of $zzz..." >&4
21044 cat > try.c <<EOCP
21045 #include <sys/types.h>
21046 #include <stdio.h>
21047 int main() {
21048         $gidtype foo = -1;
21049         if (foo < 0)
21050                 printf("-1\n");
21051         else
21052                 printf("1\n");
21053 }
21054 EOCP
21055 set try
21056 if eval $compile; then
21057         yyy=`$run ./try`
21058         case "$yyy" in
21059         '')     gidsign=1
21060                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21061                 ;;
21062         *)      gidsign=$yyy
21063                 case "$gidsign" in
21064                  1) echo "Your $zzz is unsigned." ;;
21065                 -1) echo "Your $zzz is signed."   ;;
21066                 esac
21067                 ;;
21068         esac
21069 else
21070         gidsign=1
21071         echo "(I can't compile the test program--guessing unsigned.)" >&4
21072 fi
21073
21074 : Check 64bit sizes
21075 echo " "
21076
21077 if $test X"$quadtype" != X; then
21078
21079 echo "Checking how to print 64-bit integers..." >&4
21080
21081 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21082         $cat >try.c <<'EOCP'
21083 #include <sys/types.h>
21084 #include <stdio.h>
21085 int main() {
21086   int q = 12345678901;
21087   printf("%ld\n", q);
21088 }
21089 EOCP
21090         set try
21091         if eval $compile; then
21092                 yyy=`$run ./try`
21093                 case "$yyy" in
21094                 12345678901)
21095                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21096                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21097                         echo "We will use %d."
21098                         ;;
21099                 esac
21100         fi
21101 fi
21102
21103 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21104         $cat >try.c <<'EOCP'
21105 #include <sys/types.h>
21106 #include <stdio.h>
21107 int main() {
21108   long q = 12345678901;
21109   printf("%ld\n", q);
21110 }
21111 EOCP
21112         set try
21113         if eval $compile; then
21114                 yyy=`$run ./try`
21115                 case "$yyy" in
21116                 12345678901)
21117                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21118                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21119                         echo "We will use %ld."
21120                         ;;
21121                 esac
21122         fi
21123 fi
21124
21125 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21126         $cat >try.c <<'EOCP'
21127 #include <sys/types.h>
21128 #include <inttypes.h>
21129 #include <stdio.h>
21130 int main() {
21131   int64_t q = 12345678901;
21132   printf("%" PRId64 "\n", q);
21133 }
21134 EOCP
21135         set try
21136         if eval $compile; then
21137                 yyy=`$run ./try`
21138                 case "$yyy" in
21139                 12345678901)
21140                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21141                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21142                         echo "We will use the C9X style."
21143                         ;;
21144                 esac
21145         fi
21146 fi
21147
21148 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21149         $cat >try.c <<EOCP
21150 #include <sys/types.h>
21151 #include <stdio.h>
21152 int main() {
21153   $quadtype q = 12345678901;
21154   printf("%Ld\n", q);
21155 }
21156 EOCP
21157         set try
21158         if eval $compile; then
21159                 yyy=`$run ./try`
21160                 case "$yyy" in
21161                 12345678901)
21162                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21163                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21164                         echo "We will use %Ld."
21165                         ;;
21166                 esac
21167         fi
21168 fi
21169
21170 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21171         $cat >try.c <<'EOCP'
21172 #include <sys/types.h>
21173 #include <stdio.h>
21174 int main() {
21175   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21176   printf("%lld\n", q);
21177 }
21178 EOCP
21179         set try
21180         if eval $compile; then
21181                 yyy=`$run ./try`
21182                 case "$yyy" in
21183                 12345678901)
21184                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21185                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21186                         echo "We will use the %lld style."
21187                         ;;
21188                 esac
21189         fi
21190 fi
21191
21192 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21193         $cat >try.c <<EOCP
21194 #include <sys/types.h>
21195 #include <stdio.h>
21196 int main() {
21197   $quadtype q = 12345678901;
21198   printf("%qd\n", q);
21199 }
21200 EOCP
21201         set try
21202         if eval $compile; then
21203                 yyy=`$run ./try`
21204                 case "$yyy" in
21205                 12345678901)
21206                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21207                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21208                         echo "We will use %qd."
21209                         ;;
21210                 esac
21211         fi
21212 fi
21213
21214 if $test X"$sPRId64" = X; then
21215         echo "Cannot figure out how to print 64-bit integers." >&4
21216 fi
21217 $rm_try
21218
21219 fi
21220
21221 case "$sPRId64" in
21222 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21223         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21224         ;;
21225 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21226         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21227         ;;
21228 esac
21229
21230 : Check format strings for internal types
21231 echo " "
21232 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21233
21234 if $test X"$ivsize" = X8; then
21235         ivdformat="$sPRId64"
21236         uvuformat="$sPRIu64"
21237         uvoformat="$sPRIo64"
21238         uvxformat="$sPRIx64"
21239         uvXUformat="$sPRIXU64"
21240 else
21241         if $test X"$ivsize" = X"$longsize"; then
21242                 ivdformat='"ld"'
21243                 uvuformat='"lu"'
21244                 uvoformat='"lo"'
21245                 uvxformat='"lx"'
21246                 uvXUformat='"lX"'
21247         else
21248                 if $test X"$ivsize" = X"$intsize"; then
21249                         ivdformat='"d"'
21250                         uvuformat='"u"'
21251                         uvoformat='"o"'
21252                         uvxformat='"x"'
21253                         uvXUformat='"X"'
21254                 else
21255                         : far out
21256                         if $test X"$ivsize" = X"$shortsize"; then
21257                                 ivdformat='"hd"'
21258                                 uvuformat='"hu"'
21259                                 uvoformat='"ho"'
21260                                 uvxformat='"hx"'
21261                                 uvXUformat='"hX"'
21262                         fi
21263                 fi
21264         fi
21265 fi
21266
21267 if $test X"$usequadmath" = X"$define"; then
21268     nveformat='"Qe"'
21269     nvfformat='"Qf"'
21270     nvgformat='"Qg"'
21271     nvEUformat='"QE"'
21272     nvFUformat='"QF"'
21273     nvGUformat='"QG"'
21274 else
21275     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21276         nveformat="$sPRIeldbl"
21277         nvfformat="$sPRIfldbl"
21278         nvgformat="$sPRIgldbl"
21279         nvEUformat="$sPRIEUldbl"
21280         nvFUformat="$sPRIFUldbl"
21281         nvGUformat="$sPRIGUldbl"
21282     else
21283         nveformat='"e"'
21284         nvfformat='"f"'
21285         nvgformat='"g"'
21286         nvEUformat='"E"'
21287         nvFUformat='"F"'
21288         nvGUformat='"G"'
21289     fi
21290 fi
21291
21292 case "$ivdformat" in
21293 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21294     exit 1
21295     ;;
21296 esac
21297
21298 : Check format string for GID
21299
21300 echo " "
21301 $echo "Checking the format string to be used for gids..." >&4
21302
21303 case "$gidsign" in
21304 -1)     if $test X"$gidsize" = X"$ivsize"; then
21305                 gidformat="$ivdformat"
21306         else
21307                 if $test X"$gidsize" = X"$longsize"; then
21308                         gidformat='"ld"'
21309                 else
21310                         if $test X"$gidsize" = X"$intsize"; then
21311                                 gidformat='"d"'
21312                         else
21313                                 if $test X"$gidsize" = X"$shortsize"; then
21314                                         gidformat='"hd"'
21315                                 fi
21316                         fi
21317                 fi
21318         fi
21319         ;;
21320 *)      if $test X"$gidsize" = X"$uvsize"; then
21321                 gidformat="$uvuformat"
21322         else
21323                 if $test X"$gidsize" = X"$longsize"; then
21324                         gidformat='"lu"'
21325                 else
21326                         if $test X"$gidsize" = X"$intsize"; then
21327                                 gidformat='"u"'
21328                         else
21329                                 if $test X"$gidsize" = X"$shortsize"; then
21330                                         gidformat='"hu"'
21331                                 fi
21332                         fi
21333                 fi
21334         fi
21335         ;;
21336 esac
21337
21338 : see if getgroups exists
21339 set getgroups d_getgrps
21340 eval $inlibc
21341
21342 : see if setgroups exists
21343 set setgroups d_setgrps
21344 eval $inlibc
21345
21346 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21347 echo " "
21348 case "$d_getgrps$d_setgrps" in
21349 *define*)
21350         case "$groupstype" in
21351         '') dflt="$gidtype" ;;
21352         *)  dflt="$groupstype" ;;
21353         esac
21354         $cat <<EOM
21355 What type of pointer is the second argument to getgroups() and setgroups()?
21356 Usually this is the same as group ids, $gidtype, but not always.
21357
21358 EOM
21359         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21360         . ./myread
21361         groupstype="$ans"
21362         ;;
21363 *)  groupstype="$gidtype";;
21364 esac
21365
21366 : check whether make sets MAKE
21367 echo " "
21368 echo "Checking if your $make program sets \$(MAKE)..." >&4
21369 case "$make_set_make" in
21370 '')
21371         $sed 's/^X //' > testmake.mak << 'EOF'
21372 Xall:
21373 X       @echo 'maketemp="$(MAKE)"'
21374 EOF
21375         case "`$make -f testmake.mak 2>/dev/null`" in
21376         *maketemp=*) make_set_make='#' ;;
21377         *)      make_set_make="MAKE=$make" ;;
21378         esac
21379         $rm -f testmake.mak
21380         ;;
21381 esac
21382 case "$make_set_make" in
21383 '#') echo "Yup, it does.";;
21384 *) echo "Nope, it doesn't.";;
21385 esac
21386
21387 : see what type is used for mode_t
21388 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21389 set mode_t modetype int stdio.h sys/types.h
21390 eval $typedef_ask
21391
21392 : see if we need va_copy
21393 echo " "
21394 $cat >try.c <<EOCP
21395 #include <stdarg.h>
21396 #include <stdio.h>
21397 #include <stdlib.h>
21398 #include <signal.h>
21399
21400 int
21401 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21402 {
21403   return vfprintf(f, fmt, *valp);
21404 }
21405
21406 int
21407 myvfprintf(FILE *f, const  char *fmt, va_list val)
21408 {
21409   return ivfprintf(f, fmt, &val);
21410 }
21411
21412 int
21413 myprintf(char *fmt, ...)
21414 {
21415   va_list val;
21416   va_start(val, fmt);
21417   return myvfprintf(stdout, fmt, val);
21418 }
21419
21420 int
21421 main(int ac, char **av)
21422 {
21423   signal(SIGSEGV, exit);
21424
21425   myprintf("%s%cs all right, then\n", "that", '\'');
21426   exit(0);
21427 }
21428 EOCP
21429 set try
21430 if eval $compile && $run ./try 2>&1 >/dev/null; then
21431         case "`$run ./try`" in
21432         "that's all right, then")
21433                 okay=yes
21434                 ;;
21435         esac
21436 fi
21437 case "$okay" in
21438 yes)    echo "It seems that you don't need va_copy()." >&4
21439         need_va_copy="$undef"
21440         ;;
21441 *)      echo "It seems that va_copy() or similar will be needed." >&4
21442         need_va_copy="$define"
21443         ;;
21444 esac
21445 $rm_try
21446
21447 : see what type is used for size_t
21448 rp="What is the type used for the length parameter for string functions?"
21449 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21450 eval $typedef_ask
21451
21452 : check for type of arguments to gethostbyaddr.
21453 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21454         case "$d_gethbyaddr" in
21455         $define)
21456                 $cat <<EOM
21457
21458 Checking to see what type of arguments are accepted by gethostbyaddr().
21459 EOM
21460                 hdrs="$define sys/types.h
21461                         $d_socket sys/socket.h
21462                         $i_niin netinet/in.h
21463                         $i_netdb netdb.h
21464                         $i_unistd unistd.h"
21465                 : The first arg can 'char *' or 'void *'
21466                 : The second arg is some of integral type
21467                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21468                         for yyy in size_t long int; do
21469                                 case "$netdb_host_type" in
21470                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21471                                         if ./protochk "$try" $hdrs; then
21472                                                 echo "Your system accepts $xxx for the first arg."
21473                                                 echo "...and $yyy for the second arg."
21474                                                 netdb_host_type="$xxx"
21475                                                 netdb_hlen_type="$yyy"
21476                                         fi
21477                                         ;;
21478                                 esac
21479                         done
21480                 done
21481                 : In case none of those worked, prompt the user.
21482                 case "$netdb_host_type" in
21483                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21484                         dflt='char *'
21485                         . ./myread
21486                         netdb_host_type=$ans
21487                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21488                         dflt="$sizetype"
21489                         . ./myread
21490                         netdb_hlen_type=$ans
21491                         ;;
21492                 esac
21493                 ;;
21494         *)      : no gethostbyaddr, so pick harmless defaults
21495                 netdb_host_type='char *'
21496                 netdb_hlen_type="$sizetype"
21497                 ;;
21498         esac
21499         # Remove the "const" if needed. -- but then we'll have a
21500         # prototype clash!
21501         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21502 fi
21503
21504 : check for type of argument to gethostbyname.
21505 if test "X$netdb_name_type" = X ; then
21506         case "$d_gethbyname" in
21507         $define)
21508                 $cat <<EOM
21509
21510 Checking to see what type of argument is accepted by gethostbyname().
21511 EOM
21512                 hdrs="$define sys/types.h
21513                         $d_socket sys/socket.h
21514                         $i_niin netinet/in.h
21515                         $i_netdb netdb.h
21516                         $i_unistd unistd.h"
21517                 for xxx in "const char *" "char *"; do
21518                         case "$netdb_name_type" in
21519                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21520                                 if ./protochk "$try" $hdrs; then
21521                                         echo "Your system accepts $xxx."
21522                                         netdb_name_type="$xxx"
21523                                 fi
21524                                 ;;
21525                         esac
21526                 done
21527                 : In case none of those worked, prompt the user.
21528                 case "$netdb_name_type" in
21529                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21530                         dflt='char *'
21531                         . ./myread
21532                         netdb_name_type=$ans
21533                         ;;
21534                 esac
21535                 ;;
21536         *)      : no gethostbyname, so pick harmless default
21537                 netdb_name_type='char *'
21538                 ;;
21539         esac
21540 fi
21541
21542 : check for type of 1st argument to getnetbyaddr.
21543 if test "X$netdb_net_type" = X ; then
21544         case "$d_getnbyaddr" in
21545         $define)
21546                 $cat <<EOM
21547
21548 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21549 EOM
21550                 hdrs="$define sys/types.h
21551                         $d_socket sys/socket.h
21552                         $i_niin netinet/in.h
21553                         $i_netdb netdb.h
21554                         $i_unistd unistd.h"
21555                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21556                         case "$netdb_net_type" in
21557                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21558                                 if ./protochk "$try" $hdrs; then
21559                                         echo "Your system accepts $xxx."
21560                                         netdb_net_type="$xxx"
21561                                 fi
21562                                 ;;
21563                         esac
21564                 done
21565                 : In case none of those worked, prompt the user.
21566                 case "$netdb_net_type" in
21567                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21568                         dflt='long'
21569                         . ./myread
21570                         netdb_net_type=$ans
21571                         ;;
21572                 esac
21573                 ;;
21574         *)      : no getnetbyaddr, so pick harmless default
21575                 netdb_net_type='long'
21576                 ;;
21577         esac
21578 fi
21579 : locate the preferred pager for this system
21580 fn=f/
21581 case "$pager" in
21582 '')
21583         dflt=''
21584         case "$pg" in
21585         /*) dflt=$pg;;
21586         [a-zA-Z]:/*) dflt=$pg;;
21587         esac
21588         case "$more" in
21589         /*) dflt=$more;;
21590         [a-zA-Z]:/*) dflt=$more;;
21591         esac
21592         case "$less" in
21593         /*) dflt=$less;;
21594         [a-zA-Z]:/*) dflt=$less;;
21595         esac
21596         case "$dflt" in
21597         '') dflt=/usr/ucb/more;;
21598         esac
21599         ;;
21600 *)      dflt="$pager"
21601         ;;
21602 esac
21603 fn="f/($dflt)"
21604 echo " "
21605 rp='What pager is used on your system?'
21606 . ./getfile
21607 pager="$ans"
21608
21609 : see if ar generates random libraries by itself
21610 echo " "
21611 echo "Checking how to generate random libraries on your machine..." >&4
21612 echo 'int bar1() { return bar2(); }' > bar1.c
21613 echo 'int bar2() { return 2; }' > bar2.c
21614 $cat > foo.c <<EOP
21615 #$i_stdlib I_STDLIB
21616 #ifdef I_STDLIB
21617 #include <stdlib.h>
21618 #endif
21619 int main() { printf("%d\n", bar1()); exit(0); }
21620 EOP
21621 $cc $ccflags -c bar1.c >/dev/null 2>&1
21622 $cc $ccflags -c bar2.c >/dev/null 2>&1
21623 $cc $ccflags -c foo.c >/dev/null 2>&1
21624 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21625 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21626         $run ./foobar >/dev/null 2>&1; then
21627         echo "$ar appears to generate random libraries itself."
21628         orderlib=false
21629         if [ "X$ranlib" = "X" ]; then
21630             ranlib=":"
21631         fi
21632 elif $ar s bar$_a >/dev/null 2>&1 &&
21633         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21634         $run ./foobar >/dev/null 2>&1; then
21635                 echo "a table of contents needs to be added with '$ar s'."
21636                 orderlib=false
21637                 ranlib="$ar s"
21638 elif $ar ts bar$_a >/dev/null 2>&1 &&
21639         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21640         $run ./foobar >/dev/null 2>&1; then
21641                 echo "a table of contents needs to be added with '$ar ts'."
21642                 orderlib=false
21643                 ranlib="$ar ts"
21644 else
21645         case "$ranlib" in
21646         :) ranlib='';;
21647         '')
21648                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21649                 $test -f $ranlib || ranlib=''
21650                 ;;
21651         esac
21652         if $test -n "$ranlib"; then
21653                 echo "your system has '$ranlib'; we'll use that."
21654                 orderlib=false
21655         else
21656                 echo "your system doesn't seem to support random libraries"
21657                 echo "so we'll use lorder and tsort to order the libraries."
21658                 orderlib=true
21659                 ranlib=":"
21660         fi
21661 fi
21662 $rm -f foo* bar*
21663
21664 : Check the max offset that gmtime and localtime accept
21665 echo "Checking max offsets that gmtime () accepts"
21666
21667 case "$sGMTIME_min/$sGMTIME_max" in
21668     0/0|/)
21669         $cat >try.c <<EOCP
21670 #include <sys/types.h>
21671 #include <stdio.h>
21672 #include <time.h>
21673
21674 int i;
21675 struct tm *tmp;
21676 time_t pt;
21677
21678 void gm_check (time_t t, int min_year, int max_year)
21679 {
21680     tmp = gmtime (&t);
21681     if ( tmp == NULL ||
21682         /* Check tm_year overflow */
21683          tmp->tm_year < min_year || tmp->tm_year > max_year)
21684         tmp = NULL;
21685     else
21686         pt = t;
21687     } /* gm_check */
21688
21689 int check_max ()
21690 {
21691     tmp = NULL;
21692     pt  = 0;
21693 #ifdef MAXLONG
21694     gm_check (MAXLONG, 69, 0x7fffffff);
21695 #endif
21696     if (tmp == NULL || tmp->tm_year < 0) {
21697         for (i = 63; i >= 0; i--) {
21698             time_t x = pt | ((time_t)1 << i);
21699             if (x < 0 || x < pt) continue;
21700             gm_check (x, 69, 0x7fffffff);
21701             }
21702         }
21703     printf ("sGMTIME_max=%ld\n", pt);
21704     return (0);
21705     } /* check_max */
21706
21707 int check_min ()
21708 {
21709     tmp = NULL;
21710     pt  = 0;
21711 #ifdef MINLONG
21712     gm_check (MINLONG, -1900, 70);
21713 #endif
21714     if (tmp == NULL) {
21715         for (i = 36; i >= 0; i--) {
21716             time_t x = pt - ((time_t)1 << i);
21717             if (x > 0) continue;
21718             gm_check (x, -1900, 70);
21719             }
21720         }
21721     printf ("sGMTIME_min=%ld\n", pt);
21722     return (0);
21723     } /* check_min */
21724
21725 int main (int argc, char *argv[])
21726 {
21727     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21728     check_max ();
21729     check_min ();
21730     return (0);
21731     } /* main */
21732 EOCP
21733         set try
21734         if eval $compile; then
21735             eval `$run ./try 2>/dev/null`
21736         else
21737             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21738             fi
21739         $rm_try
21740         ;;
21741     esac
21742
21743 echo "Checking max offsets that localtime () accepts"
21744
21745 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21746     0/0|/)
21747         $cat >try.c <<EOCP
21748 #include <sys/types.h>
21749 #include <stdio.h>
21750 #include <time.h>
21751
21752 int i;
21753 struct tm *tmp;
21754 time_t pt;
21755
21756 void local_check (time_t t, int min_year, int max_year)
21757 {
21758     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21759         tmp = NULL;
21760     else
21761         tmp = localtime (&t);
21762     if ( tmp == NULL ||
21763         /* Check tm_year overflow */
21764          tmp->tm_year < min_year || tmp->tm_year > max_year)
21765         tmp = NULL;
21766     else
21767         pt = t;
21768     } /* local_check */
21769
21770 int check_max ()
21771 {
21772     tmp = NULL;
21773     pt  = 0;
21774 #ifdef MAXLONG
21775     local_check (MAXLONG, 69, 0x7fffffff);
21776 #endif
21777     if (tmp == NULL || tmp->tm_year < 0) {
21778         for (i = 63; i >= 0; i--) {
21779             time_t x = pt | ((time_t)1 << i);
21780             if (x < 0 || x < pt) continue;
21781             local_check (x, 69, 0x7fffffff);
21782             }
21783         }
21784     printf ("sLOCALTIME_max=%ld\n", pt);
21785     return (0);
21786    } /* check_max */
21787
21788 int check_min ()
21789 {
21790     tmp = NULL;
21791     pt  = 0;
21792 #ifdef MINLONG
21793     local_check (MINLONG, -1900, 70);
21794 #endif
21795     if (tmp == NULL) {
21796         for (i = 36; i >= 0; i--) {
21797             time_t x = pt - ((time_t)1 << i);
21798             if (x > 0) continue;
21799             local_check (x, -1900, 70);
21800             }
21801         }
21802     printf ("sLOCALTIME_min=%ld\n", pt);
21803     return (0);
21804     } /* check_min */
21805
21806 int main (int argc, char *argv[])
21807 {
21808     check_max ();
21809     check_min ();
21810     return (0);
21811     } /* main */
21812 EOCP
21813         set try
21814         if eval $compile; then
21815             eval `$run ./try 2>/dev/null`
21816         else
21817             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21818             fi
21819         $rm_try
21820         ;;
21821     esac
21822
21823 : check for type of arguments to select.
21824 case "$selecttype" in
21825 '') case "$d_select" in
21826         $define)
21827                 echo " "
21828                 $cat <<EOM
21829 Checking to see what type of arguments are accepted by select().
21830 EOM
21831                 hdrs="$define sys/types.h
21832                         $i_systime sys/time.h
21833                         $i_sysselct sys/select.h
21834                         $d_socket sys/socket.h"
21835                 : The first arg can be int, unsigned, or size_t
21836                 : The last arg may or may not be 'const'
21837                 val=''
21838                 : void pointer has been seen but using that
21839                 : breaks the selectminbits test
21840                 for xxx in 'fd_set *' 'int *'; do
21841                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21842                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21843                                         case "$val" in
21844                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21845                                                 if ./protochk "$try" $hdrs; then
21846                                                         echo "Your system accepts $xxx."
21847                                                         val="$xxx"
21848                                                 fi
21849                                                 ;;
21850                                         esac
21851                                 done
21852                         done
21853                 done
21854                 case "$val" in
21855                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21856                         case "$d_fd_set" in
21857                                 $define) dflt="fd_set *" ;;
21858                                 *)              dflt="int *" ;;
21859                         esac
21860                         . ./myread
21861                         val=$ans
21862                         ;;
21863                 esac
21864                 selecttype="$val"
21865                 ;;
21866         *)      : no select, so pick a harmless default
21867                 selecttype='int *'
21868                 ;;
21869         esac
21870         ;;
21871 esac
21872
21873 : check for the select 'width'
21874 case "$selectminbits" in
21875 '') safebits=`expr $ptrsize \* 8`
21876     case "$d_select" in
21877         $define)
21878                 $cat <<EOM
21879
21880 Checking to see on how many bits at a time your select() operates...
21881 EOM
21882                 $cat >try.c <<EOCP
21883 #include <sys/types.h>
21884 #$i_time I_TIME
21885 #$i_systime I_SYS_TIME
21886 #$i_systimek I_SYS_TIME_KERNEL
21887 #ifdef I_TIME
21888 #   include <time.h>
21889 #endif
21890 #ifdef I_SYS_TIME
21891 #   ifdef I_SYS_TIME_KERNEL
21892 #       define KERNEL
21893 #   endif
21894 #   include <sys/time.h>
21895 #   ifdef I_SYS_TIME_KERNEL
21896 #       undef KERNEL
21897 #   endif
21898 #endif
21899 #$i_sysselct I_SYS_SELECT
21900 #ifdef I_SYS_SELECT
21901 #include <sys/select.h>
21902 #endif
21903 #$d_socket HAS_SOCKET
21904 #ifdef HAS_SOCKET
21905 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21906 #endif
21907 #include <stdio.h>
21908 #$i_stdlib I_STDLIB
21909 #ifdef I_STDLIB
21910 #include <stdlib.h>
21911 #endif
21912 $selecttype b;
21913 #define S sizeof(*(b))
21914 #define MINBITS 64
21915 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21916 #define NBITS  (NBYTES * 8)
21917 int main() {
21918     char *s = (char *)malloc(NBYTES);
21919     struct timeval t;
21920     int i;
21921     FILE* fp;
21922     int fd;
21923
21924     if (!s)
21925         exit(1);
21926     fclose(stdin);
21927     fp = fopen("try.c", "r");
21928     if (fp == 0)
21929       exit(2);
21930     fd = fileno(fp);
21931     if (fd < 0)
21932       exit(3);
21933     b = ($selecttype)s;
21934     for (i = 0; i < NBITS; i++)
21935         FD_SET(i, b);
21936     t.tv_sec  = 0;
21937     t.tv_usec = 0;
21938     select(fd + 1, b, 0, 0, &t);
21939     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21940     free(s);
21941     printf("%d\n", i + 1);
21942     return 0;
21943 }
21944 EOCP
21945                 set try
21946                 if eval $compile_ok; then
21947                         selectminbits=`$run ./try 2>/dev/null`
21948                         case "$selectminbits" in
21949                         '')     cat >&4 <<EOM
21950 Cannot figure out on how many bits at a time your select() operates.
21951 I'll play safe and guess it is $safebits bits.
21952 EOM
21953                                 selectminbits=$safebits
21954                                 bits="$safebits bits"
21955                                 ;;
21956                         1)      bits="1 bit" ;;
21957                         *)      bits="$selectminbits bits" ;;
21958                         esac
21959                         echo "Your select() operates on $bits at a time." >&4
21960                 else
21961                         rp='What is the minimum number of bits your select() operates on?'
21962                         case "$byteorder" in
21963                         12345678)       dflt=64 ;;
21964                         1234)           dflt=32 ;;
21965                         *)              dflt=1  ;;
21966                         esac
21967                         . ./myread
21968                         val=$ans
21969                         selectminbits="$val"
21970                 fi
21971                 $rm_try
21972                 ;;
21973         *)      : no select, so pick a harmless default
21974                 selectminbits=$safebits
21975                 ;;
21976         esac
21977         ;;
21978 esac
21979
21980 : Trace out the files included by signal.h, then look for SIGxxx names.
21981 case "$sig_num_init" in
21982 '')
21983 if [ "X$fieldn" = X ]; then
21984         : Just make some guesses.  We check them later.
21985         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21986 else
21987         xxx=`echo '#include <signal.h>' |
21988         $cppstdin $cppminus $cppflags 2>/dev/null |
21989         $grep '^[       ]*#.*include' |
21990         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21991                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21992 fi
21993 xxxfiles=''
21994 for xx in $xxx /dev/null ; do
21995         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21996 done
21997 case "$xxxfiles" in
21998 '')     xxxfiles=`./findhdr signal.h` ;;
21999 esac
22000 xxx=`awk '
22001 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22002         print substr($2, 4, 20)
22003 }
22004 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22005         print substr($3, 4, 20)
22006 }' $xxxfiles`
22007 : Append some common names just in case the awk scan failed.
22008 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22009 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22010 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22011 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22012 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22013
22014 : generate a few handy files for later
22015 $cat > signal.c <<EOCP
22016 #include <sys/types.h>
22017 #include <signal.h>
22018 #$i_stdlib I_STDLIB
22019 #ifdef I_STDLIB
22020 #include <stdlib.h>
22021 #endif
22022 #include <stdio.h>
22023 int main() {
22024
22025 /* Strange style to avoid deeply-nested #if/#else/#endif */
22026 #ifndef NSIG
22027 #  ifdef _NSIG
22028 #    define NSIG (_NSIG)
22029 #  endif
22030 #endif
22031
22032 #ifndef NSIG
22033 #  ifdef SIGMAX
22034 #    define NSIG (SIGMAX+1)
22035 #  endif
22036 #endif
22037
22038 #ifndef NSIG
22039 #  ifdef SIG_MAX
22040 #    define NSIG (SIG_MAX+1)
22041 #  endif
22042 #endif
22043
22044 #ifndef NSIG
22045 #  ifdef _SIG_MAX
22046 #    define NSIG (_SIG_MAX+1)
22047 #  endif
22048 #endif
22049
22050 #ifndef NSIG
22051 #  ifdef MAXSIG
22052 #    define NSIG (MAXSIG+1)
22053 #  endif
22054 #endif
22055
22056 #ifndef NSIG
22057 #  ifdef MAX_SIG
22058 #    define NSIG (MAX_SIG+1)
22059 #  endif
22060 #endif
22061
22062 #ifndef NSIG
22063 #  ifdef SIGARRAYSIZE
22064 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22065 #  endif
22066 #endif
22067
22068 #ifndef NSIG
22069 #  ifdef _sys_nsig
22070 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22071 #  endif
22072 #endif
22073
22074 /* Default to some arbitrary number that's big enough to get most
22075    of the common signals.
22076 */
22077 #ifndef NSIG
22078 #    define NSIG 50
22079 #endif
22080
22081 printf("NSIG %d\n", NSIG);
22082
22083 #ifndef JUST_NSIG
22084
22085 EOCP
22086
22087 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22088 {
22089         printf "#ifdef SIG"; printf $1; printf "\n"
22090         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22091         printf $1; printf ");\n"
22092         printf "#endif\n"
22093 }
22094 END {
22095         printf "#endif /* JUST_NSIG */\n";
22096         printf "exit(0);\n}\n";
22097 }
22098 ' >>signal.c
22099 $cat >signal.awk <<'EOP'
22100 BEGIN { ndups = 0 }
22101 $1 ~ /^NSIG$/ { nsig = $2 }
22102 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22103     if ($2 > maxsig) { maxsig = $2 }
22104     if (sig_name[$2]) {
22105         dup_name[ndups] = $1
22106         dup_num[ndups] = $2
22107         ndups++
22108     }
22109     else {
22110         sig_name[$2] = $1
22111         sig_num[$2] = $2
22112     }
22113 }
22114 END {
22115     if (nsig == 0) {
22116         nsig = maxsig + 1
22117     }
22118     printf("NSIG %d\n", nsig);
22119     for (n = 1; n < nsig; n++) {
22120         if (sig_name[n]) {
22121             printf("%s %d\n", sig_name[n], sig_num[n])
22122         }
22123         else {
22124             printf("NUM%d %d\n", n, n)
22125         }
22126     }
22127     for (n = 0; n < ndups; n++) {
22128         printf("%s %d\n", dup_name[n], dup_num[n])
22129     }
22130 }
22131 EOP
22132 $cat >signal_cmd <<EOS
22133 $startsh
22134 if $test -s signal.lst; then
22135     echo "Using your existing signal.lst file"
22136         exit 0
22137 fi
22138 xxx="$xxx"
22139 EOS
22140 $cat >>signal_cmd <<'EOS'
22141
22142 set signal
22143 if eval $compile_ok; then
22144         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22145                 $uniq | $awk -f signal.awk >signal.lst
22146 else
22147         echo "(I can't seem be able to compile the whole test program)" >&4
22148         echo "(I'll try it in little pieces.)" >&4
22149         set signal -DJUST_NSIG
22150         if eval $compile_ok; then
22151                 $run ./signal$_exe > signal.nsg
22152                 $cat signal.nsg
22153         else
22154                 echo "I can't seem to figure out how many signals you have." >&4
22155                 echo "Guessing 50." >&4
22156                 echo 'NSIG 50' > signal.nsg
22157         fi
22158         : Now look at all the signal names, one at a time.
22159         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22160                 $cat > signal.c <<EOCP
22161 #include <sys/types.h>
22162 #include <signal.h>
22163 #include <stdio.h>
22164 int main() {
22165 printf("$xx %d\n", SIG${xx});
22166 return 0;
22167 }
22168 EOCP
22169                 set signal
22170                 if eval $compile; then
22171                         echo "SIG${xx} found."
22172                         $run ./signal$_exe  >> signal.ls1
22173                 else
22174                         echo "SIG${xx} NOT found."
22175                 fi
22176         done
22177         if $test -s signal.ls1; then
22178                 $cat signal.nsg signal.ls1 |
22179                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22180         fi
22181
22182 fi
22183 if $test -s signal.lst; then
22184         :
22185 else
22186         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22187         echo 'kill -l' >signal
22188         set X `csh -f <signal`
22189         $rm -f signal
22190         shift
22191         case $# in
22192         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22193         esac
22194         echo $@ | $tr ' ' $trnl | \
22195             $awk '{ printf "%s %d\n", $1, ++s; }
22196                   END { printf "NSIG %d\n", ++s }' >signal.lst
22197 fi
22198 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22199 EOS
22200 chmod a+x signal_cmd
22201 $eunicefix signal_cmd
22202 ;;
22203 esac
22204
22205 : generate list of signal names
22206 case "$sig_num_init" in
22207 '')
22208 echo " "
22209 case "$sig_name_init" in
22210 '') doinit=yes ;;
22211 *)  case "$sig_num_init" in
22212     ''|*,*) doinit=yes ;;
22213     esac ;;
22214 esac
22215 case "$doinit" in
22216 yes)
22217         echo "Generating a list of signal names and numbers..." >&4
22218         . ./signal_cmd
22219         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22220         sig_name=`$awk 'BEGIN { printf "ZERO " }
22221                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22222         sig_num=`$awk  'BEGIN { printf "0 " }
22223                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22224         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22225                              !/^NSIG/   { printf "\"%s\", ", $1 }
22226                              END        { printf "0\n" }' signal.lst`
22227         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22228                              !/^NSIG/   { printf "%d, ", $2}
22229                              END        { printf "0\n"}' signal.lst`
22230         ;;
22231 esac
22232 echo "The following $sig_count signals are available:"
22233 echo " "
22234 echo $sig_name | $awk \
22235 'BEGIN { linelen = 0 }
22236 {
22237         for (i = 1; i <= NF; i++) {
22238                 name = "SIG" $i " "
22239                 linelen = linelen + length(name)
22240                 if (linelen > 70) {
22241                         printf "\n"
22242                         linelen = length(name)
22243                 }
22244                 printf "%s", name
22245         }
22246         printf "\n"
22247 }'
22248 sig_size=`echo $sig_name | awk '{print NF}'`
22249 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22250 ;;
22251 esac
22252
22253 : Check size of size
22254 echo " "
22255 case "$sizetype" in
22256 *_t) zzz="$sizetype"    ;;
22257 *)   zzz="filesize"     ;;
22258 esac
22259 echo "Checking the size of $zzz..." >&4
22260 cat > try.c <<EOCP
22261 #include <sys/types.h>
22262 #include <stdio.h>
22263 #$i_stdlib I_STDLIB
22264 #ifdef I_STDLIB
22265 #include <stdlib.h>
22266 #endif
22267 int main() {
22268     printf("%d\n", (int)sizeof($sizetype));
22269     exit(0);
22270 }
22271 EOCP
22272 set try
22273 if eval $compile_ok; then
22274         yyy=`$run ./try`
22275         case "$yyy" in
22276         '')     sizesize=4
22277                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22278                 ;;
22279         *)      sizesize=$yyy
22280                 echo "Your $zzz size is $sizesize bytes."
22281                 ;;
22282         esac
22283 else
22284         sizesize=4
22285         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22286 fi
22287
22288 : check for socklen_t
22289 echo " "
22290 echo "Checking to see if you have socklen_t..." >&4
22291 $cat >try.c <<EOCP
22292 #include <sys/types.h>
22293 #$d_socket HAS_SOCKET
22294 #ifdef HAS_SOCKET
22295 #include <sys/socket.h>
22296 #endif
22297 int main() { socklen_t x = 16; }
22298 EOCP
22299 set try
22300 if eval $compile; then
22301         val="$define"
22302         echo "You have socklen_t."
22303 else
22304         val="$undef"
22305         echo "You do not have socklen_t."
22306         case "$sizetype" in
22307         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22308         esac
22309 fi
22310 $rm_try
22311 set d_socklen_t
22312 eval $setvar
22313
22314 : see if this is a socks.h system
22315 set socks.h i_socks
22316 eval $inhdr
22317
22318 : check for type of the size argument to socket calls
22319 case "$d_socket" in
22320 "$define")
22321         $cat <<EOM
22322
22323 Checking to see what type is the last argument of accept().
22324 EOM
22325         yyy=''
22326         case "$d_socklen_t" in
22327         "$define") yyy="$yyy socklen_t"
22328         esac
22329         yyy="$yyy $sizetype int long unsigned"
22330         for xxx in $yyy; do
22331                 case "$socksizetype" in
22332                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22333                         case "$usesocks" in
22334                         "$define")
22335                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22336                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22337                                         socksizetype="$xxx"
22338                                 fi
22339                                 ;;
22340                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22341                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22342                                         socksizetype="$xxx"
22343                                 fi
22344                                 ;;
22345                         esac
22346                         ;;
22347                 esac
22348         done
22349 : In case none of those worked, prompt the user.
22350         case "$socksizetype" in
22351         '')     rp='What is the type for socket address structure sizes?'
22352                 dflt='int'
22353                 . ./myread
22354                 socksizetype=$ans
22355                 ;;
22356         esac
22357         ;;
22358 *)      : no sockets, so pick relatively harmless default
22359         socksizetype='int'
22360         ;;
22361 esac
22362
22363 : see what type is used for signed size_t
22364 set ssize_t ssizetype int stdio.h sys/types.h
22365 eval $typedef
22366 dflt="$ssizetype"
22367 $cat > try.c <<EOM
22368 #include <stdio.h>
22369 #$i_stdlib I_STDLIB
22370 #ifdef I_STDLIB
22371 #include <stdlib.h>
22372 #endif
22373 #include <sys/types.h>
22374 #define Size_t $sizetype
22375 #define SSize_t $dflt
22376 int main()
22377 {
22378         if (sizeof(Size_t) == sizeof(SSize_t))
22379                 printf("$dflt\n");
22380         else if (sizeof(Size_t) == sizeof(int))
22381                 printf("int\n");
22382         else
22383                 printf("long\n");
22384         exit(0);
22385 }
22386 EOM
22387 echo " "
22388 set try
22389 if eval $compile_ok && $run ./try > /dev/null; then
22390         ssizetype=`$run ./try`
22391         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22392 else
22393         $cat >&4 <<EOM
22394 Help! I can't compile and run the ssize_t test program: please enlighten me!
22395 (This is probably a misconfiguration in your system or libraries, and
22396 you really ought to fix it.  Still, I'll try anyway.)
22397
22398 I need a type that is the same size as $sizetype, but is guaranteed to
22399 be signed.  Common values are ssize_t, int and long.
22400
22401 EOM
22402         rp="What signed type is the same size as $sizetype?"
22403         . ./myread
22404         ssizetype="$ans"
22405 fi
22406 $rm_try
22407
22408 : Check the size of st_ino
22409 $echo " "
22410 $echo "Checking the size of st_ino..." >&4
22411 $cat > try.c <<EOCP
22412 #include <sys/stat.h>
22413 #include <stdio.h>
22414 #$i_stdlib I_STDLIB
22415 #ifdef I_STDLIB
22416 #include <stdlib.h>
22417 #endif
22418 int main() {
22419     struct stat st;
22420     printf("%d\n", (int)sizeof(st.st_ino));
22421     exit(0);
22422 }
22423 EOCP
22424 set try
22425 if eval $compile_ok; then
22426         val=`$run ./try`
22427         case "$val" in
22428         '')     st_ino_size=4
22429                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22430                 ;;
22431         *)      st_ino_size=$val
22432                 $echo "Your st_ino is $st_ino_size bytes long."
22433                 ;;
22434         esac
22435 else
22436         st_ino_size=4
22437         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22438 fi
22439 $rm_try
22440
22441 : Check if st_ino is signed
22442 $echo " "
22443 $echo "Checking the sign of st_ino..." >&4
22444 $cat > try.c <<EOCP
22445 #include <sys/stat.h>
22446 #include <stdio.h>
22447 int main() {
22448         struct stat foo;
22449         foo.st_ino = -1;
22450         if (foo.st_ino < 0)
22451                 printf("-1\n");
22452         else
22453                 printf("1\n");
22454 }
22455 EOCP
22456 set try
22457 if eval $compile; then
22458         val=`$run ./try`
22459         case "$val" in
22460         '')     st_ino_sign=1
22461                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22462                 ;;
22463         *)      st_ino_sign=$val
22464                 case "$st_ino_sign" in
22465                  1) $echo "Your st_ino is unsigned." ;;
22466                 -1) $echo "Your st_ino is signed."   ;;
22467                 esac
22468                 ;;
22469         esac
22470 else
22471         st_ino_sign=1
22472         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22473 fi
22474 $rm_try
22475
22476 : see what type of char stdio uses.
22477 echo " "
22478 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22479 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22480         echo "Your stdio uses unsigned chars." >&4
22481         stdchar="unsigned char"
22482 else
22483         echo "Your stdio uses signed chars." >&4
22484         stdchar="char"
22485 fi
22486 $rm -f stdioh
22487
22488 : Check size of UID
22489 echo " "
22490 case "$uidtype" in
22491 *_t) zzz="$uidtype"     ;;
22492 *)   zzz="uid"          ;;
22493 esac
22494 echo "Checking the size of $zzz..." >&4
22495 cat > try.c <<EOCP
22496 #include <sys/types.h>
22497 #include <stdio.h>
22498 #$i_stdlib I_STDLIB
22499 #ifdef I_STDLIB
22500 #include <stdlib.h>
22501 #endif
22502 int main() {
22503     printf("%d\n", (int)sizeof($uidtype));
22504     exit(0);
22505 }
22506 EOCP
22507 set try
22508 if eval $compile_ok; then
22509         yyy=`$run ./try`
22510         case "$yyy" in
22511         '')     uidsize=4
22512                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22513                 ;;
22514         *)      uidsize=$yyy
22515                 echo "Your $zzz is $uidsize bytes long."
22516                 ;;
22517         esac
22518 else
22519         uidsize=4
22520         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22521 fi
22522
22523 : Check if UID is signed
22524 echo " "
22525 case "$uidtype" in
22526 *_t) zzz="$uidtype"     ;;
22527 *)   zzz="uid"          ;;
22528 esac
22529 echo "Checking the sign of $zzz..." >&4
22530 cat > try.c <<EOCP
22531 #include <sys/types.h>
22532 #include <stdio.h>
22533 int main() {
22534         $uidtype foo = -1;
22535         if (foo < 0)
22536                 printf("-1\n");
22537         else
22538                 printf("1\n");
22539 }
22540 EOCP
22541 set try
22542 if eval $compile; then
22543         yyy=`$run ./try`
22544         case "$yyy" in
22545         '')     uidsign=1
22546                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22547                 ;;
22548         *)      uidsign=$yyy
22549                 case "$uidsign" in
22550                  1) echo "Your $zzz is unsigned." ;;
22551                 -1) echo "Your $zzz is signed."   ;;
22552                 esac
22553                 ;;
22554         esac
22555 else
22556         uidsign=1
22557         echo "(I can't compile the test program--guessing unsigned.)" >&4
22558 fi
22559
22560 : Check format string for UID
22561 echo " "
22562 $echo "Checking the format string to be used for uids..." >&4
22563
22564 case "$uidsign" in
22565 -1)     if $test X"$uidsize" = X"$ivsize"; then
22566                 uidformat="$ivdformat"
22567         else
22568                 if $test X"$uidsize" = X"$longsize"; then
22569                         uidformat='"ld"'
22570                 else
22571                         if $test X"$uidsize" = X"$intsize"; then
22572                                 uidformat='"d"'
22573                         else
22574                                 if $test X"$uidsize" = X"$shortsize"; then
22575                                         uidformat='"hd"'
22576                                 fi
22577                         fi
22578                 fi
22579         fi
22580         ;;
22581 *)      if $test X"$uidsize" = X"$uvsize"; then
22582                 uidformat="$uvuformat"
22583         else
22584                 if $test X"$uidsize" = X"$longsize"; then
22585                         uidformat='"lu"'
22586                 else
22587                         if $test X"$uidsize" = X"$intsize"; then
22588                                 uidformat='"u"'
22589                         else
22590                                 if $test X"$uidsize" = X"$shortsize"; then
22591                                         uidformat='"hu"'
22592                                 fi
22593                         fi
22594                 fi
22595         fi
22596         ;;
22597 esac
22598
22599 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22600 echo " "
22601 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22602 $cat >try.c <<'EOM'
22603 /* Intentionally a long probe as I'd like to sanity check that the exact
22604    approach is going to work, as thinking it will work, but only having it
22605    part working at runtime is worse than not having it.  */
22606
22607 #include <sys/types.h>
22608 #include <sys/sysctl.h>
22609 #include <sys/param.h>
22610 #include <stdio.h>
22611 #include <string.h>
22612 #include <stdlib.h>
22613 #include <unistd.h>
22614
22615 int
22616 main(int argc, char **argv) {
22617     char *buffer;
22618     char *argv_leaf = strrchr(argv[0], '/');
22619     char *buffer_leaf;
22620     size_t size = 0;
22621     int mib[4];
22622
22623     mib[0] = CTL_KERN;
22624     mib[1] = KERN_PROC;
22625     mib[2] = KERN_PROC_PATHNAME;
22626     mib[3] = -1;
22627
22628     if (!argv_leaf) {
22629         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22630         return 1;
22631     }
22632
22633     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22634         perror("sysctl");
22635         return 2;
22636     }
22637
22638     if (size < strlen(argv_leaf) + 1) {
22639         fprintf(stderr, "size %lu is too short for a path\n",
22640                 (unsigned long) size);
22641         return 3;
22642     }
22643
22644     if (size > MAXPATHLEN * MAXPATHLEN) {
22645         fprintf(stderr, "size %lu is too long for a path\n",
22646                 (unsigned long) size);
22647         return 4;
22648     }
22649
22650     buffer = (char *)malloc(size);
22651     if (!buffer) {
22652         perror("malloc");
22653         return 5;
22654     }
22655
22656     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22657         perror("sysctl");
22658         return 6;
22659     }
22660
22661     if (strlen(buffer) + 1 != size) {
22662         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22663                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22664         return 7;
22665     }
22666
22667
22668     if (*buffer != '/') {
22669         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22670         return 8;
22671     }
22672
22673     if (strstr(buffer, "/./")) {
22674         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22675         return 9;
22676     }
22677
22678     if (strstr(buffer, "/../")) {
22679         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22680         return 10;
22681     }
22682
22683     buffer_leaf = strrchr(buffer, '/');
22684     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22685         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22686         return 11;
22687     }
22688
22689     free(buffer);
22690
22691     return 0;
22692 }
22693 EOM
22694
22695 val=$undef
22696 set try
22697 if eval $compile; then
22698         if $run ./try; then
22699                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22700                 val="$define"
22701         else
22702                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22703                 val="$undef"
22704         fi
22705 else
22706         echo "I'm unable to compile the test program." >&4
22707         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22708         val="$undef"
22709 fi
22710 $rm_try
22711 set usekernprocpathname
22712 eval $setvar
22713
22714 : Determine if we can use _NSGetExecutablePath to find executing program
22715 echo " "
22716 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22717 $cat >try.c <<'EOM'
22718 /* Intentionally a long probe as I'd like to sanity check that the exact
22719    approach is going to work, as thinking it will work, but only having it
22720    part working at runtime is worse than not having it.  */
22721 #include <mach-o/dyld.h>
22722 #include <stdio.h>
22723 #include <stdlib.h>
22724 #include <sys/param.h>
22725 #include <string.h>
22726
22727 int
22728 main(int argc, char **argv) {
22729     char buf[1];
22730     uint32_t size = sizeof(buf);
22731     int result;
22732     char *buffer;
22733     char *tidied;
22734     char *argv_leaf = strrchr(argv[0], '/');
22735     char *tidied_leaf;
22736
22737     if (!argv_leaf) {
22738         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22739         return 1;
22740     }
22741
22742     _NSGetExecutablePath(buf, &size);
22743     if (size > MAXPATHLEN * MAXPATHLEN) {
22744         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22745                 (unsigned int) size);
22746         return 2;
22747     }
22748
22749     buffer = (char *)malloc(size);
22750     if (!buffer) {
22751         perror("malloc");
22752         return 3;
22753     }
22754
22755     result = _NSGetExecutablePath(buffer, &size);
22756     if (result != 0) {
22757         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22758                 result, (unsigned int) size);
22759         return 4;
22760     }
22761
22762     tidied = realpath(buffer, NULL);
22763     if (!tidied) {
22764         perror("realpath");
22765         return 5;
22766     }
22767
22768     free(buffer);
22769
22770     if (*tidied != '/') {
22771         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22772         return 6;
22773     }
22774
22775     if (strstr(tidied, "/./")) {
22776         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22777         return 7;
22778     }
22779
22780     if (strstr(tidied, "/../")) {
22781         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22782         return 8;
22783     }
22784
22785     tidied_leaf = strrchr(tidied, '/');
22786     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22787         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22788         return 9;
22789     }
22790
22791     free(tidied);
22792
22793     return 0;
22794 }
22795 EOM
22796
22797 val=$undef
22798 set try
22799 if eval $compile; then
22800         if $run ./try; then
22801                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22802                 val="$define"
22803         else
22804                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22805         fi
22806 else
22807         echo "I'm unable to compile the test program." >&4
22808         echo "I'll assume no _NSGetExecutablePath here." >&4
22809 fi
22810 $rm_try
22811 set usensgetexecutablepath
22812 eval $setvar
22813
22814 : Check if site customization support was requested
22815 case "$usesitecustomize" in
22816     $define|true|[Yy]*)
22817         usesitecustomize="$define"
22818         ;;
22819     *)
22820         usesitecustomize="$undef"
22821         ;;
22822     esac
22823
22824 : determine compiler compiler
22825 case "$yacc" in
22826 '')
22827         dflt=yacc;;
22828 *)
22829         dflt="$yacc";;
22830 esac
22831 echo " "
22832 comp='yacc'
22833 if $test -f "$byacc$_exe"; then
22834         dflt="$byacc"
22835         comp="byacc or $comp"
22836 fi
22837 if $test -f "$bison$_exe"; then
22838         comp="$comp or bison -y"
22839 fi
22840 rp="Which compiler compiler ($comp) shall I use?"
22841 . ./myread
22842 yacc="$ans"
22843 case "$yacc" in
22844 *bis*)
22845         case "$yacc" in
22846         *-y*) ;;
22847         *)
22848                 yacc="$yacc -y"
22849                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22850                 ;;
22851         esac
22852         ;;
22853 esac
22854
22855 : see if this is a bfd.h system
22856 set bfd.h i_bfd
22857 eval $inhdr
22858
22859 : see if this is an execinfo.h system
22860 set execinfo.h i_execinfo
22861 eval $inhdr
22862
22863 : see if this is a fenv.h system
22864 set fenv.h i_fenv
22865 eval $inhdr
22866
22867 : see if this is a fp.h system
22868 set fp.h i_fp
22869 eval $inhdr
22870
22871 : see if this is a fp_class.h system
22872 set fp_class.h i_fp_class
22873 eval $inhdr
22874
22875 : see if gdbm.h is available
22876 set gdbm.h t_gdbm
22877 eval $inhdr
22878 case "$t_gdbm" in
22879 $define)
22880         : see if gdbm_open exists
22881         set gdbm_open d_gdbm_open
22882         eval $inlibc
22883         case "$d_gdbm_open" in
22884         $undef)
22885                 t_gdbm="$undef"
22886                 echo "We won't be including <gdbm.h>"
22887                 ;;
22888         esac
22889         ;;
22890 esac
22891 val="$t_gdbm"
22892 set i_gdbm
22893 eval $setvar
22894
22895 : see if this is a ieeefp.h system
22896 case "$i_ieeefp" in
22897 '' ) set ieeefp.h i_ieeefp
22898      eval $inhdr
22899      ;;
22900 esac
22901
22902 : see if this is a libutil.h system
22903 set libutil.h i_libutil
22904 eval $inhdr
22905
22906 : see if mach cthreads are available
22907 if test "X$usethreads" = "X$define"; then
22908         set mach/cthreads.h i_machcthr
22909         eval $inhdr
22910 else
22911         i_machcthr="$undef"
22912 fi
22913
22914 : see if this is a mntent.h system
22915 set mntent.h i_mntent
22916 eval $inhdr
22917
22918 : see if net/errno.h is available
22919 val=''
22920 set net/errno.h val
22921 eval $inhdr
22922
22923 : Unfortunately, it causes problems on some systems.  Arrgh.
22924 case "$val" in
22925 $define)
22926         cat > try.c <<'EOM'
22927 #include <stdio.h>
22928 #include <errno.h>
22929 #include <net/errno.h>
22930 int func()
22931 {
22932         return ENOTSOCK;
22933 }
22934 EOM
22935         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22936                 echo "We'll be including <net/errno.h>." >&4
22937         else
22938                 echo "We won't be including <net/errno.h>." >&4
22939                 val="$undef"
22940         fi
22941         $rm_try
22942         ;;
22943 esac
22944 set i_neterrno
22945 eval $setvar
22946
22947 : see if netinet/tcp.h is available
22948 set netinet/tcp.h i_netinettcp
22949 eval $inhdr
22950
22951 : see if this is a poll.h system
22952 set poll.h i_poll
22953 eval $inhdr
22954
22955 : see if this is a prot.h system
22956 set prot.h i_prot
22957 eval $inhdr
22958
22959 : Preprocessor symbols
22960 echo " "
22961 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22962 $cat <<'EOSH' > Cppsym.know
22963 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22964 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22965 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22966 arch_pwr ardent ARM ARM32 atarist att386 att3b
22967 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22968 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22969 byteorder byte_order
22970 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22971 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22972 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22973 ELF encore EPI EXTENSIONS
22974 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22975 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22976 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22977 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22978 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22979 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22980 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22981 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22982 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22983 ksr1
22984 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22985 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22986 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22987 luna88k Lynx
22988 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22989 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22990 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22991 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22992 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
22993 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22994 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22995 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22996 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22997 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22998 ns32000 ns32016 ns32332 ns32k nsc32000
22999 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23000 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23001 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23002 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23003 QK_USER QNX
23004 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23005 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23006 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23007 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23008 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23009 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23010 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23011 SYSV4 SYSV5 sysV68 sysV88
23012 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23013 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23014 tower32_800 tower32_850 tss
23015 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23016 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23017 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23018 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23019 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23020 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23021 uxpm uxps
23022 vax venix VMESA vms
23023 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23024 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23025 z8000 zarch
23026 EOSH
23027 # Maybe put other stuff here too.
23028 ./tr '-' '_' <<EOSH >>Cppsym.know
23029 $osname
23030 EOSH
23031 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23032 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23033 $cat Cppsym.know > Cppsym.c
23034 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23035 $rm -f Cppsym.a Cppsym.b Cppsym.c
23036 cat <<EOSH > Cppsym
23037 $startsh
23038 if $test \$# -gt 0; then
23039     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23040     if $test -s Cppsym.got; then
23041         $rm -f Cppsym.got
23042         exit 0
23043     fi
23044     $rm -f Cppsym.got
23045     exit 1
23046 else
23047     $tr " " "$trnl" | ./Cppsym.try
23048     exit 0
23049 fi
23050 EOSH
23051 chmod +x Cppsym
23052 $eunicefix Cppsym
23053 cat <<EOSH > Cppsym.try
23054 $startsh
23055 cat <<'EOCP' > try.c
23056 #include <stdio.h>
23057 #if cpp_stuff == 1
23058 #define STRINGIFY(a)    "a"
23059 #endif
23060 #if cpp_stuff == 42
23061 #define StGiFy(a)  #a
23062 #define STRINGIFY(a)    StGiFy(a)
23063 #endif
23064 #if $cpp_stuff != 1 && $cpp_stuff != 42
23065 #   include "Bletch: How does this C preprocessor stringify macros?"
23066 #endif
23067 int main() {
23068 EOCP
23069 $awk \\
23070 EOSH
23071 cat <<'EOSH' >> Cppsym.try
23072 'length($1) > 0 {
23073     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23074     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23075     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23076     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23077 }' >> try.c
23078 echo 'return 0;}' >> try.c
23079 EOSH
23080 cat <<EOSH >> Cppsym.try
23081 ccflags="$ccflags"
23082 case "$osname-$gccversion" in
23083 irix-) ccflags="\$ccflags -woff 1178" ;;
23084 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23085 esac
23086 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23087 EOSH
23088 chmod +x Cppsym.try
23089 $eunicefix Cppsym.try
23090 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23091 : Add in any Linux cpp "predefined macros":
23092 case "$osname::$gccversion" in
23093   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23094     tHdrH=_tmpHdr
23095     rm -f $tHdrH'.h' $tHdrH
23096     touch $tHdrH'.h'
23097     # Filter out macro arguments, such as Linux's __INT8_C(c)
23098     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23099        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23100        if [ -s $tHdrH'_cppsym.real' ]; then
23101           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23102        fi
23103     fi
23104     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23105   ;;
23106 esac
23107 : now check the C compiler for additional symbols
23108 postprocess_cc_v=''
23109 case "$osname" in
23110 aix) postprocess_cc_v="|$tr , ' '" ;;
23111 esac
23112 $cat >ccsym <<EOS
23113 $startsh
23114 $cat >tmp.c <<EOF
23115 extern int foo;
23116 EOF
23117 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23118 do
23119         case "\$i" in
23120         -D*) echo "\$i" | $sed 's/^-D//';;
23121         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23122         esac
23123 done
23124 $rm_try
23125 EOS
23126 postprocess_cc_v=''
23127 chmod +x ccsym
23128 $eunicefix ccsym
23129 ./ccsym > ccsym1.raw
23130 if $test -s ccsym1.raw; then
23131     $sort ccsym1.raw | $uniq >ccsym.raw
23132 else
23133     mv ccsym1.raw ccsym.raw
23134 fi
23135
23136 $awk '/\=/ { print $0; next }
23137         { print $0"=1" }' ccsym.raw >ccsym.list
23138 $comm -13 Cppsym.true ccsym.list >ccsym.own
23139 $comm -12 Cppsym.true ccsym.list >ccsym.com
23140 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23141 also=''
23142 if $test -z ccsym.raw; then
23143         echo "Your C compiler doesn't seem to define any symbols!" >&4
23144         echo " "
23145         echo "However, your C preprocessor defines the following symbols:"
23146         $cat Cppsym.true
23147         ccsymbols=''
23148         cppsymbols=`$cat Cppsym.true`
23149         cppsymbols=`echo $cppsymbols`
23150         cppccsymbols="$cppsymbols"
23151 else
23152         if $test -s ccsym.com; then
23153                 echo "Your C compiler and pre-processor define these symbols:"
23154                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23155                 also='also '
23156                 symbols='ones'
23157                 cppccsymbols=`$cat ccsym.com`
23158                 cppccsymbols=`echo $cppccsymbols`
23159                 $test "$silent" || sleep 1
23160         fi
23161         if $test -s ccsym.cpp; then
23162                 $test "$also" && echo " "
23163                 echo "Your C pre-processor ${also}defines the following symbols:"
23164                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23165                 also='further '
23166                 cppsymbols=`$cat ccsym.cpp`
23167                 cppsymbols=`echo $cppsymbols`
23168                 $test "$silent" || sleep 1
23169         fi
23170         if $test -s ccsym.own; then
23171                 $test "$also" && echo " "
23172                 echo "Your C compiler ${also}defines the following cpp symbols:"
23173                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23174                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23175                 ccsymbols=`$cat ccsym.own`
23176                 ccsymbols=`echo $ccsymbols`
23177                 $test "$silent" || sleep 1
23178         fi
23179 fi
23180
23181 : add -D_FORTIFY_SOURCE if feasible and not already there
23182 case "$gccversion" in
23183 [456789].*)     case "$optimize$ccflags" in
23184         *-O*)   case "$ccflags$cppsymbols" in
23185                 *_FORTIFY_SOURCE=*) # Don't add it again.
23186                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23187                         ;;
23188                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23189                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23190                         ;;
23191                 esac
23192                 ;;
23193         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23194                 ;;
23195         esac
23196         ;;
23197 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23198         ;;
23199 esac
23200
23201 : script used to emit important warnings
23202 cat >warn <<EOS
23203 $startsh
23204 if test \$# -gt 0; then
23205         echo "\$@" >msg
23206 else
23207         cat >msg
23208 fi
23209 echo "*** WARNING:" >&4
23210 sed -e 's/^/*** /' <msg >&4
23211 echo "*** " >&4
23212 cat msg >>config.msg
23213 echo " " >>config.msg
23214 rm -f msg
23215 EOS
23216 chmod +x warn
23217 $eunicefix warn
23218
23219 : see if this is a termio system
23220 val="$undef"
23221 val2="$undef"
23222 val3="$undef"
23223 if $test `./findhdr termios.h`; then
23224     set tcsetattr i_termios
23225     eval $inlibc
23226     val3="$i_termios"
23227 fi
23228 echo " "
23229 case "$val3" in
23230     "$define") echo "You have POSIX termios.h... good!" >&4;;
23231     *)  if ./Cppsym pyr; then
23232             case "`$run /bin/universe`" in
23233                 ucb) if $test `./findhdr sgtty.h`; then
23234                         val2="$define"
23235                         echo "<sgtty.h> found." >&4
23236                     else
23237                         echo "System is pyramid with BSD universe."
23238                         ./warn "<sgtty.h> not found--you could have problems."
23239                     fi;;
23240                 *)  if $test `./findhdr termio.h`; then
23241                         val="$define"
23242                         echo "<termio.h> found." >&4
23243                     else
23244                         echo "System is pyramid with USG universe."
23245                         ./warn "<termio.h> not found--you could have problems."
23246                     fi;;
23247             esac
23248         elif ./usg; then
23249             if $test `./findhdr termio.h`; then
23250                 echo "<termio.h> found." >&4
23251                 val="$define"
23252             elif $test `./findhdr sgtty.h`; then
23253                 echo "<sgtty.h> found." >&4
23254                 val2="$define"
23255             else
23256                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23257             fi
23258         else
23259             if $test `./findhdr sgtty.h`; then
23260                 echo "<sgtty.h> found." >&4
23261                 val2="$define"
23262             elif $test `./findhdr termio.h`; then
23263                 echo "<termio.h> found." >&4
23264                 val="$define"
23265             else
23266                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23267             fi
23268         fi;;
23269 esac
23270 set i_termio; eval $setvar
23271 val=$val2; set i_sgtty; eval $setvar
23272 val=$val3; set i_termios; eval $setvar
23273
23274 : see if stdbool is available
23275 : we want a real compile instead of Inhdr because some Solaris systems
23276 : have stdbool.h, but it can only be used if the compiler indicates it
23277 : is sufficiently c99-compliant.
23278 echo " "
23279 $cat >try.c <<EOCP
23280 #include <stdio.h>
23281 #include <stdbool.h>
23282 int func(bool x)
23283 {
23284     return x ? 1 : 0;
23285 }
23286 int main(int argc, char **argv)
23287 {
23288     return func(0);
23289 }
23290 EOCP
23291 set try
23292 if eval $compile; then
23293         echo "<stdbool.h> found." >&4
23294         val="$define"
23295 else
23296         echo "<stdbool.h> NOT found." >&4
23297         val="$undef"
23298 fi
23299 $rm_try
23300 set i_stdbool
23301 eval $setvar
23302
23303 : see if stdint is available
23304 set stdint.h i_stdint
23305 eval $inhdr
23306
23307 : see if sys/access.h is available
23308 set sys/access.h i_sysaccess
23309 eval $inhdr
23310
23311 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23312 set sys/filio.h i_sysfilio
23313 eval $inhdr
23314 echo " "
23315 if $test `./findhdr sys/ioctl.h`; then
23316         val="$define"
23317         echo '<sys/ioctl.h> found.' >&4
23318 else
23319         val="$undef"
23320         if $test $i_sysfilio = "$define"; then
23321             echo '<sys/ioctl.h> NOT found.' >&4
23322         else
23323                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23324                 $test $i_termio = "$define" && xxx="termio.h"
23325                 $test $i_termios = "$define" && xxx="termios.h"
23326 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23327         fi
23328 fi
23329 set i_sysioctl
23330 eval $setvar
23331
23332 : see if socket ioctl defs are in sys/sockio.h
23333 echo " "
23334 xxx=`./findhdr sys/sockio.h`
23335 if $test "$xxx"; then
23336         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23337                 val="$define"
23338                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23339         else
23340                 val="$undef"
23341                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23342         fi
23343 else
23344         val="$undef"
23345         $cat <<EOM
23346 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23347 EOM
23348 fi
23349 set i_syssockio
23350 eval $setvar
23351
23352 : see if this is a syslog.h system
23353 set syslog.h i_syslog
23354 eval $inhdr
23355
23356 : see if this is a sys/mode.h system
23357 set sys/mode.h i_sysmode
23358 eval $inhdr
23359
23360 : see if there is a sys/poll.h file
23361 set sys/poll.h i_syspoll
23362 eval $inhdr
23363
23364 : see if sys/resource.h has to be included
23365 set sys/resource.h i_sysresrc
23366 eval $inhdr
23367
23368 : see if sys/security.h is available
23369 set sys/security.h i_syssecrt
23370 eval $inhdr
23371
23372 : see if this is a sys/statvfs.h system
23373 set sys/statvfs.h i_sysstatvfs
23374 eval $inhdr
23375
23376 : see if this is a sys/un.h system
23377 set sys/un.h i_sysun
23378 eval $inhdr
23379
23380 : see if this is a sys/utsname.h system
23381 set sys/utsname.h i_sysutsname
23382 eval $inhdr
23383
23384 : see if this is a syswait system
23385 set sys/wait.h i_syswait
23386 eval $inhdr
23387
23388 : see if this is a ustat.h system
23389 set ustat.h i_ustat
23390 eval $inhdr
23391
23392 : see if this is an utime system
23393 set utime.h i_utime
23394 eval $inhdr
23395
23396 : see if this is a vfork system
23397 case "$d_vfork" in
23398 "$define")
23399         set vfork.h i_vfork
23400         eval $inhdr
23401         ;;
23402 *)
23403         i_vfork="$undef"
23404         ;;
23405 esac
23406
23407 : see if wchar.h is present
23408 set wchar.h i_wchar
23409 eval $inhdr
23410
23411 : Check extensions
23412 echo " "
23413 echo "Looking for extensions..." >&4
23414 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23415 : contain old or inaccurate or duplicate values.
23416 nonxs_extensions=''
23417 xs_extensions=''
23418 : We do not use find because it might not be available.
23419 : We do not just use MANIFEST because the user may have dropped
23420 : some additional extensions into the source tree and expect them
23421 : to be built.
23422
23423 : Function to recursively find available extensions, ignoring DynaLoader
23424 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23425 : In 5.10.1 and later, extensions are stored in directories
23426 : like File-Glob instead of the older File/Glob/.
23427 find_extensions='
23428     for xxx in *; do
23429         case "$xxx" in
23430             DynaLoader|dynaload) ;;
23431             *)
23432             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23433             case "$this_ext" in
23434                 Scalar/List/Utils) this_ext="List/Util" ;;
23435                 PathTools)         this_ext="Cwd"       ;;
23436             esac;
23437             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23438             if $contains " $this_ext " "$tdir/$$.tmp"; then
23439                 echo >&4;
23440                 echo "Duplicate directories detected for extension $xxx" >&4;
23441                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23442                 case "$knowitall" in
23443                 "") dflt=y;;
23444                 *) dflt=n;;
23445                 esac;
23446                 . ../UU/myread;
23447                 case "$ans" in
23448                 n*|N*) ;;
23449                 *) echo >&4;
23450                     echo "Ok.  Stopping Configure." >&4;
23451                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23452                     exit 1;;
23453                 esac;
23454                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23455             fi;
23456             $ls -1 "$xxx" > "$tdir/$$.tmp";
23457             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23458                 xs_extensions="$xs_extensions $this_ext";
23459             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23460                 xs_extensions="$xs_extensions $this_ext";
23461             elif $test -d "$xxx"; then
23462                 nonxs_extensions="$nonxs_extensions $this_ext";
23463             fi;
23464             $rm -f "$tdir/$$.tmp";
23465             ;;
23466         esac;
23467     done'
23468 tdir=`pwd`
23469 cd "$rsrc/cpan"
23470 set X
23471 shift
23472 eval $find_extensions
23473 cd "$rsrc/dist"
23474 set X
23475 shift
23476 eval $find_extensions
23477 cd "$rsrc/ext"
23478 set X
23479 shift
23480 eval $find_extensions
23481 set X $xs_extensions
23482 shift
23483 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23484 set X $nonxs_extensions
23485 shift
23486 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23487 cd "$tdir"
23488 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23489
23490 : Now see which are supported on this system.
23491 avail_ext=''
23492 for xxx in $xs_extensions ; do
23493         case "$xxx" in
23494         Amiga*)
23495                 case "$osname" in
23496                 amigaos) avail_ext="$avail_ext $xxx" ;;
23497                 esac
23498                 ;;
23499         DB_File|db_file)
23500                 case "$i_db" in
23501                 $define) avail_ext="$avail_ext $xxx" ;;
23502                 esac
23503                 ;;
23504         GDBM_File|gdbm_fil)
23505                 case "$i_gdbm" in
23506                 $define) avail_ext="$avail_ext $xxx" ;;
23507                 esac
23508                 ;;
23509         IPC/SysV|ipc/sysv)
23510                 : XXX Do we need a useipcsysv variable here
23511                 case "${d_msg}${d_sem}${d_shm}" in
23512                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23513                 esac
23514                 ;;
23515         NDBM_File|ndbm_fil)
23516                 case "$d_ndbm" in
23517                 $define)
23518                     case "$osname-$use64bitint" in
23519                     hpux-define)
23520                         case "$libs" in
23521                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23522                         esac
23523                         ;;
23524                     *) avail_ext="$avail_ext $xxx" ;;
23525                     esac
23526                     ;;
23527                 esac
23528                 ;;
23529         ODBM_File|odbm_fil)
23530                 case "${i_dbm}${i_rpcsvcdbm}" in
23531                 *"${define}"*)
23532                     case "$d_cplusplus" in
23533                     define) ;; # delete as a function name will not work
23534                     *)  case "$osname-$use64bitint" in
23535                         hpux-define)
23536                             case "$libs" in
23537                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23538                             esac
23539                             ;;
23540                         *) avail_ext="$avail_ext $xxx" ;;
23541                         esac
23542                         ;;
23543                     esac
23544                     ;;
23545                 esac
23546                 ;;
23547         Opcode|opcode)
23548                 case "$useopcode" in
23549                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23550                 esac
23551                 ;;
23552         POSIX|posix)
23553                 case "$useposix" in
23554                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23555                 esac
23556                 ;;
23557         Socket|socket)
23558                 case "$d_socket" in
23559                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23560                 esac
23561                 ;;
23562         I18N/Langinfo|langinfo)
23563                 case "$uselanginfo" in
23564                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23565                 esac
23566                 ;;
23567         Sys/Syslog|sys/syslog)
23568                 case $osname in
23569                         amigaos) ;; # not really very useful on AmigaOS
23570                         *)
23571                         : XXX syslog requires socket
23572                         case "$d_socket" in
23573                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23574                         esac
23575                         ;;
23576                 esac
23577                 ;;
23578         Thread|thread)
23579                 case "$usethreads" in
23580                 true|$define|y)
23581                         case "$use5005threads" in
23582                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23583                         esac
23584                 esac
23585                 ;;
23586         threads|threads/shared)
23587                 # threads and threads::shared are special cases.
23588                 # To stop people from asking "Perl 5.8.0 was supposed
23589                 # to have this new fancy threads implementation but my
23590                 # perl doesn't have it" and from people trying to
23591                 # (re)install the threads module using CPAN.pm and
23592                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23593                 # the threads.pm and threads/shared.pm will always be
23594                 # there, croaking informatively ("you need to rebuild
23595                 # all of Perl with threads, sorry") when threads haven't
23596                 # been compiled in.
23597                 # --jhi
23598                 avail_ext="$avail_ext $xxx"
23599                 ;;
23600         VMS*)
23601                 ;;
23602         Win32*)
23603                 case "$osname" in
23604                 cygwin) avail_ext="$avail_ext $xxx" ;;
23605                 esac
23606                 ;;
23607         XS/APItest|xs/apitest)
23608                 # This is just for testing.  Skip it unless we have dynamic loading.
23609
23610                 case "$usedl" in
23611                 $define) avail_ext="$avail_ext $xxx" ;;
23612                 esac
23613                 ;;
23614         XS/Typemap|xs/typemap)
23615                 # This is just for testing.  Skip it unless we have dynamic loading.
23616                 case "$usedl" in
23617                 $define) avail_ext="$avail_ext $xxx" ;;
23618                 esac
23619                 ;;
23620         *)      avail_ext="$avail_ext $xxx"
23621                 ;;
23622         esac
23623 done
23624
23625 set X $avail_ext
23626 shift
23627 avail_ext="$*"
23628
23629 case "$onlyextensions" in
23630 '') ;;
23631 *)  keepextensions=''
23632     echo "You have requested that only certain extensions be included..." >&4
23633     for i in $onlyextensions; do
23634         case " $avail_ext " in
23635         *" $i "*)
23636             echo "Keeping extension $i."
23637             keepextensions="$keepextensions $i"
23638             ;;
23639         *) echo "Ignoring extension $i." ;;
23640         esac
23641     done
23642     avail_ext="$keepextensions"
23643     ;;
23644 esac
23645
23646 case "$noextensions" in
23647 '') ;;
23648 *)  keepextensions=''
23649     echo "You have requested that certain extensions be ignored..." >&4
23650     for i in $avail_ext; do
23651         case " $noextensions " in
23652         *" $i "*) echo "Ignoring extension $i." ;;
23653         *) echo "Keeping extension $i.";
23654            keepextensions="$keepextensions $i"
23655            ;;
23656         esac
23657     done
23658     avail_ext="$keepextensions"
23659     ;;
23660 esac
23661
23662 : Now see which nonxs extensions are supported on this system.
23663 : For now assume all are.
23664 nonxs_ext=''
23665 for xxx in $nonxs_extensions ; do
23666         case "$xxx" in
23667         VMS*)
23668                 ;;
23669         *)      nonxs_ext="$nonxs_ext $xxx"
23670                 ;;
23671         esac
23672 done
23673
23674 set X $nonxs_ext
23675 shift
23676 nonxs_ext="$*"
23677
23678 case $usedl in
23679 $define)
23680         $cat <<EOM
23681 A number of extensions are supplied with $package.  You may choose to
23682 compile these extensions for dynamic loading (the default), compile
23683 them into the $package executable (static loading), or not include
23684 them at all.  Answer "none" to include no extensions.
23685 Note that DynaLoader is always built and need not be mentioned here.
23686
23687 EOM
23688         case "$dynamic_ext" in
23689         '')
23690                 : Exclude those listed in static_ext
23691                 dflt=''
23692                 for xxx in $avail_ext; do
23693                         case " $static_ext " in
23694                         *" $xxx "*) ;;
23695                         *) dflt="$dflt $xxx" ;;
23696                         esac
23697                 done
23698                 set X $dflt
23699                 shift
23700                 dflt="$*"
23701                 ;;
23702         *)      dflt="$dynamic_ext"
23703                 # Perhaps we are reusing an old out-of-date config.sh.
23704                 case "$hint" in
23705                 previous)
23706                         if test X"$dynamic_ext" != X"$avail_ext"; then
23707                                 $cat <<EOM
23708 NOTICE:  Your previous config.sh list may be incorrect.
23709 The extensions now available to you are
23710         ${avail_ext}
23711 but the default list from your previous config.sh is
23712         ${dynamic_ext}
23713
23714 EOM
23715                         fi
23716                         ;;
23717                 esac
23718                 ;;
23719         esac
23720         case "$dflt" in
23721         '')     dflt=none;;
23722         esac
23723         rp="What extensions do you wish to load dynamically?"
23724         . ./myread
23725         case "$ans" in
23726         none) dynamic_ext=' ' ;;
23727         *) dynamic_ext="$ans" ;;
23728         esac
23729
23730         case "$static_ext" in
23731         '')
23732                 : Exclude those already listed in dynamic linking
23733                 dflt=''
23734                 for xxx in $avail_ext; do
23735                         case " $dynamic_ext " in
23736                         *" $xxx "*) ;;
23737                         *) dflt="$dflt $xxx" ;;
23738                         esac
23739                 done
23740                 set X $dflt
23741                 shift
23742                 dflt="$*"
23743                 ;;
23744         *)  dflt="$static_ext"
23745                 ;;
23746         esac
23747
23748         case "$dflt" in
23749         '')     dflt=none;;
23750         esac
23751         rp="What extensions do you wish to load statically?"
23752         . ./myread
23753         case "$ans" in
23754         none) static_ext=' ' ;;
23755         *) static_ext="$ans" ;;
23756         esac
23757         ;;
23758 *)
23759         $cat <<EOM
23760 A number of extensions are supplied with $package.  Answer "none"
23761 to include no extensions.
23762 Note that DynaLoader is always built and need not be mentioned here.
23763
23764 EOM
23765         case "$static_ext" in
23766         '') dflt="$avail_ext" ;;
23767         *)      dflt="$static_ext"
23768                 # Perhaps we are reusing an old out-of-date config.sh.
23769                 case "$hint" in
23770                 previous)
23771                         if test X"$static_ext" != X"$avail_ext"; then
23772                                 $cat <<EOM
23773 NOTICE:  Your previous config.sh list may be incorrect.
23774 The extensions now available to you are
23775         ${avail_ext}
23776 but the default list from your previous config.sh is
23777         ${static_ext}
23778
23779 EOM
23780                         fi
23781                         ;;
23782                 esac
23783                 ;;
23784         esac
23785         : Exclude those that are not xs extensions
23786         case "$dflt" in
23787         '')     dflt=none;;
23788         esac
23789         rp="What extensions do you wish to include?"
23790         . ./myread
23791         case "$ans" in
23792         none) static_ext=' ' ;;
23793         *) static_ext="$ans" ;;
23794         esac
23795         ;;
23796 esac
23797 #
23798 # Encode is a special case.  If we are building Encode as a static
23799 # extension, we need to explicitly list its subextensions as well.
23800 # For other nested extensions, this is handled automatically by
23801 # the appropriate Makefile.PL.
23802 case " $static_ext " in
23803         *" Encode "*) # Add the subextensions of Encode
23804         cd "$rsrc/cpan"
23805         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23806                 static_ext="$static_ext Encode/$xxx"
23807                 known_extensions="$known_extensions Encode/$xxx"
23808         done
23809         cd "$tdir"
23810         ;;
23811 esac
23812
23813 set X $dynamic_ext $static_ext $nonxs_ext
23814 shift
23815 extensions="$*"
23816
23817 # Sanity check:  We require an extension suitable for use with
23818 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23819 # should show up as failures in the test suite, but it's helpful to
23820 # catch them now.) The 'extensions' list is normally sorted
23821 # alphabetically, so we need to accept either
23822 #    DB_File ... Fcntl ... IO  ....
23823 # or something like
23824 #    Fcntl ... NDBM_File ... IO  ....
23825 case " $extensions"  in
23826 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23827 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23828 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23829 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23830    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23831    ;;
23832 esac
23833
23834 : Remove libraries needed only for extensions
23835 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23836 : The exception is SunOS 4.x, which needs them.
23837 case "${osname}X${osvers}" in
23838 sunos*X4*)
23839     perllibs="$libs"
23840     ;;
23841 *) case "$usedl" in
23842     $define|true|[yY]*)
23843             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23844             shift
23845             perllibs="$*"
23846             ;;
23847     *)  perllibs="$libs"
23848             ;;
23849     esac
23850     ;;
23851 esac
23852
23853 : Remove build directory name from cppstdin so it can be used from
23854 : either the present location or the final installed location.
23855 echo " "
23856 : Get out of the UU directory to get correct path name.
23857 cd ..
23858 case "$cppstdin" in
23859 `pwd`/cppstdin)
23860         echo "Stripping down cppstdin path name"
23861         cppstdin=cppstdin
23862         ;;
23863 esac
23864 cd UU
23865
23866 : end of configuration questions
23867 echo " "
23868 echo "End of configuration questions."
23869 echo " "
23870
23871 : back to where it started
23872 if test -d ../UU; then
23873         cd ..
23874 fi
23875
23876 : configuration may be unconditionally patched via a 'config.arch' file
23877 if $test -f config.arch; then
23878         echo "I see a config.arch file, loading it." >&4
23879         . ./config.arch
23880 fi
23881
23882 : configuration may be patched via a 'config.over' file
23883 if $test -f config.over; then
23884         echo " "
23885         dflt=y
23886         rp='I see a config.over file.  Do you wish to load it?'
23887         . UU/myread
23888         case "$ans" in
23889         n*) echo "OK, I'll ignore it.";;
23890         *)      . ./config.over
23891                 echo "Configuration override changes have been loaded."
23892                 ;;
23893         esac
23894 fi
23895
23896 : in case they want portability, strip down executable paths
23897 case "$d_portable" in
23898 "$define")
23899         echo " "
23900         echo "Stripping down executable paths..." >&4
23901         for file in $loclist $trylist; do
23902                 eval temp=\$$file
23903                 eval $file=`basename $temp`
23904         done
23905         ;;
23906 esac
23907
23908 : create config.sh file
23909 echo " "
23910 echo "Creating config.sh..." >&4
23911 $spitshell <<EOT >config.sh
23912 $startsh
23913 #
23914 # This file was produced by running the Configure script. It holds all the
23915 # definitions figured out by Configure. Should you modify one of these values,
23916 # do not forget to propagate your changes by running "Configure -der". You may
23917 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23918 #
23919
23920 # Package name      : $package
23921 # Source directory  : $src
23922 # Configuration time: $cf_time
23923 # Configured by     : $cf_by
23924 # Target system     : $myuname
23925
23926 EOT
23927 : Add in command line options if available
23928 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23929
23930 $spitshell <<EOT >>config.sh
23931
23932 Author='$Author'
23933 Date='$Date'
23934 Header='$Header'
23935 Id='$Id'
23936 Locker='$Locker'
23937 Log='$Log'
23938 RCSfile='$RCSfile'
23939 Revision='$Revision'
23940 Source='$Source'
23941 State='$State'
23942 _a='$_a'
23943 _exe='$_exe'
23944 _o='$_o'
23945 afs='$afs'
23946 afsroot='$afsroot'
23947 alignbytes='$alignbytes'
23948 aphostname='$aphostname'
23949 api_revision='$api_revision'
23950 api_subversion='$api_subversion'
23951 api_version='$api_version'
23952 api_versionstring='$api_versionstring'
23953 ar='$ar'
23954 archlib='$archlib'
23955 archlibexp='$archlibexp'
23956 archname64='$archname64'
23957 archname='$archname'
23958 archobjs='$archobjs'
23959 asctime_r_proto='$asctime_r_proto'
23960 awk='$awk'
23961 baserev='$baserev'
23962 bash='$bash'
23963 bin='$bin'
23964 bin_ELF='$bin_ELF'
23965 binexp='$binexp'
23966 bison='$bison'
23967 byacc='$byacc'
23968 byteorder='$byteorder'
23969 c='$c'
23970 castflags='$castflags'
23971 cat='$cat'
23972 cc='$cc'
23973 cccdlflags='$cccdlflags'
23974 ccdlflags='$ccdlflags'
23975 ccflags='$ccflags'
23976 ccflags_uselargefiles='$ccflags_uselargefiles'
23977 ccname='$ccname'
23978 ccsymbols='$ccsymbols'
23979 ccversion='$ccversion'
23980 cf_by='$cf_by'
23981 cf_email='$cf_email'
23982 cf_time='$cf_time'
23983 charbits='$charbits'
23984 charsize='$charsize'
23985 chgrp='$chgrp'
23986 chmod='$chmod'
23987 chown='$chown'
23988 clocktype='$clocktype'
23989 comm='$comm'
23990 compress='$compress'
23991 contains='$contains'
23992 cp='$cp'
23993 cpio='$cpio'
23994 cpp='$cpp'
23995 cpp_stuff='$cpp_stuff'
23996 cppccsymbols='$cppccsymbols'
23997 cppflags='$cppflags'
23998 cpplast='$cpplast'
23999 cppminus='$cppminus'
24000 cpprun='$cpprun'
24001 cppstdin='$cppstdin'
24002 cppsymbols='$cppsymbols'
24003 crypt_r_proto='$crypt_r_proto'
24004 cryptlib='$cryptlib'
24005 csh='$csh'
24006 ctermid_r_proto='$ctermid_r_proto'
24007 ctime_r_proto='$ctime_r_proto'
24008 d_Gconvert='$d_Gconvert'
24009 d_PRIEUldbl='$d_PRIEUldbl'
24010 d_PRIFUldbl='$d_PRIFUldbl'
24011 d_PRIGUldbl='$d_PRIGUldbl'
24012 d_PRIXU64='$d_PRIXU64'
24013 d_PRId64='$d_PRId64'
24014 d_PRIeldbl='$d_PRIeldbl'
24015 d_PRIfldbl='$d_PRIfldbl'
24016 d_PRIgldbl='$d_PRIgldbl'
24017 d_PRIi64='$d_PRIi64'
24018 d_PRIo64='$d_PRIo64'
24019 d_PRIu64='$d_PRIu64'
24020 d_PRIx64='$d_PRIx64'
24021 d_SCNfldbl='$d_SCNfldbl'
24022 d__fwalk='$d__fwalk'
24023 d_accept4='$d_accept4'
24024 d_access='$d_access'
24025 d_accessx='$d_accessx'
24026 d_acosh='$d_acosh'
24027 d_aintl='$d_aintl'
24028 d_alarm='$d_alarm'
24029 d_archlib='$d_archlib'
24030 d_asctime64='$d_asctime64'
24031 d_asctime_r='$d_asctime_r'
24032 d_asinh='$d_asinh'
24033 d_atanh='$d_atanh'
24034 d_atolf='$d_atolf'
24035 d_atoll='$d_atoll'
24036 d_attribute_deprecated='$d_attribute_deprecated'
24037 d_attribute_format='$d_attribute_format'
24038 d_attribute_malloc='$d_attribute_malloc'
24039 d_attribute_nonnull='$d_attribute_nonnull'
24040 d_attribute_noreturn='$d_attribute_noreturn'
24041 d_attribute_pure='$d_attribute_pure'
24042 d_attribute_unused='$d_attribute_unused'
24043 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24044 d_backtrace='$d_backtrace'
24045 d_bsd='$d_bsd'
24046 d_bsdgetpgrp='$d_bsdgetpgrp'
24047 d_bsdsetpgrp='$d_bsdsetpgrp'
24048 d_builtin_add_overflow='$d_builtin_add_overflow'
24049 d_builtin_choose_expr='$d_builtin_choose_expr'
24050 d_builtin_expect='$d_builtin_expect'
24051 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24052 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24053 d_c99_variadic_macros='$d_c99_variadic_macros'
24054 d_casti32='$d_casti32'
24055 d_castneg='$d_castneg'
24056 d_cbrt='$d_cbrt'
24057 d_chown='$d_chown'
24058 d_chroot='$d_chroot'
24059 d_chsize='$d_chsize'
24060 d_class='$d_class'
24061 d_clearenv='$d_clearenv'
24062 d_closedir='$d_closedir'
24063 d_cmsghdr_s='$d_cmsghdr_s'
24064 d_copysign='$d_copysign'
24065 d_copysignl='$d_copysignl'
24066 d_cplusplus='$d_cplusplus'
24067 d_crypt='$d_crypt'
24068 d_crypt_r='$d_crypt_r'
24069 d_csh='$d_csh'
24070 d_ctermid='$d_ctermid'
24071 d_ctermid_r='$d_ctermid_r'
24072 d_ctime64='$d_ctime64'
24073 d_ctime_r='$d_ctime_r'
24074 d_cuserid='$d_cuserid'
24075 d_dbminitproto='$d_dbminitproto'
24076 d_difftime64='$d_difftime64'
24077 d_difftime='$d_difftime'
24078 d_dir_dd_fd='$d_dir_dd_fd'
24079 d_dirfd='$d_dirfd'
24080 d_dirnamlen='$d_dirnamlen'
24081 d_dladdr='$d_dladdr'
24082 d_dlerror='$d_dlerror'
24083 d_dlopen='$d_dlopen'
24084 d_dlsymun='$d_dlsymun'
24085 d_dosuid='$d_dosuid'
24086 d_double_has_inf='$d_double_has_inf'
24087 d_double_has_nan='$d_double_has_nan'
24088 d_double_has_negative_zero='$d_double_has_negative_zero'
24089 d_double_has_subnormals='$d_double_has_subnormals'
24090 d_double_style_cray='$d_double_style_cray'
24091 d_double_style_ibm='$d_double_style_ibm'
24092 d_double_style_ieee='$d_double_style_ieee'
24093 d_double_style_vax='$d_double_style_vax'
24094 d_drand48_r='$d_drand48_r'
24095 d_drand48proto='$d_drand48proto'
24096 d_dup2='$d_dup2'
24097 d_dup3='$d_dup3'
24098 d_duplocale='$d_duplocale'
24099 d_eaccess='$d_eaccess'
24100 d_endgrent='$d_endgrent'
24101 d_endgrent_r='$d_endgrent_r'
24102 d_endhent='$d_endhent'
24103 d_endhostent_r='$d_endhostent_r'
24104 d_endnent='$d_endnent'
24105 d_endnetent_r='$d_endnetent_r'
24106 d_endpent='$d_endpent'
24107 d_endprotoent_r='$d_endprotoent_r'
24108 d_endpwent='$d_endpwent'
24109 d_endpwent_r='$d_endpwent_r'
24110 d_endsent='$d_endsent'
24111 d_endservent_r='$d_endservent_r'
24112 d_eofnblk='$d_eofnblk'
24113 d_erf='$d_erf'
24114 d_erfc='$d_erfc'
24115 d_eunice='$d_eunice'
24116 d_exp2='$d_exp2'
24117 d_expm1='$d_expm1'
24118 d_faststdio='$d_faststdio'
24119 d_fchdir='$d_fchdir'
24120 d_fchmod='$d_fchmod'
24121 d_fchmodat='$d_fchmodat'
24122 d_fchown='$d_fchown'
24123 d_fcntl='$d_fcntl'
24124 d_fcntl_can_lock='$d_fcntl_can_lock'
24125 d_fd_macros='$d_fd_macros'
24126 d_fd_set='$d_fd_set'
24127 d_fdclose='$d_fdclose'
24128 d_fdim='$d_fdim'
24129 d_fds_bits='$d_fds_bits'
24130 d_fegetround='$d_fegetround'
24131 d_fgetpos='$d_fgetpos'
24132 d_finite='$d_finite'
24133 d_finitel='$d_finitel'
24134 d_flexfnam='$d_flexfnam'
24135 d_flock='$d_flock'
24136 d_flockproto='$d_flockproto'
24137 d_fma='$d_fma'
24138 d_fmax='$d_fmax'
24139 d_fmin='$d_fmin'
24140 d_fork='$d_fork'
24141 d_fp_class='$d_fp_class'
24142 d_fp_classify='$d_fp_classify'
24143 d_fp_classl='$d_fp_classl'
24144 d_fpathconf='$d_fpathconf'
24145 d_fpclass='$d_fpclass'
24146 d_fpclassify='$d_fpclassify'
24147 d_fpclassl='$d_fpclassl'
24148 d_fpgetround='$d_fpgetround'
24149 d_fpos64_t='$d_fpos64_t'
24150 d_freelocale='$d_freelocale'
24151 d_frexpl='$d_frexpl'
24152 d_fs_data_s='$d_fs_data_s'
24153 d_fseeko='$d_fseeko'
24154 d_fsetpos='$d_fsetpos'
24155 d_fstatfs='$d_fstatfs'
24156 d_fstatvfs='$d_fstatvfs'
24157 d_fsync='$d_fsync'
24158 d_ftello='$d_ftello'
24159 d_ftime='$d_ftime'
24160 d_futimes='$d_futimes'
24161 d_gai_strerror='$d_gai_strerror'
24162 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24163 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24164 d_getaddrinfo='$d_getaddrinfo'
24165 d_getcwd='$d_getcwd'
24166 d_getespwnam='$d_getespwnam'
24167 d_getfsstat='$d_getfsstat'
24168 d_getgrent='$d_getgrent'
24169 d_getgrent_r='$d_getgrent_r'
24170 d_getgrgid_r='$d_getgrgid_r'
24171 d_getgrnam_r='$d_getgrnam_r'
24172 d_getgrps='$d_getgrps'
24173 d_gethbyaddr='$d_gethbyaddr'
24174 d_gethbyname='$d_gethbyname'
24175 d_gethent='$d_gethent'
24176 d_gethname='$d_gethname'
24177 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24178 d_gethostbyname_r='$d_gethostbyname_r'
24179 d_gethostent_r='$d_gethostent_r'
24180 d_gethostprotos='$d_gethostprotos'
24181 d_getitimer='$d_getitimer'
24182 d_getlogin='$d_getlogin'
24183 d_getlogin_r='$d_getlogin_r'
24184 d_getmnt='$d_getmnt'
24185 d_getmntent='$d_getmntent'
24186 d_getnameinfo='$d_getnameinfo'
24187 d_getnbyaddr='$d_getnbyaddr'
24188 d_getnbyname='$d_getnbyname'
24189 d_getnent='$d_getnent'
24190 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24191 d_getnetbyname_r='$d_getnetbyname_r'
24192 d_getnetent_r='$d_getnetent_r'
24193 d_getnetprotos='$d_getnetprotos'
24194 d_getpagsz='$d_getpagsz'
24195 d_getpbyname='$d_getpbyname'
24196 d_getpbynumber='$d_getpbynumber'
24197 d_getpent='$d_getpent'
24198 d_getpgid='$d_getpgid'
24199 d_getpgrp2='$d_getpgrp2'
24200 d_getpgrp='$d_getpgrp'
24201 d_getppid='$d_getppid'
24202 d_getprior='$d_getprior'
24203 d_getprotobyname_r='$d_getprotobyname_r'
24204 d_getprotobynumber_r='$d_getprotobynumber_r'
24205 d_getprotoent_r='$d_getprotoent_r'
24206 d_getprotoprotos='$d_getprotoprotos'
24207 d_getprpwnam='$d_getprpwnam'
24208 d_getpwent='$d_getpwent'
24209 d_getpwent_r='$d_getpwent_r'
24210 d_getpwnam_r='$d_getpwnam_r'
24211 d_getpwuid_r='$d_getpwuid_r'
24212 d_getsbyname='$d_getsbyname'
24213 d_getsbyport='$d_getsbyport'
24214 d_getsent='$d_getsent'
24215 d_getservbyname_r='$d_getservbyname_r'
24216 d_getservbyport_r='$d_getservbyport_r'
24217 d_getservent_r='$d_getservent_r'
24218 d_getservprotos='$d_getservprotos'
24219 d_getspnam='$d_getspnam'
24220 d_getspnam_r='$d_getspnam_r'
24221 d_gettimeod='$d_gettimeod'
24222 d_gmtime64='$d_gmtime64'
24223 d_gmtime_r='$d_gmtime_r'
24224 d_gnulibc='$d_gnulibc'
24225 d_grpasswd='$d_grpasswd'
24226 d_has_C_UTF8='$d_has_C_UTF8'
24227 d_hasmntopt='$d_hasmntopt'
24228 d_htonl='$d_htonl'
24229 d_hypot='$d_hypot'
24230 d_ilogb='$d_ilogb'
24231 d_ilogbl='$d_ilogbl'
24232 d_inc_version_list='$d_inc_version_list'
24233 d_inetaton='$d_inetaton'
24234 d_inetntop='$d_inetntop'
24235 d_inetpton='$d_inetpton'
24236 d_int64_t='$d_int64_t'
24237 d_ip_mreq='$d_ip_mreq'
24238 d_ip_mreq_source='$d_ip_mreq_source'
24239 d_ipv6_mreq='$d_ipv6_mreq'
24240 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24241 d_isascii='$d_isascii'
24242 d_isblank='$d_isblank'
24243 d_isfinite='$d_isfinite'
24244 d_isfinitel='$d_isfinitel'
24245 d_isinf='$d_isinf'
24246 d_isinfl='$d_isinfl'
24247 d_isless='$d_isless'
24248 d_isnan='$d_isnan'
24249 d_isnanl='$d_isnanl'
24250 d_isnormal='$d_isnormal'
24251 d_j0='$d_j0'
24252 d_j0l='$d_j0l'
24253 d_killpg='$d_killpg'
24254 d_lc_monetary_2008='$d_lc_monetary_2008'
24255 d_lchown='$d_lchown'
24256 d_ldbl_dig='$d_ldbl_dig'
24257 d_ldexpl='$d_ldexpl'
24258 d_lgamma='$d_lgamma'
24259 d_lgamma_r='$d_lgamma_r'
24260 d_libm_lib_version='$d_libm_lib_version'
24261 d_libname_unique='$d_libname_unique'
24262 d_link='$d_link'
24263 d_linkat='$d_linkat'
24264 d_llrint='$d_llrint'
24265 d_llrintl='$d_llrintl'
24266 d_llround='$d_llround'
24267 d_llroundl='$d_llroundl'
24268 d_localeconv_l='$d_localeconv_l'
24269 d_localtime64='$d_localtime64'
24270 d_localtime_r='$d_localtime_r'
24271 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24272 d_locconv='$d_locconv'
24273 d_lockf='$d_lockf'
24274 d_log1p='$d_log1p'
24275 d_log2='$d_log2'
24276 d_logb='$d_logb'
24277 d_long_double_style_ieee='$d_long_double_style_ieee'
24278 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24279 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24280 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24281 d_long_double_style_vax='$d_long_double_style_vax'
24282 d_longdbl='$d_longdbl'
24283 d_longlong='$d_longlong'
24284 d_lrint='$d_lrint'
24285 d_lrintl='$d_lrintl'
24286 d_lround='$d_lround'
24287 d_lroundl='$d_lroundl'
24288 d_lseekproto='$d_lseekproto'
24289 d_lstat='$d_lstat'
24290 d_madvise='$d_madvise'
24291 d_malloc_good_size='$d_malloc_good_size'
24292 d_malloc_size='$d_malloc_size'
24293 d_mblen='$d_mblen'
24294 d_mbrlen='$d_mbrlen'
24295 d_mbrtowc='$d_mbrtowc'
24296 d_mbstowcs='$d_mbstowcs'
24297 d_mbtowc='$d_mbtowc'
24298 d_memmem='$d_memmem'
24299 d_memrchr='$d_memrchr'
24300 d_mkdir='$d_mkdir'
24301 d_mkdtemp='$d_mkdtemp'
24302 d_mkfifo='$d_mkfifo'
24303 d_mkostemp='$d_mkostemp'
24304 d_mkstemp='$d_mkstemp'
24305 d_mkstemps='$d_mkstemps'
24306 d_mktime64='$d_mktime64'
24307 d_mktime='$d_mktime'
24308 d_mmap='$d_mmap'
24309 d_modfl='$d_modfl'
24310 d_modflproto='$d_modflproto'
24311 d_mprotect='$d_mprotect'
24312 d_msg='$d_msg'
24313 d_msg_ctrunc='$d_msg_ctrunc'
24314 d_msg_dontroute='$d_msg_dontroute'
24315 d_msg_oob='$d_msg_oob'
24316 d_msg_peek='$d_msg_peek'
24317 d_msg_proxy='$d_msg_proxy'
24318 d_msgctl='$d_msgctl'
24319 d_msgget='$d_msgget'
24320 d_msghdr_s='$d_msghdr_s'
24321 d_msgrcv='$d_msgrcv'
24322 d_msgsnd='$d_msgsnd'
24323 d_msync='$d_msync'
24324 d_munmap='$d_munmap'
24325 d_mymalloc='$d_mymalloc'
24326 d_nan='$d_nan'
24327 d_nanosleep='$d_nanosleep'
24328 d_ndbm='$d_ndbm'
24329 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24330 d_nearbyint='$d_nearbyint'
24331 d_newlocale='$d_newlocale'
24332 d_nextafter='$d_nextafter'
24333 d_nexttoward='$d_nexttoward'
24334 d_nice='$d_nice'
24335 d_nl_langinfo='$d_nl_langinfo'
24336 d_nv_preserves_uv='$d_nv_preserves_uv'
24337 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24338 d_off64_t='$d_off64_t'
24339 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24340 d_oldpthreads='$d_oldpthreads'
24341 d_oldsock='$d_oldsock'
24342 d_open3='$d_open3'
24343 d_openat='$d_openat'
24344 d_pathconf='$d_pathconf'
24345 d_pause='$d_pause'
24346 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24347 d_phostname='$d_phostname'
24348 d_pipe2='$d_pipe2'
24349 d_pipe='$d_pipe'
24350 d_poll='$d_poll'
24351 d_portable='$d_portable'
24352 d_prctl='$d_prctl'
24353 d_prctl_set_name='$d_prctl_set_name'
24354 d_printf_format_null='$d_printf_format_null'
24355 d_procselfexe='$d_procselfexe'
24356 d_pseudofork='$d_pseudofork'
24357 d_pthread_atfork='$d_pthread_atfork'
24358 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24359 d_pthread_yield='$d_pthread_yield'
24360 d_ptrdiff_t='$d_ptrdiff_t'
24361 d_pwage='$d_pwage'
24362 d_pwchange='$d_pwchange'
24363 d_pwclass='$d_pwclass'
24364 d_pwcomment='$d_pwcomment'
24365 d_pwexpire='$d_pwexpire'
24366 d_pwgecos='$d_pwgecos'
24367 d_pwpasswd='$d_pwpasswd'
24368 d_pwquota='$d_pwquota'
24369 d_qgcvt='$d_qgcvt'
24370 d_quad='$d_quad'
24371 d_querylocale='$d_querylocale'
24372 d_random_r='$d_random_r'
24373 d_re_comp='$d_re_comp'
24374 d_readdir64_r='$d_readdir64_r'
24375 d_readdir='$d_readdir'
24376 d_readdir_r='$d_readdir_r'
24377 d_readlink='$d_readlink'
24378 d_readv='$d_readv'
24379 d_recvmsg='$d_recvmsg'
24380 d_regcmp='$d_regcmp'
24381 d_regcomp='$d_regcomp'
24382 d_remainder='$d_remainder'
24383 d_remquo='$d_remquo'
24384 d_rename='$d_rename'
24385 d_renameat='$d_renameat'
24386 d_rewinddir='$d_rewinddir'
24387 d_rint='$d_rint'
24388 d_rmdir='$d_rmdir'
24389 d_round='$d_round'
24390 d_sbrkproto='$d_sbrkproto'
24391 d_scalbn='$d_scalbn'
24392 d_scalbnl='$d_scalbnl'
24393 d_sched_yield='$d_sched_yield'
24394 d_scm_rights='$d_scm_rights'
24395 d_seekdir='$d_seekdir'
24396 d_select='$d_select'
24397 d_sem='$d_sem'
24398 d_semctl='$d_semctl'
24399 d_semctl_semid_ds='$d_semctl_semid_ds'
24400 d_semctl_semun='$d_semctl_semun'
24401 d_semget='$d_semget'
24402 d_semop='$d_semop'
24403 d_sendmsg='$d_sendmsg'
24404 d_setegid='$d_setegid'
24405 d_seteuid='$d_seteuid'
24406 d_setgrent='$d_setgrent'
24407 d_setgrent_r='$d_setgrent_r'
24408 d_setgrps='$d_setgrps'
24409 d_sethent='$d_sethent'
24410 d_sethostent_r='$d_sethostent_r'
24411 d_setitimer='$d_setitimer'
24412 d_setlinebuf='$d_setlinebuf'
24413 d_setlocale='$d_setlocale'
24414 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24415 d_setlocale_r='$d_setlocale_r'
24416 d_setnent='$d_setnent'
24417 d_setnetent_r='$d_setnetent_r'
24418 d_setpent='$d_setpent'
24419 d_setpgid='$d_setpgid'
24420 d_setpgrp2='$d_setpgrp2'
24421 d_setpgrp='$d_setpgrp'
24422 d_setprior='$d_setprior'
24423 d_setproctitle='$d_setproctitle'
24424 d_setprotoent_r='$d_setprotoent_r'
24425 d_setpwent='$d_setpwent'
24426 d_setpwent_r='$d_setpwent_r'
24427 d_setregid='$d_setregid'
24428 d_setresgid='$d_setresgid'
24429 d_setresuid='$d_setresuid'
24430 d_setreuid='$d_setreuid'
24431 d_setrgid='$d_setrgid'
24432 d_setruid='$d_setruid'
24433 d_setsent='$d_setsent'
24434 d_setservent_r='$d_setservent_r'
24435 d_setsid='$d_setsid'
24436 d_setvbuf='$d_setvbuf'
24437 d_shm='$d_shm'
24438 d_shmat='$d_shmat'
24439 d_shmatprototype='$d_shmatprototype'
24440 d_shmctl='$d_shmctl'
24441 d_shmdt='$d_shmdt'
24442 d_shmget='$d_shmget'
24443 d_sigaction='$d_sigaction'
24444 d_siginfo_si_addr='$d_siginfo_si_addr'
24445 d_siginfo_si_band='$d_siginfo_si_band'
24446 d_siginfo_si_errno='$d_siginfo_si_errno'
24447 d_siginfo_si_fd='$d_siginfo_si_fd'
24448 d_siginfo_si_pid='$d_siginfo_si_pid'
24449 d_siginfo_si_status='$d_siginfo_si_status'
24450 d_siginfo_si_uid='$d_siginfo_si_uid'
24451 d_siginfo_si_value='$d_siginfo_si_value'
24452 d_signbit='$d_signbit'
24453 d_sigprocmask='$d_sigprocmask'
24454 d_sigsetjmp='$d_sigsetjmp'
24455 d_sin6_scope_id='$d_sin6_scope_id'
24456 d_sitearch='$d_sitearch'
24457 d_snprintf='$d_snprintf'
24458 d_sockaddr_in6='$d_sockaddr_in6'
24459 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24460 d_sockatmark='$d_sockatmark'
24461 d_sockatmarkproto='$d_sockatmarkproto'
24462 d_socket='$d_socket'
24463 d_socklen_t='$d_socklen_t'
24464 d_sockpair='$d_sockpair'
24465 d_socks5_init='$d_socks5_init'
24466 d_sqrtl='$d_sqrtl'
24467 d_srand48_r='$d_srand48_r'
24468 d_srandom_r='$d_srandom_r'
24469 d_sresgproto='$d_sresgproto'
24470 d_sresuproto='$d_sresuproto'
24471 d_stat='$d_stat'
24472 d_statblks='$d_statblks'
24473 d_statfs_f_flags='$d_statfs_f_flags'
24474 d_statfs_s='$d_statfs_s'
24475 d_static_inline='$d_static_inline'
24476 d_statvfs='$d_statvfs'
24477 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24478 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24479 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24480 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24481 d_stdio_stream_array='$d_stdio_stream_array'
24482 d_stdiobase='$d_stdiobase'
24483 d_stdstdio='$d_stdstdio'
24484 d_strcoll='$d_strcoll'
24485 d_strerror_l='$d_strerror_l'
24486 d_strerror_r='$d_strerror_r'
24487 d_strftime='$d_strftime'
24488 d_strlcat='$d_strlcat'
24489 d_strlcpy='$d_strlcpy'
24490 d_strnlen='$d_strnlen'
24491 d_strtod='$d_strtod'
24492 d_strtod_l='$d_strtod_l'
24493 d_strtol='$d_strtol'
24494 d_strtold='$d_strtold'
24495 d_strtold_l='$d_strtold_l'
24496 d_strtoll='$d_strtoll'
24497 d_strtoq='$d_strtoq'
24498 d_strtoul='$d_strtoul'
24499 d_strtoull='$d_strtoull'
24500 d_strtouq='$d_strtouq'
24501 d_strxfrm='$d_strxfrm'
24502 d_suidsafe='$d_suidsafe'
24503 d_symlink='$d_symlink'
24504 d_syscall='$d_syscall'
24505 d_syscallproto='$d_syscallproto'
24506 d_sysconf='$d_sysconf'
24507 d_sysernlst='$d_sysernlst'
24508 d_syserrlst='$d_syserrlst'
24509 d_system='$d_system'
24510 d_tcgetpgrp='$d_tcgetpgrp'
24511 d_tcsetpgrp='$d_tcsetpgrp'
24512 d_telldir='$d_telldir'
24513 d_telldirproto='$d_telldirproto'
24514 d_tgamma='$d_tgamma'
24515 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24516 d_time='$d_time'
24517 d_timegm='$d_timegm'
24518 d_times='$d_times'
24519 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24520 d_tm_tm_zone='$d_tm_tm_zone'
24521 d_tmpnam_r='$d_tmpnam_r'
24522 d_towlower='$d_towlower'
24523 d_towupper='$d_towupper'
24524 d_trunc='$d_trunc'
24525 d_truncate='$d_truncate'
24526 d_truncl='$d_truncl'
24527 d_ttyname_r='$d_ttyname_r'
24528 d_tzname='$d_tzname'
24529 d_u32align='$d_u32align'
24530 d_ualarm='$d_ualarm'
24531 d_umask='$d_umask'
24532 d_uname='$d_uname'
24533 d_union_semun='$d_union_semun'
24534 d_unlinkat='$d_unlinkat'
24535 d_unordered='$d_unordered'
24536 d_unsetenv='$d_unsetenv'
24537 d_uselocale='$d_uselocale'
24538 d_usleep='$d_usleep'
24539 d_usleepproto='$d_usleepproto'
24540 d_ustat='$d_ustat'
24541 d_vendorarch='$d_vendorarch'
24542 d_vendorbin='$d_vendorbin'
24543 d_vendorlib='$d_vendorlib'
24544 d_vendorscript='$d_vendorscript'
24545 d_vfork='$d_vfork'
24546 d_void_closedir='$d_void_closedir'
24547 d_voidsig='$d_voidsig'
24548 d_voidtty='$d_voidtty'
24549 d_vsnprintf='$d_vsnprintf'
24550 d_wait4='$d_wait4'
24551 d_waitpid='$d_waitpid'
24552 d_wcscmp='$d_wcscmp'
24553 d_wcstombs='$d_wcstombs'
24554 d_wcsxfrm='$d_wcsxfrm'
24555 d_wctomb='$d_wctomb'
24556 d_writev='$d_writev'
24557 d_xenix='$d_xenix'
24558 date='$date'
24559 db_hashtype='$db_hashtype'
24560 db_prefixtype='$db_prefixtype'
24561 db_version_major='$db_version_major'
24562 db_version_minor='$db_version_minor'
24563 db_version_patch='$db_version_patch'
24564 default_inc_excludes_dot='$default_inc_excludes_dot'
24565 direntrytype='$direntrytype'
24566 dlext='$dlext'
24567 dlsrc='$dlsrc'
24568 doubleinfbytes='$doubleinfbytes'
24569 doublekind='$doublekind'
24570 doublemantbits='$doublemantbits'
24571 doublenanbytes='$doublenanbytes'
24572 doublesize='$doublesize'
24573 drand01='$drand01'
24574 drand48_r_proto='$drand48_r_proto'
24575 dtrace='$dtrace'
24576 dtraceobject='$dtraceobject'
24577 dtracexnolibs='$dtracexnolibs'
24578 dynamic_ext='$dynamic_ext'
24579 eagain='$eagain'
24580 ebcdic='$ebcdic'
24581 echo='$echo'
24582 egrep='$egrep'
24583 emacs='$emacs'
24584 endgrent_r_proto='$endgrent_r_proto'
24585 endhostent_r_proto='$endhostent_r_proto'
24586 endnetent_r_proto='$endnetent_r_proto'
24587 endprotoent_r_proto='$endprotoent_r_proto'
24588 endpwent_r_proto='$endpwent_r_proto'
24589 endservent_r_proto='$endservent_r_proto'
24590 eunicefix='$eunicefix'
24591 exe_ext='$exe_ext'
24592 expr='$expr'
24593 extensions='$extensions'
24594 extern_C='$extern_C'
24595 extras='$extras'
24596 fflushNULL='$fflushNULL'
24597 fflushall='$fflushall'
24598 find='$find'
24599 firstmakefile='$firstmakefile'
24600 flex='$flex'
24601 fpossize='$fpossize'
24602 fpostype='$fpostype'
24603 freetype='$freetype'
24604 from='$from'
24605 full_ar='$full_ar'
24606 full_csh='$full_csh'
24607 full_sed='$full_sed'
24608 gccansipedantic='$gccansipedantic'
24609 gccosandvers='$gccosandvers'
24610 gccversion='$gccversion'
24611 getgrent_r_proto='$getgrent_r_proto'
24612 getgrgid_r_proto='$getgrgid_r_proto'
24613 getgrnam_r_proto='$getgrnam_r_proto'
24614 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24615 gethostbyname_r_proto='$gethostbyname_r_proto'
24616 gethostent_r_proto='$gethostent_r_proto'
24617 getlogin_r_proto='$getlogin_r_proto'
24618 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24619 getnetbyname_r_proto='$getnetbyname_r_proto'
24620 getnetent_r_proto='$getnetent_r_proto'
24621 getprotobyname_r_proto='$getprotobyname_r_proto'
24622 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24623 getprotoent_r_proto='$getprotoent_r_proto'
24624 getpwent_r_proto='$getpwent_r_proto'
24625 getpwnam_r_proto='$getpwnam_r_proto'
24626 getpwuid_r_proto='$getpwuid_r_proto'
24627 getservbyname_r_proto='$getservbyname_r_proto'
24628 getservbyport_r_proto='$getservbyport_r_proto'
24629 getservent_r_proto='$getservent_r_proto'
24630 getspnam_r_proto='$getspnam_r_proto'
24631 gidformat='$gidformat'
24632 gidsign='$gidsign'
24633 gidsize='$gidsize'
24634 gidtype='$gidtype'
24635 glibpth='$glibpth'
24636 gmake='$gmake'
24637 gmtime_r_proto='$gmtime_r_proto'
24638 gnulibc_version='$gnulibc_version'
24639 grep='$grep'
24640 groupcat='$groupcat'
24641 groupstype='$groupstype'
24642 gzip='$gzip'
24643 h_fcntl='$h_fcntl'
24644 h_sysfile='$h_sysfile'
24645 hint='$hint'
24646 hostcat='$hostcat'
24647 hostgenerate='$hostgenerate'
24648 hostosname='$hostosname'
24649 hostperl='$hostperl'
24650 html1dir='$html1dir'
24651 html1direxp='$html1direxp'
24652 html3dir='$html3dir'
24653 html3direxp='$html3direxp'
24654 i16size='$i16size'
24655 i16type='$i16type'
24656 i32size='$i32size'
24657 i32type='$i32type'
24658 i64size='$i64size'
24659 i64type='$i64type'
24660 i8size='$i8size'
24661 i8type='$i8type'
24662 i_arpainet='$i_arpainet'
24663 i_bfd='$i_bfd'
24664 i_bsdioctl='$i_bsdioctl'
24665 i_crypt='$i_crypt'
24666 i_db='$i_db'
24667 i_dbm='$i_dbm'
24668 i_dirent='$i_dirent'
24669 i_dlfcn='$i_dlfcn'
24670 i_execinfo='$i_execinfo'
24671 i_fcntl='$i_fcntl'
24672 i_fenv='$i_fenv'
24673 i_fp='$i_fp'
24674 i_fp_class='$i_fp_class'
24675 i_gdbm='$i_gdbm'
24676 i_gdbm_ndbm='$i_gdbm_ndbm'
24677 i_gdbmndbm='$i_gdbmndbm'
24678 i_grp='$i_grp'
24679 i_ieeefp='$i_ieeefp'
24680 i_inttypes='$i_inttypes'
24681 i_langinfo='$i_langinfo'
24682 i_libutil='$i_libutil'
24683 i_locale='$i_locale'
24684 i_machcthr='$i_machcthr'
24685 i_malloc='$i_malloc'
24686 i_mallocmalloc='$i_mallocmalloc'
24687 i_mntent='$i_mntent'
24688 i_ndbm='$i_ndbm'
24689 i_netdb='$i_netdb'
24690 i_neterrno='$i_neterrno'
24691 i_netinettcp='$i_netinettcp'
24692 i_niin='$i_niin'
24693 i_poll='$i_poll'
24694 i_prot='$i_prot'
24695 i_pthread='$i_pthread'
24696 i_pwd='$i_pwd'
24697 i_quadmath='$i_quadmath'
24698 i_rpcsvcdbm='$i_rpcsvcdbm'
24699 i_sgtty='$i_sgtty'
24700 i_shadow='$i_shadow'
24701 i_socks='$i_socks'
24702 i_stdbool='$i_stdbool'
24703 i_stdint='$i_stdint'
24704 i_stdlib='$i_stdlib'
24705 i_sunmath='$i_sunmath'
24706 i_sysaccess='$i_sysaccess'
24707 i_sysdir='$i_sysdir'
24708 i_sysfile='$i_sysfile'
24709 i_sysfilio='$i_sysfilio'
24710 i_sysin='$i_sysin'
24711 i_sysioctl='$i_sysioctl'
24712 i_syslog='$i_syslog'
24713 i_sysmman='$i_sysmman'
24714 i_sysmode='$i_sysmode'
24715 i_sysmount='$i_sysmount'
24716 i_sysndir='$i_sysndir'
24717 i_sysparam='$i_sysparam'
24718 i_syspoll='$i_syspoll'
24719 i_sysresrc='$i_sysresrc'
24720 i_syssecrt='$i_syssecrt'
24721 i_sysselct='$i_sysselct'
24722 i_syssockio='$i_syssockio'
24723 i_sysstat='$i_sysstat'
24724 i_sysstatfs='$i_sysstatfs'
24725 i_sysstatvfs='$i_sysstatvfs'
24726 i_systime='$i_systime'
24727 i_systimek='$i_systimek'
24728 i_systimes='$i_systimes'
24729 i_systypes='$i_systypes'
24730 i_sysuio='$i_sysuio'
24731 i_sysun='$i_sysun'
24732 i_sysutsname='$i_sysutsname'
24733 i_sysvfs='$i_sysvfs'
24734 i_syswait='$i_syswait'
24735 i_termio='$i_termio'
24736 i_termios='$i_termios'
24737 i_time='$i_time'
24738 i_unistd='$i_unistd'
24739 i_ustat='$i_ustat'
24740 i_utime='$i_utime'
24741 i_vfork='$i_vfork'
24742 i_wchar='$i_wchar'
24743 i_wctype='$i_wctype'
24744 i_xlocale='$i_xlocale'
24745 ignore_versioned_solibs='$ignore_versioned_solibs'
24746 inc_version_list='$inc_version_list'
24747 inc_version_list_init='$inc_version_list_init'
24748 incpath='$incpath'
24749 incpth='$incpth'
24750 inews='$inews'
24751 initialinstalllocation='$initialinstalllocation'
24752 installarchlib='$installarchlib'
24753 installbin='$installbin'
24754 installhtml1dir='$installhtml1dir'
24755 installhtml3dir='$installhtml3dir'
24756 installman1dir='$installman1dir'
24757 installman3dir='$installman3dir'
24758 installprefix='$installprefix'
24759 installprefixexp='$installprefixexp'
24760 installprivlib='$installprivlib'
24761 installscript='$installscript'
24762 installsitearch='$installsitearch'
24763 installsitebin='$installsitebin'
24764 installsitehtml1dir='$installsitehtml1dir'
24765 installsitehtml3dir='$installsitehtml3dir'
24766 installsitelib='$installsitelib'
24767 installsiteman1dir='$installsiteman1dir'
24768 installsiteman3dir='$installsiteman3dir'
24769 installsitescript='$installsitescript'
24770 installstyle='$installstyle'
24771 installusrbinperl='$installusrbinperl'
24772 installvendorarch='$installvendorarch'
24773 installvendorbin='$installvendorbin'
24774 installvendorhtml1dir='$installvendorhtml1dir'
24775 installvendorhtml3dir='$installvendorhtml3dir'
24776 installvendorlib='$installvendorlib'
24777 installvendorman1dir='$installvendorman1dir'
24778 installvendorman3dir='$installvendorman3dir'
24779 installvendorscript='$installvendorscript'
24780 intsize='$intsize'
24781 issymlink='$issymlink'
24782 ivdformat='$ivdformat'
24783 ivsize='$ivsize'
24784 ivtype='$ivtype'
24785 known_extensions='$known_extensions'
24786 ksh='$ksh'
24787 ld='$ld'
24788 ld_can_script='$ld_can_script'
24789 lddlflags='$lddlflags'
24790 ldflags='$ldflags'
24791 ldflags_uselargefiles='$ldflags_uselargefiles'
24792 ldlibpthname='$ldlibpthname'
24793 less='$less'
24794 lib_ext='$lib_ext'
24795 libc='$libc'
24796 libperl='$libperl'
24797 libpth='$libpth'
24798 libs='$libs'
24799 libsdirs='$libsdirs'
24800 libsfiles='$libsfiles'
24801 libsfound='$libsfound'
24802 libspath='$libspath'
24803 libswanted='$libswanted'
24804 libswanted_uselargefiles='$libswanted_uselargefiles'
24805 line='$line'
24806 lint='$lint'
24807 lkflags='$lkflags'
24808 ln='$ln'
24809 lns='$lns'
24810 localtime_r_proto='$localtime_r_proto'
24811 locincpth='$locincpth'
24812 loclibpth='$loclibpth'
24813 longdblinfbytes='$longdblinfbytes'
24814 longdblkind='$longdblkind'
24815 longdblmantbits='$longdblmantbits'
24816 longdblnanbytes='$longdblnanbytes'
24817 longdblsize='$longdblsize'
24818 longlongsize='$longlongsize'
24819 longsize='$longsize'
24820 lp='$lp'
24821 lpr='$lpr'
24822 ls='$ls'
24823 lseeksize='$lseeksize'
24824 lseektype='$lseektype'
24825 mail='$mail'
24826 mailx='$mailx'
24827 make='$make'
24828 make_set_make='$make_set_make'
24829 mallocobj='$mallocobj'
24830 mallocsrc='$mallocsrc'
24831 malloctype='$malloctype'
24832 man1dir='$man1dir'
24833 man1direxp='$man1direxp'
24834 man1ext='$man1ext'
24835 man3dir='$man3dir'
24836 man3direxp='$man3direxp'
24837 man3ext='$man3ext'
24838 mips_type='$mips_type'
24839 mistrustnm='$mistrustnm'
24840 mkdir='$mkdir'
24841 mmaptype='$mmaptype'
24842 modetype='$modetype'
24843 more='$more'
24844 multiarch='$multiarch'
24845 mv='$mv'
24846 myarchname='$myarchname'
24847 mydomain='$mydomain'
24848 myhostname='$myhostname'
24849 myuname='$myuname'
24850 n='$n'
24851 need_va_copy='$need_va_copy'
24852 netdb_hlen_type='$netdb_hlen_type'
24853 netdb_host_type='$netdb_host_type'
24854 netdb_name_type='$netdb_name_type'
24855 netdb_net_type='$netdb_net_type'
24856 nm='$nm'
24857 nm_opt='$nm_opt'
24858 nm_so_opt='$nm_so_opt'
24859 nonxs_ext='$nonxs_ext'
24860 nroff='$nroff'
24861 nvEUformat='$nvEUformat'
24862 nvFUformat='$nvFUformat'
24863 nvGUformat='$nvGUformat'
24864 nv_overflows_integers_at='$nv_overflows_integers_at'
24865 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24866 nveformat='$nveformat'
24867 nvfformat='$nvfformat'
24868 nvgformat='$nvgformat'
24869 nvmantbits='$nvmantbits'
24870 nvsize='$nvsize'
24871 nvtype='$nvtype'
24872 o_nonblock='$o_nonblock'
24873 obj_ext='$obj_ext'
24874 old_pthread_create_joinable='$old_pthread_create_joinable'
24875 optimize='$optimize'
24876 orderlib='$orderlib'
24877 osname='$osname'
24878 osvers='$osvers'
24879 otherlibdirs='$otherlibdirs'
24880 package='$package'
24881 pager='$pager'
24882 passcat='$passcat'
24883 patchlevel='$patchlevel'
24884 path_sep='$path_sep'
24885 perl5='$perl5'
24886 perl='$perl'
24887 perl_patchlevel='$perl_patchlevel'
24888 perl_static_inline='$perl_static_inline'
24889 perladmin='$perladmin'
24890 perllibs='$perllibs'
24891 perlpath='$perlpath'
24892 pg='$pg'
24893 phostname='$phostname'
24894 pidtype='$pidtype'
24895 plibpth='$plibpth'
24896 pmake='$pmake'
24897 pr='$pr'
24898 prefix='$prefix'
24899 prefixexp='$prefixexp'
24900 privlib='$privlib'
24901 privlibexp='$privlibexp'
24902 procselfexe='$procselfexe'
24903 ptrsize='$ptrsize'
24904 quadkind='$quadkind'
24905 quadtype='$quadtype'
24906 randbits='$randbits'
24907 randfunc='$randfunc'
24908 random_r_proto='$random_r_proto'
24909 randseedtype='$randseedtype'
24910 ranlib='$ranlib'
24911 rd_nodata='$rd_nodata'
24912 readdir64_r_proto='$readdir64_r_proto'
24913 readdir_r_proto='$readdir_r_proto'
24914 revision='$revision'
24915 rm='$rm'
24916 rm_try='$rm_try'
24917 rmail='$rmail'
24918 run='$run'
24919 runnm='$runnm'
24920 sGMTIME_max='$sGMTIME_max'
24921 sGMTIME_min='$sGMTIME_min'
24922 sLOCALTIME_max='$sLOCALTIME_max'
24923 sLOCALTIME_min='$sLOCALTIME_min'
24924 sPRIEUldbl='$sPRIEUldbl'
24925 sPRIFUldbl='$sPRIFUldbl'
24926 sPRIGUldbl='$sPRIGUldbl'
24927 sPRIXU64='$sPRIXU64'
24928 sPRId64='$sPRId64'
24929 sPRIeldbl='$sPRIeldbl'
24930 sPRIfldbl='$sPRIfldbl'
24931 sPRIgldbl='$sPRIgldbl'
24932 sPRIi64='$sPRIi64'
24933 sPRIo64='$sPRIo64'
24934 sPRIu64='$sPRIu64'
24935 sPRIx64='$sPRIx64'
24936 sSCNfldbl='$sSCNfldbl'
24937 sched_yield='$sched_yield'
24938 scriptdir='$scriptdir'
24939 scriptdirexp='$scriptdirexp'
24940 sed='$sed'
24941 seedfunc='$seedfunc'
24942 selectminbits='$selectminbits'
24943 selecttype='$selecttype'
24944 sendmail='$sendmail'
24945 setgrent_r_proto='$setgrent_r_proto'
24946 sethostent_r_proto='$sethostent_r_proto'
24947 setlocale_r_proto='$setlocale_r_proto'
24948 setnetent_r_proto='$setnetent_r_proto'
24949 setprotoent_r_proto='$setprotoent_r_proto'
24950 setpwent_r_proto='$setpwent_r_proto'
24951 setservent_r_proto='$setservent_r_proto'
24952 sh='$sh'
24953 shar='$shar'
24954 sharpbang='$sharpbang'
24955 shmattype='$shmattype'
24956 shortsize='$shortsize'
24957 shrpenv='$shrpenv'
24958 shsharp='$shsharp'
24959 sig_count='$sig_count'
24960 sig_name='$sig_name'
24961 sig_name_init='$sig_name_init'
24962 sig_num='$sig_num'
24963 sig_num_init='$sig_num_init'
24964 sig_size='$sig_size'
24965 signal_t='$signal_t'
24966 sitearch='$sitearch'
24967 sitearchexp='$sitearchexp'
24968 sitebin='$sitebin'
24969 sitebinexp='$sitebinexp'
24970 sitehtml1dir='$sitehtml1dir'
24971 sitehtml1direxp='$sitehtml1direxp'
24972 sitehtml3dir='$sitehtml3dir'
24973 sitehtml3direxp='$sitehtml3direxp'
24974 sitelib='$sitelib'
24975 sitelib_stem='$sitelib_stem'
24976 sitelibexp='$sitelibexp'
24977 siteman1dir='$siteman1dir'
24978 siteman1direxp='$siteman1direxp'
24979 siteman3dir='$siteman3dir'
24980 siteman3direxp='$siteman3direxp'
24981 siteprefix='$siteprefix'
24982 siteprefixexp='$siteprefixexp'
24983 sitescript='$sitescript'
24984 sitescriptexp='$sitescriptexp'
24985 sizesize='$sizesize'
24986 sizetype='$sizetype'
24987 sleep='$sleep'
24988 smail='$smail'
24989 so='$so'
24990 sockethdr='$sockethdr'
24991 socketlib='$socketlib'
24992 socksizetype='$socksizetype'
24993 sort='$sort'
24994 spackage='$spackage'
24995 spitshell='$spitshell'
24996 srand48_r_proto='$srand48_r_proto'
24997 srandom_r_proto='$srandom_r_proto'
24998 src='$src'
24999 ssizetype='$ssizetype'
25000 st_ino_sign='$st_ino_sign'
25001 st_ino_size='$st_ino_size'
25002 startperl='$startperl'
25003 startsh='$startsh'
25004 static_ext='$static_ext'
25005 stdchar='$stdchar'
25006 stdio_base='$stdio_base'
25007 stdio_bufsiz='$stdio_bufsiz'
25008 stdio_cnt='$stdio_cnt'
25009 stdio_filbuf='$stdio_filbuf'
25010 stdio_ptr='$stdio_ptr'
25011 stdio_stream_array='$stdio_stream_array'
25012 strerror_r_proto='$strerror_r_proto'
25013 submit='$submit'
25014 subversion='$subversion'
25015 sysman='$sysman'
25016 sysroot='$sysroot'
25017 tail='$tail'
25018 tar='$tar'
25019 targetarch='$targetarch'
25020 targetdir='$targetdir'
25021 targetenv='$targetenv'
25022 targethost='$targethost'
25023 targetmkdir='$targetmkdir'
25024 targetport='$targetport'
25025 targetsh='$targetsh'
25026 tbl='$tbl'
25027 tee='$tee'
25028 test='$test'
25029 timeincl='$timeincl'
25030 timetype='$timetype'
25031 tmpnam_r_proto='$tmpnam_r_proto'
25032 to='$to'
25033 touch='$touch'
25034 tr='$tr'
25035 trnl='$trnl'
25036 troff='$troff'
25037 ttyname_r_proto='$ttyname_r_proto'
25038 u16size='$u16size'
25039 u16type='$u16type'
25040 u32size='$u32size'
25041 u32type='$u32type'
25042 u64size='$u64size'
25043 u64type='$u64type'
25044 u8size='$u8size'
25045 u8type='$u8type'
25046 uidformat='$uidformat'
25047 uidsign='$uidsign'
25048 uidsize='$uidsize'
25049 uidtype='$uidtype'
25050 uname='$uname'
25051 uniq='$uniq'
25052 uquadtype='$uquadtype'
25053 use5005threads='$use5005threads'
25054 use64bitall='$use64bitall'
25055 use64bitint='$use64bitint'
25056 usecbacktrace='$usecbacktrace'
25057 usecrosscompile='$usecrosscompile'
25058 usedevel='$usedevel'
25059 usedl='$usedl'
25060 usedtrace='$usedtrace'
25061 usefaststdio='$usefaststdio'
25062 useithreads='$useithreads'
25063 usekernprocpathname='$usekernprocpathname'
25064 uselanginfo='$uselanginfo'
25065 uselargefiles='$uselargefiles'
25066 uselongdouble='$uselongdouble'
25067 usemallocwrap='$usemallocwrap'
25068 usemorebits='$usemorebits'
25069 usemultiplicity='$usemultiplicity'
25070 usemymalloc='$usemymalloc'
25071 usenm='$usenm'
25072 usensgetexecutablepath='$usensgetexecutablepath'
25073 useopcode='$useopcode'
25074 useperlio='$useperlio'
25075 useposix='$useposix'
25076 usequadmath='$usequadmath'
25077 usereentrant='$usereentrant'
25078 userelocatableinc='$userelocatableinc'
25079 useshrplib='$useshrplib'
25080 usesitecustomize='$usesitecustomize'
25081 usesocks='$usesocks'
25082 usethreads='$usethreads'
25083 usevendorprefix='$usevendorprefix'
25084 useversionedarchname='$useversionedarchname'
25085 usevfork='$usevfork'
25086 usrinc='$usrinc'
25087 uuname='$uuname'
25088 uvXUformat='$uvXUformat'
25089 uvoformat='$uvoformat'
25090 uvsize='$uvsize'
25091 uvtype='$uvtype'
25092 uvuformat='$uvuformat'
25093 uvxformat='$uvxformat'
25094 vendorarch='$vendorarch'
25095 vendorarchexp='$vendorarchexp'
25096 vendorbin='$vendorbin'
25097 vendorbinexp='$vendorbinexp'
25098 vendorhtml1dir='$vendorhtml1dir'
25099 vendorhtml1direxp='$vendorhtml1direxp'
25100 vendorhtml3dir='$vendorhtml3dir'
25101 vendorhtml3direxp='$vendorhtml3direxp'
25102 vendorlib='$vendorlib'
25103 vendorlib_stem='$vendorlib_stem'
25104 vendorlibexp='$vendorlibexp'
25105 vendorman1dir='$vendorman1dir'
25106 vendorman1direxp='$vendorman1direxp'
25107 vendorman3dir='$vendorman3dir'
25108 vendorman3direxp='$vendorman3direxp'
25109 vendorprefix='$vendorprefix'
25110 vendorprefixexp='$vendorprefixexp'
25111 vendorscript='$vendorscript'
25112 vendorscriptexp='$vendorscriptexp'
25113 version='$version'
25114 version_patchlevel_string='$version_patchlevel_string'
25115 versiononly='$versiononly'
25116 vi='$vi'
25117 xlibpth='$xlibpth'
25118 yacc='$yacc'
25119 yaccflags='$yaccflags'
25120 zcat='$zcat'
25121 zip='$zip'
25122 EOT
25123
25124 : add special variables
25125 $test -f $src/patchlevel.h && \
25126 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25127 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25128 echo "PERL_CONFIG_SH=true" >>config.sh
25129
25130 : propagate old symbols
25131 if $test -f UU/config.sh; then
25132         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25133         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25134                 config.sh config.sh UU/oldconfig.sh |\
25135                 $sort | $uniq -u >UU/oldsyms
25136         set X `$cat UU/oldsyms`
25137         shift
25138         case $# in
25139         0) ;;
25140         *)
25141                 $cat <<EOM
25142 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25143 EOM
25144                 echo ": Variables propagated from previous config.sh file." >>config.sh
25145                 for sym in `$cat UU/oldsyms`; do
25146                         echo "    Propagating $hint variable "'$'"$sym..."
25147                         eval 'tmp="$'"${sym}"'"'
25148                         echo "$tmp" | \
25149                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25150                 done
25151                 ;;
25152         esac
25153 fi
25154
25155 : preserve RCS keywords in files with variable substitution, grrr
25156 Id='$Id'
25157
25158 : Finish up by extracting the .SH files
25159 case "$alldone" in
25160 exit)
25161         echo "Stopping at your request, leaving temporary files around."
25162         exit 0
25163         ;;
25164 cont)
25165         ;;
25166 '')
25167         dflt=''
25168         nostick=true
25169         $cat <<EOM
25170
25171 If you'd like to make any changes to the config.sh file before I begin
25172 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25173
25174 EOM
25175         rp="Press return or use a shell escape to edit config.sh:"
25176         . UU/myread
25177         nostick=''
25178         case "$ans" in
25179         '') ;;
25180         *) : in case they cannot read
25181                 sh 1>&4 -c "$ans";;
25182         esac
25183         ;;
25184 esac
25185
25186 : if this fails, just run all the .SH files by hand
25187 . ./config.sh
25188
25189 echo " "
25190 exec 1>&4
25191 pwd=`pwd`
25192 . ./UU/extract
25193 cd "$pwd"
25194
25195 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25196         dflt=y
25197         case "$silent" in
25198         true) ;;
25199         *)
25200                 $cat <<EOM
25201
25202 Now you need to generate make dependencies by running "$make depend".
25203 You might prefer to run it in background: "$make depend > makedepend.out &"
25204 It can take a while, so you might not want to run it right now.
25205
25206 EOM
25207                 ;;
25208         esac
25209         rp="Run $make depend now?"
25210         . UU/myread
25211         case "$ans" in
25212         y*)
25213                 $make depend && echo "Now you must run '$make'."
25214                 ;;
25215         *)
25216                 echo "You must run '$make depend' then '$make'."
25217                 ;;
25218         esac
25219 elif test -f [Mm]akefile; then
25220         echo " "
25221         echo "Now you must run a $make."
25222 else
25223         echo "Configure done."
25224 fi
25225
25226 if $test -f Policy.sh; then
25227     $cat <<EOM
25228
25229 If you compile $package on a different machine or from a different object
25230 directory, copy the Policy.sh file from this object directory to the
25231 new one before you run Configure -- this will help you with most of
25232 the policy defaults.
25233
25234 EOM
25235 fi
25236 if $test -f UU/config.msg; then
25237     echo "Hmm.  I also noted the following information while running:"
25238     echo " "
25239     $cat UU/config.msg >&4
25240 fi
25241 $rm -f kit*isdone ark*isdone
25242 $rm -rf UU
25243
25244 : End of Configure
25245