This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Use a weird value in a place where ignored
[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_const=''
414 d_copysign=''
415 d_copysignl=''
416 d_cplusplus=''
417 cryptlib=''
418 d_crypt=''
419 crypt_r_proto=''
420 d_crypt_r=''
421 d_csh=''
422 full_csh=''
423 d_ctermid=''
424 ctermid_r_proto=''
425 d_ctermid_r=''
426 ctime_r_proto=''
427 d_ctime_r=''
428 d_cuserid=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_dup3=''
444 d_eaccess=''
445 d_endgrent=''
446 d_endgrent_r=''
447 endgrent_r_proto=''
448 d_endhent=''
449 d_endhostent_r=''
450 endhostent_r_proto=''
451 d_endnent=''
452 d_endnetent_r=''
453 endnetent_r_proto=''
454 d_endpent=''
455 d_endprotoent_r=''
456 endprotoent_r_proto=''
457 d_endpwent=''
458 d_endpwent_r=''
459 endpwent_r_proto=''
460 d_endsent=''
461 d_endservent_r=''
462 endservent_r_proto=''
463 d_erf=''
464 d_erfc=''
465 d_exp2=''
466 d_expm1=''
467 d_faststdio=''
468 d_fchdir=''
469 d_fchmod=''
470 d_fchown=''
471 d_fcntl=''
472 d_fcntl_can_lock=''
473 d_fd_macros=''
474 d_fd_set=''
475 d_fds_bits=''
476 d_fdclose=''
477 d_fdim=''
478 d_fegetround=''
479 d_fgetpos=''
480 d_finite=''
481 d_finitel=''
482 d_flexfnam=''
483 d_flock=''
484 d_flockproto=''
485 d_fma=''
486 d_fmax=''
487 d_fmin=''
488 d_fork=''
489 d_fp_class=''
490 d_fp_classl=''
491 d_fpclass=''
492 d_fp_classify=''
493 d_fpclassify=''
494 d_fpclassl=''
495 d_fpgetround=''
496 d_fpos64_t=''
497 d_frexpl=''
498 d_fs_data_s=''
499 d_fchmodat=''
500 d_linkat=''
501 d_openat=''
502 d_renameat=''
503 d_unlinkat=''
504 d_fseeko=''
505 d_fsetpos=''
506 d_fstatfs=''
507 d_fsync=''
508 d_ftello=''
509 d_ftime=''
510 d_gettimeod=''
511 d_futimes=''
512 d_gai_strerror=''
513 d_Gconvert=''
514 d_getaddrinfo=''
515 d_getcwd=''
516 d_getespwnam=''
517 d_getfsstat=''
518 d_getgrent=''
519 d_getgrent_r=''
520 getgrent_r_proto=''
521 d_getgrgid_r=''
522 getgrgid_r_proto=''
523 d_getgrnam_r=''
524 getgrnam_r_proto=''
525 d_getgrps=''
526 d_gethbyaddr=''
527 d_gethbyname=''
528 d_gethent=''
529 aphostname=''
530 d_gethname=''
531 d_phostname=''
532 d_uname=''
533 d_gethostbyaddr_r=''
534 gethostbyaddr_r_proto=''
535 d_gethostbyname_r=''
536 gethostbyname_r_proto=''
537 d_gethostent_r=''
538 gethostent_r_proto=''
539 d_gethostprotos=''
540 d_getitimer=''
541 d_getlogin=''
542 d_getlogin_r=''
543 getlogin_r_proto=''
544 d_getmnt=''
545 d_getmntent=''
546 d_getnameinfo=''
547 d_getnbyaddr=''
548 d_getnbyname=''
549 d_getnent=''
550 d_getnetbyaddr_r=''
551 getnetbyaddr_r_proto=''
552 d_getnetbyname_r=''
553 getnetbyname_r_proto=''
554 d_getnetent_r=''
555 getnetent_r_proto=''
556 d_getnetprotos=''
557 d_getpagsz=''
558 d_getpent=''
559 d_getpgid=''
560 d_getpgrp2=''
561 d_bsdgetpgrp=''
562 d_getpgrp=''
563 d_getppid=''
564 d_getprior=''
565 d_getpbyname=''
566 d_getpbynumber=''
567 d_getprotobyname_r=''
568 getprotobyname_r_proto=''
569 d_getprotobynumber_r=''
570 getprotobynumber_r_proto=''
571 d_getprotoent_r=''
572 getprotoent_r_proto=''
573 d_getprotoprotos=''
574 d_getprpwnam=''
575 d_getpwent=''
576 d_getpwent_r=''
577 getpwent_r_proto=''
578 d_getpwnam_r=''
579 getpwnam_r_proto=''
580 d_getpwuid_r=''
581 getpwuid_r_proto=''
582 d_getsent=''
583 d_getservbyname_r=''
584 getservbyname_r_proto=''
585 d_getservbyport_r=''
586 getservbyport_r_proto=''
587 d_getservent_r=''
588 getservent_r_proto=''
589 d_getservprotos=''
590 d_getspnam=''
591 d_getspnam_r=''
592 getspnam_r_proto=''
593 d_getsbyname=''
594 d_getsbyport=''
595 d_gmtime_r=''
596 gmtime_r_proto=''
597 d_gnulibc=''
598 gnulibc_version=''
599 d_hasmntopt=''
600 d_htonl=''
601 d_hypot=''
602 d_ilogb=''
603 d_ilogbl=''
604 d_inetaton=''
605 d_inetntop=''
606 d_inetpton=''
607 d_int64_t=''
608 d_isascii=''
609 d_isblank=''
610 d_isfinite=''
611 d_isfinitel=''
612 d_isinf=''
613 d_isinfl=''
614 d_isless=''
615 d_isnan=''
616 d_isnanl=''
617 d_isnormal=''
618 d_j0=''
619 d_j0l=''
620 d_killpg=''
621 d_lc_monetary_2008=''
622 d_lchown=''
623 d_ldbl_dig=''
624 d_lgamma=''
625 d_lgamma_r=''
626 d_libm_lib_version=''
627 d_link=''
628 d_llrint=''
629 d_llrintl=''
630 d_llround=''
631 d_llroundl=''
632 d_localeconv_l=''
633 d_localtime_r=''
634 d_localtime_r_needs_tzset=''
635 localtime_r_proto=''
636 d_locconv=''
637 d_lockf=''
638 d_log1p=''
639 d_log2=''
640 d_logb=''
641 d_ldexpl=''
642 d_long_double_style_ieee=''
643 d_long_double_style_ieee_doubledouble=''
644 d_long_double_style_ieee_extended=''
645 d_long_double_style_ieee_std=''
646 d_long_double_style_vax=''
647 d_longdbl=''
648 longdblkind=''
649 longdblsize=''
650 d_longlong=''
651 longlongsize=''
652 d_lrint=''
653 d_lrintl=''
654 d_lround=''
655 d_lroundl=''
656 d_lseekproto=''
657 d_lstat=''
658 d_madvise=''
659 d_malloc_good_size=''
660 d_malloc_size=''
661 d_mblen=''
662 d_mbrlen=''
663 d_mbrtowc=''
664 d_mbstowcs=''
665 d_mbtowc=''
666 d_memmem=''
667 d_memrchr=''
668 d_mkdir=''
669 d_mkdtemp=''
670 d_mkfifo=''
671 d_mkostemp=''
672 d_mkstemp=''
673 d_mkstemps=''
674 d_mktime=''
675 d_mmap=''
676 mmaptype=''
677 d_modfl=''
678 d_modflproto=''
679 d_mprotect=''
680 d_msg=''
681 d_msgctl=''
682 d_msgget=''
683 d_msghdr_s=''
684 d_msgrcv=''
685 d_msgsnd=''
686 d_msync=''
687 d_munmap=''
688 d_nan=''
689 d_nanosleep=''
690 d_nearbyint=''
691 d_duplocale=''
692 d_freelocale=''
693 d_newlocale=''
694 d_querylocale=''
695 d_uselocale=''
696 i_xlocale=''
697 d_nextafter=''
698 d_nexttoward=''
699 d_nice=''
700 d_nl_langinfo=''
701 d_thread_safe_nl_langinfo_l=''
702 d_off64_t=''
703 d_open3=''
704 d_fpathconf=''
705 d_pathconf=''
706 d_pause=''
707 d_pipe2=''
708 d_pipe=''
709 d_poll=''
710 d_portable=''
711 d_prctl=''
712 d_prctl_set_name=''
713 d_procselfexe=''
714 procselfexe=''
715 d_old_pthread_create_joinable=''
716 old_pthread_create_joinable=''
717 d_pthread_atfork=''
718 d_pthread_attr_setscope=''
719 d_pthread_yield=''
720 d_sched_yield=''
721 sched_yield=''
722 d_ptrdiff_t=''
723 d_qgcvt=''
724 d_random_r=''
725 random_r_proto=''
726 d_readdir64_r=''
727 readdir64_r_proto=''
728 d_readdir=''
729 d_rewinddir=''
730 d_seekdir=''
731 d_telldir=''
732 d_readdir_r=''
733 readdir_r_proto=''
734 d_readlink=''
735 d_readv=''
736 d_recvmsg=''
737 d_re_comp=''
738 d_regcmp=''
739 d_regcomp=''
740 d_remainder=''
741 d_remquo=''
742 d_rename=''
743 d_rint=''
744 d_rmdir=''
745 d_round=''
746 d_sbrkproto=''
747 d_scalbn=''
748 d_scalbnl=''
749 d_select=''
750 d_sem=''
751 d_semctl=''
752 d_semget=''
753 d_semop=''
754 d_sendmsg=''
755 d_setegid=''
756 d_seteuid=''
757 d_setgrent=''
758 d_setgrent_r=''
759 setgrent_r_proto=''
760 d_setgrps=''
761 d_sethent=''
762 d_sethostent_r=''
763 sethostent_r_proto=''
764 d_setitimer=''
765 d_setlinebuf=''
766 d_setlocale=''
767 d_setlocale_r=''
768 setlocale_r_proto=''
769 d_setnent=''
770 d_setnetent_r=''
771 setnetent_r_proto=''
772 d_setpent=''
773 d_setpgid=''
774 d_setpgrp2=''
775 d_bsdsetpgrp=''
776 d_setpgrp=''
777 d_setprior=''
778 d_setproctitle=''
779 d_setprotoent_r=''
780 setprotoent_r_proto=''
781 d_setpwent=''
782 d_setpwent_r=''
783 setpwent_r_proto=''
784 d_setregid=''
785 d_setresgid=''
786 d_setresuid=''
787 d_setreuid=''
788 d_setrgid=''
789 d_setruid=''
790 d_setsent=''
791 d_setservent_r=''
792 setservent_r_proto=''
793 d_setsid=''
794 d_setvbuf=''
795 d_shm=''
796 d_shmat=''
797 d_shmatprototype=''
798 shmattype=''
799 d_shmctl=''
800 d_shmdt=''
801 d_shmget=''
802 d_sigaction=''
803 d_siginfo_si_addr=''
804 d_siginfo_si_band=''
805 d_siginfo_si_errno=''
806 d_siginfo_si_fd=''
807 d_siginfo_si_pid=''
808 d_siginfo_si_status=''
809 d_siginfo_si_uid=''
810 d_siginfo_si_value=''
811 d_signbit=''
812 d_sigprocmask=''
813 d_sigsetjmp=''
814 usesitecustomize=''
815 d_snprintf=''
816 d_vsnprintf=''
817 d_sockatmark=''
818 d_sockatmarkproto=''
819 d_ip_mreq=''
820 d_ip_mreq_source=''
821 d_ipv6_mreq=''
822 d_ipv6_mreq_source=''
823 d_msg_ctrunc=''
824 d_msg_dontroute=''
825 d_msg_oob=''
826 d_msg_peek=''
827 d_msg_proxy=''
828 d_oldsock=''
829 d_scm_rights=''
830 d_sin6_scope_id=''
831 d_sockaddr_in6=''
832 d_sockaddr_sa_len=''
833 d_socket=''
834 d_sockpair=''
835 sockethdr=''
836 socketlib=''
837 d_socklen_t=''
838 d_socks5_init=''
839 d_sqrtl=''
840 d_srand48_r=''
841 srand48_r_proto=''
842 d_srandom_r=''
843 srandom_r_proto=''
844 d_sresgproto=''
845 d_sresuproto=''
846 d_stat=''
847 d_statblks=''
848 d_statfs_f_flags=''
849 d_statfs_s=''
850 d_static_inline=''
851 perl_static_inline=''
852 d_fstatvfs=''
853 d_statvfs=''
854 d_stdio_cnt_lval=''
855 d_stdio_ptr_lval=''
856 d_stdio_ptr_lval_nochange_cnt=''
857 d_stdio_ptr_lval_sets_cnt=''
858 d_stdiobase=''
859 d_stdstdio=''
860 stdio_base=''
861 stdio_bufsiz=''
862 stdio_cnt=''
863 stdio_filbuf=''
864 stdio_ptr=''
865 d_strcoll=''
866 d_sysernlst=''
867 d_syserrlst=''
868 d_strerror_l=''
869 d_strerror_r=''
870 strerror_r_proto=''
871 d_strftime=''
872 d_strlcat=''
873 d_strlcpy=''
874 d_strnlen=''
875 d_strtod=''
876 d_strtod_l=''
877 d_strtol=''
878 d_strtold=''
879 d_strtold_l=''
880 d_strtoll=''
881 d_strtoq=''
882 d_strtoul=''
883 d_strtoull=''
884 d_strtouq=''
885 d_strxfrm=''
886 d_symlink=''
887 d_syscall=''
888 d_syscallproto=''
889 d_sysconf=''
890 d_system=''
891 d_tcgetpgrp=''
892 d_tcsetpgrp=''
893 d_telldirproto=''
894 d_tgamma=''
895 d_time=''
896 timetype=''
897 d_asctime64=''
898 d_ctime64=''
899 d_difftime64=''
900 d_gmtime64=''
901 d_localtime64=''
902 d_mktime64=''
903 d_timegm=''
904 clocktype=''
905 d_times=''
906 d_tmpnam_r=''
907 tmpnam_r_proto=''
908 d_trunc=''
909 d_truncate=''
910 d_truncl=''
911 d_ttyname_r=''
912 ttyname_r_proto=''
913 d_tzname=''
914 d_u32align=''
915 d_ualarm=''
916 d_umask=''
917 d_semctl_semid_ds=''
918 d_semctl_semun=''
919 d_union_semun=''
920 d_unordered=''
921 d_unsetenv=''
922 d_usleep=''
923 d_usleepproto=''
924 d_ustat=''
925 d_pseudofork=''
926 d_vfork=''
927 usevfork=''
928 d_voidsig=''
929 signal_t=''
930 d_wait4=''
931 d_waitpid=''
932 d_wcscmp=''
933 d_wcstombs=''
934 d_wcsxfrm=''
935 d_wctomb=''
936 d_writev=''
937 default_inc_excludes_dot=''
938 dlext=''
939 bin_ELF=''
940 cccdlflags=''
941 ccdlflags=''
942 dlsrc=''
943 ld=''
944 ld_can_script=''
945 lddlflags=''
946 usedl=''
947 doublesize=''
948 dtraceobject=''
949 dtracexnolibs=''
950 ebcdic=''
951 fflushNULL=''
952 fflushall=''
953 fpossize=''
954 fpostype=''
955 gccansipedantic=''
956 gccosandvers=''
957 gccversion=''
958 gidformat=''
959 gidsign=''
960 gidsize=''
961 gidtype=''
962 groupstype=''
963 h_fcntl=''
964 h_sysfile=''
965 html1dir=''
966 html1direxp=''
967 installhtml1dir=''
968 html3dir=''
969 html3direxp=''
970 installhtml3dir=''
971 i_arpainet=''
972 i_bfd=''
973 i_crypt=''
974 db_hashtype=''
975 db_prefixtype=''
976 db_version_major=''
977 db_version_minor=''
978 db_version_patch=''
979 i_db=''
980 i_dbm=''
981 i_rpcsvcdbm=''
982 d_dirnamlen=''
983 direntrytype=''
984 i_dirent=''
985 i_dlfcn=''
986 i_execinfo=''
987 i_fcntl=''
988 i_fenv=''
989 i_fp=''
990 i_fp_class=''
991 i_gdbm=''
992 d_grpasswd=''
993 i_grp=''
994 i_ieeefp=''
995 i_inttypes=''
996 i_langinfo=''
997 i_libutil=''
998 i_locale=''
999 i_machcthr=''
1000 i_malloc=''
1001 i_mallocmalloc=''
1002 i_mntent=''
1003 d_gdbm_ndbm_h_uses_prototypes=''
1004 d_gdbmndbm_h_uses_prototypes=''
1005 d_ndbm=''
1006 d_ndbm_h_uses_prototypes=''
1007 i_gdbm_ndbm=''
1008 i_gdbmndbm=''
1009 i_ndbm=''
1010 i_netdb=''
1011 i_neterrno=''
1012 i_netinettcp=''
1013 i_niin=''
1014 i_sysin=''
1015 i_poll=''
1016 i_prot=''
1017 i_pthread=''
1018 d_pwage=''
1019 d_pwchange=''
1020 d_pwclass=''
1021 d_pwcomment=''
1022 d_pwexpire=''
1023 d_pwgecos=''
1024 d_pwpasswd=''
1025 d_pwquota=''
1026 i_pwd=''
1027 i_quadmath=''
1028 i_shadow=''
1029 i_socks=''
1030 i_stdbool=''
1031 i_stdint=''
1032 i_stdlib=''
1033 i_sunmath=''
1034 i_sysaccess=''
1035 i_sysdir=''
1036 i_sysfile=''
1037 d_voidtty=''
1038 i_bsdioctl=''
1039 i_sysfilio=''
1040 i_sysioctl=''
1041 i_syssockio=''
1042 i_syslog=''
1043 i_sysmman=''
1044 i_sysmode=''
1045 i_sysmount=''
1046 i_sysndir=''
1047 i_sysparam=''
1048 i_syspoll=''
1049 i_sysresrc=''
1050 i_syssecrt=''
1051 i_sysselct=''
1052 i_sysstat=''
1053 i_sysstatfs=''
1054 i_sysstatvfs=''
1055 i_systimes=''
1056 i_systypes=''
1057 i_sysuio=''
1058 i_sysun=''
1059 i_sysutsname=''
1060 i_sysvfs=''
1061 i_syswait=''
1062 i_sgtty=''
1063 i_termio=''
1064 i_termios=''
1065 d_tm_tm_gmtoff=''
1066 d_tm_tm_zone=''
1067 i_systime=''
1068 i_systimek=''
1069 i_time=''
1070 timeincl=''
1071 i_unistd=''
1072 i_ustat=''
1073 i_utime=''
1074 i_vfork=''
1075 i_wchar=''
1076 d_inc_version_list=''
1077 inc_version_list=''
1078 inc_version_list_init=''
1079 doubleinfbytes=''
1080 doublenanbytes=''
1081 longdblinfbytes=''
1082 longdblnanbytes=''
1083 installprefix=''
1084 installprefixexp=''
1085 installstyle=''
1086 installusrbinperl=''
1087 intsize=''
1088 longsize=''
1089 shortsize=''
1090 issymlink=''
1091 libc=''
1092 ldlibpthname=''
1093 libperl=''
1094 shrpenv=''
1095 useshrplib=''
1096 glibpth=''
1097 incpth=''
1098 libpth=''
1099 loclibpth=''
1100 plibpth=''
1101 xlibpth=''
1102 ignore_versioned_solibs=''
1103 libs=''
1104 libsdirs=''
1105 libsfiles=''
1106 libsfound=''
1107 libspath=''
1108 lns=''
1109 d_PRIEUldbl=''
1110 d_PRIFUldbl=''
1111 d_PRIGUldbl=''
1112 d_PRIeldbl=''
1113 d_PRIfldbl=''
1114 d_PRIgldbl=''
1115 d_SCNfldbl=''
1116 d_double_has_inf=''
1117 d_double_has_nan=''
1118 d_double_has_negative_zero=''
1119 d_double_has_subnormals=''
1120 d_double_style_cray=''
1121 d_double_style_ibm=''
1122 d_double_style_ieee=''
1123 d_double_style_vax=''
1124 doublekind=''
1125 sPRIEUldbl=''
1126 sPRIFUldbl=''
1127 sPRIGUldbl=''
1128 sPRIeldbl=''
1129 sPRIfldbl=''
1130 sPRIgldbl=''
1131 sSCNfldbl=''
1132 lseeksize=''
1133 lseektype=''
1134 make_set_make=''
1135 d_mymalloc=''
1136 freetype=''
1137 mallocobj=''
1138 mallocsrc=''
1139 malloctype=''
1140 usemallocwrap=''
1141 usemymalloc=''
1142 installman1dir=''
1143 man1dir=''
1144 man1direxp=''
1145 man1ext=''
1146 installman3dir=''
1147 man3dir=''
1148 man3direxp=''
1149 man3ext=''
1150 doublemantbits=''
1151 longdblmantbits=''
1152 nvmantbits=''
1153 modetype=''
1154 multiarch=''
1155 mydomain=''
1156 myhostname=''
1157 phostname=''
1158 c=''
1159 n=''
1160 d_eofnblk=''
1161 eagain=''
1162 o_nonblock=''
1163 rd_nodata=''
1164 need_va_copy=''
1165 netdb_hlen_type=''
1166 netdb_host_type=''
1167 netdb_name_type=''
1168 netdb_net_type=''
1169 groupcat=''
1170 hostcat=''
1171 passcat=''
1172 orderlib=''
1173 ranlib=''
1174 d_perl_otherlibdirs=''
1175 otherlibdirs=''
1176 package=''
1177 spackage=''
1178 pager=''
1179 api_revision=''
1180 api_subversion=''
1181 api_version=''
1182 api_versionstring=''
1183 patchlevel=''
1184 perl_patchlevel=''
1185 revision=''
1186 subversion=''
1187 version=''
1188 version_patchlevel_string=''
1189 perl5=''
1190 perladmin=''
1191 perlpath=''
1192 d_nv_preserves_uv=''
1193 d_nv_zero_is_allbits_zero=''
1194 i16size=''
1195 i16type=''
1196 i32size=''
1197 i32type=''
1198 i64size=''
1199 i64type=''
1200 i8size=''
1201 i8type=''
1202 ivsize=''
1203 ivtype=''
1204 nv_overflows_integers_at=''
1205 nv_preserves_uv_bits=''
1206 nvsize=''
1207 nvtype=''
1208 u16size=''
1209 u16type=''
1210 u32size=''
1211 u32type=''
1212 u64size=''
1213 u64type=''
1214 u8size=''
1215 u8type=''
1216 uvsize=''
1217 uvtype=''
1218 ivdformat=''
1219 nvEUformat=''
1220 nvFUformat=''
1221 nvGUformat=''
1222 nveformat=''
1223 nvfformat=''
1224 nvgformat=''
1225 uvXUformat=''
1226 uvoformat=''
1227 uvuformat=''
1228 uvxformat=''
1229 pidtype=''
1230 prefix=''
1231 prefixexp=''
1232 installprivlib=''
1233 privlib=''
1234 privlibexp=''
1235 ptrsize=''
1236 d_PRIXU64=''
1237 d_PRId64=''
1238 d_PRIi64=''
1239 d_PRIo64=''
1240 d_PRIu64=''
1241 d_PRIx64=''
1242 sPRIXU64=''
1243 sPRId64=''
1244 sPRIi64=''
1245 sPRIo64=''
1246 sPRIu64=''
1247 sPRIx64=''
1248 d_quad=''
1249 quadkind=''
1250 quadtype=''
1251 uquadtype=''
1252 drand01=''
1253 randbits=''
1254 randfunc=''
1255 randseedtype=''
1256 seedfunc=''
1257 installscript=''
1258 scriptdir=''
1259 scriptdirexp=''
1260 selectminbits=''
1261 selecttype=''
1262 sh=''
1263 targetsh=''
1264 sig_count=''
1265 sig_name=''
1266 sig_name_init=''
1267 sig_num=''
1268 sig_num_init=''
1269 sig_size=''
1270 d_sitearch=''
1271 installsitearch=''
1272 sitearch=''
1273 sitearchexp=''
1274 installsitebin=''
1275 sitebin=''
1276 sitebinexp=''
1277 installsitehtml1dir=''
1278 sitehtml1dir=''
1279 sitehtml1direxp=''
1280 installsitehtml3dir=''
1281 sitehtml3dir=''
1282 sitehtml3direxp=''
1283 installsitelib=''
1284 sitelib=''
1285 sitelib_stem=''
1286 sitelibexp=''
1287 installsiteman1dir=''
1288 siteman1dir=''
1289 siteman1direxp=''
1290 installsiteman3dir=''
1291 siteman3dir=''
1292 siteman3direxp=''
1293 siteprefix=''
1294 siteprefixexp=''
1295 installsitescript=''
1296 sitescript=''
1297 sitescriptexp=''
1298 sizesize=''
1299 sizetype=''
1300 d_libname_unique=''
1301 so=''
1302 socksizetype=''
1303 sharpbang=''
1304 shsharp=''
1305 spitshell=''
1306 src=''
1307 ssizetype=''
1308 st_ino_sign=''
1309 st_ino_size=''
1310 startperl=''
1311 startsh=''
1312 stdchar=''
1313 d_stdio_stream_array=''
1314 stdio_stream_array=''
1315 sysman=''
1316 sGMTIME_max=''
1317 sGMTIME_min=''
1318 sLOCALTIME_max=''
1319 sLOCALTIME_min=''
1320 trnl=''
1321 uidformat=''
1322 uidsign=''
1323 uidsize=''
1324 uidtype=''
1325 archname64=''
1326 use64bitall=''
1327 use64bitint=''
1328 usecbacktrace=''
1329 dtrace=''
1330 usedtrace=''
1331 usefaststdio=''
1332 usekernprocpathname=''
1333 ccflags_uselargefiles=''
1334 ldflags_uselargefiles=''
1335 libswanted_uselargefiles=''
1336 uselargefiles=''
1337 uselongdouble=''
1338 usemorebits=''
1339 usemultiplicity=''
1340 nm_opt=''
1341 nm_so_opt=''
1342 runnm=''
1343 usenm=''
1344 usensgetexecutablepath=''
1345 useperlio=''
1346 usequadmath=''
1347 usesocks=''
1348 d_oldpthreads=''
1349 use5005threads=''
1350 useithreads=''
1351 usereentrant=''
1352 usethreads=''
1353 incpath=''
1354 mips_type=''
1355 usrinc=''
1356 d_vendorarch=''
1357 installvendorarch=''
1358 vendorarch=''
1359 vendorarchexp=''
1360 d_vendorbin=''
1361 installvendorbin=''
1362 vendorbin=''
1363 vendorbinexp=''
1364 installvendorhtml1dir=''
1365 vendorhtml1dir=''
1366 vendorhtml1direxp=''
1367 installvendorhtml3dir=''
1368 vendorhtml3dir=''
1369 vendorhtml3direxp=''
1370 d_vendorlib=''
1371 installvendorlib=''
1372 vendorlib=''
1373 vendorlib_stem=''
1374 vendorlibexp=''
1375 installvendorman1dir=''
1376 vendorman1dir=''
1377 vendorman1direxp=''
1378 installvendorman3dir=''
1379 vendorman3dir=''
1380 vendorman3direxp=''
1381 usevendorprefix=''
1382 vendorprefix=''
1383 vendorprefixexp=''
1384 d_vendorscript=''
1385 installvendorscript=''
1386 vendorscript=''
1387 vendorscriptexp=''
1388 versiononly=''
1389 yacc=''
1390 yaccflags=''
1391 CONFIG=''
1392
1393 : Detect odd OSs
1394 define='define'
1395 undef='undef'
1396 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1397 rmlist=''
1398
1399 : We must find out about Eunice early
1400 eunicefix=':'
1401 if test -f /etc/unixtovms; then
1402         eunicefix=/etc/unixtovms
1403 fi
1404 if test -f /etc/unixtovms.exe; then
1405         eunicefix=/etc/unixtovms.exe
1406 fi
1407
1408 : Set executable suffix now -- needed before hints available
1409 if test -f "/libs/version.library"; then
1410 : Amiga OS
1411     _exe=""
1412 elif test -f "/system/gnu_library/bin/ar.pm"; then
1413 : Stratus VOS
1414     _exe=".pm"
1415 elif test -n "$DJGPP"; then
1416 : DOS DJGPP
1417     _exe=".exe"
1418 elif test -f /kern/cookiejar; then
1419 : MiNT
1420     _exe=""
1421 elif test -d c:/. -o -n "$is_os2" ; then
1422 : OS/2 or cygwin
1423     _exe=".exe"
1424 fi
1425
1426 groupstype=''
1427 i_whoami=''
1428 : Possible local include directories to search.
1429 : Set locincpth to "" in a hint file to defeat local include searches.
1430 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1431 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1432 :
1433 : no include file wanted by default
1434 inclwanted=''
1435
1436 : Enable -DEBUGGING and -DDEBUGGING from the command line
1437 EBUGGING=''
1438 DEBUGGING=''
1439
1440 : Trailing extension.  Override this in a hint file, if needed.
1441 : Extra object files, if any, needed on this platform.
1442 archobjs=''
1443 libnames=''
1444 : change the next line if compiling for Xenix/286 on Xenix/386
1445 xlibpth='/usr/lib/386 /lib/386'
1446 : Possible local library directories to search.
1447 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1448 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1449
1450 : general looking path for locating libraries
1451 glibpth="/lib /usr/lib $xlibpth"
1452 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1453 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1454 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1455 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1456
1457 : Private path used by Configure to find libraries.  Its value
1458 : is prepended to libpth. This variable takes care of special
1459 : machines, like the mips.  Usually, it should be empty.
1460 plibpth=''
1461
1462 : default library list
1463 libswanted=''
1464 : some systems want to use only the non-versioned libso:s
1465 ignore_versioned_solibs=''
1466 ccname=''
1467 ccversion=''
1468 perllibs=''
1469 : set useposix=false in your hint file to disable the POSIX extension.
1470 useposix=true
1471 : set useopcode=false in your hint file to disable the Opcode extension.
1472 useopcode=true
1473 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1474 uselanginfo=true
1475 archname64=''
1476 ccflags_uselargefiles=''
1477 ldflags_uselargefiles=''
1478 libswanted_uselargefiles=''
1479 : set usemultiplicity on the Configure command line to enable multiplicity.
1480 : set usesocks on the Configure command line to enable socks.
1481 archname=''
1482 : set usethreads on the Configure command line to enable threads.
1483 usereentrant='undef'
1484 : List of libraries we want.
1485 : If anyone needs extra -lxxx, put those in a hint file.
1486 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1487 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1488 : We probably want to search /usr/shlib before most other libraries.
1489 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1490 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1491 glibpth="/usr/shlib $glibpth"
1492 : Do not use vfork unless overridden by a hint file.
1493 usevfork=false
1494
1495 : Find the basic shell for Bourne shell scripts
1496 case "$sh" in
1497 '')
1498         case "$SYSTYPE" in
1499         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1500         *) xxx='/bin/sh';;
1501         esac
1502         if test -f "$xxx"; then
1503                 sh="$xxx"
1504         else
1505                 : Build up a list and do a single loop so we can 'break' out.
1506                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1507                 for xxx in sh bash ksh pdksh ash; do
1508                         for p in $pth; do
1509                                 try="$try ${p}/${xxx}"
1510                         done
1511                 done
1512                 for xxx in $try; do
1513                         if test -f "$xxx"; then
1514                                 sh="$xxx";
1515                                 break
1516                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1517                                 sh="$xxx";
1518                                 break
1519                         elif test -f "$xxx.exe"; then
1520                                 sh="$xxx";
1521                                 break
1522                         fi
1523                 done
1524         fi
1525         ;;
1526 esac
1527
1528 case "$sh" in
1529 '')     cat >&2 <<EOM
1530 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1531
1532 Usually it's in /bin/sh.  How did you even get this far?
1533 Please contact me (Perl Maintainers) at perlbug@perl.org and
1534 we'll try to straighten this all out.
1535 EOM
1536         exit 1
1537         ;;
1538 esac
1539
1540 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1541 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1542 targetsh=$sh
1543
1544 : see if sh knows # comments
1545 if `$sh -c '#' >/dev/null 2>&1`; then
1546         shsharp=true
1547         spitshell=cat
1548         xcat=/bin/cat
1549         test -f $xcat$_exe || xcat=/usr/bin/cat
1550         if test ! -f $xcat$_exe; then
1551                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1552                         if test -f $p/cat$_exe; then
1553                                 xcat=$p/cat
1554                                 break
1555                         fi
1556                 done
1557                 if test ! -f $xcat$_exe; then
1558                         echo "Can't find cat anywhere!"
1559                         exit 1
1560                 fi
1561         fi
1562         echo "#!$xcat" >sharp
1563         $eunicefix sharp
1564         chmod +x sharp
1565         ./sharp > today 2>/dev/null
1566         if test -s today; then
1567                 sharpbang='#!'
1568         else
1569                 echo "#! $xcat" > sharp
1570                 $eunicefix sharp
1571                 chmod +x sharp
1572                 ./sharp > today 2>/dev/null
1573                 if test -s today; then
1574                         sharpbang='#! '
1575                 else
1576                         sharpbang=': use '
1577                 fi
1578         fi
1579 else
1580         echo " "
1581         echo "Your $sh doesn't grok # comments--I will strip them later on."
1582         shsharp=false
1583         cd ..
1584         echo "exec grep -v '^[  ]*#'" >spitshell
1585         chmod +x spitshell
1586         $eunicefix spitshell
1587         spitshell=`pwd`/spitshell
1588         cd UU
1589         echo "I presume that if # doesn't work, #! won't work either!"
1590         sharpbang=': use '
1591 fi
1592 rm -f sharp today
1593
1594 : figure out how to guarantee sh startup
1595 case "$startsh" in
1596 '') startsh=${sharpbang}${sh} ;;
1597 *)
1598 esac
1599 cat >sharp <<EOSS
1600 $startsh
1601 set abc
1602 test "$?abc" != 1
1603 EOSS
1604
1605 chmod +x sharp
1606 $eunicefix sharp
1607 if ./sharp; then
1608         : echo "Yup, it does."
1609 else
1610         echo "Hmm... '$startsh' does not guarantee sh startup..."
1611         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1612 fi
1613 rm -f sharp
1614
1615 : Save command line options in file UU/cmdline.opt for later use in
1616 : generating config.sh.
1617 cat > cmdline.opt <<EOSH
1618 : Configure command line arguments.
1619 config_arg0='$0'
1620 config_args='$*'
1621 config_argc=$#
1622 EOSH
1623 argn=1
1624 args_exp=''
1625 args_sep=''
1626 for arg in "$@"; do
1627         cat >>cmdline.opt <<EOSH
1628 config_arg$argn='$arg'
1629 EOSH
1630         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1631 $arg
1632 EOC
1633         arg_exp=`cat cmdl.opt`
1634         args_exp="$args_exp$args_sep'$arg_exp'"
1635         argn=`expr $argn + 1`
1636         args_sep=' '
1637 done
1638 rm -f cmdl.opt
1639
1640 : produce awk script to parse command line options
1641 cat >options.awk <<'EOF'
1642 BEGIN {
1643         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1644
1645         len = length(optstr);
1646         for (i = 1; i <= len; i++) {
1647                 c = substr(optstr, i, 1);
1648                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1649                 if (a == ":") {
1650                         arg[c] = 1;
1651                         i++;
1652                 }
1653                 opt[c] = 1;
1654         }
1655 }
1656 {
1657         expect = 0;
1658         str = $0;
1659         if (substr(str, 1, 1) != "-") {
1660                 printf("'%s'\n", str);
1661                 next;
1662         }
1663         len = length($0);
1664         for (i = 2; i <= len; i++) {
1665                 c = substr(str, i, 1);
1666                 if (!opt[c]) {
1667                         printf("-%s\n", substr(str, i));
1668                         next;
1669                 }
1670                 printf("-%s\n", c);
1671                 if (arg[c]) {
1672                         if (i < len)
1673                                 printf("'%s'\n", substr(str, i + 1));
1674                         else
1675                                 expect = 1;
1676                         next;
1677                 }
1678         }
1679 }
1680 END {
1681         if (expect)
1682                 print "?";
1683 }
1684 EOF
1685
1686 : process the command line options
1687 set X `for arg in "$@"; do echo "X$arg"; done |
1688         sed -e s/X// | awk -f options.awk`
1689 eval "set $*"
1690 shift
1691 rm -f options.awk
1692
1693 : set up default values
1694 fastread=''
1695 reuseval=false
1696 config_sh=''
1697 alldone=''
1698 error=''
1699 silent=''
1700 extractsh=''
1701 knowitall=''
1702 rm -f optdef.sh posthint.sh
1703 cat >optdef.sh <<EOS
1704 $startsh
1705 EOS
1706
1707
1708 : option parsing
1709 while test $# -gt 0; do
1710         case "$1" in
1711         -d) shift; fastread=yes;;
1712         -e) shift; alldone=cont;;
1713         -f)
1714                 shift
1715                 cd ..
1716                 if test -r "$1"; then
1717                         config_sh="$1"
1718                 else
1719                         echo "$me: cannot read config file $1." >&2
1720                         error=true
1721                 fi
1722                 cd UU
1723                 shift;;
1724         --help|\
1725         -h) shift; error=true;;
1726         -r) shift; reuseval=true;;
1727         -s) shift; silent=true; realsilent=true;;
1728         -E) shift; alldone=exit;;
1729         -K) shift; knowitall=true;;
1730         -O) shift;;
1731         -S) shift; silent=true; extractsh=true;;
1732         -D)
1733                 shift
1734                 case "$1" in
1735                 *=)
1736                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1737                         echo "$me: ignoring -D $1" >&2
1738                         ;;
1739                 *=*) echo "$1" | \
1740                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1741                 *) echo "$1='define'" >> optdef.sh;;
1742                 esac
1743                 shift
1744                 ;;
1745         -U)
1746                 shift
1747                 case "$1" in
1748                 *=) echo "$1" >> optdef.sh;;
1749                 *=*)
1750                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1751                         echo "$me: ignoring -U $1" >&2
1752                         ;;
1753                 *) echo "$1='undef'" >> optdef.sh;;
1754                 esac
1755                 shift
1756                 ;;
1757         -A)
1758             shift
1759             xxx=''
1760             yyy="$1"
1761             zzz=''
1762             uuu=undef
1763             case "$yyy" in
1764             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1765                  case "$zzz" in
1766                  *:*) zzz='' ;;
1767                  *)   xxx=append
1768                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1769                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1770                  esac
1771                  ;;
1772             esac
1773             case "$xxx" in
1774             '')  case "$yyy" in
1775                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1776                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1777                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1778                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1779                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1780                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1781                  esac
1782                  ;;
1783             esac
1784             case "$xxx" in
1785             append)
1786                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1787             clear)
1788                 echo "$yyy=''"                  >> posthint.sh ;;
1789             define)
1790                 case "$zzz" in
1791                 '') zzz=define ;;
1792                 esac
1793                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1794             eval)
1795                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1796             prepend)
1797                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1798             undef)
1799                 case "$zzz" in
1800                 '') zzz="$uuu" ;;
1801                 esac
1802                 echo "$yyy=$zzz"                >> posthint.sh ;;
1803             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1804             esac
1805             shift
1806             ;;
1807         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1808             exit 0;;
1809         --) break;;
1810         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1811         *) break;;
1812         esac
1813 done
1814
1815 case "$error" in
1816 true)
1817         cat >&2 <<EOM
1818 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1819                  [-U symbol] [-U symbol=] [-A command:symbol...]
1820   -d : use defaults for all answers.
1821   -e : go on without questioning past the production of config.sh.
1822   -f : specify an alternate default configuration file.
1823   -h : print this help message and exit (with an error status).
1824   -r : reuse C symbols value if possible (skips costly nm extraction).
1825   -s : silent mode, only echoes questions and essential information.
1826   -D : define symbol to have some value:
1827          -D symbol         symbol gets the value 'define'
1828          -D symbol=value   symbol gets the value 'value'
1829        common used examples (see INSTALL for more info):
1830          -Duse64bitint            use 64bit integers
1831          -Duse64bitall            use 64bit integers and pointers
1832          -Dusethreads             use thread support
1833          -Dinc_version_list=none  do not include older perl trees in @INC
1834          -DEBUGGING=none          DEBUGGING options
1835          -Dcc=gcc                 choose your compiler
1836          -Dprefix=/opt/perl5      choose your destination
1837   -E : stop at the end of questions, after having produced config.sh.
1838   -K : do not use unless you know what you are doing.
1839   -O : ignored for backward compatibility
1840   -S : perform variable substitutions on all .SH files (can mix with -f)
1841   -U : undefine symbol:
1842          -U symbol    symbol gets the value 'undef'
1843          -U symbol=   symbol gets completely empty
1844        e.g.:  -Uversiononly
1845   -A : manipulate symbol after the platform specific hints have been applied:
1846          -A append:symbol=value   append value to symbol
1847          -A symbol=value          like append:, but with a separating space
1848          -A define:symbol=value   define symbol to have value
1849          -A clear:symbol          define symbol to be ''
1850          -A define:symbol         define symbol to be 'define'
1851          -A eval:symbol=value     define symbol to be eval of value
1852          -A prepend:symbol=value  prepend value to symbol
1853          -A undef:symbol          define symbol to be 'undef'
1854          -A undef:symbol=         define symbol to be ''
1855        e.g.:  -A prepend:libswanted='cl pthread '
1856               -A ccflags=-DSOME_MACRO
1857   -V : print version number and exit (with a zero status).
1858 EOM
1859         exit 1
1860         ;;
1861 esac
1862
1863 : Sanity checks
1864 case "$fastread$alldone" in
1865 yescont|yesexit) ;;
1866 *)
1867         case "$extractsh" in
1868         true) ;;
1869         *)
1870                 if test ! -t 0; then
1871                         echo "Say 'sh Configure', not 'sh <Configure'"
1872                         exit 1
1873                 fi
1874                 ;;
1875         esac
1876         ;;
1877 esac
1878
1879 exec 4>&1
1880 case "$silent" in
1881 true) exec 1>/dev/null;;
1882 esac
1883
1884 : run the defines and the undefines, if any, but leave the file out there...
1885 touch optdef.sh
1886 grep '\\' optdef.sh >/dev/null 2>&1
1887 if test $? = 0; then
1888     echo "Configure does not support \\ in -D arguments"
1889     exit 1
1890 fi
1891 . ./optdef.sh
1892 : create the posthint manipulation script and leave the file out there...
1893 touch posthint.sh
1894
1895 : set package name
1896 package='perl5'
1897 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1898 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1899 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1900 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1901 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1902 esac
1903
1904 : Some greps do not return status, grrr.
1905 echo "grimblepritz" >grimble
1906 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1907         contains=contains
1908 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1909         contains=grep
1910 else
1911         contains=contains
1912 fi
1913 rm -f grimble
1914 : the following should work in any shell
1915 case "$contains" in
1916 contains*)
1917         echo " "
1918         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1919         cat >contains <<'EOSS'
1920 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1921 EOSS
1922 chmod +x contains
1923 esac
1924
1925 : Find the path to the source tree
1926 case "$src" in
1927 '') case "$0" in
1928     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1929          case "$src" in
1930          /*)    ;;
1931          .)     ;;
1932          *)     src=`cd ../$src && pwd` ;;
1933          esac
1934          ;;
1935     *)   src='.';;
1936     esac;;
1937 esac
1938 case "$src" in
1939 '')     src=/
1940         rsrc=/
1941         ;;
1942 /*)     rsrc="$src";;
1943 *)      rsrc="../$src";;
1944 esac
1945 if test -f $rsrc/Configure && \
1946         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1947 then
1948    : found it, so we are ok.
1949 else
1950         rsrc=''
1951         for src in . .. ../.. ../../.. ../../../..; do
1952                 if test -f ../$src/Configure && \
1953                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1954                 then
1955                         rsrc=../$src
1956                         break
1957                 fi
1958         done
1959 fi
1960 case "$rsrc" in
1961 '')
1962         cat <<EOM >&4
1963
1964 Sorry, I can't seem to locate the source dir for $package.  Please start
1965 Configure with an explicit path -- i.e. /some/path/Configure.
1966
1967 EOM
1968         exit 1
1969         ;;
1970 ../.)   rsrc='..';;
1971 *)
1972         echo " "
1973         echo "Sources for $package found in \"$src\"." >&4
1974         ;;
1975 esac
1976
1977 : script used to extract .SH files with variable substitutions
1978 cat >extract <<'EOS'
1979 PERL_CONFIG_SH=true
1980 echo "Doing variable substitutions on .SH files..."
1981 if test -f MANIFEST; then
1982         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1983 else
1984         echo "(Looking for .SH files under the source directory.)"
1985         set x `(cd "$src"; find . -name "*.SH" -print)`
1986 fi
1987 shift
1988 case $# in
1989 0) set x `(cd "$src"; echo *.SH)`; shift;;
1990 esac
1991 if test ! -f "$src/$1"; then
1992         shift
1993 fi
1994 mkdir_p='
1995 name=$1;
1996 create="";
1997 while test $name; do
1998         if test ! -d "$name"; then
1999                 create="$name $create";
2000                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2001                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2002         else
2003                 name="";
2004         fi;
2005 done;
2006 for file in $create; do
2007         mkdir $file;
2008 done
2009 '
2010 for file in $*; do
2011         case "$src" in
2012         ".")
2013                 case "$file" in
2014                 */*)
2015                         dir=`expr X$file : 'X\(.*\)/'`
2016                         file=`expr X$file : 'X.*/\(.*\)'`
2017                         (cd "$dir" && . ./$file)
2018                         ;;
2019                 *)
2020                         . ./$file
2021                         ;;
2022                 esac
2023                 ;;
2024         *)
2025                 case "$file" in
2026                 */*)
2027                         dir=`expr X$file : 'X\(.*\)/'`
2028                         file=`expr X$file : 'X.*/\(.*\)'`
2029                         (set x $dir; shift; eval $mkdir_p)
2030                         sh <"$src/$dir/$file"
2031                         ;;
2032                 *)
2033                         sh <"$src/$file"
2034                         ;;
2035                 esac
2036                 ;;
2037         esac
2038 done
2039 if test -f "$src/config_h.SH"; then
2040         if test ! -f config.h; then
2041         : oops, they left it out of MANIFEST, probably, so do it anyway.
2042         . "$src/config_h.SH"
2043         fi
2044 fi
2045 EOS
2046
2047 : extract files and exit if asked to do so
2048 case "$extractsh" in
2049 true)
2050         case "$realsilent" in
2051         true) ;;
2052         *) exec 1>&4;;
2053         esac
2054         case "$config_sh" in
2055         '') config_sh='config.sh';;
2056         esac
2057         echo " "
2058         echo "Fetching answers from $config_sh..."
2059         cd ..
2060         . $config_sh
2061         . UU/optdef.sh
2062         echo " "
2063         . UU/extract
2064         rm -rf UU
2065         echo "Extraction done."
2066         exit 0
2067         ;;
2068 esac
2069
2070 : Eunice requires " " instead of "", can you believe it
2071 echo " "
2072 : Here we go...
2073 echo "Beginning of configuration questions for $package."
2074
2075 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2076
2077 : first determine how to suppress newline on echo command
2078 echo " "
2079 echo "Checking echo to see how to suppress newlines..."
2080 (echo "hi there\c" ; echo " ") >.echotmp
2081 if $contains c .echotmp >/dev/null 2>&1 ; then
2082         echo "...using -n."
2083         n='-n'
2084         c=''
2085 else
2086         cat <<'EOM'
2087 ...using \c
2088 EOM
2089         n=''
2090         c='\c'
2091 fi
2092 echo $n "The star should be here-->$c"
2093 echo '*'
2094 rm -f .echotmp
2095
2096 : Now test for existence of everything in MANIFEST
2097 echo " "
2098 if test -f "$rsrc/MANIFEST"; then
2099         echo "First let's make sure your kit is complete.  Checking..." >&4
2100         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2101                 (split -l 50 2>/dev/null || split -50)
2102         rm -f missing
2103         tmppwd=`pwd`
2104         for filelist in x??; do
2105                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2106                         >/dev/null 2>>"$tmppwd/missing")
2107         done
2108         if test -s missing; then
2109                 cat missing >&4
2110                 cat >&4 <<'EOM'
2111
2112 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2113
2114 You have the option of continuing the configuration process, despite the
2115 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2116 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2117 and contact the author (perlbug@perl.org).
2118
2119 EOM
2120                 echo $n "Continue? [n] $c" >&4
2121                 read ans
2122                 case "$ans" in
2123                 y*)
2124                         echo "Continuing..." >&4
2125                         rm -f missing
2126                         ;;
2127                 *)
2128                         echo "ABORTING..." >&4
2129                         kill $$
2130                         ;;
2131                 esac
2132         else
2133                 echo "Looks good..."
2134         fi
2135 else
2136         echo "There is no MANIFEST file.  I hope your kit is complete !"
2137 fi
2138 rm -f missing x??
2139
2140 : Find the appropriate value for a newline for tr
2141 if test -n "$DJGPP"; then
2142        trnl='\012'
2143 fi
2144 if test X"$trnl" = X; then
2145         case "`echo foo | tr '\n' x 2>/dev/null`" in
2146         foox) trnl='\n' ;;
2147         esac
2148 fi
2149 if test X"$trnl" = X; then
2150         case "`echo foo | tr '\012' x 2>/dev/null`" in
2151         foox) trnl='\012' ;;
2152         esac
2153 fi
2154 if test X"$trnl" = X; then
2155        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2156        fooxy) trnl='\n\r' ;;
2157        esac
2158 fi
2159 if test X"$trnl" = X; then
2160         cat <<EOM >&2
2161
2162 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2163
2164 EOM
2165         exit 1
2166 fi
2167
2168 : compute the number of columns on the terminal for proper question formatting
2169 case "$COLUMNS" in
2170 '') COLUMNS='80';;
2171 esac
2172
2173 : set up the echo used in my read
2174 myecho="case \"\$xxxm\" in
2175 '') echo $n \"\$rp $c\" >&4;;
2176 *) case \"\$rp\" in
2177         '') echo $n \"[\$xxxm] $c\";;
2178         *)
2179                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2180                         echo \"\$rp\" >&4
2181                         echo $n \"[\$xxxm] $c\" >&4
2182                 else
2183                         echo $n \"\$rp [\$xxxm] $c\" >&4
2184                 fi
2185                 ;;
2186         esac;;
2187 esac"
2188
2189 : now set up to do reads with possible shell escape and default assignment
2190 cat <<EOSC >myread
2191 $startsh
2192 xxxm=\$dflt
2193 $myecho
2194 ans='!'
2195 case "\$fastread" in
2196 yes) case "\$dflt" in
2197         '') ;;
2198         *) ans='';
2199                 case "\$silent-\$rp" in
2200                 true-) ;;
2201                 *) echo " " >&4;;
2202                 esac;;
2203         esac;;
2204 *) case "\$silent" in
2205         true) case "\$rp" in
2206                 '') ans='';;
2207                 esac;;
2208         esac;;
2209 esac
2210 while expr "X\$ans" : "X!" >/dev/null; do
2211         read answ
2212         set x \$xxxm
2213         shift
2214         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2215         case  "\$answ" in
2216         "!")
2217                 sh 1>&4
2218                 echo " "
2219                 $myecho
2220                 ;;
2221         !*)
2222                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2223                 shift
2224                 sh 1>&4 -c "\$*"
2225                 echo " "
2226                 $myecho
2227                 ;;
2228         "\$ans")
2229                 case "\$ans" in
2230                 \\&*)
2231                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2232                         shift
2233                         case "\$1" in
2234                         -d)
2235                                 fastread=yes
2236                                 echo "(OK, I'll run with -d after this question.)" >&4
2237                                 ;;
2238                         -*)
2239                                 echo "*** Sorry, \$1 not supported yet." >&4
2240                                 ;;
2241                         esac
2242                         $myecho
2243                         ans=!
2244                         ;;
2245                 esac;;
2246         *)
2247                 case "\$aok" in
2248                 y)
2249                         echo "*** Substitution done -- please confirm."
2250                         xxxm="\$ans"
2251                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2252                         xxxm="\$ans"
2253                         ans=!
2254                         ;;
2255                 *)
2256                         echo "*** Error -- try again."
2257                         ans=!
2258                         ;;
2259                 esac
2260                 $myecho
2261                 ;;
2262         esac
2263         case "\$ans\$xxxm\$nostick" in
2264         '')
2265                 ans=!
2266                 $myecho
2267                 ;;
2268         esac
2269 done
2270 case "\$ans" in
2271 '') ans="\$xxxm";;
2272 esac
2273 EOSC
2274
2275 : create .config dir to save info across Configure sessions
2276 test -d ../.config || mkdir ../.config
2277 cat >../.config/README <<EOF
2278 This directory created by Configure to save information that should
2279 persist across sessions for $package.
2280
2281 You may safely delete it if you wish.
2282 EOF
2283
2284 : See if we are using a devel version and want that
2285 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2286 case "$usedevel" in
2287 $define|true|[yY]*)
2288     usedevel="$define" ;;
2289 *) case "$xversion" in
2290    *[13579])
2291         cat >&4 <<EOH
2292 *** WHOA THERE!!! ***
2293
2294     This is an UNSTABLE DEVELOPMENT release.
2295     The version of this $package distribution is $xversion, that is, odd,
2296     (as opposed to even) and that signifies a development release.
2297     If you want a maintenance release, you want an even-numbered version.
2298
2299     Do ***NOT*** install this into production use.
2300     Data corruption and crashes are possible.
2301
2302     It is most seriously suggested that you do not continue any further
2303     unless you want to help in developing and debugging Perl.
2304
2305     If you *still* want to build perl, you can answer 'y' now,
2306     or pass -Dusedevel to Configure.
2307
2308 EOH
2309         rp='Do you really want to continue?'
2310         dflt='n'
2311         . ./myread
2312         case "$ans" in
2313         [yY]) echo >&4 "Okay, continuing."
2314               usedevel="$define" ;;
2315         *) echo >&4 "Okay, bye."
2316            exit 1
2317            ;;
2318         esac
2319         ;;
2320     esac
2321     usedevel="$undef"
2322     ;;
2323 esac
2324 case "$usedevel" in
2325 $define|true|[yY]*)
2326         case "$versiononly" in
2327         '') versiononly="$define" ;;
2328         esac
2329         case "$installusrbinperl" in
2330         '') installusrbinperl="$undef" ;;
2331         esac
2332         ;;
2333 esac
2334
2335 : general instructions
2336 needman=true
2337 firsttime=true
2338 user=`(logname) 2>/dev/null`
2339 case "$user" in
2340 '') user=`whoami 2>&1`;;
2341 esac
2342 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2343         firsttime=false
2344         echo " "
2345         rp='Would you like to see the instructions?'
2346         dflt=n
2347         . ./myread
2348         case "$ans" in
2349         [yY]*) ;;
2350         *) needman=false;;
2351         esac
2352 fi
2353 if $needman; then
2354         cat <<EOH
2355
2356 This installation shell script will examine your system and ask you questions
2357 to determine how the perl5 package should be installed. If you get
2358 stuck on a question, you may use a ! shell escape to start a subshell or
2359 execute a command.  Many of the questions will have default answers in square
2360 brackets; typing carriage return will give you the default.
2361
2362 On some of the questions which ask for file or directory names you are allowed
2363 to use the ~name construct to specify the login directory belonging to "name",
2364 even if you don't have a shell which knows about that.  Questions where this is
2365 allowed will be marked "(~name ok)".
2366
2367 EOH
2368         rp=''
2369         dflt='Type carriage return to continue'
2370         . ./myread
2371         cat <<'EOH'
2372
2373 The prompter used in this script allows you to use shell variables and
2374 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2375 in the default answer, as if the default line was a set of arguments given to a
2376 script shell.  This means you may also use $* to repeat the whole default line,
2377 so you do not have to re-type everything to add something to the default.
2378
2379 Every time there is a substitution, you will have to confirm.  If there is an
2380 error (e.g. an unmatched backtick), the default answer will remain unchanged
2381 and you will be prompted again.
2382
2383 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2384 the questions and use the computed defaults (or the previous answers if there
2385 was already a config.sh file). Type 'Configure -h' for a list of options.
2386 You may also start interactively and then answer '& -d' at any prompt to turn
2387 on the non-interactive behaviour for the remainder of the execution.
2388
2389 EOH
2390         . ./myread
2391         cat <<EOH
2392
2393 Much effort has been expended to ensure that this shell script will run on any
2394 Unix system.  If despite that it blows up on yours, your best bet is to edit
2395 Configure and run it again.  If you can't run Configure for some reason,
2396 you'll have to generate a config.sh file by hand.  Whatever problems you
2397 have, let me (perlbug@perl.org) know how I blew it.
2398
2399 This installation script affects things in two ways:
2400
2401 1) it may do direct variable substitutions on some of the files included
2402    in this kit.
2403 2) it builds a config.h file for inclusion in C programs.  You may edit
2404    any of these files as the need arises after running this script.
2405
2406 If you make a mistake on a question, there is no easy way to back up to it
2407 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2408 files.  Configure will offer to let you do this before it runs the SH files.
2409
2410 EOH
2411         dflt='Type carriage return to continue'
2412         . ./myread
2413         case "$firsttime" in
2414         true) echo $user >>../.config/instruct;;
2415         esac
2416 fi
2417
2418 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2419 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2420 if test "X$sysroot" = X; then
2421     sysroot=""
2422 else
2423     case "$cc" in
2424         *gcc*|*g++*)
2425             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2426             # _sysroot is used in places where we need --sysroot=foo
2427             # but using the rest of the flags could cause issues.
2428             _sysroot="--sysroot=$sysroot";
2429             case "$ccflags" in
2430                 *sysroot*) ;;
2431                 'undef'|*)
2432                 ccflags="$ccflags $_sysroot"
2433             esac
2434             case "$ldflags" in
2435                 *sysroot*) ;;
2436                 'undef'|*)
2437                 ldflags="$ldflags $_sysroot"
2438             esac
2439             case "$cppflags" in
2440                 *sysroot*) ;;
2441                 'undef'|*)
2442                 cppflags="$cppflags $_sysroot"
2443             esac
2444             # lddlflags updated below in lddlflags section;
2445             # same with cccdlflags
2446             ;;
2447     esac
2448
2449     # Adjust some defaults to also use $sysroot
2450     for var in xlibpth loclibpth locincpth glibpth; do
2451         eval xxx=\$$var
2452         eval $var=''
2453         for path in $xxx; do
2454             eval $var=\"\$$var $sysroot$path\"
2455         done
2456     done
2457
2458 fi
2459
2460 : find out where common programs are
2461 echo " "
2462 echo "Locating common programs..." >&4
2463 cat <<EOSC >loc
2464 $startsh
2465 case \$# in
2466 0) exit 1;;
2467 esac
2468 thing=\$1
2469 shift
2470 dflt=\$1
2471 shift
2472 for dir in \$*; do
2473         case "\$thing" in
2474         .)
2475         if test -d \$dir/\$thing; then
2476                 echo \$dir
2477                 exit 0
2478         fi
2479         ;;
2480         *)
2481         for thisthing in \$dir/\$thing; do
2482                 : just loop through to pick last item
2483         done
2484         if test -f \$thisthing; then
2485                 echo \$thisthing
2486                 exit 0
2487         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2488                 echo \$thisthing
2489                 exit 0
2490         elif test -f \$dir/\$thing.exe; then
2491                 if test -n "$DJGPP"; then
2492                         echo \$dir/\$thing.exe
2493                 elif test "$eunicefix" != ":"; then
2494                         : on Eunice apparently
2495                         echo \$dir/\$thing
2496                 fi
2497                 exit 0
2498         fi
2499         ;;
2500         esac
2501 done
2502 echo \$dflt
2503 exit 1
2504 EOSC
2505 chmod +x loc
2506 $eunicefix loc
2507 loclist="
2508 awk
2509 cat
2510 chmod
2511 comm
2512 cp
2513 echo
2514 expr
2515 grep
2516 ls
2517 mkdir
2518 rm
2519 sed
2520 sort
2521 touch
2522 tr
2523 uniq
2524 "
2525 trylist="
2526 ar
2527 bison
2528 byacc
2529 cpp
2530 csh
2531 date
2532 egrep
2533 gmake
2534 gzip
2535 less
2536 ln
2537 make
2538 more
2539 nm
2540 nroff
2541 perl
2542 pg
2543 test
2544 uname
2545 zip
2546 "
2547 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2548 pth="$pth $sysroot/lib $sysroot/usr/lib"
2549 for file in $loclist; do
2550         eval xxx=\$$file
2551         case "$xxx" in
2552         /*|?:[\\/]*)
2553                 if test -f "$xxx"; then
2554                         : ok
2555                 else
2556                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2557                         xxx=`./loc $file $file $pth`
2558                 fi
2559                 ;;
2560         '') xxx=`./loc $file $file $pth`;;
2561         *) xxx=`./loc $xxx $xxx $pth`;;
2562         esac
2563         eval $file=$xxx$_exe
2564         eval _$file=$xxx
2565         case "$xxx" in
2566         /*)
2567                 echo $file is in $xxx.
2568                 ;;
2569         ?:[\\/]*)
2570                 echo $file is in $xxx.
2571                 ;;
2572         *)
2573                 echo "I don't know where '$file' is, and my life depends on it." >&4
2574                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2575                 exit 1
2576                 ;;
2577         esac
2578 done
2579 echo " "
2580 echo "Don't worry if any of the following aren't found..."
2581 say=offhand
2582 for file in $trylist; do
2583         eval xxx=\$$file
2584         case "$xxx" in
2585         /*|?:[\\/]*)
2586                 if test -f "$xxx"; then
2587                         : ok
2588                 else
2589                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2590                         xxx=`./loc $file $file $pth`
2591                 fi
2592                 ;;
2593         '') xxx=`./loc $file $file $pth`;;
2594         *) xxx=`./loc $xxx $xxx $pth`;;
2595         esac
2596         eval $file=$xxx$_exe
2597         eval _$file=$xxx
2598         case "$xxx" in
2599         /*)
2600                 echo $file is in $xxx.
2601                 ;;
2602         ?:[\\/]*)
2603                 echo $file is in $xxx.
2604                 ;;
2605         *)
2606                 echo "I don't see $file out there, $say."
2607                 say=either
2608                 ;;
2609         esac
2610 done
2611 case "$egrep" in
2612 egrep)
2613         echo "Substituting grep for egrep."
2614         egrep=$grep
2615         _egrep=$grep
2616         ;;
2617 esac
2618 case "$less" in
2619 '')     ;;
2620 *)      if $less -R </dev/null >/dev/null 2>&1; then
2621                echo "Substituting less -R for less."
2622                less="$less -R"
2623                _less=$less
2624         fi
2625         ;;
2626 esac
2627 case "$ln" in
2628 ln)
2629         echo "Substituting cp for ln."
2630         ln=$cp
2631         _ln=$cp
2632         ;;
2633 esac
2634 case "$make" in
2635 make)
2636         case "$gmake" in
2637         gmake)
2638         echo "I can't find make or gmake, and my life depends on it." >&4
2639         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2640         exit 1
2641         ;;
2642         esac
2643         ;;
2644 esac
2645 case "$gmake" in
2646 gmake)  ;;
2647 *)      # We can't have osname yet.
2648         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2649                 # Assume that gmake, if found, is definitely GNU make
2650                 # and prefer it over the system make.
2651                 echo "Substituting gmake for make."
2652                 make=$gmake
2653                 _make=$gmake
2654         fi
2655         ;;
2656 esac
2657 case "$test" in
2658 test)
2659         echo "Hopefully test is built into your sh."
2660         ;;
2661 *)
2662         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2663                 echo "Using the test built into your sh."
2664                 test=test
2665                 _test=test
2666         fi
2667         ;;
2668 esac
2669 case "$echo" in
2670 echo)
2671         echo "Hopefully echo is built into your sh."
2672         ;;
2673 '') ;;
2674 *)
2675         echo " "
2676 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2677         $echo $n "hi there$c" >foo1
2678         echo $n "hi there$c" >foo2
2679         if cmp foo1 foo2 >/dev/null 2>&1; then
2680                 echo "They are compatible.  In fact, they may be identical."
2681         else
2682                 case "$n" in
2683                 '-n') n='' c='\c';;
2684                 *) n='-n' c='';;
2685                 esac
2686                 cat <<FOO
2687 They are not compatible!  You are probably running ksh on a non-USG system.
2688 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2689 have echo built in and we may have to run some Bourne shell scripts.  That
2690 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2691
2692 FOO
2693                 $echo $n "The star should be here-->$c"
2694                 $echo "*"
2695         fi
2696         $rm -f foo1 foo2
2697         ;;
2698 esac
2699
2700 # This question was auctioned at YAPC::Europe-2007 in Vienna
2701 # I never promised you could answer it. I only auctioned the question.
2702 cat <<FOO
2703 The following message is sponsored by
2704
2705   Dresden.pm<--The stars should be here.
2706
2707 Dear Perl user, system administrator or package
2708 maintainer, the Perl community sends greetings to
2709 you. Do you (emblematical) greet back [Y/n]? n
2710
2711 FOO
2712
2713 : Check what type of C compiler we use
2714 cat <<EOS >trygcc
2715 $startsh
2716 EOS
2717 cat <<'EOSC' >>trygcc
2718 case "$cc" in
2719 '') ;;
2720 *)  $rm -f try try.*
2721     $cat >try.c <<EOM
2722 int main(int argc, char *argv[]) {
2723   return 0;
2724 }
2725 EOM
2726     if $cc -o try $ccflags $ldflags try.c; then
2727        :
2728     else
2729         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2730         despair=yes
2731         trygcc=yes
2732         case "$cc" in
2733         *gcc*) trygcc=no ;;
2734         esac
2735         # Skip this test because it gives a false match on output like:
2736         #    ./trygcc: line 23: cc: command not found
2737         # case "`$cc -v -c try.c 2>&1`" in
2738         # *gcc*) trygcc=no ;;
2739         # esac
2740         if $test X"$trygcc" = Xyes; then
2741             if gcc -o try -c try.c; then
2742                 echo " "
2743                 echo "You seem to have a working gcc, though." >&4
2744                 # Switching compilers may undo the work of hints files.
2745                 # The most common problem is -D_REENTRANT for threads.
2746                 # This heuristic catches that case, but gets false positives
2747                 # if -Dusethreads was not actually specified.  Better to
2748                 # bail out here with a useful message than fail
2749                 # mysteriously later. Should we perhaps just try to
2750                 # re-invoke Configure -Dcc=gcc config_args ?
2751                 if $test -f usethreads.cbu; then
2752                         $cat >&4 <<EOM
2753
2754 *** However, any setting of the C compiler flags (e.g. for thread support)
2755 *** will be lost.  It may be necessary for you to restart Configure and
2756 *** add -Dcc=gcc to your Configure command line.
2757
2758 EOM
2759                         rp="Would you like to go ahead and try gcc anyway?"
2760                         dflt=n
2761                 else
2762                         rp="Would you like to use it?"
2763                         dflt=y
2764                 fi
2765                 if $test -f myread; then
2766                     . ./myread
2767                 else
2768                     if $test -f UU/myread; then
2769                         . ./UU/myread
2770                     else
2771                         echo "Cannot find myread, sorry.  Aborting." >&2
2772                         exit 1
2773                     fi
2774                 fi
2775                 case "$ans" in
2776                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2777                 esac
2778             fi
2779         fi
2780     fi
2781     $rm -f try try.*
2782     ;;
2783 esac
2784 EOSC
2785
2786 cat <<EOS >checkcc
2787 $startsh
2788 EOS
2789 cat <<'EOSC' >>checkcc
2790 case "$cc" in
2791 '') ;;
2792 *)  $rm -f try try.*
2793     $cat >try.c <<EOM
2794 int main(int argc, char *argv[]) {
2795   return 0;
2796 }
2797 EOM
2798     if $cc -o try $ccflags $ldflags try.c; then
2799        :
2800     else
2801         if $test X"$despair" = Xyes; then
2802            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2803         fi
2804         $cat >&4 <<EOM
2805 You need to find a working C compiler.
2806 Either (purchase and) install the C compiler supplied by your OS vendor,
2807 or for a free C compiler try http://gcc.gnu.org/
2808 I cannot continue any further, aborting.
2809 EOM
2810         exit 1
2811     fi
2812     $rm -f try try.*
2813     ;;
2814 esac
2815 EOSC
2816
2817 : determine whether symbolic links are supported
2818 echo " "
2819 $touch blurfl
2820 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2821         echo "Symbolic links are supported." >&4
2822         lns="$ln -s"
2823 else
2824         echo "Symbolic links are NOT supported." >&4
2825         lns="$ln"
2826 fi
2827 $rm -f blurfl sym
2828
2829 : determine whether symbolic links are supported
2830 echo " "
2831 case "$lns" in
2832 *"ln"*" -s")
2833         echo "Checking how to test for symbolic links..." >&4
2834         $lns blurfl sym
2835         if $test "X$issymlink" = X; then
2836                 case "$newsh" in
2837                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2838                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2839                 esac
2840                 if test $? = 0; then
2841                         issymlink="test -h"
2842                 else
2843                         echo "Your builtin 'test -h' may be broken." >&4
2844                         case "$test" in
2845                         /*)     ;;
2846                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2847                                 for p in $pth
2848                                 do
2849                                         if test -f "$p/$test"; then
2850                                                 test="$p/$test"
2851                                                 break
2852                                         fi
2853                                 done
2854                                 ;;
2855                         esac
2856                         case "$test" in
2857                         /*)
2858                                 echo "Trying external '$test -h'." >&4
2859                                 issymlink="$test -h"
2860                                 if $test ! -h sym >/dev/null 2>&1; then
2861                                         echo "External '$test -h' is broken, too." >&4
2862                                         issymlink=''
2863                                 fi
2864                                 ;;
2865                         *)      issymlink='' ;;
2866                         esac
2867                 fi
2868         fi
2869         if $test "X$issymlink" = X; then
2870                 if $test -L sym 2>/dev/null; then
2871                         issymlink="$test -L"
2872                         echo "The builtin '$test -L' worked." >&4
2873                 fi
2874         fi
2875         if $test "X$issymlink" != X; then
2876                 echo "You can test for symbolic links with '$issymlink'." >&4
2877         else
2878                 echo "I do not know how you can test for symbolic links." >&4
2879         fi
2880         $rm -f blurfl sym
2881         ;;
2882 *)      echo "No symbolic links, so not testing for their testing..." >&4
2883         ;;
2884 esac
2885
2886 : Make symlinks util
2887 case "$mksymlinks" in
2888 $define|true|[yY]*)
2889         case "$src" in
2890         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2891                 exit 1
2892                 ;;
2893         *)      case "$lns:$issymlink" in
2894                 *"ln"*" -s:"*"test -"?)
2895                         echo "Creating the symbolic links..." >&4
2896                         cd ..
2897                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2898                         awk 'NF == 1 {
2899                                 dir=".";
2900                                 file=$1 "";
2901                              }
2902                              NF == 2 {
2903                                 dir=$1 "";
2904                                 file=$2 "";
2905                              }
2906                              {
2907                                  print "# dir = ", dir, "file = ", file
2908                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2909                              } END {
2910                                  for (d in mf) {
2911                                      if (d != ".") { print("mkdir -p "d) }
2912                                      print("ln -sf "mf[d]" "d);
2913                                  }
2914                              }' source="$src" > UU/mksymlinks.$$
2915                         sh UU/mksymlinks.$$
2916                         rm UU/mksymlinks.$$
2917                         # Sanity check 1.
2918                         if test ! -d t/base; then
2919                                 echo "Failed to create the subdirectories.  Aborting." >&4
2920                                 exit 1
2921                         fi
2922                         # Sanity check 2.
2923                         if test ! -f t/base/lex.t; then
2924                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         if test ! -f win32/win32.c; then
2928                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2929                                 exit 1
2930                         fi
2931                         cd UU
2932                         ;;
2933                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2934                         ;;
2935                 esac
2936                 ;;
2937         esac
2938         ;;
2939 esac
2940
2941 : Check for Cross-Compilation
2942 if $test "X$targethost" = "X"; then
2943     targethost=""
2944 fi
2945 if $test "X$targetenv" = "X"; then
2946     targetenv=""
2947 fi
2948 case "$usecrosscompile" in
2949 $define|true|[yY]*)
2950         $echo "Cross-compiling..."
2951         croak=''
2952         case "$cc" in
2953         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2954             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2955             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2956             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2957             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2958             # leave out ld, choosing it is more complex
2959             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2960             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2961             # We are in a weird spot. Just before us, some values
2962             # were 'saved', to be restored after the hints are
2963             # run.  This means that the changes we made to ar,
2964             # nm and ranlib will get reverted.
2965             # To avoid that, we hijack the saving mechanism and
2966             # have it save our new values.
2967             for file in ar nm ranlib; do
2968                 eval xxx=\$$file
2969                 eval $file=$xxx$_exe
2970                 eval _$file=$xxx
2971             done
2972         ;;
2973         esac
2974         case "$targetarch" in
2975         '') echo "Targetarch not defined." >&4; croak=y ;;
2976         *)  echo "Using targetarch $targetarch." >&4 ;;
2977         esac
2978         case "$targethost" in
2979         '') echo "Targethost not defined." >&4; croak=n ;;
2980         *)  echo "Using targethost $targethost." >&4
2981         esac
2982         locincpth=' '
2983         loclibpth=' '
2984         case "$croak" in
2985         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2986         esac
2987     : compile a host miniperl and generate_uudmap, unless we got passed them
2988     if $test "X$hostperl" = X; then
2989       echo "Building host miniperl and generate_uudmap binaries" >&4
2990       before_host=`pwd`
2991       cd ..
2992       cd $src
2993       src=`pwd`
2994       rm -rf $src/host
2995       mkdir $src/host
2996       cd $src/host
2997       $src/Configure -des -Dusedevel -Dmksymlinks
2998       $make miniperl
2999       case "$hostgenerate" in
3000       '') $make generate_uudmap
3001           hostgenerate=$src/host/generate_uudmap
3002           ;;
3003        "$undef") hostgenerate=''
3004           ;;
3005       esac
3006       hostperl=$src/host/miniperl
3007       cd $before_host
3008     fi
3009     hostosname=`$hostperl -le 'print $^O'`
3010     ;;
3011 *)
3012     usecrosscompile="$undef"
3013     ;;
3014 esac
3015
3016 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3017 case "$targethost" in
3018     '') echo "Checking for cross-compile" >&4
3019     case "$usecrosscompile$multiarch" in
3020        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3021          if [ -f Makefile ]; then
3022            echo " "
3023            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3024          else
3025            echo "Configure done."
3026          fi
3027        exit 0
3028        ;;
3029      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3030         run=''
3031         to=:
3032         from=:
3033         ;;
3034     esac
3035     ;;
3036     *) echo "Using targethost $targethost." >&4
3037         case "$src" in
3038         /*) run=$src/Cross/run
3039             targetmkdir=$src/Cross/mkdir
3040             to=$src/Cross/to
3041             from=$src/Cross/from
3042             ;;
3043         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3044             run=$pwd/Cross/run
3045             targetmkdir=$pwd/Cross/mkdir
3046             to=$pwd/Cross/to
3047             from=$pwd/Cross/from
3048             ;;
3049         esac
3050         case "$targetrun" in
3051         '') targetrun=ssh ;;
3052         esac
3053         case "$targetto" in
3054         '') targetto=scp ;;
3055         esac
3056         case "$targetfrom" in
3057         '') targetfrom=scp ;;
3058         esac
3059         run=$run-$targetrun
3060         to=$to-$targetto
3061         from=$from-$targetfrom
3062         case "$targetdir" in
3063         '')  targetdir=/tmp
3064              echo "Guessing targetdir $targetdir." >&4
3065              ;;
3066         esac
3067         case "$targetuser" in
3068         '')  targetuser=root
3069              echo "Guessing targetuser $targetuser." >&4
3070              ;;
3071         esac
3072         case "$targetport" in
3073         '')  targetport=22
3074              echo "Guessing targetport $targetport." >&4
3075              ;;
3076         esac
3077         case "$targetfrom" in
3078         scp)    q=-q ;;
3079         *)      q='' ;;
3080         esac
3081         case "$targetrun" in
3082         ssh|rsh)
3083             cat >$run <<EOF
3084 #!/bin/sh
3085 env=''
3086 case "\$1" in
3087 -cwd)
3088   shift
3089   cwd=\$1
3090   shift
3091   ;;
3092 esac
3093 case "\$1" in
3094 -env)
3095   shift
3096   env=\$1
3097   shift
3098   ;;
3099 esac
3100 case "\$cwd" in
3101 '') cwd=$targetdir ;;
3102 esac
3103 exe=\$1
3104 shift
3105 $to \$exe
3106 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3107 EOF
3108             ;;
3109         adb)
3110             $touch $run
3111             ;;
3112         *)  echo "Unknown targetrun '$targetrun'" >&4
3113             exit 1
3114             ;;
3115         esac
3116         case "$targetmkdir" in
3117         */Cross/mkdir)
3118             cat >$targetmkdir <<EOF
3119 #!/bin/sh
3120 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3121 EOF
3122             $chmod a+rx $targetmkdir
3123             ;;
3124         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3125             exit 1
3126             ;;
3127         esac
3128         case "$targetto" in
3129         scp|rcp)
3130             cat >$to <<EOF
3131 #!/bin/sh
3132 for f in \$@
3133 do
3134   case "\$f" in
3135   /*)
3136     $targetmkdir \`dirname \$f\`
3137     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3138     ;;
3139   *)
3140     $targetmkdir $targetdir/\`dirname \$f\`
3141     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3142     ;;
3143   esac
3144 done
3145 exit 0
3146 EOF
3147             ;;
3148         cp) cat >$to <<EOF
3149 #!/bin/sh
3150 for f in \$@
3151 do
3152   case "\$f" in
3153   /*)
3154     $mkdir -p $targetdir/\`dirname \$f\`
3155     $cp \$f $targetdir/\$f || exit 1
3156     ;;
3157   *)
3158     $targetmkdir $targetdir/\`dirname \$f\`
3159     $cp \$f $targetdir/\$f || exit 1
3160     ;;
3161   esac
3162 done
3163 exit 0
3164 EOF
3165             ;;
3166         *)  echo "Unknown targetto '$targetto'" >&4
3167             exit 1
3168             ;;
3169         esac
3170         case "$targetfrom" in
3171         scp|rcp)
3172           cat >$from <<EOF
3173 #!/bin/sh
3174 for f in \$@
3175 do
3176   $rm -f \$f
3177   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3178 done
3179 exit 0
3180 EOF
3181             ;;
3182         cp) cat >$from <<EOF
3183 #!/bin/sh
3184 for f in \$@
3185 do
3186   $rm -f \$f
3187   cp $targetdir/\$f . || exit 1
3188 done
3189 exit 0
3190 EOF
3191             ;;
3192         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3193             exit 1
3194             ;;
3195         esac
3196         if $test ! -f $run; then
3197             echo "Target 'run' script '$run' not found." >&4
3198         else
3199             $chmod a+rx $run
3200         fi
3201         if $test ! -f $to; then
3202             echo "Target 'to' script '$to' not found." >&4
3203         else
3204             $chmod a+rx $to
3205         fi
3206         if $test ! -f $from; then
3207             echo "Target 'from' script '$from' not found." >&4
3208         else
3209             $chmod a+rx $from
3210         fi
3211         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3212             exit 1
3213         fi
3214         cat >&4 <<EOF
3215 Using '$run' for remote execution,
3216 and '$from' and '$to'
3217 for remote file transfer.
3218 EOF
3219         ;;
3220 *)      run=''
3221         to=:
3222         from=:
3223         usecrosscompile="$undef"
3224         targetarch=''
3225         ;;
3226 esac
3227
3228 : see whether [:lower:] and [:upper:] are supported character classes
3229 echo " "
3230 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3231 ABYZ-abyz)
3232         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3233         up='[:upper:]'
3234         low='[:lower:]'
3235         ;;
3236 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3237         # (0xd9 and 0xe2), therefore that is a nice testing point.
3238         if test "X$up" = X -o "X$low" = X; then
3239             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3240             rs) up='[A-Z]'
3241                 low='[a-z]'
3242                 ;;
3243             esac
3244         fi
3245         if test "X$up" = X -o "X$low" = X; then
3246             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3247             rs) up='A-Z'
3248                 low='a-z'
3249                 ;;
3250             esac
3251         fi
3252         if test "X$up" = X -o "X$low" = X; then
3253             case "`echo RS | od -x 2>/dev/null`" in
3254             *D9E2*|*d9e2*)
3255                 echo "Hey, this might be EBCDIC." >&4
3256                 if test "X$up" = X -o "X$low" = X; then
3257                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3258                     rs) up='[A-IJ-RS-Z]'
3259                         low='[a-ij-rs-z]'
3260                         ;;
3261                     esac
3262                 fi
3263                 if test "X$up" = X -o "X$low" = X; then
3264                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3265                     rs) up='A-IJ-RS-Z'
3266                         low='a-ij-rs-z'
3267                         ;;
3268                     esac
3269                 fi
3270                 ;;
3271             esac
3272         fi
3273 esac
3274 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3275 rs)
3276     echo "Using $up and $low to convert case." >&4
3277     ;;
3278 *)
3279     echo "I don't know how to translate letters from upper to lower case." >&4
3280     echo "Your tr is not acting any way I know of." >&4
3281     exit 1
3282     ;;
3283 esac
3284 : set up the translation script tr, must be called with ./tr of course
3285 cat >tr <<EOSC
3286 $startsh
3287 case "\$1\$2" in
3288 '[A-Z][a-z]') exec $tr '$up' '$low';;
3289 '[a-z][A-Z]') exec $tr '$low' '$up';;
3290 esac
3291 exec $tr "\$@"
3292 EOSC
3293 chmod +x tr
3294 $eunicefix tr
3295
3296 : Try to determine whether config.sh was made on this system
3297 case "$config_sh" in
3298 '')
3299 myuname=`$uname -a 2>/dev/null`
3300 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3301 # Downcase everything to avoid ambiguity.
3302 # Remove slashes and single quotes so we can use parts of this in
3303 # directory and file names.
3304 # Remove newlines so myuname is sane to use elsewhere.
3305 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3306 # because the A-Z/a-z are not consecutive.
3307 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3308         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3309 newmyuname="$myuname"
3310 dflt=n
3311 case "$knowitall" in
3312 '')
3313         if test -f ../config.sh; then
3314                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3315                         eval "`grep myuname= ../config.sh`"
3316                 fi
3317                 if test "X$myuname" = "X$newmyuname"; then
3318                         dflt=y
3319                 fi
3320         fi
3321         ;;
3322 *) dflt=y;;
3323 esac
3324
3325 : Get old answers from old config file if Configure was run on the
3326 : same system, otherwise use the hints.
3327 hint=default
3328 cd ..
3329 if test -f config.sh; then
3330         echo " "
3331         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3332         . UU/myread
3333         case "$ans" in
3334         n*|N*) echo "OK, I'll ignore it."
3335                 mv config.sh config.sh.old
3336                 myuname="$newmyuname"
3337                 ;;
3338         *)  echo "Fetching default answers from your old config.sh file..." >&4
3339                 tmp_n="$n"
3340                 tmp_c="$c"
3341                 tmp_sh="$sh"
3342                 . ./config.sh
3343                 cp config.sh UU
3344                 n="$tmp_n"
3345                 c="$tmp_c"
3346                 : Older versions did not always set $sh.  Catch re-use of such
3347                 : an old config.sh.
3348                 case "$sh" in
3349                 '') sh="$tmp_sh" ;;
3350                 esac
3351                 hint=previous
3352                 ;;
3353         esac
3354 fi
3355 . ./UU/checkcc
3356 if test ! -f config.sh; then
3357         $cat <<EOM
3358
3359 First time through, eh?  I have some defaults handy for some systems
3360 that need some extra help getting the Configure answers right:
3361
3362 EOM
3363         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3364         dflt=''
3365         : Half the following guesses are probably wrong... If you have better
3366         : tests or hints, please send them to perlbug@perl.org
3367         : The metaconfig authors would also appreciate a copy...
3368         $test -f /irix && osname=irix
3369         $test -f /xenix && osname=sco_xenix
3370         $test -f /dynix && osname=dynix
3371         $test -f /dnix && osname=dnix
3372         $test -f /lynx.os && osname=lynxos
3373         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3374         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3375         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3376         $test -f /bin/mips && /bin/mips && osname=mips
3377         $test -d /usr/apollo/bin && osname=apollo
3378         $test -f /etc/saf/_sactab && osname=svr4
3379         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3380         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3381         $test -f /sys/utilities/MultiView && osname=amigaos
3382         if $test -d /MachTen -o -d /MachTen_Folder; then
3383                 osname=machten
3384                 if $test -x /sbin/version; then
3385                         osvers=`/sbin/version | $awk '{print $2}' |
3386                         $sed -e 's/[A-Za-z]$//'`
3387                 elif $test -x /usr/etc/version; then
3388                         osvers=`/usr/etc/version | $awk '{print $2}' |
3389                         $sed -e 's/[A-Za-z]$//'`
3390                 else
3391                         osvers="$2.$3"
3392                 fi
3393         fi
3394
3395         $test -f /sys/posix.dll &&
3396                 $test -f /usr/bin/what &&
3397                 set X `/usr/bin/what /sys/posix.dll` &&
3398                 $test "$3" = UWIN &&
3399                 osname=uwin &&
3400                 osvers="$5"
3401
3402         if $test -f $uname; then
3403                 set X $myuname
3404                 shift
3405
3406                 case "$5" in
3407                 fps*) osname=fps ;;
3408                 mips*)
3409                         case "$4" in
3410                         umips) osname=umips ;;
3411                         *) osname=mips ;;
3412                         esac;;
3413                 [23]100) osname=mips ;;
3414                 i386*)
3415                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3416                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3417                                 osname='sco'
3418                                 osvers=$tmp
3419                         elif $test -f /etc/kconfig; then
3420                                 osname=isc
3421                                 if test "$lns" = "$ln -s"; then
3422                                         osvers=4
3423                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3424                                         osvers=3
3425                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3426                                         osvers=2
3427                                 fi
3428                         fi
3429                         tmp=''
3430                         ;;
3431                 pc*)
3432                         if test -n "$DJGPP"; then
3433                                 osname=dos
3434                                 osvers=djgpp
3435                         fi
3436                         ;;
3437                 esac
3438
3439                 case "$1" in
3440                 aix) osname=aix
3441                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3442                         case "$tmp" in
3443                         # oslevel can fail with:
3444                         # oslevel: Unable to acquire lock.
3445                         *not\ found) osvers="$4"."$3" ;;
3446                         '<3240'|'<>3240') osvers=3.2.0 ;;
3447                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3448                         '=3250'|'>3250') osvers=3.2.5 ;;
3449                         *) osvers=$tmp;;
3450                         esac
3451                         ;;
3452                 bitrig) osname=bitrig
3453                         osvers="$3"
3454                         ;;
3455                 bsd386) osname=bsd386
3456                         osvers=`$uname -r`
3457                         ;;
3458                 cygwin*) osname=cygwin
3459                         osvers="$3"
3460                         ;;
3461                 *dc.osx) osname=dcosx
3462                         osvers="$3"
3463                         ;;
3464                 dnix) osname=dnix
3465                         osvers="$3"
3466                         ;;
3467                 domainos) osname=apollo
3468                         osvers="$3"
3469                         ;;
3470                 dgux)   osname=dgux
3471                         osvers="$3"
3472                         ;;
3473                 dragonfly) osname=dragonfly
3474                         osvers="$3"
3475                         ;;
3476                 dynixptx*) osname=dynixptx
3477                         osvers=`echo "$4"|sed 's/^v//'`
3478                         ;;
3479                 freebsd) osname=freebsd
3480                         osvers="$3" ;;
3481                 genix)  osname=genix ;;
3482                 gnu)    osname=gnu
3483                         osvers="$3" ;;
3484                 hp*)    osname=hpux
3485                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3486                         ;;
3487                 irix*)  osname=irix
3488                         case "$3" in
3489                         4*) osvers=4 ;;
3490                         5*) osvers=5 ;;
3491                         *)      osvers="$3" ;;
3492                         esac
3493                         ;;
3494                 linux)  osname=linux
3495                         case "$3" in
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         $test -f /system/lib/libandroid.so && osname=linux-android
3499                         ;;
3500                 MiNT)   osname=mint
3501                         ;;
3502                 minix)  osname=minix
3503                         osvers=`$uname -r`
3504                         ;;
3505                 netbsd*) osname=netbsd
3506                         osvers="$3"
3507                         ;;
3508                 news-os) osvers="$3"
3509                         case "$3" in
3510                         4*) osname=newsos4 ;;
3511                         *) osname=newsos ;;
3512                         esac
3513                         ;;
3514                 nonstop-ux) osname=nonstopux ;;
3515                 openbsd) osname=openbsd
3516                         osvers="$3"
3517                         ;;
3518                 os2)    osname=os2
3519                         osvers="$4"
3520                         ;;
3521                 POSIX-BC | posix-bc ) osname=posix-bc
3522                         osvers="$3"
3523                         ;;
3524                 powerux | power_ux | powermax_os | powermaxos | \
3525                 powerunix | power_unix) osname=powerux
3526                         osvers="$3"
3527                         ;;
3528                 qnx) osname=qnx
3529                         osvers="$4"
3530                         ;;
3531                 solaris) osname=solaris
3532                         case "$3" in
3533                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3534                         *)      osvers="$3" ;;
3535                         esac
3536                         ;;
3537                 sunos) osname=sunos
3538                         case "$3" in
3539                         5*) osname=solaris
3540                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3541                         *)      osvers="$3" ;;
3542                         esac
3543                         ;;
3544                 titanos) osname=titanos
3545                         case "$3" in
3546                         1*) osvers=1 ;;
3547                         2*) osvers=2 ;;
3548                         3*) osvers=3 ;;
3549                         4*) osvers=4 ;;
3550                         *)      osvers="$3" ;;
3551                         esac
3552                         ;;
3553                 ultrix) osname=ultrix
3554                         osvers="$3"
3555                         ;;
3556                 osf1|mls+)      case "$5" in
3557                                 alpha)
3558                                         osname=dec_osf
3559                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3560                                         case "$osvers" in
3561                                         [1-9].[0-9]*) ;;
3562                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3563                                         esac
3564                                         ;;
3565                         hp*)    osname=hp_osf1  ;;
3566                         mips)   osname=mips_osf1 ;;
3567                         esac
3568                         ;;
3569                 # UnixWare 7.1.2 is known as Open UNIX 8
3570                 openunix|unixware) osname=svr5
3571                         osvers="$4"
3572                         ;;
3573                 uts)    osname=uts
3574                         osvers="$3"
3575                         ;;
3576                 vos) osvers="$3"
3577                         ;;
3578                 $2) case "$osname" in
3579                         *isc*) ;;
3580                         *freebsd*) ;;
3581                         svr*)
3582                                 : svr4.x or possibly later
3583                                 case "svr$3" in
3584                                 ${osname}*)
3585                                         osname=svr$3
3586                                         osvers=$4
3587                                         ;;
3588                                 esac
3589                                 case "$osname" in
3590                                 svr4.0)
3591                                         : Check for ESIX
3592                                         if test -f /stand/boot ; then
3593                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3594                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3595                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3596                                                         if test -n "$isesix"; then
3597                                                                 osname=esix4
3598                                                         fi
3599                                                 fi
3600                                         fi
3601                                         ;;
3602                                 esac
3603                                 ;;
3604                         *)      if test -f /etc/systemid; then
3605                                         osname=sco
3606                                         set `echo $3 | $sed 's/\./ /g'` $4
3607                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3608                                                 osvers=$1.$2.$3
3609                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3610                                                 osvers=$1.$2
3611                                         elif $test -f $src/hints/sco_$1.sh; then
3612                                                 osvers=$1
3613                                         fi
3614                                 else
3615                                         case "$osname" in
3616                                         '') : Still unknown.  Probably a generic Sys V.
3617                                                 osname="sysv"
3618                                                 osvers="$3"
3619                                                 ;;
3620                                         esac
3621                                 fi
3622                                 ;;
3623                         esac
3624                         ;;
3625                 *)      case "$osname" in
3626                         '') : Still unknown.  Probably a generic BSD.
3627                                 osname="$1"
3628                                 osvers="$3"
3629                                 ;;
3630                         esac
3631                         ;;
3632                 esac
3633         else
3634                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3635                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3636                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3637                                 osname=news_os
3638                         fi
3639                         $rm -f UU/kernel.what
3640                 elif test -d c:/. -o -n "$is_os2" ; then
3641                         set X $myuname
3642                         osname=os2
3643                         osvers="$5"
3644                 fi
3645         fi
3646
3647         case "$targetarch" in
3648         '') ;;
3649         *)  hostarch=$osname
3650             case "$targetarch" in
3651                 nto*|*-nto-*)
3652                     # Will load qnx.sh, which should change osname to nto
3653                     osname=qnx
3654                     osvers=''
3655                     ;;
3656                 *linux-android*)
3657                     # Catch arm-linux-androideabi, mipsel-linux-android,
3658                     # and i686-linux-android
3659                     osname=linux-android
3660                     osvers=''
3661                     ;;
3662                 *linux*)
3663                     # Something like arm-linux-gnueabihf is really just
3664                     # plain linux.
3665                     osname=linux
3666                     osvers=''
3667                     ;;
3668                 *solaris*|*sunos*)
3669                     osname=solaris
3670                     # XXX perhaps we should just assume
3671                     # osvers to be 2, or maybe take the value
3672                     # from targetarch. Using $run before the
3673                     # hints are run is somewhat icky.
3674                     set X `$run $uname -a 2>/dev/null`
3675                     shift
3676                     case "$3" in
3677                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3678                         *)  osvers="$3" ;;
3679                     esac
3680                     ;;
3681                 *)
3682                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3683                     osvers=''
3684                 ;;
3685             esac
3686             ;;
3687         esac
3688
3689         : Now look for a hint file osname_osvers, unless one has been
3690         : specified already.
3691         case "$hintfile" in
3692         ''|' ')
3693                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3694                 : Also try without trailing minor version numbers.
3695                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3696                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3697                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3698                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3699                 case "$file" in
3700                 '') dflt=none ;;
3701                 *)  case "$osvers" in
3702                         '') dflt=$file
3703                                 ;;
3704                         *)  if $test -f $src/hints/$file.sh ; then
3705                                         dflt=$file
3706                                 elif $test -f $src/hints/$xfile.sh ; then
3707                                         dflt=$xfile
3708                                 elif $test -f $src/hints/$xxfile.sh ; then
3709                                         dflt=$xxfile
3710                                 elif $test -f $src/hints/$xxxfile.sh ; then
3711                                         dflt=$xxxfile
3712                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3713                                         dflt=$xxxxfile
3714                                 elif $test -f "$src/hints/${osname}.sh" ; then
3715                                         dflt="${osname}"
3716                                 else
3717                                         dflt=none
3718                                 fi
3719                                 ;;
3720                         esac
3721                         ;;
3722                 esac
3723                 if $test -f Policy.sh ; then
3724                         case "$dflt" in
3725                         *Policy*) ;;
3726                         none) dflt="Policy" ;;
3727                         *) dflt="Policy $dflt" ;;
3728                         esac
3729                 fi
3730                 ;;
3731         *)
3732                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3733                 ;;
3734         esac
3735
3736         if $test -f Policy.sh ; then
3737                 $cat <<EOM
3738
3739 There's also a Policy hint file available, which should make the
3740 site-specific (policy) questions easier to answer.
3741 EOM
3742
3743         fi
3744
3745         $cat <<EOM
3746
3747 You may give one or more space-separated answers, or "none" if appropriate.
3748 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3749 previous run of Configure, you may specify it as well as or instead of
3750 OS-specific hints.  If hints are provided for your OS, you should use them:
3751 although Perl can probably be built without hints on many platforms, using
3752 hints often improve performance and may enable features that Configure can't
3753 set up on its own. If there are no hints that match your OS, specify "none";
3754 DO NOT give a wrong version or a wrong OS.
3755
3756 EOM
3757
3758         rp="Which of these apply, if any?"
3759         . UU/myread
3760         tans=$ans
3761         for file in $tans; do
3762                 if $test X$file = XPolicy -a -f Policy.sh; then
3763                         . Policy.sh
3764                         $cat Policy.sh >> UU/config.sh
3765                 elif $test -f $src/hints/$file.sh; then
3766                         . $src/hints/$file.sh
3767                         $cat $src/hints/$file.sh >> UU/config.sh
3768                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3769                         : nothing
3770                 else
3771                         : Give one chance to correct a possible typo.
3772                         echo "$file.sh does not exist"
3773                         dflt=$file
3774                         rp="hint to use instead?"
3775                         . UU/myread
3776                         for file in $ans; do
3777                                 if $test -f "$src/hints/$file.sh"; then
3778                                         . $src/hints/$file.sh
3779                                         $cat $src/hints/$file.sh >> UU/config.sh
3780                                 elif $test X$ans = X -o X$ans = Xnone ; then
3781                                         : nothing
3782                                 else
3783                                         echo "$file.sh does not exist -- ignored."
3784                                 fi
3785                         done
3786                 fi
3787         done
3788
3789         hint=recommended
3790         : Remember our hint file for later.
3791         if $test -f "$src/hints/$file.sh" ; then
3792                 hintfile="$file"
3793         else
3794                 hintfile=''
3795         fi
3796 fi
3797 cd UU
3798 ;;
3799 *)
3800         echo " "
3801         echo "Fetching default answers from $config_sh..." >&4
3802         tmp_n="$n"
3803         tmp_c="$c"
3804         cd ..
3805         cp $config_sh config.sh 2>/dev/null
3806         chmod +w config.sh
3807         . ./config.sh
3808         cd UU
3809         cp ../config.sh .
3810         n="$tmp_n"
3811         c="$tmp_c"
3812         hint=previous
3813         ;;
3814 esac
3815 . ./optdef.sh
3816
3817 : Restore computed paths
3818 for file in $loclist $trylist; do
3819         eval $file="\$_$file"
3820 done
3821
3822 cat << EOM
3823
3824 Configure uses the operating system name and version to set some defaults.
3825 The default value is probably right if the name rings a bell. Otherwise,
3826 since spelling matters for me, either accept the default or answer "none"
3827 to leave it blank.
3828
3829 EOM
3830 case "$osname" in
3831         ''|' ')
3832                 case "$hintfile" in
3833                 ''|' '|none) dflt=none ;;
3834                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3835                 esac
3836                 ;;
3837         *) dflt="$osname" ;;
3838 esac
3839 rp="Operating system name?"
3840 . ./myread
3841 case "$ans" in
3842 none)  osname='' ;;
3843 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3844 esac
3845 echo " "
3846 case "$osvers" in
3847         ''|' ')
3848                 case "$hintfile" in
3849                 ''|' '|none) dflt=none ;;
3850                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3851                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3852                         case "$dflt" in
3853                         ''|' ') dflt=none ;;
3854                         esac
3855                         ;;
3856                 esac
3857                 ;;
3858         *) dflt="$osvers" ;;
3859 esac
3860 rp="Operating system version?"
3861 . ./myread
3862 case "$ans" in
3863 none)  osvers='' ;;
3864 *) osvers="$ans" ;;
3865 esac
3866
3867
3868 . ./posthint.sh
3869
3870 : who configured the system
3871 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3872 case "$cf_by" in
3873 "")
3874         cf_by=`(logname) 2>/dev/null`
3875         case "$cf_by" in
3876         "")
3877                 cf_by=`(whoami) 2>/dev/null`
3878                 case "$cf_by" in
3879                 "") cf_by=unknown ;;
3880                 esac ;;
3881         esac ;;
3882 esac
3883
3884 : decide how portable to be.  Allow command line overrides.
3885 case "$d_portable" in
3886 "$undef") ;;
3887 *)      d_portable="$define" ;;
3888 esac
3889
3890 : set up shell script to do ~ expansion
3891 cat >filexp <<EOSS
3892 $startsh
3893 : expand filename
3894 case "\$1" in
3895  \~/*|\~)
3896         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3897         ;;
3898  \~*)
3899         if $test -f /bin/csh; then
3900                 /bin/csh -f -c "glob \$1"
3901                 failed=\$?
3902                 echo ""
3903                 exit \$failed
3904         else
3905                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3906                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3907                 if $test ! -d "\$dir"; then
3908                         me=\`basename \$0\`
3909                         echo "\$me: can't locate home directory for: \$name" >&2
3910                         exit 1
3911                 fi
3912                 case "\$1" in
3913                 */*)
3914                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3915                         ;;
3916                 *)
3917                         echo \$dir
3918                         ;;
3919                 esac
3920         fi
3921         ;;
3922 *)
3923         echo \$1
3924         ;;
3925 esac
3926 EOSS
3927 chmod +x filexp
3928 $eunicefix filexp
3929
3930 : now set up to get a file name
3931 cat <<EOS >getfile
3932 $startsh
3933 EOS
3934 cat <<'EOSC' >>getfile
3935 tilde=''
3936 fullpath=''
3937 already=''
3938 skip=''
3939 none_ok=''
3940 exp_file=''
3941 nopath_ok=''
3942 orig_rp="$rp"
3943 orig_dflt="$dflt"
3944 case "$gfpth" in
3945 '') gfpth='.' ;;
3946 esac
3947
3948 case "$fn" in
3949 *\(*)
3950         : getfile will accept an answer from the comma-separated list
3951         : enclosed in parentheses even if it does not meet other criteria.
3952         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3953         fn=`echo $fn | sed 's/(.*)//'`
3954         ;;
3955 esac
3956
3957 case "$fn" in
3958 *:*)
3959         loc_file=`expr $fn : '.*:\(.*\)'`
3960         fn=`expr $fn : '\(.*\):.*'`
3961         ;;
3962 esac
3963
3964 case "$fn" in
3965 *~*) tilde=true;;
3966 esac
3967 case "$fn" in
3968 */*) fullpath=true;;
3969 esac
3970 case "$fn" in
3971 *+*) skip=true;;
3972 esac
3973 case "$fn" in
3974 *n*) none_ok=true;;
3975 esac
3976 case "$fn" in
3977 *e*) exp_file=true;;
3978 esac
3979 case "$fn" in
3980 *p*) nopath_ok=true;;
3981 esac
3982
3983 case "$fn" in
3984 *f*) type='File';;
3985 *d*) type='Directory';;
3986 *l*) type='Locate';;
3987 esac
3988
3989 what="$type"
3990 case "$what" in
3991 Locate) what='File';;
3992 esac
3993
3994 case "$exp_file" in
3995 '')
3996         case "$d_portable" in
3997         "$define") ;;
3998         *) exp_file=true;;
3999         esac
4000         ;;
4001 esac
4002
4003 cd ..
4004 while test "$type"; do
4005         redo=''
4006         rp="$orig_rp"
4007         dflt="$orig_dflt"
4008         case "$tilde" in
4009         true) rp="$rp (~name ok)";;
4010         esac
4011         . UU/myread
4012         if test -f UU/getfile.ok && \
4013                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4014         then
4015                 value="$ans"
4016                 ansexp="$ans"
4017                 break
4018         fi
4019         case "$ans" in
4020         none)
4021                 value=''
4022                 ansexp=''
4023                 case "$none_ok" in
4024                 true) type='';;
4025                 esac
4026                 ;;
4027         *)
4028                 case "$tilde" in
4029                 '') value="$ans"
4030                         ansexp="$ans";;
4031                 *)
4032                         value=`UU/filexp $ans`
4033                         case $? in
4034                         0)
4035                                 if test "$ans" != "$value"; then
4036                                         echo "(That expands to $value on this system.)"
4037                                 fi
4038                                 ;;
4039                         *) value="$ans";;
4040                         esac
4041                         ansexp="$value"
4042                         case "$exp_file" in
4043                         '') value="$ans";;
4044                         esac
4045                         ;;
4046                 esac
4047                 case "$fullpath" in
4048                 true)
4049                         case "$ansexp" in
4050                         /*) value="$ansexp" ;;
4051                         [a-zA-Z]:/*) value="$ansexp" ;;
4052                         *)
4053                                 redo=true
4054                                 case "$already" in
4055                                 true)
4056                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4057                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4058                                         ;;
4059                                 *)
4060                                 echo "Please give a full path name, starting with slash." >&4
4061                                         case "$tilde" in
4062                                         true)
4063                                 echo "Note that using ~name is ok provided it expands well." >&4
4064                                                 already=true
4065                                                 ;;
4066                                         esac
4067                                 esac
4068                                 ;;
4069                         esac
4070                         ;;
4071                 esac
4072                 case "$redo" in
4073                 '')
4074                         case "$type" in
4075                         File)
4076                                 for fp in $gfpth; do
4077                                         if test "X$fp" = X.; then
4078                                             pf="$ansexp"
4079                                         else    
4080                                             pf="$fp/$ansexp"
4081                                         fi
4082                                         if test -f "$pf"; then
4083                                                 type=''
4084                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4085                                         then
4086                                                 echo "($value is not a plain file, but that's ok.)"
4087                                                 type=''
4088                                         fi
4089                                         if test X"$type" = X; then
4090                                             value="$pf"
4091                                             break
4092                                         fi
4093                                 done
4094                                 ;;
4095                         Directory)
4096                                 for fp in $gfpth; do
4097                                         if test "X$fp" = X.; then
4098                                             dir="$ans"
4099                                             direxp="$ansexp"
4100                                         else    
4101                                             dir="$fp/$ansexp"
4102                                             direxp="$fp/$ansexp"
4103                                         fi
4104                                         if test -d "$direxp"; then
4105                                                 type=''
4106                                                 value="$dir"
4107                                                 break
4108                                         fi
4109                                 done
4110                                 ;;
4111                         Locate)
4112                                 if test -d "$ansexp"; then
4113                                         echo "(Looking for $loc_file in directory $value.)"
4114                                         value="$value/$loc_file"
4115                                         ansexp="$ansexp/$loc_file"
4116                                 fi
4117                                 if test -f "$ansexp"; then
4118                                         type=''
4119                                 fi
4120                                 case "$nopath_ok" in
4121                                 true)   case "$value" in
4122                                         */*) ;;
4123                                         *)      echo "Assuming $value will be in people's path."
4124                                                 type=''
4125                                                 ;;
4126                                         esac
4127                                         ;;
4128                                 esac
4129                                 ;;
4130                         esac
4131
4132                         case "$skip" in
4133                         true) type='';
4134                         esac
4135
4136                         case "$type" in
4137                         '') ;;
4138                         *)
4139                                 if test "$fastread" = yes; then
4140                                         dflt=y
4141                                 else
4142                                         dflt=n
4143                                 fi
4144                                 rp="$what $value doesn't exist.  Use that name anyway?"
4145                                 . UU/myread
4146                                 dflt=''
4147                                 case "$ans" in
4148                                 y*) type='';;
4149                                 *) echo " ";;
4150                                 esac
4151                                 ;;
4152                         esac
4153                         ;;
4154                 esac
4155                 ;;
4156         esac
4157 done
4158 cd UU
4159 ans="$value"
4160 rp="$orig_rp"
4161 dflt="$orig_dflt"
4162 rm -f getfile.ok
4163 test "X$gfpthkeep" != Xy && gfpth=""
4164 EOSC
4165
4166 : determine root of directory hierarchy where package will be installed.
4167 case "$prefix" in
4168 '')
4169         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4170         ;;
4171 *?/)
4172         dflt=`echo "$prefix" | sed 's/.$//'`
4173         ;;
4174 *)
4175         dflt="$prefix"
4176         ;;
4177 esac
4178 $cat <<EOM
4179
4180 By default, $package will be installed in $dflt/bin, manual pages
4181 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4182 installation directories. Typically this is something like /usr/local.
4183 If you wish to have binaries under /usr/bin but other parts of the
4184 installation under /usr/local, that's ok: you will be prompted
4185 separately for each of the installation directories, the prefix being
4186 only used to set the defaults.
4187
4188 EOM
4189 fn=d~
4190 rp='Installation prefix to use?'
4191 . ./getfile
4192 oldprefix=''
4193 case "$prefix" in
4194 '') ;;
4195 *)
4196         case "$ans" in
4197         "$prefix") ;;
4198         *) oldprefix="$prefix";;
4199         esac
4200         ;;
4201 esac
4202 prefix="$ans"
4203 prefixexp="$ansexp"
4204
4205 : allow them to override the AFS root
4206 case "$afsroot" in
4207 '')     afsroot=/afs ;;
4208 *)      afsroot=$afsroot ;;
4209 esac
4210
4211 : is AFS running?
4212 echo " "
4213 case "$afs" in
4214 $define|true)   afs=true ;;
4215 $undef|false)   afs=false ;;
4216 *)      if $test -d $afsroot; then
4217                 afs=true
4218         else
4219                 afs=false
4220         fi
4221         ;;
4222 esac
4223 if $afs; then
4224         echo "AFS may be running... I'll be extra cautious then..." >&4
4225 else
4226         echo "AFS does not seem to be running..." >&4
4227 fi
4228
4229 : determine installation prefix for where package is to be installed.
4230 if $afs; then
4231 $cat <<EOM
4232
4233 Since you are running AFS, I need to distinguish the directory in which
4234 files will reside from the directory in which they are installed (and from
4235 which they are presumably copied to the former directory by occult means).
4236
4237 EOM
4238         case "$installprefix" in
4239         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4240         *) dflt="$installprefix";;
4241         esac
4242 else
4243 $cat <<EOM
4244
4245 In some special cases, particularly when building $package for distribution,
4246 it is convenient to distinguish the directory in which files should be
4247 installed from the directory ($prefix) in which they will
4248 eventually reside.  For most users, these two directories are the same.
4249
4250 EOM
4251         case "$installprefix" in
4252         '') dflt=$prefix ;;
4253         *) dflt=$installprefix;;
4254         esac
4255 fi
4256 fn=d~
4257 rp='What installation prefix should I use for installing files?'
4258 . ./getfile
4259 installprefix="$ans"
4260 installprefixexp="$ansexp"
4261
4262 : Perform the prefixexp/installprefixexp correction if necessary
4263 cat <<EOS >installprefix
4264 $startsh
4265 EOS
4266 cat <<'EOSC' >>installprefix
4267 : Change installation prefix, if necessary.
4268 if $test X"$prefix" != X"$installprefix"; then
4269     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4270 else
4271     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4272 fi
4273 EOSC
4274 chmod +x installprefix
4275 $eunicefix installprefix
4276
4277 : Set variables such as privlib and privlibexp from the output of ./getfile
4278 : performing the prefixexp/installprefixexp correction if necessary.
4279 cat <<EOS >setprefixvar
4280 $startsh
4281 EOS
4282 cat <<'EOSC' >>setprefixvar
4283 eval "${prefixvar}=\"\$ans\""
4284 eval "${prefixvar}exp=\"\$ansexp\""
4285 . ./installprefix
4286 EOSC
4287 chmod +x setprefixvar
4288 $eunicefix setprefixvar
4289
4290 : set up the script used to warn in case of inconsistency
4291 cat <<EOS >whoa
4292 $startsh
4293 EOS
4294 cat <<'EOSC' >>whoa
4295 dflt=y
4296 case "$hint" in
4297     recommended)
4298         case "$hintfile" in
4299         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4300                 ;;
4301         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4302                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4303                 ;;
4304         esac
4305         ;;
4306     *)  echo " "
4307         echo "*** WHOA THERE!!! ***" >&4
4308         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4309         ;;
4310 esac
4311 rp="    Keep the $hint value?"
4312 . ./myread
4313 case "$ans" in
4314 y) td=$was; tu=$was;;
4315 esac
4316 EOSC
4317
4318 : function used to set '$1' to '$val'
4319 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4320 case "$val$was" in
4321 $define$undef) . ./whoa; eval "$var=\$td";;
4322 $undef$define) . ./whoa; eval "$var=\$tu";;
4323 *) eval "$var=$val";;
4324 esac'
4325
4326 : get the patchlevel
4327 echo " "
4328 echo "Getting the current patchlevel..." >&4
4329 if $test -r $rsrc/patchlevel.h;then
4330         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4331         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4332         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4333         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4334         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4335         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4336         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4337 else
4338         revision=0
4339         patchlevel=0
4340         subversion=0
4341         api_revision=0
4342         api_version=0
4343         api_subversion=0
4344         perl_patchlevel=0
4345         $echo "(You do not have patchlevel.h.  Eek.)"
4346 fi
4347 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4348 version_patchlevel_string="version $patchlevel subversion $subversion"
4349 case "$perl_patchlevel" in
4350 0|'') ;;
4351 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4352     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4353     ;;
4354 esac
4355
4356 $echo "(You have $package $version_patchlevel_string.)"
4357
4358 case "$osname" in
4359 dos|vms)
4360         : XXX Should be a Configure test for double-dots in filenames.
4361         version=`echo $revision $patchlevel $subversion | \
4362                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4363         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4364                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4365         ;;
4366 *)
4367         version=`echo $revision $patchlevel $subversion | \
4368                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4369         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4370                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4371         ;;
4372 esac
4373 : Special case the 5.005_xx maintenance series, which used 5.005
4374 : without any subversion label as a subdirectory in $sitelib
4375 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4376         api_versionstring='5.005'
4377 fi
4378
4379 : Do we want threads support and if so, what type
4380 case "$usethreads" in
4381 $define|true|[yY]*)     dflt='y';;
4382 *)     # Catch case where user specified ithreads or 5005threads but
4383        # forgot -Dusethreads (A.D. 4/2002)
4384        case "$useithreads$use5005threads" in
4385        *$define*)       dflt='y';;
4386        *)               dflt='n';;
4387        esac
4388        ;;
4389 esac
4390 cat <<EOM
4391
4392 Perl can be built to offer a form of threading support on some systems
4393 To do so, Configure can be run with -Dusethreads.
4394
4395 Note that Perl built with threading support runs slightly slower
4396 and uses slightly more memory than plain Perl.
4397
4398 If this doesn't make any sense to you, just accept the default '$dflt'.
4399 EOM
4400 rp='Build a threading Perl?'
4401 . ./myread
4402 case "$ans" in
4403 y|Y)    val="$define" ;;
4404 *)      val="$undef" ;;
4405 esac
4406 set usethreads
4407 eval $setvar
4408
4409 if $test $patchlevel -lt 9; then
4410     case "$usethreads" in
4411     $define)
4412         : Default to ithreads unless overridden on command line or with
4413         : old config.sh
4414         dflt='y'
4415         case "$use5005threads" in
4416                 $define|true|[yY]*)
4417                         echo "5.005 threads are no longer supported"
4418                         exit 1
4419                 ;;
4420         esac
4421         case "$useithreads" in
4422                 $undef|false|[nN]*) dflt='n';;
4423         esac
4424         rp='Use the newer interpreter-based ithreads?'
4425         . ./myread
4426         case "$ans" in
4427         y|Y)    val="$define" ;;
4428         *)      val="$undef" ;;
4429         esac
4430         set useithreads
4431         eval $setvar
4432         : Now set use5005threads to the opposite value.
4433         case "$useithreads" in
4434         $define) val="$undef" ;;
4435         *) val="$define" ;;
4436         esac
4437         set use5005threads
4438         eval $setvar
4439         ;;
4440     *)
4441         useithreads="$undef"
4442         use5005threads="$undef"
4443         ;;
4444     esac
4445
4446     case "$useithreads$use5005threads" in
4447     "$define$define")
4448         $cat >&4 <<EOM
4449
4450 You cannot have both the ithreads and the 5.005 threads enabled
4451 at the same time.  Disabling the 5.005 threads since they are
4452 much less stable than the ithreads.
4453
4454 EOM
4455         use5005threads="$undef"
4456         ;;
4457     esac
4458
4459 else
4460 : perl-5.9.x and later
4461
4462     if test X"$usethreads" = "X$define"; then
4463         case "$use5005threads" in
4464             $define|true|[yY]*)
4465                 $cat >&4 <<EOM
4466
4467 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4468
4469 EOM
4470             ;;
4471         esac
4472     fi
4473
4474     use5005threads="$undef"
4475     useithreads="$usethreads"
4476 fi
4477
4478 case "$d_oldpthreads" in
4479 '')     : Configure tests would be welcome here.  For now, assume undef.
4480         val="$undef" ;;
4481 *)      val="$d_oldpthreads" ;;
4482 esac
4483 set d_oldpthreads
4484 eval $setvar
4485
4486
4487 : Look for a hint-file generated 'call-back-unit'.  If the
4488 : user has specified that a threading perl is to be built,
4489 : we may need to set or change some other defaults.
4490 if $test -f usethreads.cbu; then
4491     echo "Your platform has some specific hints regarding threaded builds, using them..."
4492     . ./usethreads.cbu
4493 else
4494     case "$usethreads" in
4495         "$define"|true|[yY]*)
4496                 $cat <<EOM
4497 (Your platform does not have any specific hints for threaded builds.
4498  Assuming POSIX threads, then.)
4499 EOM
4500         ;;
4501     esac
4502 fi
4503
4504 : Check if multiplicity is required
4505 cat <<EOM
4506
4507 Perl can be built so that multiple Perl interpreters can coexist
4508 within the same Perl executable.
4509 EOM
4510
4511 case "$useithreads" in
4512 $define)
4513         cat <<EOM
4514 This multiple interpreter support is required for interpreter-based threads.
4515 EOM
4516         val="$define"
4517         ;;
4518 *)      case "$usemultiplicity" in
4519         $define|true|[yY]*)     dflt='y';;
4520         *) dflt='n';;
4521         esac
4522         echo " "
4523         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4524         rp='Build Perl for multiplicity?'
4525         . ./myread
4526         case "$ans" in
4527         y|Y)    val="$define" ;;
4528         *)      val="$undef" ;;
4529         esac
4530         ;;
4531 esac
4532 set usemultiplicity
4533 eval $setvar
4534
4535 : Check if morebits is requested
4536 case "$usemorebits" in
4537 "$define"|true|[yY]*)
4538         use64bitint="$define"
4539         uselongdouble="$define"
4540         usemorebits="$define"
4541         ;;
4542 *)      usemorebits="$undef"
4543         ;;
4544 esac
4545
4546 : Determine the C compiler to be used
4547 echo " "
4548 case "$cc" in
4549 '') dflt=cc;;
4550 *) dflt="$cc";;
4551 esac
4552 rp="Use which C compiler?"
4553 . ./myread
4554 cc="$ans"
4555
4556 : See whether they have no cc but they do have gcc
4557 . ./trygcc
4558 if $test -f cc.cbu; then
4559     . ./cc.cbu
4560 fi
4561 . ./checkcc
4562
4563 : make some quick guesses about what we are up against
4564 echo " "
4565 $echo $n "Hmm...  $c"
4566 echo exit 1 >bsd
4567 echo exit 1 >usg
4568 echo exit 1 >v7
4569 echo exit 1 >osf1
4570 echo exit 1 >eunice
4571 echo exit 1 >xenix
4572 echo exit 1 >venix
4573 echo exit 1 >os2
4574 d_bsd="$undef"
4575 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4576 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4577 then
4578         echo "Looks kind of like an OSF/1 system, but we'll see..."
4579         echo exit 0 >osf1
4580 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4581         xxx=`./loc addbib blurfl $pth`
4582         if $test -f $xxx; then
4583         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4584                 echo exit 0 >bsd
4585                 echo exit 0 >usg
4586         else
4587                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4588                         echo "Looks kind of like an extended USG system, but we'll see..."
4589                 else
4590                         echo "Looks kind of like a USG system, but we'll see..."
4591                 fi
4592                 echo exit 0 >usg
4593         fi
4594 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4595         echo "Looks kind of like a BSD system, but we'll see..."
4596         d_bsd="$define"
4597         echo exit 0 >bsd
4598 else
4599         echo "Looks kind of like a Version 7 system, but we'll see..."
4600         echo exit 0 >v7
4601 fi
4602 case "$eunicefix" in
4603 *unixtovms*)
4604         $cat <<'EOI'
4605 There is, however, a strange, musty smell in the air that reminds me of
4606 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4607 EOI
4608         echo exit 0 >eunice
4609         d_eunice="$define"
4610 : it so happens the Eunice I know will not run shell scripts in Unix format
4611         ;;
4612 *)
4613         echo " "
4614         echo "Congratulations.  You aren't running Eunice."
4615         d_eunice="$undef"
4616         ;;
4617 esac
4618 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4619 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4620 : semicolon as a patch separator
4621 case "$p_" in
4622 :) ;;
4623 *)
4624         $cat <<'EOI'
4625 I have the feeling something is not exactly right, however...don't tell me...
4626 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4627 (Or you may be running DOS with DJGPP.)
4628 EOI
4629         echo exit 0 >os2
4630         ;;
4631 esac
4632 if test -f /xenix; then
4633         echo "Actually, this looks more like a XENIX system..."
4634         echo exit 0 >xenix
4635         d_xenix="$define"
4636 else
4637         echo " "
4638         echo "It's not Xenix..."
4639         d_xenix="$undef"
4640 fi
4641 chmod +x xenix
4642 $eunicefix xenix
4643 if test -f /venix; then
4644         echo "Actually, this looks more like a VENIX system..."
4645         echo exit 0 >venix
4646 else
4647         echo " "
4648         if ./xenix; then
4649                 : null
4650         else
4651                 echo "Nor is it Venix..."
4652         fi
4653 fi
4654 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4655 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4656 $rm -f foo
4657
4658 : Check if we are using GNU gcc and what its version is
4659 echo " "
4660 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4661 $cat >try.c <<EOM
4662 #include <stdio.h>
4663 int main() {
4664 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4665 #ifdef __VERSION__
4666         printf("%s\n", __VERSION__);
4667 #else
4668         printf("%s\n", "1");
4669 #endif
4670 #endif
4671         return(0);
4672 }
4673 EOM
4674 if $cc -o try $ccflags $ldflags try.c; then
4675         gccversion=`$run ./try`
4676         case "$gccversion" in
4677         '') echo "You are not using GNU cc." ;;
4678         *)  echo "You are using GNU cc $gccversion."
4679             ccname=gcc
4680             ;;
4681         esac
4682 else
4683         echo " "
4684         echo "*** WHOA THERE!!! ***" >&4
4685         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4686         case "$knowitall" in
4687         '')
4688         echo "    You'd better start hunting for one and let me know about it." >&4
4689                 exit 1
4690                 ;;
4691         esac
4692 fi
4693 $rm -f try try.*
4694 case "$gccversion" in
4695 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4696 esac
4697 case "$gccversion" in
4698 '') gccosandvers='' ;;
4699 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4700    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4701    gccshortvers=''
4702    case "$gccosandvers" in
4703    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4704    $osname$osvers) ;; # looking good
4705    $osname*) cat <<EOM >&4
4706
4707 *** WHOA THERE!!! ***
4708
4709     Your gcc has not been compiled for the exact release of
4710     your operating system ($gccosandvers versus $osname$osvers).
4711
4712     In general it is a good idea to keep gcc synchronized with
4713     the operating system because otherwise serious problems
4714     may ensue when trying to compile software, like Perl.
4715
4716     I'm trying to be optimistic here, though, and will continue.
4717     If later during the configuration and build icky compilation
4718     problems appear (headerfile conflicts being the most common
4719     manifestation), I suggest reinstalling the gcc to match
4720     your operating system release.
4721
4722 EOM
4723       ;;
4724    *) gccosandvers='' ;; # failed to parse, better be silent
4725    esac
4726    ;;
4727 esac
4728 case "$ccname" in
4729 '') ccname="$cc" ;;
4730 esac
4731
4732 # gcc 3.* complain about adding -Idirectories that they already know about,
4733 # so we will take those off from locincpth.
4734 case "$gccversion" in
4735 3*)
4736     echo "main(){}">try.c
4737     for incdir in $locincpth; do
4738        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4739              grep '^c[cp]p*[01]: warning: changing search order '`
4740        if test "X$warn" != X; then
4741            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4742        fi
4743     done
4744     $rm -f try try.*
4745 esac
4746
4747 # gcc 4.9 by default does some optimizations that break perl.
4748 # see ticket 121505.
4749 #
4750 # The -fwrapv disables those optimizations (and probably others,) so
4751 # for gcc 4.9 (and later, since the optimizations probably won't go
4752 # away), add -fwrapv unless the user requests -fno-wrapv, which
4753 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4754 # which turns the overflows -fwrapv ignores into runtime errors.
4755 case "$gccversion" in
4756 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4757     case "$ccflags" in
4758     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4759     *) ccflags="$ccflags -fwrapv" ;;
4760     esac
4761 esac
4762
4763 : What should the include directory be ?
4764 : Use sysroot if set, so findhdr looks in the right place.
4765 echo " "
4766 $echo $n "Hmm...  $c"
4767 dflt="$sysroot/usr/include"
4768 incpath=''
4769 mips_type=''
4770 if $test -f /bin/mips && /bin/mips; then
4771         echo "Looks like a MIPS system..."
4772         $cat >usr.c <<'EOCP'
4773 #ifdef SYSTYPE_BSD43
4774 /bsd43
4775 #endif
4776 EOCP
4777         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4778                 dflt='/bsd43/usr/include'
4779                 incpath='/bsd43'
4780                 mips_type='BSD 4.3'
4781         else
4782                 mips_type='System V'
4783         fi
4784         $rm -f usr.c usr.out
4785         echo "and you're compiling with the $mips_type compiler and libraries."
4786         xxx_prompt=y
4787         echo "exit 0" >mips
4788 else
4789         echo "Doesn't look like a MIPS system."
4790         xxx_prompt=n
4791         echo "exit 1" >mips
4792 fi
4793 chmod +x mips
4794 $eunicefix mips
4795 case "$usrinc" in
4796 '') ;;
4797 *) dflt="$usrinc";;
4798 esac
4799 case "$xxx_prompt" in
4800 y)      fn=d/
4801         echo " "
4802         rp='Where are the include files you want to use?'
4803         . ./getfile
4804         usrinc="$ans"
4805         ;;
4806 *)      usrinc="$dflt"
4807         ;;
4808 esac
4809
4810 : see how we invoke the C preprocessor
4811 echo " "
4812 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4813 cat <<'EOT' >testcpp.c
4814 #define ABC abc
4815 #define XYZ xyz
4816 ABC.XYZ
4817 EOT
4818 cd ..
4819 if test ! -f cppstdin; then
4820         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4821                 # AIX cc -E doesn't show the absolute headerfile
4822                 # locations but we'll cheat by using the -M flag.
4823                 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
4824         else
4825                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4826         fi
4827 else
4828         echo "Keeping your $hint cppstdin wrapper."
4829 fi
4830 chmod 755 cppstdin
4831 wrapper=`pwd`/cppstdin
4832 ok='false'
4833 cd UU
4834
4835 if $test "X$cppstdin" != "X" && \
4836         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4837         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4838 then
4839         echo "You used to use $cppstdin $cppminus so we'll use that again."
4840         case "$cpprun" in
4841         '') echo "But let's see if we can live without a wrapper..." ;;
4842         *)
4843                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4844                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4845                 then
4846                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4847                         ok='true'
4848                 else
4849                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4850                 fi
4851                 ;;
4852         esac
4853 else
4854         case "$cppstdin" in
4855         '') ;;
4856         *)
4857                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4858                 ;;
4859         esac
4860 fi
4861
4862 if $ok; then
4863         : nothing
4864 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4865         $cc -E <testcpp.c >testcpp.out 2>&1; \
4866         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4867         echo "Yup, it does."
4868         x_cpp="$cc $cppflags -E"
4869         x_minus='';
4870 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4871         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4872         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4873         echo "Yup, it does."
4874         x_cpp="$cc $cppflags -E"
4875         x_minus='-';
4876 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4877         $cc -P <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "Yipee, that works!"
4880         x_cpp="$cc $cppflags -P"
4881         x_minus='';
4882 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4883         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4884         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4885         echo "At long last!"
4886         x_cpp="$cc $cppflags -P"
4887         x_minus='-';
4888 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4889         $cpp <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         echo "It works!"
4892         x_cpp="$cpp $cppflags"
4893         x_minus='';
4894 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4895         $cpp - <testcpp.c >testcpp.out 2>&1; \
4896         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4897         echo "Hooray, it works!  I was beginning to wonder."
4898         x_cpp="$cpp $cppflags"
4899         x_minus='-';
4900 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4901         $wrapper <testcpp.c >testcpp.out 2>&1; \
4902         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903         x_cpp="$wrapper"
4904         x_minus=''
4905         echo "Eureka!"
4906 else
4907         dflt=''
4908         rp="No dice.  I can't find a C preprocessor.  Name one:"
4909         . ./myread
4910         x_cpp="$ans"
4911         x_minus=''
4912         $x_cpp <testcpp.c >testcpp.out 2>&1
4913         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4914                 echo "OK, that will do." >&4
4915         else
4916 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4917                 exit 1
4918         fi
4919 fi
4920
4921 case "$ok" in
4922 false)
4923         cppstdin="$x_cpp"
4924         cppminus="$x_minus"
4925         cpprun="$x_cpp"
4926         cpplast="$x_minus"
4927         set X $x_cpp
4928         shift
4929         case "$1" in
4930         "$cpp")
4931                 echo "Perhaps can we force $cc -E using a wrapper..."
4932                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4933                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4934                 then
4935                         echo "Yup, we can."
4936                         cppstdin="$wrapper"
4937                         cppminus='';
4938                 else
4939                         echo "Nope, we'll have to live without it..."
4940                 fi
4941                 ;;
4942         esac
4943         case "$cpprun" in
4944         "$wrapper")
4945                 cpprun=''
4946                 cpplast=''
4947                 ;;
4948         esac
4949         ;;
4950 esac
4951
4952 case "$cppstdin" in
4953 "$wrapper"|'cppstdin') ;;
4954 *) $rm -f $wrapper;;
4955 esac
4956 $rm -f testcpp.c testcpp.out
4957
4958 : Adjust cppfilter for path component separator
4959 case "$osname" in
4960 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4961 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4962 *)   cppfilter='' ;;
4963 esac
4964
4965 : Use gcc to determine libpth and incpth
4966 # If using gcc or clang, we can get better values for libpth, incpth
4967 # and usrinc directly from the compiler.
4968 # Note that ccname for clang is also gcc.
4969 case "$ccname" in
4970     gcc)
4971         $echo 'extern int foo;' > try.c
4972         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4973         shift
4974         if $test $# -gt 0; then
4975             incpth="$incpth $*"
4976             incpth="`$echo $incpth|$sed 's/^ //'`"
4977             for i in $*; do
4978                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4979                 if $test -d $j; then
4980                     libpth="$libpth $j"
4981                 fi
4982             done
4983             libpth="`$echo $libpth|$sed 's/^ //'`"
4984             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4985                 if $test -d $xxx; then
4986                     case " $libpth " in
4987                     *" $xxx "*) ;;
4988                     *) libpth="$libpth $xxx";;
4989                     esac
4990                 fi
4991             done
4992         fi
4993         $rm -f try.c
4994         case "$usrinc" in
4995         '') for i in $incpth; do
4996                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4997                     usrinc="$i"
4998                     break
4999                 fi
5000             done
5001             ;;
5002         esac
5003
5004         case "$usecrosscompile" in
5005         $define|true|[yY]*)
5006             case "$incpth" in
5007                 '') echo "Incpth not defined." >&4; croak=y ;;
5008                 *)  echo "Using incpth '$incpth'." >&4 ;;
5009             esac
5010             case "$libpth" in
5011                 '') echo "Libpth not defined." >&4; croak=y ;;
5012                 *)  echo "Using libpth '$libpth'." >&4 ;;
5013             esac
5014             case "$usrinc" in
5015                 '') echo "Usrinc not defined." >&4; croak=y ;;
5016                 *)  echo "Using usrinc $usrinc." >&4 ;;
5017             esac
5018             case "$croak" in
5019                 y)
5020                 if test "X$sysroot" = X; then
5021                     echo "Cannot continue, aborting." >&4; exit 1
5022                 else
5023                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5024                 fi
5025                 ;;
5026             esac
5027             ;;
5028         esac
5029     ;;
5030 esac
5031
5032 : Default value for incpth is just usrinc
5033 case "$incpth" in
5034 '') incpth="$usrinc";;
5035 esac
5036
5037 : Set private lib path
5038 case "$plibpth" in
5039 '') if ./mips; then
5040         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5041     fi;;
5042 esac
5043 case "$libpth" in
5044 ' ') dlist='';;
5045 '') dlist="$loclibpth $plibpth $glibpth";;
5046 *) dlist="$libpth";;
5047 esac
5048
5049 : Now check and see which directories actually exist, avoiding duplicates
5050 for xxx in $dlist
5051 do
5052     if $test -d $xxx; then
5053                 case " $libpth " in
5054                 *" $xxx "*) ;;
5055                 *) libpth="$libpth $xxx";;
5056                 esac
5057     fi
5058 done
5059 $cat <<'EOM'
5060
5061 Some systems have incompatible or broken versions of libraries.  Among
5062 the directories listed in the question below, please remove any you
5063 know not to be holding relevant libraries, and add any that are needed.
5064 Say "none" for none.
5065
5066 EOM
5067
5068 if test "X$sysroot" != X; then
5069     $cat <<EOM
5070 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5071
5072 EOM
5073 fi
5074
5075 case "$libpth" in
5076 '') dflt='none';;
5077 *)
5078         set X $libpth
5079         shift
5080         dflt=${1+"$@"}
5081         ;;
5082 esac
5083 rp="Directories to use for library searches?"
5084 . ./myread
5085 case "$ans" in
5086 none) libpth=' ';;
5087 *) libpth="$ans";;
5088 esac
5089
5090 : compute shared library extension
5091 case "$so" in
5092 '')
5093         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5094                 dflt='sl'
5095         else
5096                 dflt='so'
5097         fi
5098         ;;
5099 *) dflt="$so";;
5100 esac
5101 $cat <<EOM
5102
5103 On some systems, shared libraries may be available.  Answer 'none' if
5104 you want to suppress searching of shared libraries for the remainder
5105 of this configuration.
5106
5107 EOM
5108 rp='What is the file extension used for shared libraries?'
5109 . ./myread
5110 so="$ans"
5111
5112 : Does target system insist that shared library basenames are unique
5113 $cat << EOM
5114
5115 Some dynamic loaders assume that the *basename* of shared library filenames
5116 are globally unique.  We'll default this to undef as we assume your system
5117 is not this weird. Set to defined if you're on one of them.
5118
5119 EOM
5120
5121 dflt='n'
5122 rp='Make shared library basenames unique?'
5123 . ./myread
5124 case "$ans" in
5125 y|Y) val="$define" ;;
5126 *)   val="$undef"  ;;
5127 esac
5128 set d_libname_unique
5129 eval $setvar
5130
5131 : Define several unixisms.
5132 : Hints files or command line option can be used to override them.
5133 : The convoluted testing is in case hints files set either the old
5134 : or the new name.
5135 case "$_exe" in
5136 '')     case "$exe_ext" in
5137         '')     ;;
5138         *)      _exe="$exe_ext" ;;
5139         esac
5140         ;;
5141 esac
5142 case "$_a" in
5143 '')     case "$lib_ext" in
5144     '') _a='.a';;
5145         *)      _a="$lib_ext" ;;
5146         esac
5147         ;;
5148 esac
5149 case "$_o" in
5150 '') case "$obj_ext" in
5151         '')     _o='.o';;
5152         *)      _o="$obj_ext";;
5153         esac
5154         ;;
5155 esac
5156 case "$p_" in
5157 '') case "$path_sep" in
5158         '')     p_=':';;
5159         *)      p_="$path_sep";;
5160         esac
5161         ;;
5162 esac
5163 exe_ext=$_exe
5164 lib_ext=$_a
5165 obj_ext=$_o
5166 path_sep=$p_
5167
5168 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5169
5170 : Which makefile gets called first.  This is used by make depend.
5171 case "$firstmakefile" in
5172 '') firstmakefile='makefile';;
5173 esac
5174
5175 : Check is we will use socks
5176 case "$usesocks" in
5177 $define|true|[yY]*)     dflt='y';;
5178 *) dflt='n';;
5179 esac
5180 cat <<EOM
5181
5182 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5183 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5184 to use the PerlIO abstraction layer, this will be implicitly selected.
5185
5186 If this doesn't make any sense to you, just accept the default '$dflt'.
5187 EOM
5188 rp='Build Perl for SOCKS?'
5189 . ./myread
5190 case "$ans" in
5191 y|Y)    val="$define" ;;
5192 *)      val="$undef" ;;
5193 esac
5194 set usesocks
5195 eval $setvar
5196
5197 : Check for uselongdouble support
5198 case "$ccflags" in
5199 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5200 esac
5201
5202 case "$uselongdouble" in
5203 $define|true|[yY]*)     dflt='y';;
5204 *) dflt='n';;
5205 esac
5206 cat <<EOM
5207
5208 Perl can be built to take advantage of long doubles which
5209 (if available) may give more accuracy and range for floating point numbers.
5210
5211 If this doesn't make any sense to you, just accept the default '$dflt'.
5212 EOM
5213 rp='Try to use long doubles if available?'
5214 . ./myread
5215 case "$ans" in
5216 y|Y)    val="$define"   ;;
5217 *)      val="$undef"    ;;
5218 esac
5219 set uselongdouble
5220 eval $setvar
5221
5222 case "$uselongdouble" in
5223 true|[yY]*) uselongdouble="$define" ;;
5224 esac
5225
5226 : Look for a hint-file generated 'call-back-unit'.  If the
5227 : user has specified that long doubles should be used,
5228 : we may need to set or change some other defaults.
5229 if $test -f uselongdouble.cbu; then
5230     echo "Your platform has some specific hints regarding long doubles, using them..."
5231     . ./uselongdouble.cbu
5232 else
5233     case "$uselongdouble" in
5234         $define)
5235                 $cat <<EOM
5236 (Your platform does not have any specific hints for long doubles.)
5237 EOM
5238         ;;
5239     esac
5240 fi
5241
5242 : Check if quadmath is requested
5243 case "$usequadmath" in
5244 "$define"|true|[yY]*) usequadmath="$define" ;;
5245 *)                    usequadmath="$undef"  ;;
5246 esac
5247
5248 : Fail if both uselongdouble and usequadmath are requested
5249 case "$usequadmath:$uselongdouble" in
5250 define:define)
5251         $cat <<EOM >&4
5252
5253 *** You requested the use of the quadmath library and use
5254 *** of long doubles.
5255 ***
5256 *** Please select one or the other.
5257 EOM
5258         exit 1
5259         ;;
5260 esac
5261
5262 : Looking for optional libraries
5263 echo " "
5264 echo "Checking for optional libraries..." >&4
5265 case "$libs" in
5266 ' '|'') dflt='';;
5267 *) dflt="$libs";;
5268 esac
5269 case "$libswanted" in
5270 '') libswanted='c_s';;
5271 esac
5272 case "$usesocks" in
5273 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5274 esac
5275 case "$usecbacktrace" in
5276 "$define") libswanted="$libswanted bfd" ;;
5277 esac
5278 case "$usequadmath" in
5279 "$define") libswanted="$libswanted quadmath" ;;
5280 esac
5281 libsfound=''
5282 libsfiles=''
5283 libsdirs=''
5284 libspath=''
5285 for thisdir in $libpth $xlibpth; do
5286   test -d $thisdir && libspath="$libspath $thisdir"
5287 done
5288 for thislib in $libswanted; do
5289         for thisdir in $libspath; do
5290             xxx=''
5291             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5292                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=shared
5295                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5296                 $test -f "$xxx" && eval $libscheck
5297                 $test -f "$xxx" && libstyle=shared
5298             fi
5299             if test ! -f "$xxx"; then
5300                 xxx=$thisdir/lib$thislib.$so
5301                 $test -f "$xxx" && eval $libscheck
5302                 $test -f "$xxx" && libstyle=shared
5303             fi
5304             if test ! -f "$xxx"; then
5305                 xxx=$thisdir/lib$thislib$_a
5306                 $test -f "$xxx" && eval $libscheck
5307                 $test -f "$xxx" && libstyle=static
5308             fi
5309             if test ! -f "$xxx"; then
5310                 xxx=$thisdir/$thislib$_a
5311                 $test -f "$xxx" && eval $libscheck
5312                 $test -f "$xxx" && libstyle=static
5313             fi
5314             if test ! -f "$xxx"; then
5315                 xxx=$thisdir/lib${thislib}_s$_a
5316                 $test -f "$xxx" && eval $libscheck
5317                 $test -f "$xxx" && libstyle=static
5318                 $test -f "$xxx" && thislib=${thislib}_s
5319             fi
5320             if test ! -f "$xxx"; then
5321                 xxx=$thisdir/Slib$thislib$_a
5322                 $test -f "$xxx" && eval $libscheck
5323                 $test -f "$xxx" && libstyle=static
5324             fi
5325             if $test -f "$xxx"; then
5326                 case "$libstyle" in
5327                 shared) echo "Found -l$thislib (shared)." ;;
5328                 static) echo "Found -l$thislib." ;;
5329                 *)      echo "Found -l$thislib ($libstyle)." ;;
5330                 esac
5331                 case " $dflt " in
5332                 *"-l$thislib "*);;
5333                 *) dflt="$dflt -l$thislib"
5334                    libsfound="$libsfound $xxx"
5335                    yyy=`basename $xxx`
5336                    libsfiles="$libsfiles $yyy"
5337                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5338                    case " $libsdirs " in
5339                    *" $yyy "*) ;;
5340                    *) libsdirs="$libsdirs $yyy" ;;
5341                    esac
5342                    ;;
5343                 esac
5344                 break
5345             fi
5346         done
5347         if $test ! -f "$xxx"; then
5348             echo "No -l$thislib."
5349         fi
5350 done
5351 set X $dflt
5352 shift
5353 dflt="$*"
5354 case "$libs" in
5355 '') dflt="$dflt";;
5356 *) dflt="$libs";;
5357 esac
5358 case "$dflt" in
5359 ' '|'') dflt='none';;
5360 esac
5361
5362 $cat <<EOM
5363
5364 In order to compile $package on your machine, a number of libraries
5365 are usually needed.  Include any other special libraries here as well.
5366 Say "none" for none.  The default list is almost always right.
5367 EOM
5368
5369 echo " "
5370 rp="What libraries to use?"
5371 . ./myread
5372 case "$ans" in
5373 none) libs=' ';;
5374 *) libs="$ans";;
5375 esac
5376
5377 : determine optimization, if desired, or use for debug flag also
5378 case "$optimize" in
5379 ' '|$undef) dflt='none';;
5380 '') dflt='-O';;
5381 *) dflt="$optimize";;
5382 esac
5383 $cat <<EOH
5384
5385 By default, $package compiles with the -O flag to use the optimizer.
5386 Alternately, you might want to use the symbolic debugger, which uses
5387 the -g flag (on traditional Unix systems).  Either flag can be
5388 specified here.  To use neither flag, specify the word "none".
5389
5390 EOH
5391 rp="What optimizer/debugger flag should be used?"
5392 . ./myread
5393 optimize="$ans"
5394 case "$optimize" in
5395 'none') optimize=" ";;
5396 esac
5397
5398 : Check what DEBUGGING is required from the command line
5399 : -DEBUGGING      or -DDEBUGGING or
5400 : -DEBUGGING=both                       = -g + -DDEBUGGING
5401 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5402 : -DEBUGGING=none or -UDEBUGGING        =
5403 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5404 case "$EBUGGING" in
5405 '')     ;;
5406 *)      DEBUGGING=$EBUGGING ;;
5407 esac
5408
5409 case "$DEBUGGING" in
5410 -g|both|$define)
5411     case "$optimize" in
5412         *-g*) ;;
5413         *)    optimize="$optimize -g" ;;
5414     esac ;;
5415 none|$undef)
5416     case "$optimize" in
5417         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5418                 shift
5419                 optimize="$*"
5420                 ;;
5421     esac ;;
5422 esac
5423
5424 dflt=''
5425 case "$DEBUGGING" in
5426 both|$define) dflt='-DDEBUGGING'
5427 esac
5428
5429 : argument order is deliberate, as the flag will start with - which set could
5430 : think is an option
5431 checkccflag='check=$1; flag=$2; callback=$3;
5432 echo " ";
5433 echo "Checking if your compiler accepts $flag" 2>&1;
5434 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5435 echo "int main(void) { return 0; }" > gcctest.c;
5436 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5437     echo "Yes, it does." 2>&1;
5438     if $test -s gcctest.out ; then
5439         echo "But your platform does not like it:";
5440         cat gcctest.out;
5441     else
5442         case "$ccflags" in
5443         *$check*)
5444             echo "Leaving current flags $ccflags alone." 2>&1
5445             ;;
5446         *) dflt="$dflt $flag";
5447             eval $callback
5448             ;;
5449         esac
5450     fi
5451 else
5452     echo "Nope, it does not, but that is ok." 2>&1;
5453 fi
5454 '
5455
5456 : We will not override a previous value, but we might want to
5457 : augment a hint file
5458 case "$hint" in
5459 default|recommended)
5460         case "$gccversion" in
5461         1*) dflt="$dflt -fpcc-struct-return" ;;
5462         esac
5463         case "$optimize:$DEBUGGING" in
5464         *-g*:old) dflt="$dflt -DDEBUGGING";;
5465         esac
5466         case "$gccversion" in
5467         2*) if $test -d /etc/conf/kconfig.d &&
5468                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5469                 then
5470                         # Interactive Systems (ISC) POSIX mode.
5471                         dflt="$dflt -posix"
5472                 fi
5473                 ;;
5474         esac
5475         case "$gccversion" in
5476         1*) ;;
5477         2.[0-8]*) ;;
5478         ?*)     set strict-aliasing -fno-strict-aliasing
5479                 eval $checkccflag
5480                 ;;
5481         esac
5482         # For gcc, adding -pipe speeds up compilations for some, but apparently
5483         # some assemblers can't read from stdin.  (It also slows down compilations
5484         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5485         case "$gccversion" in
5486         ?*)     set pipe -pipe
5487                 eval $checkccflag
5488                 ;;
5489         esac
5490
5491         # on x86_64 (at least) we require an extra library (libssp) in the
5492         # link command line. This library is not named, so I infer that it is
5493         # an implementation detail that may change. Hence the safest approach
5494         # is to add the flag to the flags passed to the compiler at link time,
5495         # as that way the compiler can do the right implementation dependant
5496         # thing. (NWC)
5497         case "$osname" in
5498         amigaos) ;; # -fstack-protector builds but doesn't work
5499         *)      case "$gccversion" in
5500                 ?*)     set stack-protector-strong -fstack-protector-strong
5501                         eval $checkccflag
5502                         case "$dflt" in
5503                         *-fstack-protector-strong*) ;; # It got added.
5504                         *) # Try the plain/older -fstack-protector.
5505                            set stack-protector -fstack-protector
5506                            eval $checkccflag
5507                            ;;
5508                         esac
5509                         ;;
5510                 esac
5511                 ;;
5512         esac
5513         ;;
5514 esac
5515
5516 case "$mips_type" in
5517 *BSD*|'') inclwanted="$locincpth $usrinc";;
5518 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5519 esac
5520 for thisincl in $inclwanted; do
5521         if $test -d $thisincl; then
5522                 if $test x$thisincl != x$usrinc; then
5523                         case "$dflt" in
5524                         *" -I$thisincl "*);;
5525                         *) dflt="$dflt -I$thisincl ";;
5526                         esac
5527                 fi
5528         fi
5529 done
5530
5531 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5532         xxx=true;
5533 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5534         xxx=true;
5535 else
5536         xxx=false;
5537 fi;
5538 if $xxx; then
5539         case "$dflt" in
5540         *$2*);;
5541         *) dflt="$dflt -D$2";;
5542         esac;
5543 fi'
5544
5545 set signal.h LANGUAGE_C; eval $inctest
5546
5547 case "$usesocks" in
5548 $define)
5549         ccflags="$ccflags -DSOCKS"
5550         ;;
5551 esac
5552
5553 case "$hint" in
5554 default|recommended) dflt="$ccflags $dflt" ;;
5555 *) dflt="$ccflags";;
5556 esac
5557
5558 case "$dflt" in
5559 ''|' ') dflt=none;;
5560 esac
5561
5562 $cat <<EOH
5563
5564 Your C compiler may want other flags.  For this question you should include
5565 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5566 but you should NOT include libraries or ld flags like -lwhatever.  If you
5567 want $package to honor its debug switch, you should include -DDEBUGGING here.
5568 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5569
5570 To use no flags, specify the word "none".
5571
5572 EOH
5573 set X $dflt
5574 shift
5575 dflt=${1+"$@"}
5576 rp="Any additional cc flags?"
5577 . ./myread
5578 case "$ans" in
5579 none) ccflags='';;
5580 *) ccflags="$ans";;
5581 esac
5582
5583 : the following weeds options from ccflags that are of no interest to cpp
5584 case "$cppflags" in
5585 '') cppflags="$ccflags" ;;
5586 *)  set X $ccflags; shift
5587     case " $cppflags " in
5588     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5589     *) cppflags="$cppflags $ccflags" ;;
5590     esac
5591     ;;
5592 esac
5593 case "$gccversion" in
5594 1*) cppflags="$cppflags -D__GNUC__"
5595 esac
5596 case "$mips_type" in
5597 '');;
5598 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5599 esac
5600 case "$cppflags" in
5601 '');;
5602 *)
5603         echo " "
5604         echo "Let me guess what the preprocessor flags are..." >&4
5605         set X $cppflags
5606         shift
5607         cppflags=''
5608         $cat >cpp.c <<'EOM'
5609 #define BLURFL foo
5610
5611 BLURFL xx LFRULB
5612 EOM
5613         previous=''
5614         for flag in $*
5615         do
5616                 case "$flag" in
5617                 -*) ftry="$flag";;
5618                 *) ftry="$previous $flag";;
5619                 esac
5620                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5621                         >cpp1.out 2>/dev/null && \
5622                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5623                         >cpp2.out 2>/dev/null && \
5624                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5625                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5626                 then
5627                         cppflags="$cppflags $ftry"
5628                         previous=''
5629                 else
5630                         previous="$flag"
5631                 fi
5632         done
5633         set X $cppflags
5634         shift
5635         cppflags=${1+"$@"}
5636         case "$cppflags" in
5637         *-*)  echo "They appear to be: $cppflags";;
5638         esac
5639         $rm -f cpp.c cpp?.out
5640         ;;
5641 esac
5642
5643 : flags used in final linking phase
5644 case "$ldflags" in
5645 '') if ./venix; then
5646                 dflt='-i -z'
5647         else
5648                 dflt=''
5649         fi
5650         case "$ccflags" in
5651         *-posix*) dflt="$dflt -posix" ;;
5652         esac
5653         ;;
5654 *) dflt="$ldflags";;
5655 esac
5656 # See note above about -fstack-protector
5657 case "$ccflags" in
5658 *-fstack-protector-strong*)
5659         case "$dflt" in
5660         *-fstack-protector-strong*) ;; # Don't add it again
5661         *) dflt="$dflt -fstack-protector-strong" ;;
5662         esac
5663         ;;
5664 *-fstack-protector*)
5665         case "$dflt" in
5666         *-fstack-protector*) ;; # Don't add it again
5667         *) dflt="$dflt -fstack-protector" ;;
5668         esac
5669         ;;
5670 esac
5671
5672 : Try to guess additional flags to pick up local libraries.
5673 for thislibdir in $libpth; do
5674         case " $loclibpth " in
5675         *" $thislibdir "*)
5676                 case "$dflt " in
5677                 *"-L$thislibdir "*) ;;
5678                 *)  dflt="$dflt -L$thislibdir" ;;
5679                 esac
5680                 ;;
5681         esac
5682 done
5683
5684 case "$dflt" in
5685 '') dflt='none' ;;
5686 esac
5687
5688 $cat <<EOH
5689
5690 Your C linker may need flags.  For this question you should
5691 include -L/whatever and any other flags used by the C linker, but you
5692 should NOT include libraries like -lwhatever.
5693
5694 Make sure you include the appropriate -L/path flags if your C linker
5695 does not normally search all of the directories you specified above,
5696 namely
5697         $libpth
5698 To use no flags, specify the word "none".
5699
5700 EOH
5701
5702 rp="Any additional ld flags (NOT including libraries)?"
5703 . ./myread
5704 case "$ans" in
5705 none) ldflags='';;
5706 *) ldflags="$ans";;
5707 esac
5708 rmlist="$rmlist pdp11"
5709
5710 : coherency check
5711 echo " "
5712 echo "Checking your choice of C compiler and flags for coherency..." >&4
5713 $cat > try.c <<'EOF'
5714 #include <stdio.h>
5715 int main() { printf("Ok\n"); return(0); }
5716 EOF
5717 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5718 shift
5719 $cat >try.msg <<'EOM'
5720 I've tried to compile and run the following simple program:
5721
5722 EOM
5723 $cat try.c >> try.msg
5724
5725 $cat >> try.msg <<EOM
5726
5727 I used the command:
5728
5729         $*
5730         $run ./try
5731
5732 and I got the following output:
5733
5734 EOM
5735 dflt=y
5736 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5737         if $sh -c "$run ./try " >>try.msg 2>&1; then
5738                 xxx=`$run ./try`
5739                 case "$xxx" in
5740                 "Ok") dflt=n ;;
5741                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5742                 esac
5743         else
5744                 echo "The program compiled OK, but exited with status $?." >>try.msg
5745                 rp="You have a problem.  Shall I abort Configure"
5746                 dflt=y
5747         fi
5748 else
5749         echo "I can't compile the test program." >>try.msg
5750         rp="You have a BIG problem.  Shall I abort Configure"
5751         dflt=y
5752 fi
5753 case "$dflt" in
5754 y)
5755         $cat try.msg >&4
5756         case "$knowitall" in
5757         '')
5758                 echo "(The supplied flags or libraries might be incorrect.)"
5759                 ;;
5760         *) dflt=n;;
5761         esac
5762         echo " "
5763         . ./myread
5764         case "$ans" in
5765         n*|N*) ;;
5766         *)      echo "Ok.  Stopping Configure." >&4
5767                 exit 1
5768                 ;;
5769         esac
5770         ;;
5771 n) echo "OK, that should do.";;
5772 esac
5773 $rm_try gcctest gcctest.out
5774
5775 : define a shorthand compile call
5776 compile='
5777 mc_file=$1;
5778 shift;
5779 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5780 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5781 exit 1;
5782 fi;
5783 esac;
5784 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5785 : define a shorthand compile call for compilations that should be ok.
5786 compile_ok='
5787 mc_file=$1;
5788 shift;
5789 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5790
5791 : stub, used only to satisfy other units
5792 i_stdlib='define'
5793
5794 : check for lengths of integral types
5795 echo " "
5796 case "$intsize" in
5797 '')
5798         echo "Checking to see how big your integers are..." >&4
5799         $cat >try.c <<EOCP
5800 #include <stdio.h>
5801 #$i_stdlib I_STDLIB
5802 #ifdef I_STDLIB
5803 #include <stdlib.h>
5804 #endif
5805 int main()
5806 {
5807         printf("intsize=%d;\n", (int)sizeof(int));
5808         printf("longsize=%d;\n", (int)sizeof(long));
5809         printf("shortsize=%d;\n", (int)sizeof(short));
5810         exit(0);
5811 }
5812 EOCP
5813         set try
5814         if eval $compile_ok && $run ./try > /dev/null; then
5815                 eval `$run ./try`
5816                 echo "Your integers are $intsize bytes long."
5817                 echo "Your long integers are $longsize bytes long."
5818                 echo "Your short integers are $shortsize bytes long."
5819         else
5820                 $cat >&4 <<EOM
5821 !
5822 Help! I can't compile and run the intsize test program: please enlighten me!
5823 (This is probably a misconfiguration in your system or libraries, and
5824 you really ought to fix it.  Still, I'll try anyway.)
5825 !
5826 EOM
5827                 dflt=4
5828                 rp="What is the size of an integer (in bytes)?"
5829                 . ./myread
5830                 intsize="$ans"
5831                 dflt=$intsize
5832                 rp="What is the size of a long integer (in bytes)?"
5833                 . ./myread
5834                 longsize="$ans"
5835                 dflt=2
5836                 rp="What is the size of a short integer (in bytes)?"
5837                 . ./myread
5838                 shortsize="$ans"
5839         fi
5840         ;;
5841 esac
5842 $rm_try
5843
5844 : check for long long
5845 echo " "
5846 echo "Checking to see if you have long long..." >&4
5847 echo 'int main() { long long x = 7; return 0; }' > try.c
5848 set try
5849 if eval $compile; then
5850         val="$define"
5851         echo "You have long long."
5852 else
5853         val="$undef"
5854         echo "You do not have long long."
5855 fi
5856 $rm_try
5857 set d_longlong
5858 eval $setvar
5859
5860 : check for length of long long
5861 case "${d_longlong}${longlongsize}" in
5862 $define)
5863         echo " "
5864         echo "Checking to see how big your long longs are..." >&4
5865         $cat >try.c <<'EOCP'
5866 #include <stdio.h>
5867 int main()
5868 {
5869     printf("%d\n", (int)sizeof(long long));
5870     return(0);
5871 }
5872 EOCP
5873         set try
5874         if eval $compile_ok; then
5875                 longlongsize=`$run ./try`
5876                 echo "Your long longs are $longlongsize bytes long."
5877         else
5878                 dflt='8'
5879                 echo " "
5880                 echo "(I can't seem to compile the test program.  Guessing...)"
5881                 rp="What is the size of a long long (in bytes)?"
5882                 . ./myread
5883                 longlongsize="$ans"
5884         fi
5885         if $test "X$longsize" = "X$longlongsize"; then
5886                 echo "(That isn't any different from an ordinary long.)"
5887         fi
5888         ;;
5889 esac
5890 $rm_try
5891
5892 : determine filename position in cpp output
5893 echo " "
5894 echo "Computing filename position in cpp output for #include directives..." >&4
5895 case "$osname" in
5896 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5897 esac
5898 case "$fieldn" in
5899 '')
5900 case "$osname" in
5901 vos) testaccess=-e ;;
5902 *)   testaccess=-r ;;
5903 esac
5904 echo '#include <stdio.h>' > foo.c
5905 $cat >fieldn <<EOF
5906 $startsh
5907 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5908 $grep '^[       ]*#.*stdio\.h' | \
5909 while read cline; do
5910         pos=1
5911         set \$cline
5912         while $test \$# -gt 0; do
5913                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5914                         echo "\$pos"
5915                         exit 0
5916                 fi
5917                 shift
5918                 pos=\`expr \$pos + 1\`
5919         done
5920 done
5921 EOF
5922 chmod +x fieldn
5923 fieldn=`./fieldn`
5924 $rm -f foo.c fieldn
5925 ;;
5926 esac
5927 case $fieldn in
5928 '') pos='???';;
5929 1) pos=first;;
5930 2) pos=second;;
5931 3) pos=third;;
5932 *) pos="${fieldn}th";;
5933 esac
5934 echo "Your cpp writes the filename in the $pos field of the line."
5935
5936 : locate header file
5937 $cat >findhdr <<EOF
5938 $startsh
5939 wanted=\$1
5940 name=''
5941 for usrincdir in $incpth
5942 do
5943         if test -f \$usrincdir/\$wanted; then
5944                 echo "\$usrincdir/\$wanted"
5945                 exit 0
5946         fi
5947 done
5948 awkprg='{ print \$$fieldn }'
5949 echo "#include <\$wanted>" > foo\$\$.c
5950 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5951 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5952 while read cline; do
5953         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5954         case "\$name" in
5955         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5956         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5957         *) exit 2;;
5958         esac;
5959 done;
5960 #
5961 # status = 0: grep returned 0 lines, case statement not executed
5962 # status = 1: headerfile found
5963 # status = 2: while loop executed, no headerfile found
5964 #
5965 status=\$?
5966 $rm -f foo\$\$.c;
5967 if test \$status -eq 1; then
5968         exit 0;
5969 fi
5970 exit 1
5971 EOF
5972 chmod +x findhdr
5973
5974 : define an alternate in-header-list? function
5975 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5976 cont=true; xxf="echo \"<\$1> found.\" >&4";
5977 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5978 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5979 esac;
5980 case $# in 4) instead=instead;; *) instead="at last";; esac;
5981 while $test "$cont"; do
5982         xxx=`./findhdr $1`
5983         var=$2; eval "was=\$$2";
5984         if $test "$xxx" && $test -r "$xxx";
5985         then eval $xxf;
5986         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5987                 cont="";
5988         else eval $xxnf;
5989         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5990         set $yyy; shift; shift; yyy=$@;
5991         case $# in 0) cont="";;
5992         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5993                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5994         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5995                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5996         esac;
5997 done;
5998 while $test "$yyy";
5999 do set $yyy; var=$2; eval "was=\$$2";
6000         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6001         set $yyy; shift; shift; yyy=$@;
6002 done'
6003
6004 : see if inttypes.h is available
6005 : we want a real compile instead of Inhdr because some systems
6006 : have an inttypes.h which includes non-existent headers
6007 echo " "
6008 $cat >try.c <<EOCP
6009 #include <inttypes.h>
6010 int main() {
6011         static int32_t foo32 = 0x12345678;
6012 }
6013 EOCP
6014 set try
6015 if eval $compile; then
6016         echo "<inttypes.h> found." >&4
6017         val="$define"
6018 else
6019         echo "<inttypes.h> NOT found." >&4
6020         val="$undef"
6021 fi
6022 $rm_try
6023 set i_inttypes
6024 eval $setvar
6025
6026 : check for int64_t
6027 echo " "
6028 echo "Checking to see if you have int64_t..." >&4
6029 $cat >try.c <<EOCP
6030 #include <sys/types.h>
6031 #$i_inttypes I_INTTYPES
6032 #ifdef I_INTTYPES
6033 #include <inttypes.h>
6034 #endif
6035 int main() { int64_t x = 7; }
6036 EOCP
6037 set try
6038 if eval $compile; then
6039         val="$define"
6040         echo "You have int64_t."
6041 else
6042         val="$undef"
6043         echo "You do not have int64_t."
6044 fi
6045 $rm_try
6046 set d_int64_t
6047 eval $setvar
6048
6049 : Check if 64bit ints have a quad type
6050 echo " "
6051 echo "Checking which 64-bit integer type we could use..." >&4
6052
6053 case "$intsize" in
6054 8) val=int
6055    set quadtype
6056    eval $setvar
6057    val='"unsigned int"'
6058    set uquadtype
6059    eval $setvar
6060    quadkind=1
6061    ;;
6062 *) case "$longsize" in
6063    8) val=long
6064       set quadtype
6065       eval $setvar
6066       val='"unsigned long"'
6067       set uquadtype
6068       eval $setvar
6069       quadkind=2
6070       ;;
6071    *) case "$d_longlong:$longlongsize" in
6072       define:8)
6073         val='"long long"'
6074         set quadtype
6075         eval $setvar
6076         val='"unsigned long long"'
6077         set uquadtype
6078         eval $setvar
6079         quadkind=3
6080         ;;
6081       *) case "$d_int64_t" in
6082          define)
6083            val=int64_t
6084            set quadtype
6085            eval $setvar
6086            val=uint64_t
6087            set uquadtype
6088            eval $setvar
6089            quadkind=4
6090            ;;
6091          esac
6092          ;;
6093       esac
6094       ;;
6095    esac
6096    ;;
6097 esac
6098
6099 case "$quadtype" in
6100 '')     echo "Alas, no 64-bit integer types in sight." >&4
6101         d_quad="$undef"
6102         ;;
6103 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6104         d_quad="$define"
6105         ;;
6106 esac
6107
6108 : Do we want 64bit support
6109 case "$uselonglong" in
6110 "$define"|true|[yY]*)
6111         cat <<EOM >&4
6112
6113 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6114 EOM
6115         use64bitint="$define"
6116         ;;
6117 esac
6118 case "$use64bits" in
6119 "$define"|true|[yY]*)
6120         cat <<EOM >&4
6121
6122 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6123 EOM
6124         use64bitint="$define"
6125         ;;
6126 esac
6127 case "$use64bitints" in
6128 "$define"|true|[yY]*)
6129         cat <<EOM >&4
6130
6131 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6132 EOM
6133         use64bitint="$define"
6134         ;;
6135 esac
6136 case "$use64bitsint" in
6137 "$define"|true|[yY]*)
6138         cat <<EOM >&4
6139
6140 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6141 EOM
6142         use64bitint="$define"
6143         ;;
6144 esac
6145 case "$uselonglongs" in
6146 "$define"|true|[yY]*)
6147         cat <<EOM >&4
6148
6149 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6150 EOM
6151         use64bitint="$define"
6152         ;;
6153 esac
6154 case "$use64bitsall" in
6155 "$define"|true|[yY]*)
6156         cat <<EOM >&4
6157
6158 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6159 EOM
6160         use64bitall="$define"
6161         ;;
6162 esac
6163
6164 case "$ccflags" in
6165 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6166 esac
6167 case "$use64bitall" in
6168 "$define"|true|[yY]*) use64bitint="$define" ;;
6169 esac
6170
6171 case "$longsize" in
6172 8) cat <<EOM
6173
6174 You have natively 64-bit long integers.
6175 EOM
6176    val="$define"
6177    ;;
6178 *) case "$use64bitint" in
6179    "$define"|true|[yY]*) dflt='y';;
6180    *) dflt='n';;
6181    esac
6182    case "$d_quad" in
6183    "$define") ;;
6184    *) dflt='n' ;;
6185    esac
6186    cat <<EOM
6187
6188 Perl can be built to take advantage of 64-bit integer types
6189 on some systems.  To do so, Configure can be run with -Duse64bitint.
6190 Choosing this option will most probably introduce binary incompatibilities.
6191
6192 If this doesn't make any sense to you, just accept the default '$dflt'.
6193 (The default has been chosen based on your configuration.)
6194 EOM
6195    rp='Try to use 64-bit integers, if available?'
6196    . ./myread
6197    case "$ans" in
6198    [yY]*) val="$define" ;;
6199    *)     val="$undef"  ;;
6200    esac
6201    ;;
6202 esac
6203 set use64bitint
6204 eval $setvar
6205
6206 case "$use64bitall" in
6207 "$define"|true|[yY]*) dflt='y' ;;
6208 *) case "$longsize" in
6209    8) dflt='y' ;;
6210    *) dflt='n' ;;
6211    esac
6212    ;;
6213 esac
6214 cat <<EOM
6215
6216 You may also choose to try maximal 64-bitness.  It means using as much
6217 64-bitness as possible on the platform.  This in turn means even more
6218 binary incompatibilities.  On the other hand, your platform may not
6219 have any more 64-bitness available than what you already have chosen.
6220
6221 If this doesn't make any sense to you, just accept the default '$dflt'.
6222 (The default has been chosen based on your configuration.)
6223 EOM
6224 rp='Try to use maximal 64-bit support, if available?'
6225 . ./myread
6226 case "$ans" in
6227 [yY]*) val="$define" ;;
6228 *)     val="$undef"  ;;
6229 esac
6230 set use64bitall
6231 eval $setvar
6232 case "$use64bitall" in
6233 "$define")
6234         case "$use64bitint" in
6235         "$undef")
6236                 cat <<EOM
6237
6238 Since you have chosen a maximally 64-bit build, I'm also turning on
6239 the use of 64-bit integers.
6240 EOM
6241                 use64bitint="$define" ;;
6242         esac
6243         ;;
6244 esac
6245
6246 : Look for a hint-file generated 'call-back-unit'.  If the
6247 : user has specified that a 64-bit perl is to be built,
6248 : we may need to set or change some other defaults.
6249 if $test -f use64bitint.cbu; then
6250         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6251         . ./use64bitint.cbu
6252 fi
6253 case "$use64bitint" in
6254 "$define"|true|[yY]*)
6255         : This test was common to all the OpenBSD forks, and seems harmless for
6256         : other platforms:
6257         echo " "
6258         echo "Checking if your C library has broken 64-bit functions..." >&4
6259         cat >try.c <<EOCP
6260 #include <stdio.h>
6261 typedef $uquadtype myULL;
6262 int main (void)
6263 {
6264     struct {
6265         double d;
6266         myULL  u;
6267     } *p, test[] = {
6268         {4294967303.15, 4294967303ULL},
6269         {4294967294.2,  4294967294ULL},
6270         {4294967295.7,  4294967295ULL},
6271         {0.0, 0ULL}
6272     };
6273     for (p = test; p->u; p++) {
6274         myULL x = (myULL)p->d;
6275         if (x != p->u) {
6276             printf("buggy\n");
6277             return 0;
6278         }
6279     }
6280     printf("ok\n");
6281     return 0;
6282 }
6283 EOCP
6284         set try
6285         if eval $compile_ok; then
6286             libcquad=`$run ./try`
6287             echo "Your C library's 64-bit functions are $libcquad."
6288         else
6289             echo "(I can't seem to compile the test program.)"
6290             echo "Assuming that your C library's 64-bit functions are ok."
6291             libcquad="ok"
6292         fi
6293         $rm_try
6294
6295         case "$libcquad" in
6296             buggy*)
6297                 cat >&4 <<EOM
6298
6299 *** You have a C library with broken 64-bit functions.
6300 *** 64-bit support does not work reliably in this configuration.
6301 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6302 *** Cannot continue, aborting.
6303
6304 EOM
6305                 exit 1
6306                 ;;
6307         esac
6308         case "$longsize" in
6309         4) case "$archname64" in
6310            '') archname64=64int ;;
6311            esac
6312            ;;
6313         esac
6314         ;;
6315 esac
6316
6317 : Look for a hint-file generated 'call-back-unit'.  If the
6318 : user has specified that a maximally 64-bit perl is to be built,
6319 : we may need to set or change some other defaults.
6320 if $test -f use64bitall.cbu; then
6321         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6322         . ./use64bitall.cbu
6323 fi
6324 case "$use64bitall" in
6325 "$define"|true|[yY]*)
6326         case "$longsize" in
6327         4) case "$archname64" in
6328            ''|64int) archname64=64all ;;
6329            esac
6330            ;;
6331         esac
6332         ;;
6333 esac
6334
6335 case "$d_quad:$use64bitint" in
6336 $undef:$define)
6337         cat >&4 <<EOF
6338
6339 *** You have chosen to use 64-bit integers,
6340 *** but none can be found.
6341 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6342 *** Cannot continue, aborting.
6343
6344 EOF
6345         exit 1
6346         ;;
6347 esac
6348
6349 : Check if we are using the GNU C library
6350 echo " "
6351 echo "Checking for GNU C Library..." >&4
6352 cat >try.c <<'EOCP'
6353 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6354    alone are insufficient to distinguish different versions, such as
6355    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6356    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6357 */
6358 #include <stdio.h>
6359 int main(void)
6360 {
6361 #ifdef __GLIBC__
6362 #   ifdef __GLIBC_MINOR__
6363 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6364 #           include <gnu/libc-version.h>
6365             printf("%s\n",  gnu_get_libc_version());
6366 #       else
6367             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6368 #       endif
6369 #   else
6370         printf("%d\n",  __GLIBC__);
6371 #   endif
6372     return 0;
6373 #else
6374     return 1;
6375 #endif
6376 }
6377 EOCP
6378 set try
6379 if eval $compile_ok && $run ./try > glibc.ver; then
6380         val="$define"
6381         gnulibc_version=`$cat glibc.ver`
6382         echo "You are using the GNU C Library version $gnulibc_version"
6383 else
6384         val="$undef"
6385         gnulibc_version=''
6386         echo "You are not using the GNU C Library"
6387 fi
6388 $rm_try glibc.ver
6389 set d_gnulibc
6390 eval $setvar
6391
6392 : see if nm is to be used to determine whether a symbol is defined or not
6393 case "$usenm" in
6394 '')
6395         dflt=''
6396         case "$d_gnulibc" in
6397         "$define")
6398                 echo " "
6399                 echo "nm probably won't work on the GNU C Library." >&4
6400                 dflt=n
6401                 ;;
6402         esac
6403         case "$dflt" in
6404         '')
6405                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6406                         echo " "
6407                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6408                         echo "'nm' won't be sufficient on this system." >&4
6409                         dflt=n
6410                 fi
6411                 ;;
6412         esac
6413         case "$dflt" in
6414         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6415                 if $test $dflt -gt 20; then
6416                         dflt=y
6417                 else
6418                         dflt=n
6419                 fi
6420                 ;;
6421         esac
6422         ;;
6423 *)
6424         case "$usenm" in
6425         true|$define) dflt=y;;
6426         *) dflt=n;;
6427         esac
6428         ;;
6429 esac
6430 $cat <<EOM
6431
6432 I can use $nm to extract the symbols from your C libraries. This
6433 is a time consuming task which may generate huge output on the disk (up
6434 to 3 megabytes) but that should make the symbols extraction faster. The
6435 alternative is to skip the 'nm' extraction part and to compile a small
6436 test program instead to determine whether each symbol is present. If
6437 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6438 this may be the best solution.
6439
6440 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6441
6442 EOM
6443 rp="Shall I use $nm to extract C symbols from the libraries?"
6444 . ./myread
6445 case "$ans" in
6446 [Nn]*) usenm=false;;
6447 *) usenm=true;;
6448 esac
6449
6450 runnm=$usenm
6451 case "$reuseval" in
6452 true) runnm=false;;
6453 esac
6454
6455 : nm options which may be necessary
6456 case "$nm_opt" in
6457 '') if $test -f /mach_boot; then
6458                 nm_opt=''       # Mach
6459         elif $test -d /usr/ccs/lib; then
6460                 nm_opt='-p'     # Solaris (and SunOS?)
6461         elif $test -f /dgux; then
6462                 nm_opt='-p'     # DG-UX
6463         elif $test -f /lib64/rld; then
6464                 nm_opt='-p'     # 64-bit Irix
6465         else
6466                 nm_opt=''
6467         fi;;
6468 esac
6469
6470 : nm options which may be necessary for shared libraries but illegal
6471 : for archive libraries.  Thank you, Linux.
6472 case "$nm_so_opt" in
6473 '')     case "$myuname" in
6474         *linux*|gnu*)
6475                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6476                         nm_so_opt='--dynamic'
6477                 fi
6478                 ;;
6479         esac
6480         ;;
6481 esac
6482
6483 : Figure out where the libc is located
6484 case "$runnm" in
6485 true)
6486 : get list of predefined functions in a handy place
6487 echo " "
6488 case "$libc" in
6489 '') libc=unknown
6490         case "$libs" in
6491         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6492         esac
6493         ;;
6494 esac
6495 case "$libs" in
6496 '') ;;
6497 *)  for thislib in $libs; do
6498         case "$thislib" in
6499         -lc|-lc_s)
6500                 : Handle C library specially below.
6501                 ;;
6502         -l*)
6503                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6504                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6505                         :
6506                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6515                         :
6516                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6517                         :
6518                 else
6519                         try=''
6520                 fi
6521                 libnames="$libnames $try"
6522                 ;;
6523         *) libnames="$libnames $thislib" ;;
6524         esac
6525         done
6526         ;;
6527 esac
6528 xxx=normal
6529 case "$libc" in
6530 unknown)
6531         set /lib/libc.$so
6532         for xxx in $libpth; do
6533                 $test -r $1 || set $xxx/libc.$so
6534                 : The messy sed command sorts on library version numbers.
6535                 $test -r $1 || \
6536                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6537                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6538                                 h
6539                                 s/[0-9][0-9]*/0000&/g
6540                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6541                                 G
6542                                 s/\n/ /' | \
6543                          $sort | $sed -e 's/^.* //'`
6544                 eval set \$$#
6545         done
6546         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6547         $test -r $1 || set $sysroot/lib/libsys_s$_a
6548         ;;
6549 *)
6550         set blurfl
6551         ;;
6552 esac
6553 if $test -r "$1"; then
6554         echo "Your (shared) C library seems to be in $1."
6555         libc="$1"
6556 elif $test -r /lib/libc && $test -r /lib/clib; then
6557         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6558         xxx=apollo
6559         libc='/lib/clib /lib/libc'
6560         if $test -r /lib/syslib; then
6561                 echo "(Your math library is in /lib/syslib.)"
6562                 libc="$libc /lib/syslib"
6563         fi
6564 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6565         echo "Your C library seems to be in $libc, as you said before."
6566 elif $test -r $incpath/usr/lib/libc$_a; then
6567         libc=$incpath/usr/lib/libc$_a;
6568         echo "Your C library seems to be in $libc.  That's fine."
6569 elif $test -r /lib/libc$_a; then
6570         libc=/lib/libc$_a;
6571         echo "Your C library seems to be in $libc.  You're normal."
6572 else
6573         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6574                 :
6575         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6576                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6577         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6578                 :
6579         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6580                 :
6581         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6582                 :
6583         else
6584                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6585         fi
6586         if $test -r "$tans"; then
6587                 echo "Your C library seems to be in $tans, of all places."
6588                 libc=$tans
6589         else
6590                 libc='blurfl'
6591         fi
6592 fi
6593 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6594         dflt="$libc"
6595         cat <<EOM
6596
6597 If the guess above is wrong (which it might be if you're using a strange
6598 compiler, or your machine supports multiple models), you can override it here.
6599
6600 EOM
6601 else
6602         dflt=''
6603         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6604         cat >&4 <<EOM
6605 I can't seem to find your C library.  I've looked in the following places:
6606
6607 EOM
6608         $sed 's/^/      /' libpath
6609         cat <<EOM
6610
6611 None of these seems to contain your C library. I need to get its name...
6612
6613 EOM
6614 fi
6615 fn=f
6616 rp='Where is your C library?'
6617 . ./getfile
6618 libc="$ans"
6619
6620 echo " "
6621 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6622 set X `cat libnames`
6623 shift
6624 xxx=files
6625 case $# in 1) xxx=file; esac
6626 echo "Extracting names from the following $xxx for later perusal:" >&4
6627 echo " "
6628 $sed 's/^/      /' libnames >&4
6629 echo " "
6630 $echo $n "This may take a while...$c" >&4
6631
6632 for file in $*; do
6633         case $file in
6634         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6635         *) $nm $nm_opt $file 2>/dev/null;;
6636         esac
6637 done >libc.tmp
6638
6639 $echo $n ".$c"
6640 $grep fprintf libc.tmp > libc.ptf
6641 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6642 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6643 xxx='[ADTSIWi]'
6644 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6669                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6698         eval $xscan;\
6699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6700                 eval $xrun
6701 else
6702         $nm -p $* 2>/dev/null >libc.tmp
6703         $grep fprintf libc.tmp > libc.ptf
6704         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6705                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6706         then
6707                 nm_opt='-p'
6708                 eval $xrun
6709         else
6710                 echo " "
6711                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6712                 com=''
6713                 if $ar t $libc > libc.tmp && \
6714                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6715                 then
6716                         for thisname in $libnames $libc; do
6717                                 $ar t $thisname >>libc.tmp
6718                         done
6719                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6720                         echo "Ok." >&4
6721                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6722                         for thisname in $libnames $libc; do
6723                                 $ar tv $thisname >>libc.tmp
6724                                 emximp -o tmp.imp $thisname \
6725                                     2>/dev/null && \
6726                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6727                                     < tmp.imp >>libc.tmp
6728                                 $rm -f tmp.imp
6729                         done
6730                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6731                         echo "Ok." >&4
6732                 else
6733                         echo "$ar didn't seem to work right." >&4
6734                         echo "Maybe this is a Cray...trying bld instead..." >&4
6735                         if  bld t $libc | \
6736                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6737                                 $test -s libc.list
6738                         then
6739                                 for thisname in $libnames; do
6740                                         bld t $libnames | \
6741                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6742                                         $ar t $thisname >>libc.tmp
6743                                 done
6744                                 echo "Ok." >&4
6745                         else
6746                                 echo "That didn't work either.  Giving up." >&4
6747                                 exit 1
6748                         fi
6749                 fi
6750         fi
6751 fi
6752 nm_extract="$com"
6753 case "$PASE" in
6754 define)
6755     echo " "
6756     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6757     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6758     ;;
6759 *)  if $test -f /lib/syscalls.exp; then
6760         echo " "
6761         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6762         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6763                 /lib/syscalls.exp >>libc.list
6764     fi
6765     ;;
6766 esac
6767 ;;
6768 esac
6769 $rm -f libnames libpath
6770
6771 : Check if we are using C++
6772 echo " "
6773 echo "Checking for C++..." >&4
6774 $cat >try.c <<'EOCP'
6775 #include <stdio.h>
6776 int main(void)
6777 {
6778 #ifdef __cplusplus
6779     return 0;
6780 #else
6781     return 1;
6782 #endif
6783 }
6784 EOCP
6785 set try
6786 if eval $compile_ok && $run ./try; then
6787         val="$define"
6788         echo "You are using a C++ compiler."
6789 else
6790         val="$undef"
6791         echo "You are not using a C++ compiler."
6792 fi
6793 $rm_try cplusplus$$
6794 set d_cplusplus
6795 eval $setvar
6796
6797 : is a C symbol defined?
6798 csym='tlook=$1;
6799 case "$3" in
6800 -v) tf=libc.tmp; tdc="";;
6801 -a) tf=libc.tmp; tdc="[]";;
6802 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6803 esac;
6804 case "$d_cplusplus" in
6805     $define)    extern_C="extern \"C\"" ;;
6806     *)          extern_C="extern"       ;;
6807 esac;
6808 tx=yes;
6809 case "$reuseval-$4" in
6810 true-) ;;
6811 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6812 esac;
6813 case "$tx" in
6814 yes)
6815         tval=false;
6816         if $test "$runnm" = true; then
6817                 if $contains $tlook $tf >/dev/null 2>&1; then
6818                         tval=true;
6819                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6820                         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;
6821                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6822                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6823                         $rm_try;
6824                 fi;
6825         else
6826                 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;
6827                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6828                 $rm_try;
6829         fi;
6830         ;;
6831 *)
6832         case "$tval" in
6833         $define) tval=true;;
6834         *) tval=false;;
6835         esac;
6836         ;;
6837 esac;
6838 eval "$2=$tval"'
6839
6840 : define an is-in-libc? function
6841 inlibc='echo " "; td=$define; tu=$undef;
6842 sym=$1; var=$2; eval "was=\$$2";
6843 tx=yes;
6844 case "$reuseval$was" in
6845 true) ;;
6846 true*) tx=no;;
6847 esac;
6848 case "$tx" in
6849 yes)
6850         set $sym tres -f;
6851         eval $csym;
6852         case "$tres" in
6853         true)
6854                 echo "$sym() found." >&4;
6855                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6856         *)
6857                 echo "$sym() NOT found." >&4;
6858                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6859         esac;;
6860 *)
6861         case "$was" in
6862         $define) echo "$sym() found." >&4;;
6863         *) echo "$sym() NOT found." >&4;;
6864         esac;;
6865 esac'
6866
6867 : check for length of double
6868 echo " "
6869 case "$doublesize" in
6870 '')
6871         echo "Checking to see how big your double precision numbers are..." >&4
6872         $cat >try.c <<EOCP
6873 #include <stdio.h>
6874 #$i_stdlib I_STDLIB
6875 #ifdef I_STDLIB
6876 #include <stdlib.h>
6877 #endif
6878 int main()
6879 {
6880     printf("%d\n", (int)sizeof(double));
6881     exit(0);
6882 }
6883 EOCP
6884         set try
6885         if eval $compile_ok; then
6886                 doublesize=`$run ./try`
6887                 echo "Your double is $doublesize bytes long."
6888         else
6889                 dflt='8'
6890                 echo "(I can't seem to compile the test program.  Guessing...)"
6891                 rp="What is the size of a double precision number (in bytes)?"
6892                 . ./myread
6893                 doublesize="$ans"
6894         fi
6895         ;;
6896 esac
6897 $rm_try
6898
6899 : check for long doubles
6900 echo " "
6901 echo "Checking to see if you have long double..." >&4
6902 echo 'int main() { long double x = 7.0; }' > try.c
6903 set try
6904 if eval $compile; then
6905         val="$define"
6906         echo "You have long double."
6907 else
6908         val="$undef"
6909         echo "You do not have long double."
6910 fi
6911 $rm_try
6912 set d_longdbl
6913 eval $setvar
6914
6915 : see if ldexpl exists
6916 set ldexpl d_ldexpl
6917 eval $inlibc
6918
6919 : check for length of long double
6920 case "${d_longdbl}${longdblsize}" in
6921 $define)
6922         echo " "
6923         echo "Checking to see how big your long doubles are..." >&4
6924         $cat >try.c <<'EOCP'
6925 #include <stdio.h>
6926 int main()
6927 {
6928         printf("%d\n", sizeof(long double));
6929 }
6930 EOCP
6931         set try
6932         set try
6933         if eval $compile; then
6934                 longdblsize=`$run ./try`
6935                 echo "Your long doubles are $longdblsize bytes long."
6936         else
6937                 dflt='8'
6938                 echo " "
6939                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6940                 rp="What is the size of a long double (in bytes)?"
6941                 . ./myread
6942                 longdblsize="$ans"
6943         fi
6944         if $test "X$doublesize" = "X$longdblsize"; then
6945                 echo "That isn't any different from an ordinary double."
6946                 echo "I'll keep your setting anyway, but you may see some"
6947                 echo "harmless compilation warnings."
6948         fi
6949         ;;
6950 esac
6951 $rm_try
6952
6953 $echo "Checking the kind of long doubles you have..." >&4
6954 case "$d_longdbl" in
6955 define)
6956 $cat <<EOP >try.c
6957 #$i_stdlib I_STDLIB
6958 #define LONGDBLSIZE $longdblsize
6959 #define DOUBLESIZE $doublesize
6960 #include <float.h>
6961 #ifdef I_STDLIB
6962 #include <stdlib.h>
6963 #endif
6964 #include <stdio.h>
6965 static const long double d = -0.1L;
6966 int main() {
6967   unsigned const char* b = (unsigned const char*)(&d);
6968 #if DOUBLESIZE == LONGDBLSIZE
6969   printf("0\n"); /* if it floats like double */
6970   exit(0);
6971 #endif
6972 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6973   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6974     /* IEEE 754 128-bit little-endian */
6975     printf("1\n");
6976     exit(0);
6977   }
6978   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6979     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6980     printf("2\n");
6981     exit(0);
6982   }
6983 #endif
6984 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6985  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6986  * cannot be trusted. */
6987 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6988   if (b[0] == 0xCD && b[9] == 0xBF) {
6989     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6990      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6991      * Also known as "extended precision". */
6992     printf("3\n");
6993     exit(0);
6994   }
6995   if (b[0] == 0xBF && b[9] == 0xCD) {
6996     /* Is there ever big-endian 80-bit, really?
6997      *
6998      * The Motorola 68881 had another "extended precision" format:
6999      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7000      * for total of 96 bits of bytes.  The zero bits were unused.
7001      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7002      * If it ever becomes relevant, this format should be allocated
7003      * a new doublekind code since it's quite different from the Intel x87.
7004      */
7005     printf("4\n");
7006     exit(0);
7007   }
7008 #endif
7009 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7010   /* software "double double", the 106 is 53+53.
7011    * but irix thinks it is 107. */
7012   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7013     /* double double 128-bit fully little-endian,
7014      * little-endian doubles in little-endian order,
7015      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7016     printf("5\n");
7017     exit(0);
7018   }
7019   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7020     /* double double 128-bit fully big-endian,
7021      * big-endian doubles in big-endian order,
7022      * e.g. PPC/Power and MIPS:
7023      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7024     printf("6\n");
7025     exit(0);
7026   }
7027   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7028     /* double double 128-bit mixed endian.
7029      * little-endian doubles in big-endian order,
7030      * e.g. ppc64el,
7031      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7032     printf("7\n");
7033     exit(0);
7034   }
7035   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7036     /* double double 128-bit mixed endian,
7037      * big-endian doubles in little-endian order,
7038      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7039     printf("8\n");
7040     exit(0);
7041   }
7042 #endif
7043 /* We are largely making this up because it may well be
7044  * that the VAX format H was never made available to C,
7045  * only to Fortran. */
7046 #if LONGDBLSIZE == 16 && defined(__vax__)
7047   if (b[0] == 0xFD && b[15] == 0x99) {
7048     /* VAX format H, PDP-11 mixed endian. */
7049     printf("9\n");
7050     exit(0);
7051   }
7052 #endif
7053   printf("-1\n"); /* unknown */
7054   exit(0);
7055 }
7056 EOP
7057 set try
7058 if eval $compile; then
7059     longdblkind=`$run ./try`
7060 else
7061     longdblkind=-1
7062 fi
7063 ;;
7064 *) longdblkind=0 ;;
7065 esac
7066 case "$longdblkind" in
7067 0) echo "Your long doubles are doubles." >&4 ;;
7068 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7069 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7070 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7071 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7072 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7073 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7074 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7075 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7076 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7077 *) echo "Cannot figure out your long double." >&4 ;;
7078 esac
7079 d_long_double_style_ieee=$undef
7080 d_long_double_style_ieee_std=$undef
7081 d_long_double_style_ieee_extended=$undef
7082 d_long_double_style_ieee_doubledouble=$undef
7083 d_long_double_style_vax=$undef
7084 case "$longdblkind" in
7085 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7086 esac
7087 case "$longdblkind" in
7088 1|2) d_long_double_style_ieee_std=$define ;;
7089 esac
7090 case "$longdblkind" in
7091 3|4) d_long_double_style_ieee_extended=$define ;;
7092 esac
7093 case "$longdblkind" in
7094 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7095 esac
7096 case "$longdblkind" in
7097 9) d_long_double_style_vax=$define ;;
7098 esac
7099 $rm_try
7100
7101 : determine the architecture name
7102 echo " "
7103 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7104         tarch=`arch`"-$osname"
7105 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7106         if uname -m > tmparch 2>&1 ; then
7107                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7108                         -e 's/$/'"-$osname/" tmparch`
7109         else
7110                 tarch="$osname"
7111         fi
7112         $rm -f tmparch
7113 else
7114         tarch="$osname"
7115 fi
7116 case "$myarchname" in
7117 ''|"$tarch") ;;
7118 *)
7119         echo "(Your architecture name used to be $myarchname.)"
7120         archname=''
7121         ;;
7122 esac
7123 case "$targetarch" in
7124 '') ;;
7125 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7126 esac
7127 myarchname="$tarch"
7128 case "$archname" in
7129 '') dflt="$tarch";;
7130 *) dflt="$archname";;
7131 esac
7132 rp='What is your architecture name'
7133 . ./myread
7134 archname="$ans"
7135
7136 : optionally add API version to the architecture for versioned archlibs
7137 case "$useversionedarchname" in
7138 $define|true|[yY]*) dflt='y';;
7139 *)                  dflt='n';;
7140 esac
7141 rp='Add the Perl API version to your archname?'
7142 . ./myread
7143 case "$ans" in
7144 y|Y)    useversionedarchname="$define" ;;
7145 *)      useversionedarchname="$undef" ;;
7146 esac
7147 case "$useversionedarchname" in
7148 $define)
7149         case "$archname" in
7150         *-$api_versionstring)
7151                 echo "...and architecture name already has -$api_versionstring" >&4
7152                 ;;
7153         *)
7154                 archname="$archname-$api_versionstring"
7155                 echo "...setting architecture name to $archname." >&4
7156                 ;;
7157         esac
7158         ;;
7159 esac
7160
7161 case "$usethreads" in
7162 $define)
7163         echo "Threads selected." >&4
7164         case "$archname" in
7165         *-thread*) echo "...and architecture name already has -thread." >&4
7166                 ;;
7167         *)      archname="$archname-thread"
7168                 echo "...setting architecture name to $archname." >&4
7169                 ;;
7170         esac
7171         ;;
7172 esac
7173 case "$usemultiplicity" in
7174 $define)
7175         echo "Multiplicity selected." >&4
7176         case "$archname" in
7177         *-multi*) echo "...and architecture name already has -multi." >&4
7178                 ;;
7179         *)      archname="$archname-multi"
7180                 echo "...setting architecture name to $archname." >&4
7181                 ;;
7182         esac
7183         ;;
7184 esac
7185 case "$use64bitint$use64bitall" in
7186 *"$define"*)
7187         case "$archname64" in
7188         '')
7189                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7190                 ;;
7191         *)
7192                 case "$use64bitint" in
7193                 "$define") echo "64 bit integers selected." >&4 ;;
7194                 esac
7195                 case "$use64bitall" in
7196                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7197                 esac
7198                 case "$archname" in
7199                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7200                         ;;
7201                 *)      archname="$archname-$archname64"
7202                         echo "...setting architecture name to $archname." >&4
7203                         ;;
7204                 esac
7205                 ;;
7206         esac
7207 esac
7208 case "$uselongdouble" in
7209 $define)
7210         echo "Long doubles selected." >&4
7211         case "$longdblsize" in
7212         $doublesize)
7213                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7214                 ;;
7215         *)
7216                 case "$archname" in
7217                 *-ld*) echo "...and architecture name already has -ld." >&4
7218                         ;;
7219                 *)      archname="$archname-ld"
7220                         echo "...setting architecture name to $archname." >&4
7221                         ;;
7222                 esac
7223                 ;;
7224         esac
7225         ;;
7226 esac
7227 case "$usequadmath" in
7228 $define)
7229         echo "quadmath selected." >&4
7230         case "$archname" in
7231         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7232                 ;;
7233         *)      archname="$archname-quadmath"
7234                 echo "...setting architecture name to $archname." >&4
7235                 ;;
7236         esac
7237         ;;
7238 esac
7239 if $test -f archname.cbu; then
7240         echo "Your platform has some specific hints for architecture name, using them..."
7241         . ./archname.cbu
7242 fi
7243
7244 : set the prefixit variable, to compute a suitable default value
7245 prefixit='case "$3" in
7246 ""|none)
7247         case "$oldprefix" in
7248         "") eval "$1=\"\$$2\"";;
7249         *)
7250                 case "$3" in
7251                 "") eval "$1=";;
7252                 none)
7253                         eval "tp=\"\$$2\"";
7254                         case "$tp" in
7255                         ""|" ") eval "$1=\"\$$2\"";;
7256                         *) eval "$1=";;
7257                         esac;;
7258                 esac;;
7259         esac;;
7260 *)
7261         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7262         case "$tp" in
7263         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7264         /*-$oldprefix/*|\~*-$oldprefix/*)
7265                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7266         *) eval "$1=\"\$$2\"";;
7267         esac;;
7268 esac'
7269
7270 : determine installation style
7271 : For now, try to deduce it from prefix unless it is already set.
7272 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7273 case "$installstyle" in
7274 '')     case "$prefix" in
7275                 *perl*) dflt='lib';;
7276                 *) dflt='lib/perl5' ;;
7277         esac
7278         ;;
7279 *)      dflt="$installstyle" ;;
7280 esac
7281 : Probably not worth prompting for this since we prompt for all
7282 : the directories individually, and the prompt would be too long and
7283 : confusing anyway.
7284 installstyle=$dflt
7285
7286 : determine where public executables go
7287 echo " "
7288 set dflt bin bin
7289 eval $prefixit
7290 fn=d~
7291 rp='Pathname where the public executables will reside?'
7292 . ./getfile
7293 if $test "X$ansexp" != "X$binexp"; then
7294         installbin=''
7295 fi
7296 prefixvar=bin
7297 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7298 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7299 :     this via initialinstalllocation
7300 . ./setprefixvar
7301
7302 case "$userelocatableinc" in
7303 $define|true|[yY]*)     dflt='y' ;;
7304 *)                      dflt='n' ;;
7305 esac
7306 cat <<EOM
7307
7308 Would you like to build Perl so that the installation is relocatable, so that
7309 library paths in @INC are determined relative to the path of the perl binary?
7310 This is not advised for system Perl installs, or if you need to run setid
7311 scripts or scripts under taint mode.
7312
7313 If this doesn't make any sense to you, just accept the default '$dflt'.
7314 EOM
7315 rp='Use relocatable @INC?'
7316 . ./myread
7317 case "$ans" in
7318 y|Y)    val="$define" ;;
7319 *)      val="$undef"  ;;
7320 esac
7321 set userelocatableinc
7322 eval $setvar
7323
7324 initialinstalllocation="$binexp"
7325 : Default prefix is now "up one level from where the binaries are"
7326 case "$userelocatableinc" in
7327 $define|true|[yY]*)
7328     bin=".../"
7329     binexp=".../"
7330     prefix=".../.."
7331     prefixexp=".../.."
7332     installprefixexp=".../.."
7333     ;;
7334 esac
7335
7336 : determine where private library files go
7337 : Usual default is /usr/local/lib/perl5/$version.
7338 : Also allow things like /opt/perl/lib/$version, since
7339 : /opt/perl/lib/perl5... would be redundant.
7340 : The default "style" setting is made in installstyle.U
7341 case "$installstyle" in
7342 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7343 *)       set dflt privlib lib/$version ;;
7344 esac
7345 eval $prefixit
7346 $cat <<EOM
7347
7348 There are some auxiliary files for $package that need to be put into a
7349 private library directory that is accessible by everyone.
7350
7351 EOM
7352 fn=$binexp
7353 fn=d~+
7354 rp='Pathname where the private library files will reside?'
7355 . ./getfile
7356 prefixvar=privlib
7357 . ./setprefixvar
7358
7359 : set the prefixup variable, to restore leading tilda escape
7360 prefixup='case "$prefixexp" in
7361 "$prefix") ;;
7362 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7363 esac'
7364
7365 : determine where public architecture dependent libraries go
7366 set archlib archlib
7367 eval $prefixit
7368 : privlib default is /usr/local/lib/$package/$version
7369 : archlib default is /usr/local/lib/$package/$version/$archname
7370 : privlib may have an optional trailing /share.
7371 tdflt=`echo $privlib | $sed 's,/share$,,'`
7372 tdflt=$tdflt/$archname
7373 case "$archlib" in
7374 '')     dflt=$tdflt
7375         ;;
7376 *)      dflt="$archlib"
7377     ;;
7378 esac
7379 $cat <<EOM
7380
7381 $spackage contains architecture-dependent library files.  If you are
7382 sharing libraries in a heterogeneous environment, you might store
7383 these files in a separate location.  Otherwise, you can just include
7384 them with the rest of the public library files.
7385
7386 EOM
7387 fn=$binexp
7388 fn=d+~
7389 rp='Where do you want to put the public architecture-dependent libraries?'
7390 . ./getfile
7391 prefixvar=archlib
7392 . ./setprefixvar
7393 if $test X"$archlib" = X"$privlib"; then
7394         d_archlib="$undef"
7395 else
7396         d_archlib="$define"
7397 fi
7398
7399 : see if setuid scripts can be secure
7400 $cat <<EOM
7401
7402 Some kernels have a bug that prevents setuid #! scripts from being
7403 secure.  Some sites have disabled setuid #! scripts because of this.
7404
7405 First let's decide if your kernel supports secure setuid #! scripts.
7406 (If setuid #! scripts would be secure but have been disabled anyway,
7407 don't say that they are secure if asked.)
7408
7409 EOM
7410
7411 val="$undef"
7412 if $test -d /dev/fd; then
7413         echo "#!$ls" >reflect
7414         chmod +x,u+s reflect
7415         ./reflect >flect 2>&1
7416         if $contains "/dev/fd" flect >/dev/null; then
7417                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7418                 val="$define"
7419         else
7420                 $cat <<EOM
7421 If you are not sure if they are secure, I can check but I'll need a
7422 username and password different from the one you are using right now.
7423 If you don't have such a username or don't want me to test, simply
7424 enter 'none'.
7425
7426 EOM
7427                 rp='Other username to test security of setuid scripts with?'
7428                 dflt='none'
7429                 . ./myread
7430                 case "$ans" in
7431                 n|none)
7432                         case "$d_suidsafe" in
7433                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7434                                 dflt=n;;
7435                         "$undef")
7436                                 echo "Well, the $hint value is *not* secure." >&4
7437                                 dflt=n;;
7438                         *)      echo "Well, the $hint value *is* secure." >&4
7439                                 dflt=y;;
7440                         esac
7441                         ;;
7442                 *)
7443                         $rm -f reflect flect
7444                         echo "#!$ls" >reflect
7445                         chmod +x,u+s reflect
7446                         echo >flect
7447                         chmod a+w flect
7448                         echo '"su" will (probably) prompt you for '"$ans's password."
7449                         su $ans -c './reflect >flect'
7450                         if $contains "/dev/fd" flect >/dev/null; then
7451                                 echo "Okay, it looks like setuid scripts are secure." >&4
7452                                 dflt=y
7453                         else
7454                                 echo "I don't think setuid scripts are secure." >&4
7455                                 dflt=n
7456                         fi
7457                         ;;
7458                 esac
7459                 rp='Does your kernel have *secure* setuid scripts?'
7460                 . ./myread
7461                 case "$ans" in
7462                 [yY]*)  val="$define";;
7463                 *)      val="$undef";;
7464                 esac
7465         fi
7466 else
7467         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7468         echo "(That's for file descriptors, not floppy disks.)"
7469         val="$undef"
7470 fi
7471 set d_suidsafe
7472 eval $setvar
7473
7474 $rm -f reflect flect
7475
7476 : now see if they want to do setuid emulation
7477 if $test $patchlevel -lt 11; then
7478 echo " "
7479 val="$undef"
7480 case "$d_suidsafe" in
7481 "$define")
7482         val="$undef"
7483         echo "No need to emulate SUID scripts since they are secure here." >&4
7484         ;;
7485 *)
7486         $cat <<EOM
7487 Some systems have disabled setuid scripts, especially systems where
7488 setuid scripts cannot be secure.  On systems where setuid scripts have
7489 been disabled, the setuid/setgid bits on scripts are currently
7490 useless.  It is possible for $package to detect those bits and emulate
7491 setuid/setgid in a secure fashion.  This emulation will only work if
7492 setuid scripts have been disabled in your kernel.
7493
7494 EOM
7495         case "$d_dosuid" in
7496         "$define") dflt=y ;;
7497         *) dflt=n ;;
7498         esac
7499         rp="Do you want to do setuid/setgid emulation?"
7500         . ./myread
7501         case "$ans" in
7502         [yY]*)  val="$define";;
7503         *)      val="$undef";;
7504         esac
7505         ;;
7506 esac
7507 set d_dosuid
7508 eval $setvar
7509 else
7510     case "$d_dosuid" in
7511         "$define")
7512         cat >&4 <<EOH
7513
7514 SUID emulation has been removed for 5.12
7515 Please re-run Configure without -Dd_dosuid
7516
7517 EOH
7518         exit 1;
7519         ;;
7520     esac
7521     d_dosuid=undef
7522 fi
7523
7524 : Find perl5.005 or later.
7525 echo "Looking for a previously installed perl5.005 or later... "
7526 case "$perl5" in
7527 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7528                 : Check if this perl is recent and can load a simple module
7529                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7530                         perl5=$tdir/perl
7531                         break;
7532                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7533                         perl5=$tdir/perl5
7534                         break;
7535                 fi
7536         done
7537         ;;
7538 *)      perl5="$perl5"
7539         ;;
7540 esac
7541 case "$perl5" in
7542 '')     echo "None found.  That's ok.";;
7543 *)      echo "Using $perl5." ;;
7544 esac
7545
7546 : Set the siteprefix variables
7547 $cat <<EOM
7548
7549 After $package is installed, you may wish to install various
7550 add-on modules and utilities.  Typically, these add-ons will
7551 be installed under $prefix with the rest
7552 of this package.  However, you may wish to install such add-ons
7553 elsewhere under a different prefix.
7554
7555 If you do not wish to put everything under a single prefix, that's
7556 ok.  You will be prompted for the individual locations; this siteprefix
7557 is only used to suggest the defaults.
7558
7559 The default should be fine for most people.
7560
7561 EOM
7562 fn=d~+
7563 rp='Installation prefix to use for add-on modules and utilities?'
7564 : XXX Here might be another good place for an installstyle setting.
7565 case "$siteprefix" in
7566 '') dflt=$prefix ;;
7567 *)  dflt=$siteprefix ;;
7568 esac
7569 . ./getfile
7570 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7571 oldsiteprefix=''
7572 case "$siteprefix" in
7573 '') ;;
7574 *)      case "$ans" in
7575         "$prefix") ;;
7576         *) oldsiteprefix="$prefix";;
7577         esac
7578         ;;
7579 esac
7580 siteprefix="$ans"
7581 siteprefixexp="$ansexp"
7582
7583 : determine where site specific libraries go.
7584 : Usual default is /usr/local/lib/perl5/site_perl/$version
7585 : The default "style" setting is made in installstyle.U
7586 : XXX No longer works with Prefixit stuff.
7587 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7588 case "$sitelib" in
7589 '') case "$installstyle" in
7590         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7591         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7592         esac
7593         ;;
7594 *)      dflt="$sitelib"
7595         ;;
7596 esac
7597 $cat <<EOM
7598
7599 The installation process will create a directory for
7600 site-specific extensions and modules.  Most users find it convenient
7601 to place all site-specific files in this directory rather than in the
7602 main distribution directory.
7603
7604 EOM
7605 fn=d~+
7606 rp='Pathname for the site-specific library files?'
7607 . ./getfile
7608 prefixvar=sitelib
7609 . ./setprefixvar
7610 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7611
7612 : Determine list of previous versions to include in @INC
7613 $cat > getverlist <<EOPL
7614 #!$perl5 -w
7615 use File::Basename;
7616 \$api_versionstring = "$api_versionstring";
7617 \$version = "$version";
7618 \$stem = "$sitelib_stem";
7619 \$archname = "$archname";
7620 EOPL
7621         $cat >> getverlist <<'EOPL'
7622 # The list found is store twice for each entry: the original name, and
7623 # the binary broken down version as pack "sss", so sorting is easy and
7624 # unambiguous. This will work for all versions that have a maximum of
7625 # three digit groups, separate by '.'s or '_'s. Names are extended with
7626 # ".0.0" to ensure at least three elements for the pack.
7627 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7628
7629 # Can't have leading @ because metaconfig interprets it as a command!
7630 ;@inc_version_list=();
7631 # XXX Redo to do opendir/readdir?
7632 if (-d $stem) {
7633     chdir($stem);
7634     ;@candidates = map {
7635         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7636     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7637 }
7638 else {
7639     ;@candidates = ();
7640 }
7641
7642 ($pversion, $aversion, $vsn5005) = map {
7643     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7644 foreach $d (@candidates) {
7645     if ($d->[1] lt $pversion) {
7646         if ($d->[1] ge $aversion) {
7647             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7648         }
7649         elsif ($d->[1] ge $vsn5005) {
7650             unshift(@inc_version_list, grep { -d } $d->[0]);
7651         }
7652     }
7653     else {
7654         # Skip newer version.  I.e. don't look in
7655         # 5.7.0 if we're installing 5.6.1.
7656     }
7657 }
7658
7659 if (@inc_version_list) {
7660     print join(' ', @inc_version_list);
7661 }
7662 else {
7663     # Blank space to preserve value for next Configure run.
7664     print " ";
7665 }
7666 EOPL
7667 chmod +x getverlist
7668 case "$inc_version_list" in
7669 '')     if test -x "$perl5$exe_ext"; then
7670                 dflt=`$perl5 getverlist`
7671         else
7672                 dflt='none'
7673         fi
7674         ;;
7675 $undef) dflt='none' ;;
7676 *)  eval dflt=\"$inc_version_list\" ;;
7677 esac
7678 case "$dflt" in
7679 ''|' ') dflt=none ;;
7680 esac
7681 case "$dflt" in
7682 5.005) dflt=none ;;
7683 esac
7684 $cat <<EOM
7685
7686 In order to ease the process of upgrading, this version of perl
7687 can be configured to use modules built and installed with earlier
7688 versions of perl that were installed under $prefix.  Specify here
7689 the list of earlier versions that this version of perl should check.
7690 If Configure detected no earlier versions of perl installed under
7691 $prefix, then the list will be empty.  Answer 'none' to tell perl
7692 to not search earlier versions.
7693
7694 The default should almost always be sensible, so if you're not sure,
7695 just accept the default.
7696 EOM
7697
7698 rp='List of earlier versions to include in @INC?'
7699 . ./myread
7700 case "$ans" in
7701 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7702 *) inc_version_list="$ans" ;;
7703 esac
7704 case "$inc_version_list" in
7705 ''|' ')
7706         inc_version_list_init='0'
7707         d_inc_version_list="$undef"
7708         ;;
7709 *)      inc_version_list_init=`echo $inc_version_list |
7710                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7711         d_inc_version_list="$define"
7712         ;;
7713 esac
7714 $rm -f getverlist
7715
7716 : see if malloc/malloc.h has to be included
7717 set malloc/malloc.h i_mallocmalloc
7718 eval $inhdr
7719
7720 : see if this is a malloc.h system
7721 : we want a real compile instead of Inhdr because some systems have a
7722 : malloc.h that just gives a compile error saying to use stdlib.h instead
7723 echo " "
7724 $cat >try.c <<EOCP
7725 #include <stdlib.h>
7726 #include <malloc.h>
7727 #$i_mallocmalloc I_MALLOCMALLOC
7728 #ifdef I_MALLOCMALLOC
7729 # include <malloc/malloc.h>
7730 #endif
7731
7732 int main () { return 0; }
7733 EOCP
7734 set try
7735 if eval $compile; then
7736     echo "<malloc.h> found." >&4
7737     val="$define"
7738 else
7739     echo "<malloc.h> NOT found." >&4
7740     val="$undef"
7741 fi
7742 $rm_try
7743 set i_malloc
7744 eval $setvar
7745
7746 : check for length of pointer
7747 echo " "
7748 case "$ptrsize" in
7749 '')
7750         echo "Checking to see how big your pointers are..." >&4
7751         $cat >try.c <<EOCP
7752 #include <stdio.h>
7753 #$i_stdlib I_STDLIB
7754 #ifdef I_STDLIB
7755 #include <stdlib.h>
7756 #endif
7757 int main()
7758 {
7759     printf("%d\n", (int)sizeof(void *));
7760     exit(0);
7761 }
7762 EOCP
7763         set try
7764         if eval $compile_ok; then
7765                 ptrsize=`$run ./try`
7766                 echo "Your pointers are $ptrsize bytes long."
7767         else
7768                 dflt='4'
7769                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7770                 rp="What is the size of a pointer (in bytes)?"
7771                 . ./myread
7772                 ptrsize="$ans"
7773         fi
7774         ;;
7775 esac
7776 $rm_try
7777 case "$use64bitall" in
7778 "$define"|true|[yY]*)
7779         case "$ptrsize" in
7780         4)      cat <<EOM >&4
7781
7782 *** You have chosen a maximally 64-bit build,
7783 *** but your pointers are only 4 bytes wide.
7784 *** Please rerun Configure without -Duse64bitall.
7785 EOM
7786                 case "$d_quad" in
7787                 define)
7788                         cat <<EOM >&4
7789 *** Since you have quads, you could possibly try with -Duse64bitint.
7790 EOM
7791                         ;;
7792                 esac
7793                 cat <<EOM >&4
7794 *** Cannot continue, aborting.
7795
7796 EOM
7797
7798                 exit 1
7799                 ;;
7800         esac
7801         ;;
7802 esac
7803
7804 : determine whether to use malloc wrapping
7805 echo " "
7806 case "$usemallocwrap" in
7807 [yY]*|true|$define)     dflt='y' ;;
7808 [nN]*|false|$undef)     dflt='n' ;;
7809 *)      case "$usedevel" in
7810         [yY]*|true|$define)     dflt='y' ;;
7811         *) dflt='n' ;;
7812         esac
7813         ;;
7814 esac
7815 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7816 . ./myread
7817 usemallocwrap="$ans"
7818 case "$ans" in
7819 y*|true)
7820         usemallocwrap="$define" ;;
7821 *)
7822         usemallocwrap="$undef" ;;
7823 esac
7824
7825 : determine which malloc to compile in
7826 echo " "
7827 case "$usemymalloc" in
7828 [yY]*|true|$define)     dflt='y' ;;
7829 [nN]*|false|$undef)     dflt='n' ;;
7830 *)      case "$ptrsize" in
7831         4) dflt='y' ;;
7832         *) dflt='n' ;;
7833         esac
7834         if test "$useithreads" = "$define"; then dflt='n'; fi
7835         ;;
7836 esac
7837 rp="Do you wish to attempt to use the malloc that comes with $package?"
7838 . ./myread
7839 usemymalloc="$ans"
7840 case "$ans" in
7841 y*|true)
7842         usemymalloc='y'
7843         mallocsrc='malloc.c'
7844         mallocobj="malloc$_o"
7845         d_mymalloc="$define"
7846         case "$libs" in
7847         *-lmalloc*)
7848                 : Remove malloc from list of libraries to use
7849                 echo "Removing unneeded -lmalloc from library list" >&4
7850                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7851                 shift
7852                 libs="$*"
7853                 echo "libs = $libs" >&4
7854                 ;;
7855         esac
7856         ;;
7857 *)
7858         usemymalloc='n'
7859         mallocsrc=''
7860         mallocobj=''
7861         d_mymalloc="$undef"
7862         ;;
7863 esac
7864
7865 : compute the return types of malloc and free
7866 echo " "
7867 $cat >malloc.c <<END
7868 #$i_malloc I_MALLOC
7869 #$i_stdlib I_STDLIB
7870 #include <stdio.h>
7871 #include <sys/types.h>
7872 #ifdef I_MALLOC
7873 #include <malloc.h>
7874 #endif
7875 #ifdef I_STDLIB
7876 #include <stdlib.h>
7877 #endif
7878 #ifdef TRY_MALLOC
7879 void *malloc();
7880 #endif
7881 #ifdef TRY_FREE
7882 void free();
7883 #endif
7884 END
7885 case "$malloctype" in
7886 '')
7887         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7888                 malloctype='void *'
7889         else
7890                 malloctype='char *'
7891         fi
7892         ;;
7893 esac
7894 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7895
7896 case "$freetype" in
7897 '')
7898         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7899                 freetype='void'
7900         else
7901                 freetype='int'
7902         fi
7903         ;;
7904 esac
7905 echo "Your system uses $freetype free(), it would seem." >&4
7906 $rm -f malloc.[co]
7907 : determine where site specific architecture-dependent libraries go.
7908 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7909 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7910 : sitelib may have an optional trailing /share.
7911 case "$sitearch" in
7912 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7913         dflt="$dflt/$archname"
7914         ;;
7915 *)      dflt="$sitearch"
7916         ;;
7917 esac
7918 set sitearch sitearch none
7919 eval $prefixit
7920 $cat <<EOM
7921
7922 The installation process will also create a directory for
7923 architecture-dependent site-specific extensions and modules.
7924
7925 EOM
7926 fn=d~+
7927 rp='Pathname for the site-specific architecture-dependent library files?'
7928 . ./getfile
7929 prefixvar=sitearch
7930 . ./setprefixvar
7931 if $test X"$sitearch" = X"$sitelib"; then
7932         d_sitearch="$undef"
7933 else
7934         d_sitearch="$define"
7935 fi
7936
7937 : Set the vendorprefix variables
7938 $cat <<EOM
7939
7940 The installation process will also create a directory for
7941 vendor-supplied add-ons.  Vendors who supply perl with their system
7942 may find it convenient to place all vendor-supplied files in this
7943 directory rather than in the main distribution directory.  This will
7944 ease upgrades between binary-compatible maintenance versions of perl.
7945
7946 Of course you may also use these directories in whatever way you see
7947 fit.  For example, you might use them to access modules shared over a
7948 company-wide network.
7949
7950 The default answer should be fine for most people.
7951 This causes further questions about vendor add-ons to be skipped
7952 and no vendor-specific directories will be configured for perl.
7953
7954 EOM
7955 rp='Do you want to configure vendor-specific add-on directories?'
7956 case "$usevendorprefix" in
7957 define|true|[yY]*) dflt=y ;;
7958 *)      : User may have set vendorprefix directly on Configure command line.
7959         case "$vendorprefix" in
7960         ''|' ') dflt=n ;;
7961         *)      dflt=y ;;
7962         esac
7963         ;;
7964 esac
7965 . ./myread
7966 case "$ans" in
7967 [yY]*)  fn=d~+
7968         rp='Installation prefix to use for vendor-supplied add-ons?'
7969         case "$vendorprefix" in
7970         '') dflt="$prefix" ;;
7971         *)  dflt=$vendorprefix ;;
7972         esac
7973         . ./getfile
7974         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7975         oldvendorprefix=''
7976         case "$vendorprefix" in
7977         '') ;;
7978         *)      case "$ans" in
7979                 "$prefix") ;;
7980                 *) oldvendorprefix="$prefix";;
7981                 esac
7982                 ;;
7983         esac
7984         usevendorprefix="$define"
7985         vendorprefix="$ans"
7986         vendorprefixexp="$ansexp"
7987         ;;
7988 *)      usevendorprefix="$undef"
7989         vendorprefix=''
7990         vendorprefixexp=''
7991         ;;
7992 esac
7993
7994 : Set the vendorlib variables
7995 case "$vendorprefix" in
7996 '')     d_vendorlib="$undef"
7997         vendorlib=''
7998         vendorlibexp=''
7999         ;;
8000 *)      d_vendorlib="$define"
8001         : determine where vendor-supplied modules go.
8002         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8003         case "$vendorlib" in
8004         '')
8005                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8006                 case "$installstyle" in
8007                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8008                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8009                 esac
8010                 ;;
8011         *)      dflt="$vendorlib"
8012                 ;;
8013         esac
8014         fn=d~+
8015         rp='Pathname for the vendor-supplied library files?'
8016         . ./getfile
8017         vendorlib="$ans"
8018         vendorlibexp="$ansexp"
8019         ;;
8020 esac
8021 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8022 prefixvar=vendorlib
8023 . ./installprefix
8024
8025 : Set the vendorarch variables
8026 case "$vendorprefix" in
8027 '')     d_vendorarch="$undef"
8028         vendorarch=''
8029         vendorarchexp=''
8030         ;;
8031 *)      d_vendorarch="$define"
8032         : determine where vendor-supplied architecture-dependent libraries go.
8033         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8034         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8035         : vendorlib may have an optional trailing /share.
8036         case "$vendorarch" in
8037         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8038                 dflt="$dflt/$archname"
8039                 ;;
8040         *)      dflt="$vendorarch" ;;
8041         esac
8042         fn=d~+
8043         rp='Pathname for vendor-supplied architecture-dependent files?'
8044         . ./getfile
8045         vendorarch="$ans"
8046         vendorarchexp="$ansexp"
8047         ;;
8048 esac
8049 prefixvar=vendorarch
8050 . ./installprefix
8051 if $test X"$vendorarch" = X"$vendorlib"; then
8052         d_vendorarch="$undef"
8053 else
8054         d_vendorarch="$define"
8055 fi
8056
8057 : Final catch-all directories to search
8058 $cat <<EOM
8059
8060 Lastly, you can have perl look in other directories for extensions and
8061 modules in addition to those already specified.
8062 These directories will be searched after
8063         $sitearch
8064         $sitelib
8065 EOM
8066 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8067 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8068 echo ' '
8069 case "$otherlibdirs" in
8070 ''|' ') dflt='none' ;;
8071 *)      dflt="$otherlibdirs" ;;
8072 esac
8073 $cat <<EOM
8074 Enter a colon-separated set of extra paths to include in perl's @INC
8075 search path, or enter 'none' for no extra paths.
8076
8077 EOM
8078
8079 rp='Colon-separated list of additional directories for perl to search?'
8080 . ./myread
8081 case "$ans" in
8082 ' '|''|none)    otherlibdirs=' ' ;;
8083 *)      otherlibdirs="$ans" ;;
8084 esac
8085 case "$otherlibdirs" in
8086 ' ') val=$undef ;;
8087 *)      val=$define ;;
8088 esac
8089 set d_perl_otherlibdirs
8090 eval $setvar
8091
8092 : DTrace support
8093 dflt_dtrace='/usr/sbin/dtrace'
8094 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8095
8096 cat <<EOM
8097
8098 Perl can be built to support DTrace on platforms that support it.
8099 DTrace is a diagnosis and performance analysis tool from Sun.
8100
8101 If this doesn't make any sense to you, just accept the default.
8102 EOM
8103
8104 while $test 1 ; do
8105         case "$usedtrace" in
8106         $define|true|[yY]*)
8107                 dflt='y'
8108                 ;;
8109         ?*)
8110                 dflt='y'
8111                 dflt_dtrace=$usedtrace
8112                 ;;
8113         *)
8114                 dflt='n'
8115                 ;;
8116         esac
8117
8118         rp='Support DTrace if available?'
8119         . ./myread
8120         case "$ans" in
8121         y|Y)    val="$define" ;;
8122         *)      val="$undef" ;;
8123         esac
8124         set usedtrace
8125         eval $setvar
8126
8127         test "X$usedtrace" != "X$define" && break
8128
8129         echo " "
8130         rp='Where is the dtrace executable?'
8131         dflt=$dflt_dtrace
8132         . ./getfile
8133         val="$ans"
8134         set dtrace
8135         eval $setvar
8136
8137         if $test -f $dtrace
8138         then
8139                 if $dtrace -h -s ../perldtrace.d \
8140                         -o perldtrace.tmp >/dev/null 2>&1 \
8141                         && rm -f perldtrace.tmp
8142                 then
8143                         echo " "
8144                         echo "Good: your $dtrace knows about the -h flag."
8145                 else
8146                         cat >&2 <<EOM
8147
8148 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8149 ***
8150 *** Your installed dtrace doesn't support the -h switch to compile a D
8151 *** program into a C header. Can't continue.
8152
8153 EOM
8154                         exit 1
8155                 fi
8156                 break;
8157         fi
8158
8159         case "$fastread" in
8160         yes)
8161                 cat >&2 <<EOM
8162
8163 *** $me:  Fatal Error:  $dtrace not found.
8164 *** Can't continue.
8165
8166 EOM
8167                 exit 1
8168                 ;;
8169         *)
8170                 echo "*** $dtrace was not found."
8171                 echo " "
8172                 ;;
8173         esac
8174 done
8175
8176 : See if we want extra modules installed
8177 echo " "
8178 case "$extras" in
8179 '') dflt='n';;
8180 *) dflt='y';;
8181 esac
8182 cat <<EOM
8183 Perl can be built with extra modules or bundles of modules which
8184 will be fetched from the CPAN and installed alongside Perl.
8185
8186 Notice that you will need access to the CPAN; either via the Internet,
8187 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8188 be asked later to configure the CPAN.pm module which will in turn do
8189 the installation of the rest of the extra modules or bundles.)
8190
8191 Notice also that if the modules require any external software such as
8192 libraries and headers (the libz library and the zlib.h header for the
8193 Compress::Zlib module, for example) you MUST have any such software
8194 already installed, this configuration process will NOT install such
8195 things for you.
8196
8197 If this doesn't make any sense to you, just accept the default '$dflt'.
8198 EOM
8199 rp='Install any extra modules (y or n)?'
8200 . ./myread
8201 case "$ans" in
8202 y|Y)
8203         cat <<EOM
8204
8205 Please list any extra modules or bundles to be installed from CPAN,
8206 with spaces between the names.  The names can be in any format the
8207 'install' command of CPAN.pm will understand.  (Answer 'none',
8208 without the quotes, to install no extra modules or bundles.)
8209 EOM
8210         rp='Extras?'
8211         dflt="$extras"
8212         . ./myread
8213         extras="$ans"
8214 esac
8215 case "$extras" in
8216 ''|'none')
8217         val=''
8218         $rm -f ../extras.lst
8219         ;;
8220 *)      echo "(Saving the list of extras for later...)"
8221         echo "$extras" > ../extras.lst
8222         val="'$extras'"
8223         ;;
8224 esac
8225 set extras
8226 eval $setvar
8227 echo " "
8228
8229 : determine where html pages for programs go
8230 set html1dir html1dir none
8231 eval $prefixit
8232 $cat <<EOM
8233
8234 If you wish to install html files for programs in $spackage, indicate
8235 the appropriate directory here.  To skip installing html files,
8236 answer "none".
8237 EOM
8238 case "$html1dir" in
8239 ''|none|$undef|' ') dflt=none ;;
8240 *) dflt=$html1dir ;;
8241 esac
8242 fn=dn+~
8243 rp="Directory for the main $spackage html pages?"
8244 . ./getfile
8245 prefixvar=html1dir
8246 . ./setprefixvar
8247 : Use ' ' for none so value is preserved next time through Configure
8248 $test X"$html1dir" = "X" && html1dir=' '
8249
8250 : determine where html pages for libraries and modules go
8251 set html3dir html3dir none
8252 eval $prefixit
8253 $cat <<EOM
8254
8255 If you wish to install html files for modules associated with $spackage,
8256 indicate the appropriate directory here.  To skip installing html files,
8257 answer "none".
8258 EOM
8259 : There is no obvious default.  If they have specified html1dir, then
8260 : try to key off that, possibly changing .../html1 into .../html3.
8261 case "$html3dir" in
8262 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8263 *) dflt=$html3dir ;;
8264 esac
8265 fn=dn+~
8266 rp="Directory for the $spackage module html pages?"
8267 . ./getfile
8268 prefixvar=html3dir
8269 . ./setprefixvar
8270 : Use ' ' for none so value is preserved next time through Configure
8271 $test X"$html3dir" = "X" && html3dir=' '
8272
8273 : determine whether to install perl also as /usr/bin/perl
8274
8275 echo " "
8276 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8277         $cat <<EOM
8278 Many scripts expect perl to be installed as /usr/bin/perl.
8279
8280 If you want to, I can install the perl you are about to compile
8281 as /usr/bin/perl (in addition to $bin/perl).
8282 EOM
8283         if test -f /usr/bin/perl; then
8284             $cat <<EOM
8285
8286 However, please note that because you already have a /usr/bin/perl,
8287 overwriting that with a new Perl would very probably cause problems.
8288 Therefore I'm assuming you don't want to do that (unless you insist).
8289
8290 EOM
8291             case "$installusrbinperl" in
8292             "$define"|[yY]*)    dflt='y';;
8293             *)                  dflt='n';;
8294             esac
8295         else
8296             $cat <<EOM
8297
8298 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8299
8300 EOM
8301             case "$installusrbinperl" in
8302             "$undef"|[nN]*)     dflt='n';;
8303             *)                  dflt='y';;
8304             esac
8305         fi
8306         rp="Do you want to install perl as /usr/bin/perl?"
8307         . ./myread
8308         case "$ans" in
8309         [yY]*)  val="$define";;
8310         *)      val="$undef" ;;
8311         esac
8312 else
8313         val="$undef"
8314 fi
8315 set installusrbinperl
8316 eval $setvar
8317
8318 : see if dlopen exists
8319 xxx_runnm="$runnm"
8320 xxx_ccflags="$ccflags"
8321 runnm=false
8322 : with g++ one needs -shared to get is-in-libc to work for dlopen
8323 case "$gccversion" in
8324 '')     ;;
8325 *Clang*)        ;;
8326 *)      case "$d_cplusplus" in
8327         "$define") ccflags="$ccflags -shared" ;;
8328         esac
8329         ;;
8330 esac
8331 set dlopen d_dlopen
8332 eval $inlibc
8333 runnm="$xxx_runnm"
8334 ccflags="$xxx_ccflags"
8335
8336 : see if this is a unistd.h system
8337 set unistd.h i_unistd
8338 eval $inhdr
8339
8340 : determine which dynamic loading, if any, to compile in
8341 echo " "
8342 dldir="ext/DynaLoader"
8343 case "$usedl" in
8344     $define|y|true)
8345         dflt='y'
8346         usedl="$define"
8347         ;;
8348     $undef|n|false)
8349         dflt='n'
8350         usedl="$undef"
8351         ;;
8352     *)
8353         dflt='n'
8354         case "$d_dlopen" in
8355             $define) dflt='y' ;;
8356         esac
8357         : Does a dl_xxx.xs file exist for this operating system
8358         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8359         ;;
8360 esac
8361 rp="Do you wish to use dynamic loading?"
8362 . ./myread
8363 usedl="$ans"
8364 bin_ELF="$undef"
8365 case "$ans" in
8366     y*) usedl="$define"
8367         case "$dlsrc" in
8368             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8369                     dflt="$dldir/dl_${osname}.xs"
8370                 elif $test "$d_dlopen" = "$define" ; then
8371                     dflt="$dldir/dl_dlopen.xs"
8372                 else
8373                     dflt=''
8374                 fi
8375                 ;;
8376             *)  dflt="$dldir/$dlsrc"
8377                 ;;
8378         esac
8379         echo "The following dynamic loading files are available:"
8380         : Can not go over to $dldir because getfile has path hard-coded in.
8381         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8382         rp="Source file to use for dynamic loading"
8383         fn="fne"
8384         gfpth="$src"
8385         . ./getfile
8386         usedl="$define"
8387         : emulate basename
8388         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8389
8390         $cat << EOM
8391
8392 Some systems may require passing special flags to $cc -c to
8393 compile modules that will be used to create a shared library.
8394 To use no flags, say "none".
8395
8396 EOM
8397         case "$cccdlflags" in
8398             '') case "$gccversion" in
8399                 '') case "$osname" in
8400                         hpux)   dflt='+z' ;;
8401                         irix*)  dflt='-KPIC' ;;
8402                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8403                         sunos)  dflt='-pic' ;;
8404                         *)      dflt='none' ;;
8405                     esac
8406                     ;;
8407                 *)  case "$osname" in
8408                         darwin) dflt='none' ;;
8409                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8410                         *)      dflt='-fpic' ;;
8411                     esac ;;
8412                 esac ;;
8413             ' ') dflt='none' ;;
8414             *)   dflt="$cccdlflags" ;;
8415         esac
8416
8417         case "$dflt" in
8418             none) dflt='' ;;
8419         esac
8420
8421         # If -Dsysroot was specified, now's the time to add it
8422         # to cccdlflags
8423         if test "X$sysroot" != X; then
8424             case "$gccversion" in
8425                 '') ;;
8426                 *)  case "$dflt" in
8427                         *sysroot*) ;;
8428                         'undef'|*)
8429                             dflt="$dflt --sysroot=$sysroot" ;;
8430                     esac
8431                     ;;
8432             esac
8433         fi
8434
8435         case "$dflt" in
8436             '') dflt='none';;
8437         esac
8438
8439         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8440         . ./myread
8441         case "$ans" in
8442             none) cccdlflags=' ' ;;
8443             *)    cccdlflags="$ans" ;;
8444         esac
8445
8446         cat << EOM
8447
8448 Some systems use ld to create libraries that can be dynamically loaded,
8449 while other systems (such as those using ELF) use $cc.
8450
8451 EOM
8452
8453 : Determine if this is ELF
8454         $cat >try.c <<EOM
8455 /* Test for whether ELF binaries are produced */
8456 #include <fcntl.h>
8457 #$i_stdlib I_STDLIB
8458 #ifdef I_STDLIB
8459 #include <stdlib.h>
8460 #endif
8461 #$i_unistd I_UNISTD
8462 #ifdef I_UNISTD
8463 #include <unistd.h>
8464 #endif
8465 int main() {
8466     char b[4];
8467     int i = open("a.out",O_RDONLY);
8468     if(i == -1)
8469         exit(1); /* fail */
8470     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8471         exit(0); /* succeed (yes, it is ELF) */
8472     exit(1); /* fail */
8473 }
8474 EOM
8475         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8476             bin_ELF="$define"
8477         fi
8478         $rm_try
8479
8480         case "$ld" in
8481             '') if $test $bin_ELF = "$define"; then
8482                     cat <<EOM
8483 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8484 EOM
8485                     dflt="$cc"
8486                 else
8487                     echo "I'll use ld to build dynamic libraries."
8488                     dflt='ld'
8489                 fi
8490                 ;;
8491             *)  dflt="$ld"
8492                 ;;
8493         esac
8494
8495         rp="What command should be used to create dynamic libraries?"
8496         . ./myread
8497         ld="$ans"
8498
8499         cat << EOM
8500
8501 Some systems may require passing special flags to $ld to create a
8502 library that can be dynamically loaded.  If your ld flags include
8503 -L/other/path options to locate libraries outside your loader's normal
8504 search path, you may need to specify those -L options here as well.  To
8505 use no flags, say "none".
8506
8507 EOM
8508         case "$lddlflags" in
8509             '') case "$osname" in
8510                     haiku) dflt='-shared' ;;
8511                     hpux) dflt='-b';
8512                           case "$gccversion" in
8513                               '') dflt="$dflt +vnocompatwarnings" ;;
8514                           esac
8515                           ;;
8516                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8517                     solaris) # See [perl #66604].
8518                             # On Solaris 11, gcc -m64 on amd64
8519                             # appears not to understand -G.  gcc versions at
8520                             # least as old as 3.4.3 support -shared, so just
8521                             # use that with Solaris 11 and later, but keep
8522                             # the old behavior for older Solaris versions.
8523                             case "$gccversion" in
8524                                 '') dflt='-G' ;;
8525                                 *)  case "$osvers" in
8526                                         2.?|2.10) dflt='-G' ;;
8527                                         *) dflt='-shared' ;;
8528                                     esac
8529                                     ;;
8530                             esac
8531                             ;;
8532                     sunos) dflt='-assert nodefinitions' ;;
8533                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8534                     *)     dflt='none' ;;
8535                 esac
8536                 ;;
8537             *) dflt="$lddlflags" ;;
8538         esac
8539
8540         : Only do this for gcc, since, for example, qcc has no concept
8541         : of --sysroot.
8542         if $test "X$sysroot" != X; then
8543             case "$gccversion" in
8544                 '') ;;
8545                 *)  dflt="$dflt --sysroot $sysroot" ;;
8546             esac
8547         fi
8548
8549         : Try to guess additional flags to pick up local libraries.
8550         : Be careful not to append to a plain 'none'
8551         case "$dflt" in
8552             none) dflt='' ;;
8553         esac
8554         for thisflag in $ldflags; do
8555             case "$thisflag" in
8556                 -L*|-R*|-Wl,-R*)
8557                     case " $dflt " in
8558                         *" $thisflag "*) ;;
8559                         *) dflt="$dflt $thisflag" ;;
8560                     esac
8561                     ;;
8562             esac
8563         done
8564
8565         case "$dflt" in
8566             ''|' ') dflt='none' ;;
8567         esac
8568
8569         case "$ldflags" in
8570             *-fstack-protector-strong*)
8571                 case "$dflt" in
8572                     *-fstack-protector-strong*) ;; # Don't add it again
8573                     *) dflt="$dflt -fstack-protector-strong" ;;
8574                 esac
8575                 ;;
8576             *-fstack-protector*)
8577                 case "$dflt" in
8578                     *-fstack-protector*) ;; # Don't add it again
8579                     *) dflt="$dflt -fstack-protector" ;;
8580                 esac
8581                 ;;
8582         esac
8583
8584         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8585         . ./myread
8586         case "$ans" in
8587             none) lddlflags=' ' ;;
8588             *) lddlflags="$ans" ;;
8589         esac
8590
8591         cat <<EOM
8592
8593 Some systems may require passing special flags to $cc to indicate that
8594 the resulting executable will use dynamic linking.  To use no flags,
8595 say "none".
8596
8597 EOM
8598         case "$ccdlflags" in
8599             '') case "$osname" in
8600                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8601                     sunos)             dflt='none'   ;;
8602                     *)                 dflt='none'   ;;
8603                 esac ;;
8604             ' ') dflt='none' ;;
8605             *)   dflt="$ccdlflags" ;;
8606         esac
8607         rp="Any special flags to pass to $cc to use dynamic linking?"
8608         . ./myread
8609         case "$ans" in
8610             none) ccdlflags=' ' ;;
8611             *)    ccdlflags="$ans" ;;
8612         esac
8613         ;;
8614
8615     *)  usedl="$undef"
8616         ld='ld'
8617         dlsrc='dl_none.xs'
8618         lddlflags=''
8619         ccdlflags=''
8620         ;;
8621 esac
8622
8623 ld_can_script="$undef"
8624 case "$bin_ELF$usedl" in
8625     $define$define)
8626         # Abuse try.h and a.out names for neat cleanup
8627         $cat >try.c <<EOM
8628 void foo() {}
8629 void bar() {}
8630 EOM
8631         $cat >try.h <<EOM
8632 LIBTEST_42 {
8633  global:
8634   foo;
8635  local: *;
8636  };
8637 EOM
8638         if $cc $cccdlflags $ccdlflags $ccflags \
8639                $ldflags $lddlflags -o a.out try.c \
8640                -Wl,--version-script=try.h >/dev/null 2>&1 \
8641            &&  $test -s a.out ; then
8642             echo "ld supports scripting" >&4
8643             ld_can_script="$define"
8644         else
8645             echo "ld does not support scripting" >&4
8646         fi
8647         $rm_try
8648         ;;
8649 esac
8650
8651 : Do we want a shared libperl?
8652 also=''
8653 case "$usedl" in
8654 $undef)
8655         # No dynamic loading being used, so don't bother even to prompt.
8656         useshrplib='false'
8657         ;;
8658 *)      case "$useshrplib" in
8659         '')     case "$osname" in
8660                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8661                         dflt=y
8662                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8663                         ;;
8664                 *)      dflt=n
8665                         ;;
8666                 esac
8667                 ;;
8668         $define|true|[Yy]*)
8669                 dflt=y
8670                 ;;
8671         *)      dflt=n
8672                 ;;
8673         esac
8674         $cat << EOM
8675
8676 The perl executable is normally obtained by linking perlmain.c with
8677 libperl${_a}, any static extensions (usually just DynaLoader), and
8678 any other libraries needed on this system (such as -lm, etc.).  Since
8679 your system supports dynamic loading, it is probably possible to build
8680 a shared libperl.$so.  If you will have more than one executable linked
8681 to libperl.$so, this will significantly reduce the size of each
8682 executable, but it may have a noticeable effect on performance.  The
8683 default is probably sensible for your system.
8684 $also
8685
8686 EOM
8687         rp="Build a shared libperl.$so (y/n)"
8688         . ./myread
8689         case "$ans" in
8690         true|$define|[Yy]*)
8691                 useshrplib='true'  ;;
8692         *)      useshrplib='false' ;;
8693         esac
8694         ;;
8695 esac
8696
8697 case "$useshrplib" in
8698 true)
8699         case "$userelocatableinc" in
8700         true|define)
8701                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8702                 echo "See INSTALL for an explanation why that won't work." >&4
8703                 exit 4
8704                 ;;
8705         esac
8706         case "$libperl" in
8707         '')
8708                 # Figure out a good name for libperl.so.  Since it gets stored in
8709                 # a version-specific architecture-dependent library, the version
8710                 # number isn't really that important, except for making cc/ld happy.
8711                 #
8712                 # A name such as libperl.so.10.1
8713                 majmin="libperl.$so.$patchlevel.$subversion"
8714                 # A name such as libperl.so.100
8715                 majonly=`echo $patchlevel $subversion |
8716                         $awk '{printf "%d%02d", $1, $2}'`
8717                 majonly=libperl.$so.$majonly
8718                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8719                 # rely on figuring it out from the naming of libc.
8720                 case "${osname}${osvers}" in
8721                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8722                         dflt=libperl.$so
8723                         ;;
8724                 cygwin*) # ld links now against the dll directly
8725                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8726                         majonly=`echo $patchlevel $subversion |
8727                                 $awk '{printf "%03d%03d", $1, $2}'`
8728                         majonly=cygperl5.$majonly.$so
8729                         dflt=$majmin
8730                         ;;
8731                 *)      # Try to guess based on whether libc has major.minor.
8732                         case "$libc" in
8733                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8734                         *libc.$so.[0-9]*) dflt=$majonly ;;
8735                         *)      dflt=libperl.$so ;;
8736                         esac
8737                         ;;
8738                 esac
8739                 ;;
8740         *)      dflt=$libperl
8741                 ;;
8742         esac
8743         cat << EOM
8744
8745 I need to select a good name for the shared libperl.  If your system uses
8746 library names with major and minor numbers, then you might want something
8747 like $majmin.  Alternatively, if your system uses a single version
8748 number for shared libraries, then you might want to use $majonly.
8749 Or, your system might be quite happy with a simple libperl.$so.
8750
8751 Since the shared libperl will get installed into a version-specific
8752 architecture-dependent directory, the version number of the shared perl
8753 library probably isn't important, so the default should be o.k.
8754
8755 EOM
8756         rp='What name do you want to give to the shared libperl?'
8757         . ./myread
8758         libperl=$ans
8759         echo "Ok, I'll use $libperl"
8760         ;;
8761 *)
8762         libperl="libperl${_a}"
8763         ;;
8764 esac
8765
8766 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8767 case "$shrpdir" in
8768 '') ;;
8769 *)      $cat >&4 <<EOM
8770 WARNING:  Use of the shrpdir variable for the installation location of
8771 the shared $libperl is not supported.  It was never documented and
8772 will not work in this version.  Let me (perlbug@perl.org)
8773 know of any problems this may cause.
8774
8775 EOM
8776         case "$shrpdir" in
8777         "$archlibexp/CORE")
8778                 $cat >&4 <<EOM
8779 But your current setting of $shrpdir is
8780 the default anyway, so it's harmless.
8781 EOM
8782                 ;;
8783         *)
8784                 $cat >&4 <<EOM
8785 Further, your current attempted setting of $shrpdir
8786 conflicts with the value of $archlibexp/CORE
8787 that installperl will use.
8788 EOM
8789                 ;;
8790         esac
8791         ;;
8792 esac
8793
8794 # How will the perl executable find the installed shared $libperl?
8795 # Add $xxx to ccdlflags.
8796 # If we can't figure out a command-line option, use $shrpenv to
8797 # set env LD_RUN_PATH.  The main perl makefile uses this.
8798 shrpdir=$archlibexp/CORE
8799 xxx=''
8800 tmp_shrpenv=''
8801 if "$useshrplib"; then
8802     case "$osname" in
8803         aix)
8804                 # We'll set it in Makefile.SH...
8805                 ;;
8806         solaris)
8807                 xxx="-R $shrpdir"
8808                 ;;
8809         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8810                 xxx="-Wl,-R$shrpdir"
8811                 ;;
8812         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8813                 xxx="-Wl,-rpath,$shrpdir"
8814                 ;;
8815         hpux*)
8816                 # hpux doesn't like the default, either.
8817                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8818                 ;;
8819         cygwin)
8820                 # cygwin needs only ldlibpth
8821                 ;;
8822         *)
8823                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8824                 ;;
8825         esac
8826         case "$xxx" in
8827         '') ;;
8828         *)
8829                 # Only add $xxx if it isn't already in ccdlflags.
8830                 case " $ccdlflags " in
8831                 *" $xxx "*)     ;;
8832                 *)      ccdlflags="$ccdlflags $xxx"
8833                         cat <<EOM >&4
8834
8835 Adding $xxx to the flags
8836 passed to $ld so that the perl executable will find the
8837 installed shared $libperl.
8838
8839 EOM
8840                         ;;
8841                 esac
8842                 ;;
8843         esac
8844 fi
8845 # Fix ccdlflags in AIX for building external extensions.
8846 # (For building Perl itself bare -bE:perl.exp is needed,
8847 #  Makefile.SH takes care of this.)
8848 case "$osname" in
8849 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8850 esac
8851 # Respect a hint or command-line value.
8852 case "$shrpenv" in
8853 '') shrpenv="$tmp_shrpenv" ;;
8854 esac
8855 case "$ldlibpthname" in
8856 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8857 none)   ldlibpthname='' ;;
8858 esac
8859
8860 : determine where manual pages are on this system
8861 echo " "
8862 case "$sysman" in
8863 '')
8864         syspath='/usr/share/man/man1 /usr/man/man1'
8865         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8866         syspath="$syspath /usr/man/u_man/man1"
8867         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8868         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8869         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8870         sysman=`./loc . /usr/man/man1 $syspath`
8871         ;;
8872 esac
8873 if $test -d "$sysman"; then
8874         echo "System manual is in $sysman." >&4
8875 else
8876         echo "Could not find manual pages in source form." >&4
8877 fi
8878
8879 : determine where manual pages go
8880 set man1dir man1dir none
8881 eval $prefixit
8882 $cat <<EOM
8883
8884 $spackage has manual pages available in source form.
8885 EOM
8886 case "$nroff" in
8887 nroff)
8888         echo "However, you don't have nroff, so they're probably useless to you."
8889         case "$man1dir" in
8890         '') man1dir="none";;
8891         esac;;
8892 esac
8893 echo "If you don't want the manual sources installed, answer 'none'."
8894 case "$man1dir" in
8895 ' ') dflt=none
8896         ;;
8897 '')
8898         lookpath="$prefixexp/share/man/man1"
8899         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8900         lookpath="$lookpath $prefixexp/man/p_man/man1"
8901         lookpath="$lookpath $prefixexp/man/u_man/man1"
8902         lookpath="$lookpath $prefixexp/man/man.1"
8903         case "$sysman" in
8904         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8905         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8906         esac
8907         set dflt
8908         eval $prefixup
8909         ;;
8910 *)  dflt="$man1dir"
8911         ;;
8912 esac
8913 echo " "
8914 fn=dn+~
8915 rp="Where do the main $spackage manual pages (source) go?"
8916 . ./getfile
8917 if $test "X$man1direxp" != "X$ansexp"; then
8918         installman1dir=''
8919 fi
8920 prefixvar=man1dir
8921 . ./setprefixvar
8922
8923 case "$man1dir" in
8924 '')     man1dir=' '
8925         installman1dir='';;
8926 esac
8927
8928 : What suffix to use on installed man pages
8929
8930 case "$man1dir" in
8931 ' ')
8932         man1ext='0'
8933         ;;
8934 *)
8935         rp="What suffix should be used for the main $spackage man pages?"
8936         case "$man1ext" in
8937         '')     case "$man1dir" in
8938                 *1)  dflt=1 ;;
8939                 *1p) dflt=1p ;;
8940                 *1pm) dflt=1pm ;;
8941                 *l) dflt=l;;
8942                 *n) dflt=n;;
8943                 *o) dflt=o;;
8944                 *p) dflt=p;;
8945                 *C) dflt=C;;
8946                 *L) dflt=L;;
8947                 *L1) dflt=L1;;
8948                 *) dflt=1;;
8949                 esac
8950                 ;;
8951         *)      dflt="$man1ext";;
8952         esac
8953         . ./myread
8954         man1ext="$ans"
8955         ;;
8956 esac
8957
8958 : see if we can have long filenames
8959 echo " "
8960 first=123456789abcdef
8961 $rm -f $first
8962 if (echo hi >$first) 2>/dev/null; then
8963         if $test -f 123456789abcde; then
8964                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8965                 val="$undef"
8966         else
8967                 echo 'You can have filenames longer than 14 characters.'>&4
8968                 val="$define"
8969         fi
8970 else
8971         $cat <<'EOM'
8972 You can't have filenames longer than 14 chars.
8973 You can't even think about them!
8974 EOM
8975         val="$undef"
8976 fi
8977 set d_flexfnam
8978 eval $setvar
8979 $rm -rf 123456789abcde*
8980
8981 : determine where library module manual pages go
8982 set man3dir man3dir none
8983 eval $prefixit
8984 $cat <<EOM
8985
8986 $spackage has manual pages for many of the library modules.
8987 EOM
8988
8989 case "$nroff" in
8990 nroff)
8991         $cat <<'EOM'
8992 However, you don't have nroff, so they're probably useless to you.
8993 EOM
8994         case "$man3dir" in
8995         '') man3dir="none";;
8996         esac;;
8997 esac
8998
8999 case "$d_flexfnam" in
9000 undef)
9001         $cat <<'EOM'
9002 However, your system can't handle the long file names like File::Basename.3.
9003 EOM
9004         case "$man3dir" in
9005         '') man3dir="none";;
9006         esac;;
9007 esac
9008
9009 echo "If you don't want the manual sources installed, answer 'none'."
9010 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9011 case "$man3dir" in
9012 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9013         if $test -d "$privlib/man/man3"; then
9014                 cat <<EOM >&4
9015
9016 WARNING:  Previous versions of perl installed man3 pages into
9017 $privlib/man/man3.  This version will suggest a
9018 new default of $dflt.
9019 EOM
9020                 tdflt=$dflt
9021                 dflt='n'
9022                 rp='Do you wish to preserve the old behavior?(y/n)'
9023                 . ./myread
9024                 case "$ans" in
9025                 y*) dflt="$privlib/man/man3" ;;
9026                 *)  dflt=$tdflt ;;
9027                 esac
9028     fi
9029         ;;
9030 *)      dflt="$man3dir" ;;
9031 esac
9032 case "$dflt" in
9033 ' ') dflt=none ;;
9034 esac
9035 echo " "
9036 fn=dn+~
9037 rp="Where do the $package library man pages (source) go?"
9038 . ./getfile
9039 prefixvar=man3dir
9040 . ./setprefixvar
9041
9042 case "$man3dir" in
9043 '')     man3dir=' '
9044         installman3dir='';;
9045 esac
9046
9047 : What suffix to use on installed man pages
9048 case "$man3dir" in
9049 ' ')
9050         man3ext='0'
9051         ;;
9052 *)
9053         rp="What suffix should be used for the $package library man pages?"
9054         case "$man3ext" in
9055         '')     case "$man3dir" in
9056                 *3)  dflt=3 ;;
9057                 *3p) dflt=3p ;;
9058                 *3pm) dflt=3pm ;;
9059                 *l) dflt=l;;
9060                 *n) dflt=n;;
9061                 *o) dflt=o;;
9062                 *p) dflt=p;;
9063                 *C) dflt=C;;
9064                 *L) dflt=L;;
9065                 *L3) dflt=L3;;
9066                 *) dflt=3;;
9067                 esac
9068                 ;;
9069         *)      dflt="$man3ext";;
9070         esac
9071         . ./myread
9072         man3ext="$ans"
9073         ;;
9074 esac
9075
9076 : see if we have to deal with yellow pages, now NIS.
9077 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9078         case "$hostcat" in
9079         nidump*) ;;
9080         *)
9081                 case "$hostcat" in
9082                 *ypcat*) dflt=y;;
9083                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9084                                 dflt=y
9085                         else
9086                                 dflt=n
9087                         fi;;
9088                 *) dflt=n;;
9089                 esac
9090                 echo " "
9091                 rp='Are you getting the hosts file via yellow pages?'
9092                 . ./myread
9093                 case "$ans" in
9094                 y*) hostcat='ypcat hosts';;
9095                 *) hostcat='cat /etc/hosts';;
9096                 esac
9097                 ;;
9098         esac
9099 fi
9100 case "$hostcat" in
9101 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9102 esac
9103 case "$groupcat" in
9104 '') test -f /etc/group && groupcat='cat /etc/group';;
9105 esac
9106 case "$passcat" in
9107 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9108 esac
9109
9110 : now get the host name
9111 echo " "
9112 echo "Figuring out host name..." >&4
9113 case "$myhostname" in
9114 '') cont=true
9115         echo 'Maybe "hostname" will work...'
9116         if tans=`sh -c hostname 2>&1` ; then
9117                 myhostname=$tans
9118                 phostname=hostname
9119                 cont=''
9120         fi
9121         ;;
9122 *) cont='';;
9123 esac
9124 if $test "$cont"; then
9125         if ./xenix; then
9126                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9127                 if tans=`cat /etc/systemid 2>&1` ; then
9128                         myhostname=$tans
9129                         phostname='cat /etc/systemid'
9130                         echo "Whadyaknow.  Xenix always was a bit strange..."
9131                         cont=''
9132                 fi
9133         elif $test -r /etc/systemid; then
9134                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9135         fi
9136 fi
9137 if $test "$cont"; then
9138         echo 'No, maybe "uuname -l" will work...'
9139         if tans=`sh -c 'uuname -l' 2>&1` ; then
9140                 myhostname=$tans
9141                 phostname='uuname -l'
9142         else
9143                 echo 'Strange.  Maybe "uname -n" will work...'
9144                 if tans=`sh -c 'uname -n' 2>&1` ; then
9145                         myhostname=$tans
9146                         phostname='uname -n'
9147                 else
9148                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9149                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9150                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9151                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9152                         else
9153                                 case "$myhostname" in
9154                                 '') echo "Does this machine have an identity crisis or something?"
9155                                         phostname='';;
9156                                 *)
9157                                         echo "Well, you said $myhostname before..."
9158                                         phostname='echo $myhostname';;
9159                                 esac
9160                         fi
9161                 fi
9162         fi
9163 fi
9164 case "$myhostname" in
9165 '') myhostname=noname ;;
9166 esac
9167 : you do not want to know about this
9168 set $myhostname
9169 myhostname=$1
9170
9171 : verify guess
9172 if $test "$myhostname" ; then
9173         dflt=y
9174         rp='Your host name appears to be "'$myhostname'".'" Right?"
9175         . ./myread
9176         case "$ans" in
9177         y*) ;;
9178         *) myhostname='';;
9179         esac
9180 fi
9181
9182 : bad guess or no guess
9183 while $test "X$myhostname" = X ; do
9184         dflt=''
9185         rp="Please type the (one word) name of your host:"
9186         . ./myread
9187         myhostname="$ans"
9188 done
9189
9190 : translate upper to lower if necessary
9191 case "$myhostname" in
9192 *[A-Z]*)
9193         echo "(Normalizing case in your host name)"
9194         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9195         ;;
9196 esac
9197
9198 case "$myhostname" in
9199 *.*)
9200         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9201         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9202         echo "(Trimming domain name from host name--host name is now $myhostname)"
9203         ;;
9204 *) case "$mydomain" in
9205         '')
9206                 {
9207                         test "X$hostcat" = "Xypcat hosts" &&
9208                         ypmatch "$myhostname" hosts 2>/dev/null |\
9209                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9210                         $test -s hosts
9211                 } || {
9212                         test "X$hostcat" != "X" &&
9213                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9214                                         /[       ]$myhostname[  . ]/p" > hosts
9215                 }
9216                 tmp_re="[       . ]"
9217                 if $test -f hosts; then
9218                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9219                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9220                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9221                                 hosts | $sort | $uniq | \
9222                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9223                         case `$echo X$dflt` in
9224                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9225                                 dflt=.
9226                                 ;;
9227                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9228                                 ;;
9229                         esac
9230                 else
9231                         echo "(I cannot locate a hosts database anywhere)"
9232                         dflt=.
9233                 fi
9234                 case "$dflt" in
9235                 .)
9236                         tans=`./loc resolv.conf X /etc /usr/etc`
9237                         if $test -f "$tans"; then
9238                                 echo "(Attempting domain name extraction from $tans)"
9239                                 dflt=.`$sed -n -e 's/   / /g' \
9240                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9241                                   -e 1q 2>/dev/null`
9242                                 case "$dflt" in
9243                                 .) dflt=.`$sed -n -e 's/        / /g' \
9244                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9245                                      -e 1q 2>/dev/null`
9246                                         ;;
9247                                 esac
9248                         fi
9249                         ;;
9250                 esac
9251                 case "$dflt" in
9252                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9253                         dflt=.`sh -c domainname 2>/dev/null`
9254                         case "$dflt" in
9255                         '') dflt='.';;
9256                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9257                         esac
9258                         ;;
9259                 esac
9260                 case "$dflt$osname" in
9261                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9262                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9263                         ;;
9264                 esac
9265                 case "$dflt" in
9266                 .) echo "(Lost all hope -- silly guess then)"
9267                         dflt='.nonet'
9268                         ;;
9269                 esac
9270                 $rm -f hosts
9271                 ;;
9272         *) dflt="$mydomain";;
9273         esac;;
9274 esac
9275 echo " "
9276 rp="What is your domain name?"
9277 . ./myread
9278 tans="$ans"
9279 case "$ans" in
9280 '') ;;
9281 .*) ;;
9282 *) tans=".$tans";;
9283 esac
9284 mydomain="$tans"
9285
9286 : translate upper to lower if necessary
9287 case "$mydomain" in
9288 *[A-Z]*)
9289         echo "(Normalizing case in your domain name)"
9290         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9291         ;;
9292 esac
9293
9294 : a little sanity check here
9295 case "$phostname" in
9296 '') ;;
9297 *)
9298         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9299         $myhostname$mydomain|$myhostname) ;;
9300         *)
9301                 case "$phostname" in
9302                 sed*)
9303                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9304                         ;;
9305                 *)
9306                         echo "(That doesn't agree with your $phostname command, by the way.)"
9307                         ;;
9308                 esac
9309         ;;
9310         esac
9311         ;;
9312 esac
9313
9314 : determine the e-mail address of the user who is running us
9315 $cat <<EOM
9316
9317 I need to get your e-mail address in Internet format if possible, i.e.
9318 something like user@host.domain. Please answer accurately since I have
9319 no easy means to double check it. The default value provided below
9320 is most probably close to reality but may not be valid from outside
9321 your organization...
9322
9323 EOM
9324 cont=x
9325 while test "$cont"; do
9326         case "$MAILDOMAIN" in
9327         '')
9328                 if $test -s /etc/mailname; then
9329                         maildomain=`$cat /etc/mailname`
9330                 else
9331                         maildomain="$myhostname$mydomain"
9332                 fi
9333                 ;;
9334         *)  maildomain="$MAILDOMAIN";;
9335         esac
9336         case "$cf_email" in
9337         '') dflt="$cf_by@$maildomain";;
9338         *)  dflt="$cf_email";;
9339         esac
9340         rp='What is your e-mail address?'
9341         . ./myread
9342         cf_email="$ans"
9343         case "$cf_email" in
9344         *@*.*) cont='' ;;
9345         *)
9346                 rp='Address does not look like an Internet one.  Use it anyway?'
9347                 case "$fastread" in
9348                 yes) dflt=y ;;
9349                 *) dflt=n ;;
9350                 esac
9351                 . ./myread
9352                 case "$ans" in
9353                 y*) cont='' ;;
9354                 *) echo " " ;;
9355                 esac
9356                 ;;
9357         esac
9358 done
9359
9360 : Ask e-mail of administrator
9361 $cat <<EOM
9362
9363 If you or somebody else will be maintaining perl at your site, please
9364 fill in the correct e-mail address here so that they may be contacted
9365 if necessary. Currently, the "perlbug" program included with perl
9366 will send mail to this address in addition to perlbug@perl.org. You may
9367 enter "none" for no administrator.
9368
9369 EOM
9370 case "$perladmin" in
9371 '') dflt="$cf_email";;
9372 *) dflt="$perladmin";;
9373 esac
9374 rp='Perl administrator e-mail address'
9375 . ./myread
9376 perladmin="$ans"
9377
9378 : determine whether to use a version number suffix for installed binaries
9379 echo " "
9380 $cat <<EOM
9381 Do you want to use a version number suffix for installed binaries? This
9382 will install 'perl$version' instead of 'perl', and likewise for other
9383 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9384 to be installed side-by-side. Unless you are a developer, you probably
9385 do *not* want to do this.
9386 EOM
9387 case "$versiononly" in
9388 "$define"|[Yy]*|true) dflt='y' ;;
9389 *) dflt='n';
9390 esac
9391 rp="Do you want to use a version number suffix for installed binaries?"
9392 . ./myread
9393 case "$ans" in
9394 [yY]*)  val="$define";;
9395 *)      val="$undef" ;;
9396 esac
9397 set versiononly
9398 eval $setvar
9399
9400 case "$versiononly" in
9401 "$define") inc_version_list=''
9402            inc_version_list_init=0
9403            ;;
9404 esac
9405
9406 : figure out how to guarantee perl startup
9407 : XXX Note that this currently takes advantage of the bug that binexp ignores
9408 :     the Configure -Dinstallprefix setting, which in turn means that under
9409 :     relocatable @INC, initialinstalllocation is what binexp started as.
9410 case "$startperl" in
9411 '')
9412         case "$sharpbang" in
9413         *!)
9414                 $cat <<EOH
9415
9416 I can use the #! construct to start perl on your system. This will
9417 make startup of perl scripts faster, but may cause problems if you
9418 want to share those scripts and perl is not in a standard place
9419 ($initialinstalllocation/perl) on all your platforms. The alternative
9420 is to force a shell by starting the script with a single ':' character.
9421
9422 EOH
9423                 case "$versiononly" in
9424                 "$define")      dflt="$initialinstalllocation/perl$version";;
9425                 *)              dflt="$initialinstalllocation/perl";;
9426                 esac
9427                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9428                 . ./myread
9429                 case "$ans" in
9430                 none)   startperl=": # use perl";;
9431                 *)      startperl="#!$ans"
9432                         if $test 30 -lt `echo "$ans" | wc -c`; then
9433                                 $cat >&4 <<EOM
9434
9435 WARNING:  Some systems limit the #! command to 32 characters.
9436 If you experience difficulty running Perl scripts with #!, try
9437 installing Perl in a directory with a shorter pathname.
9438
9439 EOM
9440                         fi ;;
9441                 esac
9442                 ;;
9443         *) startperl=": # use perl"
9444                 ;;
9445         esac
9446         ;;
9447 esac
9448 echo "I'll use $startperl to start perl scripts."
9449
9450 : figure best path for perl in scripts
9451 case "$perlpath" in
9452 '')
9453         case "$versiononly" in
9454         "$define")      perlpath="$initialinstalllocation/perl$version";;
9455         *)              perlpath="$initialinstalllocation/perl";;
9456         esac
9457         case "$startperl" in
9458         *!*) ;;
9459         *)
9460                 $cat <<EOH
9461
9462 I will use the "eval 'exec'" idiom to start Perl on your system.
9463 I can use the full path of your Perl binary for this purpose, but
9464 doing so may cause problems if you want to share those scripts and
9465 Perl is not always in a standard place ($initialinstalllocation/perl).
9466
9467 EOH
9468                 dflt="$initialinstalllocation/perl"
9469                 rp="What path shall I use in \"eval 'exec'\"?"
9470                 . ./myread
9471                 perlpath="$ans"
9472                 ;;
9473         esac
9474         ;;
9475 esac
9476 case "$startperl" in
9477 *!*)    ;;
9478 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9479 esac
9480
9481 : determine where public executable scripts go
9482 set scriptdir scriptdir
9483 eval $prefixit
9484 case "$scriptdir" in
9485 '')
9486         dflt="$bin"
9487         : guess some guesses
9488         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9489         $test -d /usr/share/bin     && dflt=/usr/share/bin
9490         $test -d /usr/local/script  && dflt=/usr/local/script
9491         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9492         $test -d $prefixexp/script  && dflt=$prefixexp/script
9493         set dflt
9494         eval $prefixup
9495         ;;
9496 *)  dflt="$scriptdir"
9497         ;;
9498 esac
9499 $cat <<EOM
9500
9501 Some installations have a separate directory just for executable scripts so
9502 that they can mount it across multiple architectures but keep the scripts in
9503 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9504 Or you might just lump your scripts in with all your other executables.
9505
9506 EOM
9507 fn=d~
9508 rp='Where do you keep publicly executable scripts?'
9509 . ./getfile
9510 if $test "X$ansexp" != "X$scriptdirexp"; then
9511         installscript=''
9512 fi
9513 installscriptdir=''
9514 prefixvar=scriptdir
9515 . ./setprefixvar
9516 : A little fix up for an irregularly named variable.
9517 installscript="$installscriptdir"
9518
9519 : determine where add-on public executables go
9520 case "$sitebin" in
9521 '')     dflt=$siteprefix/bin ;;
9522 *)      dflt=$sitebin ;;
9523 esac
9524 fn=d~
9525 rp='Pathname where the add-on public executables should be installed?'
9526 . ./getfile
9527 prefixvar=sitebin
9528 . ./setprefixvar
9529
9530 : determine where add-on html pages go
9531 : There is no standard location, so try to copy the previously-selected
9532 : directory structure for the core html pages.
9533 case "$sitehtml1dir" in
9534 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9535 *)     dflt=$sitehtml1dir ;;
9536 esac
9537 case "$dflt" in
9538 ''|' ') dflt=none ;;
9539 esac
9540 fn=dn+~
9541 rp='Pathname where the site-specific html pages should be installed?'
9542 . ./getfile
9543 prefixvar=sitehtml1dir
9544 . ./setprefixvar
9545
9546 : determine where add-on library html pages go
9547 : There is no standard location, so try to copy the previously-selected
9548 : directory structure for the core html pages.
9549 case "$sitehtml3dir" in
9550 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9551 *)     dflt=$sitehtml3dir ;;
9552 esac
9553 case "$dflt" in
9554 ''|' ') dflt=none ;;
9555 esac
9556 fn=dn+~
9557 rp='Pathname where the site-specific library html pages should be installed?'
9558 . ./getfile
9559 prefixvar=sitehtml3dir
9560 . ./setprefixvar
9561
9562 : determine where add-on manual pages go
9563 case "$siteman1dir" in
9564 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9565 *)      dflt=$siteman1dir ;;
9566 esac
9567 case "$dflt" in
9568 ''|' ') dflt=none ;;
9569 esac
9570 fn=dn+~
9571 rp='Pathname where the site-specific manual pages should be installed?'
9572 . ./getfile
9573 prefixvar=siteman1dir
9574 . ./setprefixvar
9575
9576 : determine where add-on library man pages go
9577 case "$siteman3dir" in
9578 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9579 *)      dflt=$siteman3dir ;;
9580 esac
9581 case "$dflt" in
9582 ''|' ') dflt=none ;;
9583 esac
9584 fn=dn+~
9585 rp='Pathname where the site-specific library manual pages should be installed?'
9586 . ./getfile
9587 prefixvar=siteman3dir
9588 . ./setprefixvar
9589
9590 : determine where add-on public executable scripts go
9591 case "$sitescript" in
9592 '')     dflt=$siteprefix/script
9593         $test -d $dflt || dflt=$sitebin ;;
9594 *)  dflt="$sitescript" ;;
9595 esac
9596 fn=d~+
9597 rp='Pathname where add-on public executable scripts should be installed?'
9598 . ./getfile
9599 prefixvar=sitescript
9600 . ./setprefixvar
9601
9602 : see if backtrace exists
9603 set backtrace d_backtrace
9604 eval $inlibc
9605
9606 : add flags if using c backtrace
9607 case "$usecbacktrace" in
9608   "") usecbacktrace=$undef ;;
9609   [yY]*|true|$define)
9610     case "$d_backtrace" in
9611       [yY]*|true|$define)
9612         case " $ccflags " in
9613           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9614           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9615           esac
9616         ;;
9617       *)
9618         echo "This system does not support backtrace" >&4
9619         usecbacktrace=$undef
9620         ;;
9621       esac
9622     ;;
9623   esac
9624
9625 : Check if faststdio is requested and available
9626 case "$usefaststdio" in
9627 $define|true|[yY]*|'')
9628         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9629         case "$xversion" in
9630         [68])   dflt='y' ;;
9631         *)      dflt='n' ;;
9632         esac
9633         ;;
9634 *) dflt='n';;
9635 esac
9636 cat <<EOM
9637
9638 Perl can be built to use 'fast stdio', which means using the stdio
9639 library but also directly manipulating the stdio buffers to enable
9640 faster I/O.  Using stdio is better for backward compatibility (especially
9641 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9642 interface has been preferred instead of stdio.
9643
9644 If this doesn't make any sense to you, just accept the default '$dflt'.
9645 EOM
9646 rp='Use the "fast stdio" if available?'
9647 . ./myread
9648 case "$ans" in
9649 y|Y)    val="$define" ;;
9650 *)      val="$undef" ;;
9651 esac
9652 set usefaststdio
9653 eval $setvar
9654
9655 : define an is-a-typedef? function
9656 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9657 case "$inclist" in
9658 "") inclist="sys/types.h";;
9659 esac;
9660 eval "varval=\$$var";
9661 case "$varval" in
9662 "")
9663         $rm -f temp.c;
9664         for inc in $inclist; do
9665                 echo "#include <$inc>" >>temp.c;
9666         done;
9667         echo "#ifdef $type" >> temp.c;
9668         echo "printf(\"We have $type\");" >> temp.c;
9669         echo "#endif" >> temp.c;
9670         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9671         if $contains $type temp.E >/dev/null 2>&1; then
9672                 eval "$var=\$type";
9673         else
9674                 eval "$var=\$def";
9675         fi;
9676         $rm -f temp.?;;
9677 *) eval "$var=\$varval";;
9678 esac'
9679
9680 : define an is-a-typedef? function that prompts if the type is not available.
9681 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9682 case "$inclist" in
9683 "") inclist="sys/types.h";;
9684 esac;
9685 eval "varval=\$$var";
9686 case "$varval" in
9687 "")
9688         $rm -f temp.c;
9689         for inc in $inclist; do
9690                 echo "#include <$inc>" >>temp.c;
9691         done;
9692         echo "#ifdef $type" >> temp.c;
9693         echo "printf(\"We have $type\");" >> temp.c;
9694         echo "#endif" >> temp.c;
9695         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9696         echo " " ;
9697         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9698         if $contains $type temp.E >/dev/null 2>&1; then
9699                 echo "$type found." >&4;
9700                 eval "$var=\$type";
9701         else
9702                 echo "$type NOT found." >&4;
9703                 dflt="$def";
9704                 . ./myread ;
9705                 eval "$var=\$ans";
9706         fi;
9707         $rm -f temp.?;;
9708 *) eval "$var=\$varval";;
9709 esac'
9710
9711 : see what type lseek is declared as in the kernel
9712 rp="What is the type used for lseek's offset on this system?"
9713 set off_t lseektype long stdio.h sys/types.h
9714 eval $typedef_ask
9715
9716 echo " "
9717 echo "Checking to see how big your file offsets are..." >&4
9718 $cat >try.c <<EOCP
9719 #include <sys/types.h>
9720 #include <stdio.h>
9721 int main()
9722 {
9723     printf("%d\n", (int)sizeof($lseektype));
9724     return(0);
9725 }
9726 EOCP
9727 set try
9728 if eval $compile_ok; then
9729         lseeksize=`$run ./try`
9730         echo "Your file offsets are $lseeksize bytes long."
9731 else
9732         dflt=$longsize
9733         echo " "
9734         echo "(I can't seem to compile the test program.  Guessing...)"
9735         rp="What is the size of your file offsets (in bytes)?"
9736         . ./myread
9737         lseeksize="$ans"
9738 fi
9739 $rm_try
9740
9741 : see what type file positions are declared as in the library
9742 rp="What is the type for file position used by fsetpos()?"
9743 set fpos_t fpostype long stdio.h sys/types.h
9744 eval $typedef_ask
9745
9746 : Check size for Fpos_t
9747 echo " "
9748 case "$fpostype" in
9749 *_t) zzz="$fpostype"    ;;
9750 *)   zzz="fpos_t"       ;;
9751 esac
9752 echo "Checking the size of $zzz..." >&4
9753 cat > try.c <<EOCP
9754 #include <sys/types.h>
9755 #include <stdio.h>
9756 #$i_stdlib I_STDLIB
9757 #ifdef I_STDLIB
9758 #include <stdlib.h>
9759 #endif
9760 int main() {
9761     printf("%d\n", (int)sizeof($fpostype));
9762     exit(0);
9763 }
9764 EOCP
9765 set try
9766 if eval $compile_ok; then
9767         yyy=`$run ./try`
9768         case "$yyy" in
9769         '')     fpossize=4
9770                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9771                 ;;
9772         *)      fpossize=$yyy
9773                 echo "Your $zzz is $fpossize bytes long."
9774                 ;;
9775         esac
9776 else
9777         dflt="$longsize"
9778         echo " " >&4
9779         echo "(I can't compile the test program.  Guessing...)" >&4
9780         rp="What is the size of your file positions (in bytes)?"
9781         . ./myread
9782         fpossize="$ans"
9783 fi
9784
9785 : Check for large file support
9786 # Backward compatibility (uselfs is deprecated).
9787 case "$uselfs" in
9788 "$define"|true|[yY]*)
9789         cat <<EOM >&4
9790
9791 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9792 EOM
9793         uselargefiles="$define"
9794         ;;
9795 esac
9796
9797 case "$lseeksize:$fpossize" in
9798 8:8) cat <<EOM
9799
9800 You can have files larger than 2 gigabytes.
9801 EOM
9802    val="$define" ;;
9803 *)    case "$uselargefiles" in
9804    "$undef"|false|[nN]*) dflt='n' ;;
9805    *)   dflt='y' ;;
9806    esac
9807    cat <<EOM
9808
9809 Perl can be built to understand large files (files larger than 2 gigabytes)
9810 on some systems.  To do so, Configure can be run with -Duselargefiles.
9811
9812 If this doesn't make any sense to you, just accept the default '$dflt'.
9813 EOM
9814    rp='Try to understand large files, if available?'
9815    . ./myread
9816    case "$ans" in
9817    y|Y) val="$define" ;;
9818    *)   val="$undef"  ;;
9819    esac
9820    ;;
9821 esac
9822 set uselargefiles
9823 eval $setvar
9824 : Look for a hint-file generated 'call-back-unit'.  If the
9825 : user has specified that a large files perl is to be built,
9826 : we may need to set or change some other defaults.
9827 if $test -f uselargefiles.cbu; then
9828         echo "Your platform has some specific hints regarding large file builds, using them..."
9829         . ./uselargefiles.cbu
9830 fi
9831 case "$uselargefiles" in
9832 "$define")
9833         if $test -f uselargefiles.cbu; then
9834                 echo " "
9835                 echo "Rechecking to see how big your file offsets are..." >&4
9836                 $cat >try.c <<EOCP
9837 #include <sys/types.h>
9838 #include <stdio.h>
9839 int main()
9840 {
9841     printf("%d\n", (int)sizeof($lseektype));
9842     return(0);
9843 }
9844 EOCP
9845                 set try
9846                 if eval $compile_ok; then
9847                         lseeksize=`$run ./try`
9848                         $echo "Your file offsets are now $lseeksize bytes long."
9849                 else
9850                         dflt="$lseeksize"
9851                         echo " "
9852                         echo "(I can't seem to compile the test program.  Guessing...)"
9853                         rp="What is the size of your file offsets (in bytes)?"
9854                         . ./myread
9855                         lseeksize="$ans"
9856                 fi
9857                 case "$fpostype" in
9858                 *_t) zzz="$fpostype"    ;;
9859                 *)   zzz="fpos_t"       ;;
9860                 esac
9861                 $echo $n "Rechecking the size of $zzz...$c" >&4
9862                 $cat > try.c <<EOCP
9863 #include <sys/types.h>
9864 #include <stdio.h>
9865 #$i_stdlib I_STDLIB
9866 #ifdef I_STDLIB
9867 #include <stdlib.h>
9868 #endif
9869 int main() {
9870     printf("%d\n", (int)sizeof($fpostype));
9871     return(0);
9872 }
9873 EOCP
9874                 set try
9875                 if eval $compile_ok; then
9876                         yyy=`$run ./try`
9877                         dflt="$lseeksize"
9878                         case "$yyy" in
9879                         '')     echo " "
9880                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9881                                 ;;
9882                         *)      fpossize=$yyy
9883                                 echo " $fpossize bytes." >&4
9884                                 ;;
9885                         esac
9886                 else
9887                         dflt="$fpossize"
9888                         echo " "
9889                         echo "(I can't compile the test program.  Guessing...)" >&4
9890                         rp="What is the size of your file positions (in bytes)?"
9891                         . ./myread
9892                         fpossize="$ans"
9893                 fi
9894                 $rm_try
9895         fi
9896         ;;
9897 esac
9898
9899 : Check if we want perlio
9900 useperlio="$define"
9901
9902 : Set the vendorbin variables
9903 case "$vendorprefix" in
9904 '')     d_vendorbin="$undef"
9905         vendorbin=''
9906         vendorbinexp=''
9907         ;;
9908 *)      d_vendorbin="$define"
9909         : determine where vendor-supplied executables go.
9910         case "$vendorbin" in
9911         '') dflt=$vendorprefix/bin ;;
9912         *)      dflt="$vendorbin" ;;
9913         esac
9914         fn=d~+
9915         rp='Pathname for the vendor-supplied executables directory?'
9916         . ./getfile
9917         vendorbin="$ans"
9918         vendorbinexp="$ansexp"
9919         ;;
9920 esac
9921 prefixvar=vendorbin
9922 . ./installprefix
9923
9924 : Set the vendorhtml1dir variables
9925 case "$vendorprefix" in
9926 '')     vendorhtml1dir=''
9927         vendorhtml1direxp=''
9928         ;;
9929 *)      : determine where vendor-supplied html pages go.
9930         : There is no standard location, so try to copy the previously-selected
9931         : directory structure for the core html pages.
9932         : XXX Better default suggestions would be welcome.
9933         case "$vendorhtml1dir" in
9934         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9935         *)      dflt=$vendorhtml1dir ;;
9936         esac
9937         case "$dflt" in
9938         ''|' ') dflt=none ;;
9939         esac
9940         fn=dn+~
9941         rp='Pathname for the vendor-supplied html pages?'
9942         . ./getfile
9943         vendorhtml1dir="$ans"
9944         vendorhtml1direxp="$ansexp"
9945         ;;
9946 esac
9947 : Use ' ' for none so value is preserved next time through Configure
9948 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9949 prefixvar=vendorhtml1dir
9950 . ./installprefix
9951
9952 : Set the vendorhtml3dir variables
9953 case "$vendorprefix" in
9954 '')     vendorhtml3dir=''
9955         vendorhtml3direxp=''
9956         ;;
9957 *)      : determine where vendor-supplied module html pages go.
9958         : There is no standard location, so try to copy the previously-selected
9959         : directory structure for the core html pages.
9960         : XXX Better default suggestions would be welcome.
9961         case "$vendorhtml3dir" in
9962         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9963         *)      dflt=$vendorhtml3dir ;;
9964         esac
9965         case "$dflt" in
9966         ''|' ') dflt=none ;;
9967         esac
9968         fn=dn+~
9969         rp='Pathname for the vendor-supplied html pages?'
9970         . ./getfile
9971         vendorhtml3dir="$ans"
9972         vendorhtml3direxp="$ansexp"
9973         ;;
9974 esac
9975 : Use ' ' for none so value is preserved next time through Configure
9976 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9977 prefixvar=vendorhtml3dir
9978 . ./installprefix
9979
9980 : Set the vendorman1dir variables
9981 case "$vendorprefix" in
9982 '')     vendorman1dir=''
9983         vendorman1direxp=''
9984         ;;
9985 *)      : determine where vendor-supplied manual pages go.
9986         case "$vendorman1dir" in
9987         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9988         *)      dflt=$vendorman1dir ;;
9989         esac
9990         case "$dflt" in
9991         ''|' ') dflt=none ;;
9992         esac
9993         fn=nd~+
9994         rp='Pathname for the vendor-supplied manual section 1 pages?'
9995         . ./getfile
9996         vendorman1dir="$ans"
9997         vendorman1direxp="$ansexp"
9998         ;;
9999 esac
10000 : Use ' ' for none so value is preserved next time through Configure
10001 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10002 prefixvar=vendorman1dir
10003 . ./installprefix
10004
10005 : Set the vendorman3dir variables
10006 case "$vendorprefix" in
10007 '')     vendorman3dir=''
10008         vendorman3direxp=''
10009         ;;
10010 *)      : determine where vendor-supplied module manual pages go.
10011         case "$vendorman3dir" in
10012         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10013         *)      dflt=$vendorman3dir ;;
10014         esac
10015         case "$dflt" in
10016         ''|' ') dflt=none ;;
10017         esac
10018         fn=nd~+
10019         rp='Pathname for the vendor-supplied manual section 3 pages?'
10020         . ./getfile
10021         vendorman3dir="$ans"
10022         vendorman3direxp="$ansexp"
10023         ;;
10024 esac
10025 : Use ' ' for none so value is preserved next time through Configure
10026 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10027 prefixvar=vendorman3dir
10028 . ./installprefix
10029
10030 : Set the vendorscript variables
10031 case "$vendorprefix" in
10032 '')     d_vendorscript="$undef"
10033         vendorscript=''
10034         vendorscriptexp=''
10035         ;;
10036 *)      d_vendorscript="$define"
10037         : determine where vendor-supplied scripts go.
10038         case "$vendorscript" in
10039         '')     dflt=$vendorprefix/script
10040                 $test -d $dflt || dflt=$vendorbin ;;
10041         *)  dflt="$vendorscript" ;;
10042         esac
10043         $cat <<EOM
10044
10045 The installation process will create a directory for
10046 vendor-supplied scripts.
10047
10048 EOM
10049         fn=d~+
10050         rp='Pathname for the vendor-supplied scripts directory?'
10051         . ./getfile
10052         vendorscript="$ans"
10053         vendorscriptexp="$ansexp"
10054         ;;
10055 esac
10056 prefixvar=vendorscript
10057 . ./installprefix
10058
10059 : see if qgcvt exists
10060 set qgcvt d_qgcvt
10061 eval $inlibc
10062
10063 : Check what kind of doubles your system has
10064 $echo "Checking the kind of doubles you have..." >&4
10065 $cat >try.c <<EOP
10066 #$i_stdlib I_STDLIB
10067 #define DOUBLESIZE $doublesize
10068 #ifdef I_STDLIB
10069 #include <stdlib.h>
10070 #endif
10071 #include <stdio.h>
10072 static const double d = -0.1;
10073 int main() {
10074   unsigned const char* b = (unsigned const char*)(&d);
10075 #if DOUBLESIZE == 4
10076   if (b[0] == 0xCD && b[3] == 0xBD) {
10077     /* IEEE 754 32-bit little-endian */
10078     printf("1\n");
10079     exit(0);
10080   }
10081   if (b[0] == 0xBD && b[3] == 0xCD) {
10082     /* IEEE 754 32-bit big-endian */
10083     printf("2\n");
10084     exit(0);
10085   }
10086   if (b[0] == 0xCC && b[3] == 0xCC) {
10087     /* VAX format F, 32-bit PDP-style mixed endian. */
10088     printf("9\n");
10089     exit(0);
10090   }
10091   if (b[0] == 0xC0 && b[3] == 0x9A) {
10092     /* IBM single 32-bit */
10093     printf("12\n");
10094     exit(0);
10095   }
10096 #endif
10097 #if DOUBLESIZE == 8
10098   if (b[0] == 0x9A && b[7] == 0xBF) {
10099     /* IEEE 754 64-bit little-endian */
10100     printf("3\n");
10101     exit(0);
10102   }
10103   if (b[0] == 0xBF && b[7] == 0x9A) {
10104     /* IEEE 754 64-bit big-endian */
10105     printf("4\n");
10106     exit(0);
10107   }
10108   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10109    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10110     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10111     * 99 99 b9 bf 9a 99 99 99 */
10112     printf("7\n");
10113     exit(0);
10114   }
10115   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10116    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10117     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10118     * 99 99 99 9a bf b9 99 99 */
10119     printf("8\n");
10120     exit(0);
10121   }
10122   if (b[0] == 0xCC && b[7] == 0xCC) {
10123    /* VAX format D, 64-bit PDP-style mixed endian. */
10124     printf("10\n");
10125     exit(0);
10126   }
10127   if (b[0] == 0xD9 && b[7] == 0x99) {
10128    /* VAX format G, 64-bit PDP-style mixed endian. */
10129     printf("11\n");
10130     exit(0);
10131   }
10132   if (b[0] == 0xC0 && b[7] == 0x9A) {
10133     /* IBM double 64-bit */
10134     printf("13\n");
10135     exit(0);
10136   }
10137   if (b[0] == 0xBF && b[7] == 0xCD) {
10138     /* CRAY single 64-bit */
10139     printf("14\n");
10140     exit(0);
10141   }
10142 #endif
10143 #if DOUBLESIZE == 16
10144   if (b[0] == 0x9A && b[15] == 0xBF) {
10145     /* IEEE 754 128-bit little-endian */
10146     printf("5\n");
10147     exit(0);
10148   }
10149   if (b[0] == 0xBF && b[15] == 0x9A) {
10150     /* IEEE 754 128-bit big-endian */
10151     printf("6\n");
10152     exit(0);
10153   }
10154 #endif
10155   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10156    * Whether those environments can still build Perl is debatable. */
10157   printf("-1\n"); /* unknown */
10158   exit(0);
10159 }
10160 EOP
10161 set try
10162 if eval $compile; then
10163     doublekind=`$run ./try`
10164 else
10165     doublekind=-1
10166 fi
10167 case "$doublekind" in
10168 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10169 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10170 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10171 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10172 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10173 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10174 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10175 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10176 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10177 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10178 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10179 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10180 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10181 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10182 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10183 esac
10184 d_double_style_ieee=$undef
10185 d_double_style_vax=$undef
10186 d_double_style_ibm=$undef
10187 d_double_style_cray=$undef
10188 case "$doublekind" in
10189 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10190 9|10|11) d_double_style_vax=$define ;;
10191 12|13) d_double_style_ibm=$define ;;
10192 14) d_double_style_cray=$define ;;
10193 esac
10194 case "$d_double_style_ieee" in
10195 $define)
10196     d_double_has_inf=$define
10197     d_double_has_nan=$define
10198     d_double_has_negative_zero=$define
10199     d_double_has_subnormals=$define
10200     ;;
10201 *)
10202     d_double_has_inf=$undef
10203     d_double_has_nan=$undef
10204     d_double_has_negative_zero=$undef
10205     d_double_has_subnormals=$undef
10206     ;;
10207 esac
10208 $rm_try
10209
10210 : Check print/scan long double stuff
10211 echo " "
10212
10213 if $test X"$d_longdbl" = X"$define"; then
10214
10215 echo "Checking how to print long doubles..." >&4
10216
10217 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10218         $cat >try.c <<'EOCP'
10219 #include <sys/types.h>
10220 #include <stdio.h>
10221 int main() {
10222   double d = 123.456;
10223   printf("%.3f\n", d);
10224 }
10225 EOCP
10226         set try
10227         if eval $compile; then
10228                 yyy=`$run ./try`
10229                 case "$yyy" in
10230                 123.456)
10231                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10232                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10233                         echo "We will use %f."
10234                         ;;
10235                 esac
10236         fi
10237 fi
10238
10239 if $test X"$sPRIfldbl" = X; then
10240         $cat >try.c <<'EOCP'
10241 #include <sys/types.h>
10242 #include <stdio.h>
10243 int main() {
10244   long double d = 123.456;
10245   printf("%.3Lf\n", d);
10246 }
10247 EOCP
10248         set try
10249         if eval $compile; then
10250                 yyy=`$run ./try`
10251                 case "$yyy" in
10252                 123.456)
10253                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10254                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10255                         echo "We will use %Lf."
10256                         ;;
10257                 esac
10258         fi
10259 fi
10260
10261 if $test X"$sPRIfldbl" = X; then
10262         $cat >try.c <<'EOCP'
10263 #include <sys/types.h>
10264 #include <stdio.h>
10265 int main() {
10266   long double d = 123.456;
10267   printf("%.3llf\n", d);
10268 }
10269 EOCP
10270         set try
10271         if eval $compile; then
10272                 yyy=`$run ./try`
10273                 case "$yyy" in
10274                 123.456)
10275                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10276                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10277                         echo "We will use %llf."
10278                         ;;
10279                 esac
10280         fi
10281 fi
10282
10283 if $test X"$sPRIfldbl" = X; then
10284         $cat >try.c <<'EOCP'
10285 #include <sys/types.h>
10286 #include <stdio.h>
10287 int main() {
10288   long double d = 123.456;
10289   printf("%.3lf\n", d);
10290 }
10291 EOCP
10292         set try
10293         if eval $compile; then
10294                 yyy=`$run ./try`
10295                 case "$yyy" in
10296                 123.456)
10297                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10298                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10299                         echo "We will use %lf."
10300                         ;;
10301                 esac
10302         fi
10303 fi
10304
10305 if $test X"$sPRIfldbl" = X; then
10306         echo "Cannot figure out how to print long doubles." >&4
10307 else
10308         sSCNfldbl=$sPRIfldbl    # expect consistency
10309 fi
10310
10311 $rm_try
10312
10313 fi # d_longdbl
10314
10315 case "$sPRIfldbl" in
10316 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10317         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10318         d_SCNfldbl="$undef";
10319         ;;
10320 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10321         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10322         d_SCNfldbl="$define";
10323         ;;
10324 esac
10325
10326 : Before committing on uselongdouble, see whether that looks sane.
10327 if $test "$uselongdouble" = "$define"; then
10328     message=""
10329     echo " "
10330     echo "Checking if your long double math functions work right..." >&4
10331     $cat > try.c <<EOF
10332 #include <math.h>
10333 #include <stdio.h>
10334 int main() {
10335   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10336 }
10337 EOF
10338     case "$osname:$gccversion" in
10339     aix:)       saveccflags="$ccflags"
10340                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10341     esac
10342     set try
10343     if eval $compile_ok; then
10344       yyy=`$run ./try`
10345     fi
10346     case "$yyy" in
10347     3) echo "Your long double math functions are working correctly." >&4 ;;
10348     *) echo "Your long double math functions are broken, not using long doubles." >&4
10349        uselongdouble=$undef
10350        ;;
10351     esac
10352     $rm_try
10353     case "$osname:$gccversion" in
10354     aix:)       ccflags="$saveccflags" ;; # restore
10355     esac
10356 fi
10357
10358 : Check how to convert floats to strings.
10359
10360 if test "X$d_Gconvert" = X; then
10361
10362 echo " "
10363 echo "Checking for an efficient way to convert floats to strings."
10364 echo " " > try.c
10365 case "$uselongdouble" in
10366 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10367 esac
10368 case "$d_longdbl" in
10369 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10370 esac
10371 case "$d_PRIgldbl" in
10372 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10373 esac
10374 $cat >>try.c <<EOP
10375 #ifdef TRY_gconvert
10376 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10377 char *myname = "gconvert";
10378 #endif
10379 #ifdef TRY_gcvt
10380 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10381 char *myname = "gcvt";
10382 #endif
10383 #ifdef TRY_qgcvt
10384 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10385 char *myname = "qgcvt";
10386 #define DOUBLETYPE long double
10387 #endif
10388 #ifdef TRY_sprintf
10389 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10390 #ifdef HAS_PRIgldbl
10391 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10392 #else
10393 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10394 #endif
10395 #else
10396 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10397 #endif
10398 char *myname = "sprintf";
10399 #endif
10400
10401 #ifndef DOUBLETYPE
10402 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10403 #define DOUBLETYPE long double
10404 #else
10405 #define DOUBLETYPE double
10406 #endif
10407 #endif
10408
10409 #include <stdio.h>
10410
10411 #$i_stdlib I_STDLIB
10412 #ifdef I_STDLIB
10413 #include <stdlib.h>
10414 #endif
10415 #include <string.h>
10416
10417 int checkit(char *expect, char *got)
10418 {
10419     if (strcmp(expect, got)) {
10420                 printf("%s oddity:  Expected %s, got %s\n",
10421                         myname, expect, got);
10422                 exit(1);
10423         }
10424 }
10425
10426 int main()
10427 {
10428         char buf[64];
10429         buf[63] = '\0';
10430
10431         /* This must be 1st test on (which?) platform */
10432         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10433         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10434         checkit("0.1", buf);
10435
10436         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10437         checkit("0.01", buf);
10438
10439         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10440         checkit("0.001", buf);
10441
10442         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10443         checkit("0.0001", buf);
10444
10445         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10446         if (strlen(buf) > 5)
10447             checkit("9e-005", buf); /* for Microsoft ?? */
10448         else
10449             checkit("9e-05", buf);
10450
10451         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10452         checkit("1", buf);
10453
10454         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10455         checkit("1.1", buf);
10456
10457         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10458         checkit("1.01", buf);
10459
10460         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10461         checkit("1.001", buf);
10462
10463         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10464         checkit("1.0001", buf);
10465
10466         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10467         checkit("1.00001", buf);
10468
10469         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10470         checkit("1.000001", buf);
10471
10472         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10473         checkit("0", buf);
10474
10475         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10476         checkit("-1", buf);
10477
10478         /* Some Linux gcvt's give 1.e+5 here. */
10479         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10480         checkit("100000", 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         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10487         checkit("123.456", buf);
10488
10489         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10490         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10491         /* 34 should be enough to scare even long double
10492          * places into using the e notation. */
10493         if (strlen(buf) > 5)
10494             checkit("1e+034", buf); /* for Microsoft */
10495         else
10496             checkit("1e+34", buf);
10497
10498         /* For Perl, if you add additional tests here, also add them to
10499          * t/base/num.t for benefit of platforms not using Configure or
10500          * overriding d_Gconvert */
10501
10502         exit(0);
10503 }
10504 EOP
10505 : first add preferred functions to our list
10506 xxx_list=""
10507 for xxx_convert in $gconvert_preference; do
10508     case $xxx_convert in
10509     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10510     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10511     esac
10512 done
10513 : then add any others
10514 for xxx_convert in gconvert gcvt sprintf; do
10515     case "$xxx_list" in
10516     *$xxx_convert*) ;;
10517     *) xxx_list="$xxx_list $xxx_convert" ;;
10518     esac
10519 done
10520
10521 case "$d_longdbl$uselongdouble" in
10522 "$define$define")
10523     : again, add preferred functions to our list first
10524     xxx_ld_list=""
10525     for xxx_convert in $gconvert_ld_preference; do
10526         case $xxx_convert in
10527         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10528         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10529         esac
10530     done
10531     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10532     for xxx_convert in qgcvt sprintf $xxx_list; do
10533         case "$xxx_ld_list" in
10534         $xxx_convert*|*" $xxx_convert"*) ;;
10535         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10536         esac
10537     done
10538     : if sprintf cannot do long doubles, move it to the end
10539     if test "$d_PRIgldbl" != "$define"; then
10540         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10541     fi
10542     : if no qgcvt, remove it
10543     if test "$d_qgcvt" != "$define"; then
10544         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10545     fi
10546     : use the ld_list
10547     xxx_list="$xxx_ld_list"
10548     ;;
10549 esac
10550
10551 for xxx_convert in $xxx_list; do
10552         echo "Trying $xxx_convert..."
10553         $rm -f try try$_o core
10554         set try -DTRY_$xxx_convert
10555         if eval $compile; then
10556                 echo "$xxx_convert() found." >&4
10557                 if $run ./try; then
10558                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10559                         break;
10560                 else
10561                         echo "...But $xxx_convert didn't work as I expected."
10562                         xxx_convert=''
10563                 fi
10564         else
10565                 echo "$xxx_convert NOT found." >&4
10566         fi
10567 done
10568
10569 if test X$xxx_convert = X; then
10570     echo "*** WHOA THERE!!! ***" >&4
10571     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10572     xxx_convert=sprintf
10573 fi
10574
10575 case "$xxx_convert" in
10576 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10577 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10578 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10579 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10580    "$define$define$define")
10581       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10582    "$define$define$undef")
10583       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10584    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10585    esac
10586    ;;
10587 esac
10588
10589 fi
10590 $rm_try
10591
10592 : see if _fwalk exists
10593 set fwalk d__fwalk
10594 eval $inlibc
10595
10596 : see if accept4 exists
10597 set accept4 d_accept4
10598 eval $inlibc
10599
10600 : Initialize h_fcntl
10601 h_fcntl=false
10602
10603 : Initialize h_sysfile
10604 h_sysfile=false
10605
10606 : access call always available on UNIX
10607 set access d_access
10608 eval $inlibc
10609
10610 : locate the flags for 'access()'
10611 case "$d_access" in
10612 "$define")
10613         echo " "
10614         $cat >access.c <<EOCP
10615 #include <sys/types.h>
10616 #ifdef I_FCNTL
10617 #include <fcntl.h>
10618 #endif
10619 #ifdef I_SYS_FILE
10620 #include <sys/file.h>
10621 #endif
10622 #ifdef I_UNISTD
10623 #include <unistd.h>
10624 #endif
10625 #$i_stdlib I_STDLIB
10626 #ifdef I_STDLIB
10627 #include <stdlib.h>
10628 #endif
10629 int main() {
10630         exit(R_OK);
10631 }
10632 EOCP
10633         : check sys/file.h first, no particular reason here
10634         if $test `./findhdr sys/file.h` && \
10635                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10636                 h_sysfile=true;
10637                 echo "<sys/file.h> defines the *_OK access constants." >&4
10638         elif $test `./findhdr fcntl.h` && \
10639                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10640                 h_fcntl=true;
10641                 echo "<fcntl.h> defines the *_OK access constants." >&4
10642         elif $test `./findhdr unistd.h` && \
10643                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10644                 echo "<unistd.h> defines the *_OK access constants." >&4
10645         else
10646                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10647         fi
10648         ;;
10649 esac
10650 $rm -f access*
10651
10652 : see if accessx exists
10653 set accessx d_accessx
10654 eval $inlibc
10655
10656 : see if acosh exists
10657 set acosh d_acosh
10658 eval $inlibc
10659
10660 : see if aintl exists
10661 set aintl d_aintl
10662 eval $inlibc
10663
10664 : see if alarm exists
10665 set alarm d_alarm
10666 eval $inlibc
10667
10668 : see if 64bit time functions exists
10669
10670 set ctime64 d_ctime64
10671 eval $inlibc
10672
10673 set localtime64 d_localtime64
10674 eval $inlibc
10675
10676 set gmtime64 d_gmtime64
10677 eval $inlibc
10678
10679 set mktime64 d_mktime64
10680 eval $inlibc
10681
10682 set difftime64 d_difftime64
10683 eval $inlibc
10684
10685 set asctime64 d_asctime64
10686 eval $inlibc
10687
10688 : see if POSIX threads are available
10689 set pthread.h i_pthread
10690 eval $inhdr
10691
10692 : define a function to check prototypes
10693 $cat > protochk <<EOSH
10694 $startsh
10695 cc="$cc"
10696 optimize="$optimize"
10697 ccflags="$ccflags"
10698 define="$define"
10699 rm_try="$rm_try"
10700 usethreads=$usethreads
10701 i_pthread=$i_pthread
10702 pthread_h_first=$pthread_h_first
10703 EOSH
10704
10705 $cat >> protochk <<'EOSH'
10706
10707 $rm_try
10708 foo="$1"
10709 shift
10710 while test $# -ge 2; do
10711         case "$1" in
10712                 $define) echo "#include <$2>" >> try.c ;;
10713                 literal) echo "$2" >> try.c ;;
10714         esac
10715     # Extra magic for the benefit of systems that need pthread.h
10716     # to be included early to correctly detect threadsafe functions.
10717     # Such functions must guarantee themselves, though, that the usethreads
10718     # and i_pthread have been defined, before calling protochk.
10719     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10720         echo "#include <pthread.h>" >> try.c
10721         pthread_h_done=yes
10722     fi
10723     shift 2
10724 done
10725 cat >> try.c <<'EOCP'
10726 #define _(args) args
10727 EOCP
10728 echo "$foo" >> try.c
10729 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10730 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10731 status=$?
10732 $rm_try
10733 exit $status
10734 EOSH
10735 chmod +x protochk
10736 $eunicefix protochk
10737
10738 : Define hasproto macro for Configure internal use
10739 hasproto='varname=$1; func=$2; shift; shift;
10740 while $test $# -ge 2; do
10741         case "$1" in
10742         $define) echo "#include <$2>";;
10743         esac ;
10744     shift 2;
10745 done > try.c;
10746 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10747 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10748         echo "$func() prototype found.";
10749         val="$define";
10750 else
10751         echo "$func() prototype NOT found.";
10752         val="$undef";
10753 fi;
10754 set $varname;
10755 eval $setvar;
10756 $rm_try tryout.c'
10757
10758 : see if sys/types.h has to be included
10759 set sys/types.h i_systypes
10760 eval $inhdr
10761
10762 : see if sys/select.h has to be included
10763 set sys/select.h i_sysselct
10764 eval $inhdr
10765
10766 : Define hasfield macro for Configure internal use
10767 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10768 while $test $# -ge 2; do
10769         case "$1" in
10770         $define) echo "#include <$2>";;
10771         esac ;
10772     shift 2;
10773 done > try.c;
10774 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10775 set try;
10776 if eval $compile; then
10777         val="$define";
10778 else
10779         val="$undef";
10780 fi;
10781 set $varname;
10782 eval $setvar;
10783 $rm_try'
10784
10785 : see if we should include sys/time.h
10786 echo " "
10787 i_time='define'
10788 if test "X$timeincl" = X; then
10789         echo "Testing to see if we should include <sys/time.h>." >&4
10790         $echo $n "I'm now running the test program...$c"
10791         $cat >try.c <<EOCP
10792 #include <sys/types.h>
10793 #include <time.h>
10794 #ifdef I_SYSTIME
10795 #ifdef SYSTIMEKERNEL
10796 #define KERNEL
10797 #endif
10798 #include <sys/time.h>
10799 #endif
10800 #ifdef I_SYSSELECT
10801 #include <sys/select.h>
10802 #endif
10803 #$i_stdlib I_STDLIB
10804 #ifdef I_STDLIB
10805 #include <stdlib.h>
10806 #endif
10807 int main()
10808 {
10809         struct tm foo;
10810 #ifdef S_TIMEVAL
10811         struct timeval bar;
10812 #endif
10813 #ifdef S_TIMEZONE
10814         struct timezone tzp;
10815 #endif
10816         if (foo.tm_sec == foo.tm_sec)
10817                 exit(0);
10818 #ifdef S_TIMEVAL
10819         if (bar.tv_sec == bar.tv_sec)
10820                 exit(0);
10821 #endif
10822         exit(1);
10823 }
10824 EOCP
10825         flags=''
10826         for s_timezone in '-DS_TIMEZONE' ''; do
10827         sysselect=''
10828         for s_timeval in '-DS_TIMEVAL' ''; do
10829         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10830         for i_systime in '-DI_SYSTIME' ''; do
10831                 case "$flags" in
10832                 '') $echo $n ".$c"
10833                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10834                         if eval $compile; then
10835                                 set X $i_systime $i_systimek $sysselect $s_timeval
10836                                 shift
10837                                 flags="$*"
10838                                 echo " "
10839                                 $echo $n "Succeeded with $flags$c"
10840                         fi
10841                         ;;
10842                 esac
10843         done
10844         done
10845         done
10846         done
10847         timeincl=''
10848         echo " "
10849         case "$flags" in
10850         *SYSTIMEKERNEL*) i_systimek="$define"
10851                 timeincl=`./findhdr sys/time.h`
10852                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10853         *) i_systimek="$undef";;
10854         esac
10855         case "$flags" in
10856         *I_SYSTIME*) i_systime="$define"
10857                 timeincl=`./findhdr sys/time.h`" $timeincl"
10858                 echo "We'll include <sys/time.h>." >&4;;
10859         *) i_systime="$undef";;
10860         esac
10861         $rm_try
10862 fi
10863 : see if struct tm knows about tm_zone
10864 case "$i_systime$i_time" in
10865 *$define*)
10866         echo " "
10867         echo "Checking to see if your struct tm has tm_zone field..." >&4
10868         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10869         eval $hasfield
10870         ;;
10871 *)      val="$undef"
10872         set d_tm_tm_zone
10873         eval $setvar
10874         ;;
10875 esac
10876 case "$d_tm_tm_zone" in
10877 "$define")      echo "Yes, it does."   ;;
10878 *)              echo "No, it doesn't." ;;
10879 esac
10880 : see if struct tm knows about tm_gmtoff
10881 case "$i_systime$i_time" in
10882 *$define*)
10883         echo " "
10884         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10885         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10886         eval $hasfield
10887         ;;
10888 *)      val="$undef"
10889         set d_tm_tm_gmtoff
10890         eval $setvar
10891         ;;
10892 esac
10893 case "$d_tm_tm_gmtoff" in
10894 "$define")      echo "Yes, it does."   ;;
10895 *)              echo "No, it doesn't." ;;
10896 esac
10897
10898 : see if asctime_r exists
10899 set asctime_r d_asctime_r
10900 eval $inlibc
10901 case "$d_asctime_r" in
10902 "$define")
10903         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10904         case "$d_asctime_r_proto:$usethreads" in
10905         ":define")      d_asctime_r_proto=define
10906                 set d_asctime_r_proto asctime_r $hdrs
10907                 eval $hasproto ;;
10908         *)      ;;
10909         esac
10910         case "$d_asctime_r_proto" in
10911         define)
10912         case "$asctime_r_proto" in
10913         ''|0) try='char* asctime_r(const struct tm*, char*);'
10914         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10915         esac
10916         case "$asctime_r_proto" in
10917         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10918         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10919         esac
10920         case "$asctime_r_proto" in
10921         ''|0) try='int asctime_r(const struct tm*, char*);'
10922         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10923         esac
10924         case "$asctime_r_proto" in
10925         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10926         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10927         esac
10928         case "$asctime_r_proto" in
10929         ''|0)   d_asctime_r=undef
10930                 asctime_r_proto=0
10931                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10932         * )     case "$asctime_r_proto" in
10933                 REENTRANT_PROTO*) ;;
10934                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10935                 esac
10936                 echo "Prototype: $try" ;;
10937         esac
10938         ;;
10939         *)      case "$usethreads" in
10940                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10941                 esac
10942                 d_asctime_r=undef
10943                 asctime_r_proto=0
10944                 ;;
10945         esac
10946         ;;
10947 *)      asctime_r_proto=0
10948         ;;
10949 esac
10950
10951 : see if asinh exists
10952 set asinh d_asinh
10953 eval $inlibc
10954
10955 : see if atanh exists
10956 set atanh d_atanh
10957 eval $inlibc
10958
10959 : see if atolf exists
10960 set atolf d_atolf
10961 eval $inlibc
10962
10963 : see if atoll exists
10964 set atoll d_atoll
10965 eval $inlibc
10966
10967 : Look for GCC-style attribute format
10968 case "$d_attribute_format" in
10969 '')
10970 echo " "
10971 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10972 $cat >attrib.c <<'EOCP'
10973 #include <stdio.h>
10974 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10975 EOCP
10976 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10977         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10978                 echo "Your C compiler doesn't support __attribute__((format))."
10979                 val="$undef"
10980         else
10981                 echo "Your C compiler supports __attribute__((format))."
10982                 val="$define"
10983         fi
10984 else
10985         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10986         val="$undef"
10987 fi
10988 ;;
10989 *) val="$d_attribute_format" ;;
10990 esac
10991 set d_attribute_format
10992 eval $setvar
10993 $rm -f attrib*
10994
10995 : Look for GCC-style attribute format with null format allowed
10996 case "$d_printf_format_null" in
10997 '') case "$d_attribute_format" in
10998     $define)
10999         echo " "
11000         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11001 $cat >attrib.c <<EOCP
11002 #include <stdio.h>
11003 #$i_stdlib I_STDLIB
11004 #ifdef I_STDLIB
11005 #include <stdlib.h>
11006 #endif
11007 #$i_inttypes I_INTTYPES
11008 #ifdef I_INTTYPES
11009 #include <inttypes.h>
11010 #endif
11011 #ifndef INTPTR_MAX
11012 #define intptr_t int
11013 #endif
11014 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11015 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11016 int main () { exit(null_printf(NULL)); }
11017 EOCP
11018         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11019             : run the executable in case it produces a run-time warning
11020             if $run ./attrib >>attrib.out 2>&1; then
11021                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11022                     echo "Your C compiler doesn't allow __printf__ format to be null."
11023                     val="$undef"
11024                 else
11025                     echo "Your C compiler allows __printf__ format to be null."
11026                     val="$define"
11027                 fi
11028             else
11029             echo "Your C compiler executable failed with __printf__ format null."
11030             val="$undef"
11031         fi
11032     else
11033         echo "Your C compiler fails with __printf__ format null."
11034         val="$undef"
11035     fi
11036     ;;
11037     *)  val="$undef" ;;
11038     esac
11039 ;;
11040 *)  val="$d_printf_format_null" ;;
11041 esac
11042 set d_printf_format_null
11043 eval $setvar
11044 $rm -f attrib*
11045
11046 : Look for GCC-style attribute malloc
11047 case "$d_attribute_malloc" in
11048 '')
11049 echo " "
11050 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11051 $cat >attrib.c <<'EOCP'
11052 #include <stdio.h>
11053 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11054 EOCP
11055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11056         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11057                 echo "Your C compiler doesn't support __attribute__((malloc))."
11058                 val="$undef"
11059         else
11060                 echo "Your C compiler supports __attribute__((malloc))."
11061                 val="$define"
11062         fi
11063 else
11064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11065         val="$undef"
11066 fi
11067 ;;
11068 *) val="$d_attribute_malloc" ;;
11069 esac
11070 set d_attribute_malloc
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute nonnull
11075 case "$d_attribute_nonnull" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((nonnull))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_nonnull" ;;
11097 esac
11098 set d_attribute_nonnull
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute noreturn
11103 case "$d_attribute_noreturn" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 void fall_over_dead( void ) __attribute__((noreturn));
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((noreturn))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_noreturn" ;;
11125 esac
11126 set d_attribute_noreturn
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute pure
11131 case "$d_attribute_pure" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 int square( int n ) __attribute__((pure));
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((pure))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((pure))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_pure" ;;
11153 esac
11154 set d_attribute_pure
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : Look for GCC-style attribute unused
11159 case "$d_attribute_unused" in
11160 '')
11161 echo " "
11162 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11163 $cat >attrib.c <<'EOCP'
11164 #include <stdio.h>
11165 int do_something( int dummy __attribute__((unused)), int n );
11166 EOCP
11167 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11168         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11169                 echo "Your C compiler doesn't support __attribute__((unused))."
11170                 val="$undef"
11171         else
11172                 echo "Your C compiler supports __attribute__((unused))."
11173                 val="$define"
11174         fi
11175 else
11176         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11177         val="$undef"
11178 fi
11179 ;;
11180 *) val="$d_attribute_unused" ;;
11181 esac
11182 set d_attribute_unused
11183 eval $setvar
11184 $rm -f attrib*
11185
11186 : Look for GCC-style attribute deprecated
11187 case "$d_attribute_deprecated" in
11188 '')
11189 echo " "
11190 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11191 $cat >attrib.c <<'EOCP'
11192 #include <stdio.h>
11193 int I_am_deprecated(void) __attribute__((deprecated));
11194 EOCP
11195 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11196         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11197                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11198                 val="$undef"
11199         else
11200                 echo "Your C compiler supports __attribute__((deprecated))."
11201                 val="$define"
11202         fi
11203 else
11204         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11205         val="$undef"
11206 fi
11207 ;;
11208 *) val="$d_attribute_deprecated" ;;
11209 esac
11210 set d_attribute_deprecated
11211 eval $setvar
11212 $rm -f attrib*
11213
11214 : Look for GCC-style attribute warn_unused_result
11215 case "$d_attribute_warn_unused_result" in
11216 '')
11217 echo " "
11218 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11219 $cat >attrib.c <<'EOCP'
11220 #include <stdio.h>
11221 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11222 EOCP
11223 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11224         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11225                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11226                 val="$undef"
11227         else
11228                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11229                 val="$define"
11230         fi
11231 else
11232         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11233         val="$undef"
11234 fi
11235 ;;
11236 *) val="$d_attribute_warn_unused_result" ;;
11237 esac
11238 set d_attribute_warn_unused_result
11239 eval $setvar
11240 $rm -f attrib*
11241
11242 : see if getpgrp exists
11243 set getpgrp d_getpgrp
11244 eval $inlibc
11245
11246 case "$d_getpgrp" in
11247 "$define")
11248         echo " "
11249         echo "Checking to see which flavor of getpgrp is in use..."
11250         $cat >try.c <<EOP
11251 #$i_unistd I_UNISTD
11252 #include <sys/types.h>
11253 #ifdef I_UNISTD
11254 #  include <unistd.h>
11255 #endif
11256 #$i_stdlib I_STDLIB
11257 #ifdef I_STDLIB
11258 #include <stdlib.h>
11259 #endif
11260 int main()
11261 {
11262         if (getuid() == 0) {
11263                 printf("(I see you are running Configure as super-user...)\n");
11264                 setuid(1);
11265         }
11266 #ifdef TRY_BSD_PGRP
11267         if (getpgrp(1) == 0)
11268                 exit(0);
11269 #else
11270         if (getpgrp() > 0)
11271                 exit(0);
11272 #endif
11273         exit(1);
11274 }
11275 EOP
11276         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11277                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11278                 val="$define"
11279         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11280                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11281                 val="$undef"
11282         else
11283                 echo "I can't seem to compile and run the test program."
11284                 if ./usg; then
11285                         xxx="a USG one, i.e. you use getpgrp()."
11286                 else
11287                         # SVR4 systems can appear rather BSD-ish.
11288                         case "$i_unistd" in
11289                         $undef)
11290                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11291                                 val="$define"
11292                                 ;;
11293                         $define)
11294                                 xxx="probably a USG one, i.e. you use getpgrp()."
11295                                 val="$undef"
11296                                 ;;
11297                         esac
11298                 fi
11299                 echo "Assuming your getpgrp is $xxx" >&4
11300         fi
11301         ;;
11302 *) val="$undef";;
11303 esac
11304 set d_bsdgetpgrp
11305 eval $setvar
11306 $rm_try
11307
11308 : see if setpgrp exists
11309 set setpgrp d_setpgrp
11310 eval $inlibc
11311
11312 case "$d_setpgrp" in
11313 "$define")
11314         echo " "
11315         echo "Checking to see which flavor of setpgrp is in use..."
11316         $cat >try.c <<EOP
11317 #$i_unistd I_UNISTD
11318 #include <sys/types.h>
11319 #ifdef I_UNISTD
11320 #  include <unistd.h>
11321 #endif
11322 #$i_stdlib I_STDLIB
11323 #ifdef I_STDLIB
11324 #include <stdlib.h>
11325 #endif
11326 int main()
11327 {
11328         if (getuid() == 0) {
11329                 printf("(I see you are running Configure as super-user...)\n");
11330                 setuid(1);
11331         }
11332 #ifdef TRY_BSD_PGRP
11333         if (-1 == setpgrp(1, 1))
11334                 exit(0);
11335 #else
11336         if (setpgrp() != -1)
11337                 exit(0);
11338 #endif
11339         exit(1);
11340 }
11341 EOP
11342         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11343                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11344                 val="$define"
11345         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11346                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11347                 val="$undef"
11348         else
11349                 echo "(I can't seem to compile and run the test program.)"
11350                 if ./usg; then
11351                         xxx="a USG one, i.e. you use setpgrp()."
11352                 else
11353                         # SVR4 systems can appear rather BSD-ish.
11354                         case "$i_unistd" in
11355                         $undef)
11356                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11357                                 val="$define"
11358                                 ;;
11359                         $define)
11360                                 xxx="probably a USG one, i.e. you use setpgrp()."
11361                                 val="$undef"
11362                                 ;;
11363                         esac
11364                 fi
11365                 echo "Assuming your setpgrp is $xxx" >&4
11366         fi
11367         ;;
11368 *) val="$undef";;
11369 esac
11370 set d_bsdsetpgrp
11371 eval $setvar
11372 $rm_try
11373
11374 : Look for GCC-style __builtin_add_overflow
11375 case "$d_builtin_add_overflow" in
11376 '')
11377     echo " "
11378     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11379     $cat >try.c <<'EOCP'
11380 int main(void) {
11381     const unsigned int uint_max = ~0u;
11382     int target_int = 0;
11383     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11384         return 1;
11385     }
11386     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11387         return 1;
11388     }
11389     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11390         return 1;
11391     }
11392     return 0;
11393 }
11394 EOCP
11395     set try
11396     if eval $compile && $run ./try; then
11397         echo "Your C compiler supports __builtin_add_overflow."
11398         val="$define"
11399     else
11400         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11401         val="$undef"
11402     fi
11403     ;;
11404 *) val="$d_builtin_add_overflow" ;;
11405 esac
11406
11407 set d_builtin_add_overflow
11408 eval $setvar
11409 $rm_try
11410
11411 : Look for GCC-style __builtin_sub_overflow
11412 case "$d_builtin_sub_overflow" in
11413 '')
11414     echo " "
11415     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11416     $cat >try.c <<'EOCP'
11417 int main(void) {
11418     const unsigned int uint_max = ~0u;
11419     int target_int = 0;
11420     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11421         return 1;
11422     }
11423     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11424         return 1;
11425     }
11426     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11427         return 1;
11428     }
11429     return 0;
11430 }
11431 EOCP
11432     set try
11433     if eval $compile && $run ./try; then
11434         echo "Your C compiler supports __builtin_sub_overflow."
11435         val="$define"
11436     else
11437         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11438         val="$undef"
11439     fi
11440     ;;
11441 *) val="$d_builtin_sub_overflow" ;;
11442 esac
11443
11444 set d_builtin_sub_overflow
11445 eval $setvar
11446 $rm_try
11447
11448 : Look for GCC-style __builtin_mul_overflow
11449 case "$d_builtin_mul_overflow" in
11450 '')
11451     echo " "
11452     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11453     $cat >try.c <<'EOCP'
11454 int main(void) {
11455     const unsigned int uint_max = ~0u;
11456     int target_int = 0;
11457     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11458         return 1;
11459     }
11460     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11461         return 1;
11462     }
11463     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11464         return 1;
11465     }
11466     return 0;
11467 }
11468 EOCP
11469     set try
11470     if eval $compile && $run ./try; then
11471         echo "Your C compiler supports __builtin_mul_overflow."
11472         val="$define"
11473     else
11474         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11475         val="$undef"
11476     fi
11477     ;;
11478 *) val="$d_builtin_mul_overflow" ;;
11479 esac
11480
11481 set d_builtin_mul_overflow
11482 eval $setvar
11483 $rm_try
11484
11485 : Look for GCC-style __builtin_choose_expr
11486 case "$d_builtin_choose_expr" in
11487 '')
11488     echo " "
11489     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11490     $cat >try.c <<'EOCP'
11491 #include <assert.h>
11492 #include <stdlib.h>
11493 #include <stdio.h>
11494
11495 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11496
11497 int main(void) {
11498     assert( SYRINX(1) == 2112 );
11499     assert( SYRINX(1) != 5150 );
11500     assert( SYRINX(0) == 5150 );
11501     assert( SYRINX(0) != 2112 );
11502     puts( "All good!" );
11503     exit(0);
11504 }
11505
11506 EOCP
11507     set try
11508     if eval $compile && $run ./try; then
11509         echo "Your C compiler supports __builtin_choose_expr."
11510         val="$define"
11511     else
11512         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11513         val="$undef"
11514     fi
11515 ;;
11516 *) val="$d_builtin_choose_expr" ;;
11517 esac
11518
11519 set d_builtin_choose_expr
11520 eval $setvar
11521 $rm_try
11522
11523 : Look for GCC-style __builtin_expect
11524 case "$d_builtin_expect" in
11525 '')
11526     echo " "
11527     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11528     $cat >try.c <<'EOCP'
11529 int main(void) {
11530     int n = 50;
11531     if ( __builtin_expect(n, 0) ) n = 1;
11532     /* Remember shell exit code truth is 0, C truth is non-zero */
11533     return !(n == 1);
11534 }
11535 EOCP
11536     set try
11537     if eval $compile && $run ./try; then
11538         echo "Your C compiler supports __builtin_expect."
11539         val="$define"
11540     else
11541         echo "Your C compiler doesn't seem to understand __builtin_expect."
11542         val="$undef"
11543     fi
11544     ;;
11545 *) val="$d_builtin_expect" ;;
11546 esac
11547
11548 set d_builtin_expect
11549 eval $setvar
11550 $rm_try
11551
11552 : see if the Compiler supports C99 variadic macros
11553 echo "Checking for C99 variadic macros." >&4
11554 $cat >try.c <<EOCP
11555 #include <stdio.h>
11556 #include <stdarg.h>
11557
11558 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11559
11560 int main() {
11561   char buf[20];
11562   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11563   puts(buf);
11564   return 0;
11565 }
11566 EOCP
11567 set try
11568 if eval $compile && $run ./try 2>&1 >/dev/null; then
11569     case "`$run ./try`" in
11570         "123 456 789")
11571         echo "You have C99 variadic macros." >&4
11572         d_c99_variadic_macros="$define"
11573         ;;
11574         *)
11575         echo "You don't have functional C99 variadic macros." >&4
11576         d_c99_variadic_macros="$undef"
11577         ;;
11578     esac
11579 else
11580     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11581     d_c99_variadic_macros="$undef"
11582 fi
11583 $rm_try
11584
11585 : see if signal is declared as pointer to function returning int or void
11586 echo " "
11587 xxx=`./findhdr signal.h`
11588 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11589 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11590         echo "You have int (*signal())() instead of void." >&4
11591         val="$undef"
11592 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11593         echo "You have void (*signal())()." >&4
11594         val="$define"
11595 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11596         echo "You have int (*signal())() instead of void." >&4
11597         val="$undef"
11598 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11599         echo "You have void (*signal())()." >&4
11600         val="$define"
11601 else
11602         case "$d_voidsig" in
11603         '')
11604         echo "I can't determine whether signal handler returns void or int..." >&4
11605                 dflt=void
11606                 rp="What type does your signal handler return?"
11607                 . ./myread
11608                 case "$ans" in
11609                 v*) val="$define";;
11610                 *) val="$undef";;
11611                 esac;;
11612         "$define")
11613                 echo "As you already told me, signal handler returns void." >&4
11614                 val="$define"
11615                 ;;
11616         *)      echo "As you already told me, signal handler returns int." >&4
11617                 val="$undef"
11618                 ;;
11619         esac
11620 fi
11621 set d_voidsig
11622 eval $setvar
11623 case "$d_voidsig" in
11624 "$define") signal_t="void";;
11625 *) signal_t="int";;
11626 esac
11627 $rm -f $$.tmp
11628
11629 : check for ability to cast large floats to 32-bit ints.
11630 echo " "
11631 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11632 if $test "$intsize" -ge 4; then
11633         xxx=int
11634 else
11635         xxx=long
11636 fi
11637 $cat >try.c <<EOCP
11638 #include <stdio.h>
11639 #$i_stdlib I_STDLIB
11640 #ifdef I_STDLIB
11641 #include <stdlib.h>
11642 #endif
11643 #include <sys/types.h>
11644 #include <signal.h>
11645 $signal_t blech(int s) { exit(3); }
11646 int main()
11647 {
11648         $xxx i32;
11649         double f, g;
11650         int result = 0;
11651         char str[16];
11652         signal(SIGFPE, blech);
11653
11654         /* Don't let compiler optimize the test away.  Store the number
11655            in a writable string for gcc to pass to sscanf under HP-UX.
11656         */
11657         sprintf(str, "2147483647");
11658         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11659         g = 10 * f;
11660         i32  = ($xxx) g;
11661
11662         /* x86 processors will probably give 0x8000 0000, which is a
11663            sign change.  We don't want that.  We want to mimic SPARC
11664            behavior here, which is to preserve the sign and give
11665            back 0x7fff ffff.
11666         */
11667         if (i32 != ($xxx) f)
11668                 result |= 1;
11669         exit(result);
11670 }
11671 EOCP
11672 set try
11673 if eval $compile_ok; then
11674         $run ./try 2>/dev/null
11675         yyy=$?
11676 else
11677         echo "(I can't seem to compile the test program--assuming it can't)"
11678         yyy=1
11679 fi
11680 case "$yyy" in
11681 0)      val="$define"
11682         echo "Yup, it can."
11683         ;;
11684 *)      val="$undef"
11685         echo "Nope, it can't."
11686         ;;
11687 esac
11688 set d_casti32
11689 eval $setvar
11690 $rm_try
11691
11692 : check for ability to cast negative floats to unsigned
11693 echo " "
11694 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11695 $cat >try.c <<EOCP
11696 #include <stdio.h>
11697 #$i_stdlib I_STDLIB
11698 #ifdef I_STDLIB
11699 #include <stdlib.h>
11700 #endif
11701 #include <sys/types.h>
11702 #include <signal.h>
11703 $signal_t blech(int s) { exit(7); }
11704 $signal_t blech_in_list(int s) { exit(4); }
11705 unsigned long dummy_long(unsigned long p) { return p; }
11706 unsigned int dummy_int(unsigned int p) { return p; }
11707 unsigned short dummy_short(unsigned short p) { return p; }
11708 int main()
11709 {
11710         double f;
11711         unsigned long along;
11712         unsigned int aint;
11713         unsigned short ashort;
11714         int result = 0;
11715         char str[16];
11716
11717         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11718            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11719            optimized the whole file away
11720         */
11721         /* Store the number in a writable string for gcc to pass to
11722            sscanf under HP-UX.
11723         */
11724         sprintf(str, "-123");
11725         sscanf(str, "%lf", &f);  /* f = -123.; */
11726
11727         signal(SIGFPE, blech);
11728         along = (unsigned long)f;
11729         aint = (unsigned int)f;
11730         ashort = (unsigned short)f;
11731         if (along != (unsigned long)-123)
11732                 result |= 1;
11733         if (aint != (unsigned int)-123)
11734                 result |= 1;
11735         if (ashort != (unsigned short)-123)
11736                 result |= 1;
11737         sprintf(str, "1073741824.");
11738         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11739         f = f + f;
11740         along = 0;
11741         along = (unsigned long)f;
11742         if (along != 0x80000000)
11743                 result |= 2;
11744         f -= 1.;
11745         along = 0;
11746         along = (unsigned long)f;
11747         if (along != 0x7fffffff)
11748                 result |= 1;
11749         f += 2.;
11750         along = 0;
11751         along = (unsigned long)f;
11752         if (along != 0x80000001)
11753                 result |= 2;
11754         if (result)
11755                 exit(result);
11756         signal(SIGFPE, blech_in_list);
11757         sprintf(str, "123.");
11758         sscanf(str, "%lf", &f);  /* f = 123.; */
11759         along = dummy_long((unsigned long)f);
11760         aint = dummy_int((unsigned int)f);
11761         ashort = dummy_short((unsigned short)f);
11762         if (along != (unsigned long)123)
11763                 result |= 4;
11764         if (aint != (unsigned int)123)
11765                 result |= 4;
11766         if (ashort != (unsigned short)123)
11767                 result |= 4;
11768         exit(result);
11769
11770 }
11771 EOCP
11772 set try
11773 if eval $compile_ok; then
11774         $run ./try 2>/dev/null
11775         castflags=$?
11776 else
11777         echo "(I can't seem to compile the test program--assuming it can't)"
11778         castflags=7
11779 fi
11780 case "$castflags" in
11781 0)      val="$define"
11782         echo "Yup, it can."
11783         ;;
11784 *)      val="$undef"
11785         echo "Nope, it can't."
11786         ;;
11787 esac
11788 set d_castneg
11789 eval $setvar
11790 $rm_try
11791
11792 : see if cbrt exists
11793 set cbrt d_cbrt
11794 eval $inlibc
11795
11796 : see if chown exists
11797 set chown d_chown
11798 eval $inlibc
11799
11800 : see if chroot exists
11801 set chroot d_chroot
11802 eval $inlibc
11803
11804 : see if chsize exists
11805 set chsize d_chsize
11806 eval $inlibc
11807
11808 : see if class exists
11809 set class d_class
11810 eval $inlibc
11811
11812 : see if clearenv exists
11813 set clearenv d_clearenv
11814 eval $inlibc
11815
11816 : Define hasstruct macro for Configure internal use
11817 hasstruct='varname=$1; struct=$2; shift; shift;
11818 while $test $# -ge 2; do
11819         case "$1" in
11820         $define) echo "#include <$2>";;
11821         esac ;
11822     shift 2;
11823 done > try.c;
11824 echo "int main () { struct $struct foo; }" >> try.c;
11825 set try;
11826 if eval $compile; then
11827         val="$define";
11828 else
11829         val="$undef";
11830 fi;
11831 set $varname;
11832 eval $setvar;
11833 $rm_try'
11834
11835 : see whether socket exists
11836 socketlib=''
11837 sockethdr=''
11838 echo " "
11839 $echo $n "Hmm... $c" >&4
11840 if set socket val -f d_socket; eval $csym; $val; then
11841     echo "Looks like you have Berkeley networking support." >&4
11842     d_socket="$define"
11843     if set setsockopt val -f; eval $csym; $val; then
11844         d_oldsock="$undef"
11845     else
11846         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11847         d_oldsock="$define"
11848     fi
11849 else
11850     if $contains socklib libc.list >/dev/null 2>&1; then
11851         echo "Looks like you have Berkeley networking support." >&4
11852         d_socket="$define"
11853         : we will have to assume that it supports the 4.2 BSD interface
11854         d_oldsock="$undef"
11855     else
11856         echo "You don't have Berkeley networking in libc$_a..." >&4
11857         if test "X$d_socket" = "X$define"; then
11858             echo "...but you seem to believe that you have sockets." >&4
11859         else
11860             for net in net socket
11861             do
11862                 if test -f $sysroot/usr/lib/lib$net$_a; then
11863                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11864                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11865                     if $contains socket libc.list >/dev/null 2>&1; then
11866                         d_socket="$define"
11867                         socketlib="-l$net"
11868                         case "$net" in
11869                         net)
11870                             echo "...but the Wollongong group seems to have hacked it in." >&4
11871                             sockethdr="-I$sysroot/usr/netinclude"
11872                             ;;
11873                         esac
11874                         echo "Found Berkeley sockets interface in lib$net." >&4
11875                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11876                             d_oldsock="$undef"
11877                         else
11878                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11879                             d_oldsock="$define"
11880                         fi
11881                         break
11882                     fi
11883                 fi
11884             done
11885             if test "X$d_socket" != "X$define"; then
11886                echo "or anywhere else I see." >&4
11887                d_socket="$undef"
11888                d_oldsock="$undef"
11889             fi
11890         fi
11891     fi
11892 fi
11893
11894 : see if socketpair exists
11895 set socketpair d_sockpair
11896 eval $inlibc
11897
11898
11899 echo " "
11900 echo "Checking the availability sa_len in the sock struct ..." >&4
11901 $cat >try.c <<EOF
11902 #include <sys/types.h>
11903 #include <sys/socket.h>
11904 int main() {
11905 struct sockaddr sa;
11906 return (sa.sa_len);
11907 }
11908 EOF
11909 val="$undef"
11910 set try; if eval $compile; then
11911     val="$define"
11912 fi
11913 set d_sockaddr_sa_len; eval $setvar
11914 $rm_try
11915
11916 echo " "
11917 echo "Checking the availability struct sockaddr_in6 ..." >&4
11918 $cat >try.c <<EOF
11919 #include <sys/types.h>
11920 #include <sys/socket.h>
11921 #include <netinet/in.h>
11922 int main() {
11923 struct sockaddr_in6 sin6;
11924 return (sin6.sin6_family);
11925 }
11926 EOF
11927 val="$undef"
11928 set try; if eval $compile; then
11929     val="$define"
11930 fi
11931 set d_sockaddr_in6; eval $setvar
11932 $rm_try
11933
11934 echo " "
11935 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11936 $cat >try.c <<EOF
11937 #include <sys/types.h>
11938 #include <sys/socket.h>
11939 #include <netinet/in.h>
11940 int main() {
11941 struct sockaddr_in6 sin6;
11942 return (sin6.sin6_scope_id);
11943 }
11944 EOF
11945 val="$undef"
11946 set try; if eval $compile; then
11947     val="$define"
11948 fi
11949 set d_sin6_scope_id; eval $setvar
11950 $rm_try
11951
11952 echo " "
11953 echo "Checking the availability struct ip_mreq ..." >&4
11954 $cat >try.c <<EOF
11955 #include <sys/types.h>
11956 #include <sys/socket.h>
11957 #include <netinet/in.h>
11958 int main() {
11959 struct ip_mreq mreq;
11960 return (mreq.imr_multiaddr.s_addr);
11961 }
11962 EOF
11963 val="$undef"
11964 set try; if eval $compile; then
11965        val="$define"
11966 fi
11967 set d_ip_mreq; eval $setvar
11968 $rm_try
11969
11970 echo " "
11971 echo "Checking the availability struct ip_mreq_source ..." >&4
11972 $cat >try.c <<EOF
11973 #include <sys/types.h>
11974 #include <sys/socket.h>
11975 #include <netinet/in.h>
11976 int main() {
11977 struct ip_mreq_source mreq;
11978 return (mreq.imr_multiaddr.s_addr);
11979 }
11980 EOF
11981 val="$undef"
11982 set try; if eval $compile; then
11983        val="$define"
11984 fi
11985 set d_ip_mreq_source; eval $setvar
11986 $rm_try
11987
11988 echo " "
11989 echo "Checking the availability struct ipv6_mreq ..." >&4
11990 $cat >try.c <<EOF
11991 #include <sys/types.h>
11992 #include <sys/socket.h>
11993 #include <netinet/in.h>
11994 int main() {
11995 struct ipv6_mreq mreq;
11996 return (mreq.ipv6mr_interface);
11997 }
11998 EOF
11999 val="$undef"
12000 set try; if eval $compile; then
12001     val="$define"
12002 fi
12003 set d_ipv6_mreq; eval $setvar
12004 $rm_try
12005
12006 echo " "
12007 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12008 $cat >try.c <<EOF
12009 #include <sys/types.h>
12010 #include <sys/socket.h>
12011 #include <netinet/in.h>
12012 int main() {
12013 struct ipv6_mreq_source mreq;
12014 return (mreq.imr_multiaddr.s_addr);
12015 }
12016 EOF
12017 val="$undef"
12018 set try; if eval $compile; then
12019        val="$define"
12020 fi
12021 set d_ipv6_mreq_source; eval $setvar
12022 $rm_try
12023
12024 echo " "
12025 echo "Checking the availability of certain socket constants..." >&4
12026 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12027     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12028     $cat >try.c <<EOF
12029 #include <sys/types.h>
12030 #include <sys/socket.h>
12031 int main() {
12032     int i = $ENUM;
12033 }
12034 EOF
12035     val="$undef"
12036     set try; if eval $compile; then
12037         val="$define"
12038     fi
12039     set d_${enum}; eval $setvar
12040     $rm_try
12041 done
12042
12043 : see if this is a sys/uio.h system
12044 set sys/uio.h i_sysuio
12045 eval $inhdr
12046
12047 : Check for cmsghdr support
12048 echo " "
12049 echo "Checking to see if your system supports struct cmsghdr..." >&4
12050 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12051 eval $hasstruct
12052 case "$d_cmsghdr_s" in
12053 "$define")      echo "Yes, it does."   ;;
12054 *)              echo "No, it doesn't." ;;
12055 esac
12056
12057 : check for const keyword
12058 echo " "
12059 echo 'Checking to see if your C compiler knows about "const"...' >&4
12060 $cat >const.c <<'EOCP'
12061 typedef struct spug { int drokk; } spug;
12062 int main()
12063 {
12064         const char *foo;
12065         const spug y = { 0 };
12066 }
12067 EOCP
12068 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12069         val="$define"
12070         echo "Yup, it does."
12071 else
12072         val="$undef"
12073         echo "Nope, it doesn't."
12074 fi
12075 set d_const
12076 eval $setvar
12077
12078 : see if copysign exists
12079 set copysign d_copysign
12080 eval $inlibc
12081
12082 : see if copysignl exists
12083 set copysignl d_copysignl
12084 eval $inlibc
12085
12086 : see if crypt exists
12087 echo " "
12088 set crypt d_crypt
12089 eval $inlibc
12090 case "$d_crypt" in
12091 $define) cryptlib='' ;;
12092 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12093                 echo 'crypt() found.' >&4
12094                 val="$define"
12095                 cryptlib=''
12096         else
12097                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12098                 if $test -z "$cryptlib"; then
12099                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12100                 else
12101                         cryptlib=-lcrypt
12102                 fi
12103                 if $test -z "$cryptlib"; then
12104                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12105                 else
12106                         cryptlib=-lcrypt
12107                 fi
12108                 if $test -z "$cryptlib"; then
12109                         cryptlib=`./loc libcrypt$_a "" $libpth`
12110                 else
12111                         cryptlib=-lcrypt
12112                 fi
12113                 if $test -z "$cryptlib"; then
12114                         echo 'crypt() NOT found.' >&4
12115                         val="$undef"
12116                 else
12117                         val="$define"
12118                 fi
12119         fi
12120         set d_crypt
12121         eval $setvar
12122         ;;
12123 esac
12124
12125 : see if this is a crypt.h system
12126 set crypt.h i_crypt
12127 eval $inhdr
12128
12129 : see if crypt_r exists
12130 set crypt_r d_crypt_r
12131 eval $inlibc
12132 case "$d_crypt_r" in
12133 "$define")
12134         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12135         case "$d_crypt_r_proto:$usethreads" in
12136         ":define")      d_crypt_r_proto=define
12137                 set d_crypt_r_proto crypt_r $hdrs
12138                 eval $hasproto ;;
12139         *)      ;;
12140         esac
12141         case "$d_crypt_r_proto" in
12142         define)
12143         case "$crypt_r_proto" in
12144         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12145         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12146         esac
12147         case "$crypt_r_proto" in
12148         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12149         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12150         esac
12151         case "$crypt_r_proto" in
12152         ''|0)   d_crypt_r=undef
12153                 crypt_r_proto=0
12154                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12155         * )     case "$crypt_r_proto" in
12156                 REENTRANT_PROTO*) ;;
12157                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12158                 esac
12159                 echo "Prototype: $try" ;;
12160         esac
12161         ;;
12162         *)      case "$usethreads" in
12163                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12164                 esac
12165                 d_crypt_r=undef
12166                 crypt_r_proto=0
12167                 ;;
12168         esac
12169         ;;
12170 *)      crypt_r_proto=0
12171         ;;
12172 esac
12173
12174 : get csh whereabouts
12175 case "$csh" in
12176 'csh') val="$undef" ;;
12177 *) val="$define" ;;
12178 esac
12179 set d_csh
12180 eval $setvar
12181 : Respect a hint or command line value for full_csh.
12182 case "$full_csh" in
12183 '') full_csh=$csh ;;
12184 esac
12185
12186 : see if ctermid exists
12187 set ctermid d_ctermid
12188 eval $inlibc
12189
12190 : see if ctermid_r exists
12191 set ctermid_r d_ctermid_r
12192 eval $inlibc
12193 case "$d_ctermid_r" in
12194 "$define")
12195         hdrs="$i_systypes sys/types.h define stdio.h "
12196         case "$d_ctermid_r_proto:$usethreads" in
12197         ":define")      d_ctermid_r_proto=define
12198                 set d_ctermid_r_proto ctermid_r $hdrs
12199                 eval $hasproto ;;
12200         *)      ;;
12201         esac
12202         case "$d_ctermid_r_proto" in
12203         define)
12204         case "$ctermid_r_proto" in
12205         ''|0) try='char* ctermid_r(char*);'
12206         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12207         esac
12208         case "$ctermid_r_proto" in
12209         ''|0)   d_ctermid_r=undef
12210                 ctermid_r_proto=0
12211                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12212         * )     case "$ctermid_r_proto" in
12213                 REENTRANT_PROTO*) ;;
12214                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12215                 esac
12216                 echo "Prototype: $try" ;;
12217         esac
12218         ;;
12219         *)      case "$usethreads" in
12220                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12221                 esac
12222                 d_ctermid_r=undef
12223                 ctermid_r_proto=0
12224                 ;;
12225         esac
12226         ;;
12227 *)      ctermid_r_proto=0
12228         ;;
12229 esac
12230
12231 : see if ctime_r exists
12232 set ctime_r d_ctime_r
12233 eval $inlibc
12234 case "$d_ctime_r" in
12235 "$define")
12236         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12237         case "$d_ctime_r_proto:$usethreads" in
12238         ":define")      d_ctime_r_proto=define
12239                 set d_ctime_r_proto ctime_r $hdrs
12240                 eval $hasproto ;;
12241         *)      ;;
12242         esac
12243         case "$d_ctime_r_proto" in
12244         define)
12245         case "$ctime_r_proto" in
12246         ''|0) try='char* ctime_r(const time_t*, char*);'
12247         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12248         esac
12249         case "$ctime_r_proto" in
12250         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12251         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12252         esac
12253         case "$ctime_r_proto" in
12254         ''|0) try='int ctime_r(const time_t*, char*);'
12255         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12256         esac
12257         case "$ctime_r_proto" in
12258         ''|0) try='int ctime_r(const time_t*, char*, int);'
12259         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12260         esac
12261         case "$ctime_r_proto" in
12262         ''|0)   d_ctime_r=undef
12263                 ctime_r_proto=0
12264                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12265         * )     case "$ctime_r_proto" in
12266                 REENTRANT_PROTO*) ;;
12267                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12268                 esac
12269                 echo "Prototype: $try" ;;
12270         esac
12271         ;;
12272         *)      case "$usethreads" in
12273                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12274                 esac
12275                 d_ctime_r=undef
12276                 ctime_r_proto=0
12277                 ;;
12278         esac
12279         ;;
12280 *)      ctime_r_proto=0
12281         ;;
12282 esac
12283
12284 : see if cuserid exists
12285 set cuserid d_cuserid
12286 eval $inlibc
12287
12288 : see if dbm.h is available
12289 : see if dbmclose exists
12290 set dbmclose d_dbmclose
12291 eval $inlibc
12292
12293 case "$d_dbmclose" in
12294 $define)
12295         set dbm.h i_dbm
12296         eval $inhdr
12297         case "$i_dbm" in
12298         $define)
12299                 val="$undef"
12300                 set i_rpcsvcdbm
12301                 eval $setvar
12302                 ;;
12303         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12304                 eval $inhdr
12305                 ;;
12306         esac
12307         ;;
12308 *)      echo "We won't be including <dbm.h>"
12309         val="$undef"
12310         set i_dbm
12311         eval $setvar
12312         val="$undef"
12313         set i_rpcsvcdbm
12314         eval $setvar
12315         ;;
12316 esac
12317
12318 : see if prototype for dbminit is available
12319 echo " "
12320 set d_dbminitproto dbminit $i_dbm dbm.h
12321 eval $hasproto
12322
12323 : see if difftime exists
12324 set difftime d_difftime
12325 eval $inlibc
12326
12327 : see if this is a dirent system
12328 echo " "
12329 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12330         val="$define"
12331         echo "<dirent.h> found." >&4
12332 else
12333         val="$undef"
12334         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12335                 echo "<sys/dir.h> found." >&4
12336                 echo " "
12337         else
12338                 xinc=`./findhdr sys/ndir.h`
12339         fi
12340         echo "<dirent.h> NOT found." >&4
12341 fi
12342 set i_dirent
12343 eval $setvar
12344
12345 : Look for type of directory structure.
12346 echo " "
12347 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12348
12349 case "$direntrytype" in
12350 ''|' ')
12351         case "$i_dirent" in
12352         $define) guess1='struct dirent' ;;
12353         *) guess1='struct direct'  ;;
12354         esac
12355         ;;
12356 *)      guess1="$direntrytype"
12357         ;;
12358 esac
12359
12360 case "$guess1" in
12361 'struct dirent') guess2='struct direct' ;;
12362 *) guess2='struct dirent' ;;
12363 esac
12364
12365 if $contains "$guess1" try.c >/dev/null 2>&1; then
12366         direntrytype="$guess1"
12367         echo "Your directory entries are $direntrytype." >&4
12368 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12369         direntrytype="$guess2"
12370         echo "Your directory entries seem to be $direntrytype." >&4
12371 else
12372         echo "I don't recognize your system's directory entries." >&4
12373         rp="What type is used for directory entries on this system?"
12374         dflt="$guess1"
12375         . ./myread
12376         direntrytype="$ans"
12377 fi
12378 $rm_try
12379
12380 : see if the directory entry stores field length
12381 echo " "
12382 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12383 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12384         echo "Good, your directory entry keeps length information in d_namlen." >&4
12385         val="$define"
12386 else
12387         echo "Your directory entry does not know about the d_namlen field." >&4
12388         val="$undef"
12389 fi
12390 set d_dirnamlen
12391 eval $setvar
12392 $rm_try
12393
12394 : Look for DIR.dd_fd
12395 case "$i_dirent" in
12396 "$define")
12397     echo "Checking to see if DIR has a dd_fd member variable" >&4
12398     $cat >try.c <<EOCP
12399 #$i_stdlib I_STDLIB
12400 #ifdef I_STDLIB
12401 #include <stdlib.h>
12402 #endif
12403 #include <dirent.h>
12404
12405 int main() {
12406     DIR dir;
12407     dir.dd_fd = 1;
12408     return 0;
12409 }
12410 EOCP
12411     val=$undef
12412     set try
12413     if eval $compile; then
12414         echo "Yes, it does."
12415         val="$define"
12416     else
12417         echo "No, it does not."
12418         val="$undef"
12419     fi
12420     ;;
12421 *)
12422     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12423     val="$undef"
12424     ;;
12425 esac
12426 set d_dir_dd_fd
12427 eval $setvar
12428 $rm_try
12429
12430 : see if this is an sysdir system
12431 set sys/dir.h i_sysdir
12432 eval $inhdr
12433
12434 : see if this is an sysndir system
12435 set sys/ndir.h i_sysndir
12436 eval $inhdr
12437
12438 : Look for dirfd
12439 echo " "
12440 $cat >dirfd.c <<EOM
12441 #include <stdio.h>
12442 #$i_stdlib I_STDLIB
12443 #ifdef I_STDLIB
12444 #include <stdlib.h>
12445 #endif
12446 #$i_dirent I_DIRENT             /**/
12447 #$i_sysdir I_SYS_DIR            /**/
12448 #$i_sysndir I_SYS_NDIR          /**/
12449 #$i_systypes I_SYS_TYPES        /**/
12450 #if defined(I_SYS_TYPES)
12451 #include <sys/types.h>
12452 #endif
12453 #if defined(I_DIRENT)
12454 #include <dirent.h>
12455 #else
12456 #ifdef I_SYS_NDIR
12457 #include <sys/ndir.h>
12458 #else
12459 #ifdef I_SYS_DIR
12460 #include <sys/dir.h>
12461 #endif
12462 #endif
12463 #endif
12464 int main() {
12465         DIR *dirp = opendir(".");
12466         if (dirfd(dirp) >= 0)
12467                 exit(0);
12468         else
12469                 exit(1);
12470 }
12471 EOM
12472 val=$undef
12473 set dirfd
12474 if eval $compile; then
12475         val="$define"
12476 fi
12477 case "$val" in
12478 $define)        echo "dirfd() found." >&4       ;;
12479 *)              echo "dirfd() NOT found." >&4   ;;
12480 esac
12481 set d_dirfd
12482 eval $setvar
12483 $rm -f dirfd*
12484
12485 : see if dladdr exists
12486 set dladdr d_dladdr
12487 eval $inlibc
12488
12489 : see if dlerror exists
12490 xxx_runnm="$runnm"
12491 runnm=false
12492 set dlerror d_dlerror
12493 eval $inlibc
12494 runnm="$xxx_runnm"
12495
12496 : see if dlfcn is available
12497 set dlfcn.h i_dlfcn
12498 eval $inhdr
12499
12500 : Check what extension to use for shared libs
12501 case "$usedl" in
12502 $define|y|true)
12503         $cat << EOM
12504
12505 On a few systems, the dynamically loaded modules that perl generates and uses
12506 will need a different extension than shared libs. The default will probably
12507 be appropriate.
12508
12509 EOM
12510         case "$dlext" in
12511         '')     dflt="$so" ;;
12512         *)      dflt="$dlext" ;;
12513         esac
12514         rp='What is the extension of dynamically loaded modules'
12515         . ./myread
12516         dlext="$ans"
12517         ;;
12518 *)
12519         dlext="none"
12520         ;;
12521 esac
12522
12523 : Check if dlsym need a leading underscore
12524 echo " "
12525 val="$undef"
12526
12527 case "$dlsrc" in
12528 dl_dlopen.xs)
12529         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12530         $cat >dyna.c <<'EOM'
12531 fred () { }
12532 EOM
12533
12534 $cat >fred.c<<EOM
12535
12536 #include <stdio.h>
12537 #$i_stdlib I_STDLIB
12538 #ifdef I_STDLIB
12539 #include <stdlib.h>
12540 #endif
12541 #$i_dlfcn I_DLFCN
12542 #ifdef I_DLFCN
12543 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12544 #else
12545 #include <sys/types.h>
12546 #include <nlist.h>
12547 #include <link.h>
12548 #endif
12549
12550 extern int fred() ;
12551
12552 int main()
12553 {
12554     void * handle ;
12555     void * symbol ;
12556 #ifndef RTLD_LAZY
12557     int mode = 1 ;
12558 #else
12559     int mode = RTLD_LAZY ;
12560 #endif
12561     handle = dlopen("./dyna.$dlext", mode) ;
12562     if (handle == NULL) {
12563         printf ("1\n") ;
12564         fflush (stdout) ;
12565         exit(0);
12566     }
12567     symbol = dlsym(handle, "fred") ;
12568     if (symbol == NULL) {
12569         /* try putting a leading underscore */
12570         symbol = dlsym(handle, "_fred") ;
12571         if (symbol == NULL) {
12572             printf ("2\n") ;
12573             fflush (stdout) ;
12574             exit(0);
12575         }
12576         printf ("3\n") ;
12577     }
12578     else
12579         printf ("4\n") ;
12580     fflush (stdout) ;
12581     exit(0);
12582 }
12583 EOM
12584         : Call the object file tmp-dyna.o in case dlext=o.
12585         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12586                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12587                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12588                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12589                 xxx=`$run ./fred`
12590                 case $xxx in
12591                 1)      echo "Test program failed using dlopen." >&4
12592                         echo "Perhaps you should not use dynamic loading." >&4;;
12593                 2)      echo "Test program failed using dlsym." >&4
12594                         echo "Perhaps you should not use dynamic loading." >&4;;
12595                 3)      echo "dlsym needs a leading underscore" >&4
12596                         val="$define" ;;
12597                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12598                 esac
12599         else
12600                 echo "I can't compile and run the test program." >&4
12601                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12602         fi
12603         ;;
12604 esac
12605
12606 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12607
12608 set d_dlsymun
12609 eval $setvar
12610
12611 : see if drand48_r exists
12612 set drand48_r d_drand48_r
12613 eval $inlibc
12614 case "$d_drand48_r" in
12615 "$define")
12616         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12617         case "$d_drand48_r_proto:$usethreads" in
12618         ":define")      d_drand48_r_proto=define
12619                 set d_drand48_r_proto drand48_r $hdrs
12620                 eval $hasproto ;;
12621         *)      ;;
12622         esac
12623         case "$d_drand48_r_proto" in
12624         define)
12625         case "$drand48_r_proto" in
12626         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12627         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12628         esac
12629         case "$drand48_r_proto" in
12630         ''|0)   d_drand48_r=undef
12631                 drand48_r_proto=0
12632                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12633         * )     case "$drand48_r_proto" in
12634                 REENTRANT_PROTO*) ;;
12635                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12636                 esac
12637                 echo "Prototype: $try" ;;
12638         esac
12639         ;;
12640         *)      case "$usethreads" in
12641                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12642                 esac
12643                 d_drand48_r=undef
12644                 drand48_r_proto=0
12645                 ;;
12646         esac
12647         ;;
12648 *)      drand48_r_proto=0
12649         ;;
12650 esac
12651
12652 : see if prototype for drand48 is available
12653 echo " "
12654 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12655 eval $hasproto
12656
12657 : see if dup2 exists
12658 set dup2 d_dup2
12659 eval $inlibc
12660
12661 : see if dup3 exists
12662 set dup3 d_dup3
12663 eval $inlibc
12664
12665 : see if this is an xlocale.h system
12666 set xlocale.h i_xlocale
12667 eval $inhdr
12668
12669 : see if newlocale exists
12670 set newlocale d_newlocale
12671 eval $inlibc
12672
12673 : see if freelocale exists
12674 set freelocale d_freelocale
12675 eval $inlibc
12676
12677 : see if uselocale exists
12678 set uselocale d_uselocale
12679 eval $inlibc
12680
12681 : see if duplocale exists
12682 set duplocale d_duplocale
12683 eval $inlibc
12684
12685 : see if querylocale exists
12686 set querylocale d_querylocale
12687 eval $inlibc
12688
12689 : see if eaccess exists
12690 set eaccess d_eaccess
12691 eval $inlibc
12692
12693 : see if endgrent exists
12694 set endgrent d_endgrent
12695 eval $inlibc
12696
12697 : see if this is an grp system
12698 set grp.h i_grp
12699 eval $inhdr
12700
12701 case "$i_grp" in
12702 $define)
12703         xxx=`./findhdr grp.h`
12704         $cppstdin $cppflags $cppminus < $xxx >$$.h
12705
12706         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12707                 val="$define"
12708         else
12709                 val="$undef"
12710         fi
12711         set d_grpasswd
12712         eval $setvar
12713
12714         $rm -f $$.h
12715         ;;
12716 *)
12717         val="$undef";
12718         set d_grpasswd; eval $setvar
12719         ;;
12720 esac
12721
12722 : see if endgrent_r exists
12723 set endgrent_r d_endgrent_r
12724 eval $inlibc
12725 case "$d_endgrent_r" in
12726 "$define")
12727         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12728         case "$d_endgrent_r_proto:$usethreads" in
12729         ":define")      d_endgrent_r_proto=define
12730                 set d_endgrent_r_proto endgrent_r $hdrs
12731                 eval $hasproto ;;
12732         *)      ;;
12733         esac
12734         case "$d_endgrent_r_proto" in
12735         define)
12736         case "$endgrent_r_proto" in
12737         ''|0) try='int endgrent_r(FILE**);'
12738         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12739         esac
12740         case "$endgrent_r_proto" in
12741         ''|0) try='void endgrent_r(FILE**);'
12742         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12743         esac
12744         case "$endgrent_r_proto" in
12745         ''|0)   d_endgrent_r=undef
12746                 endgrent_r_proto=0
12747                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12748         * )     case "$endgrent_r_proto" in
12749                 REENTRANT_PROTO*) ;;
12750                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12751                 esac
12752                 echo "Prototype: $try" ;;
12753         esac
12754         ;;
12755         *)      case "$usethreads" in
12756                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12757                 esac
12758                 d_endgrent_r=undef
12759                 endgrent_r_proto=0
12760                 ;;
12761         esac
12762         ;;
12763 *)      endgrent_r_proto=0
12764         ;;
12765 esac
12766
12767 : see if endhostent exists
12768 set endhostent d_endhent
12769 eval $inlibc
12770
12771 : see if this is a netdb.h system
12772 set netdb.h i_netdb
12773 eval $inhdr
12774
12775 : see if endhostent_r exists
12776 set endhostent_r d_endhostent_r
12777 eval $inlibc
12778 case "$d_endhostent_r" in
12779 "$define")
12780         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12781         case "$d_endhostent_r_proto:$usethreads" in
12782         ":define")      d_endhostent_r_proto=define
12783                 set d_endhostent_r_proto endhostent_r $hdrs
12784                 eval $hasproto ;;
12785         *)      ;;
12786         esac
12787         case "$d_endhostent_r_proto" in
12788         define)
12789         case "$endhostent_r_proto" in
12790         ''|0) try='int endhostent_r(struct hostent_data*);'
12791         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12792         esac
12793         case "$endhostent_r_proto" in
12794         ''|0) try='void endhostent_r(struct hostent_data*);'
12795         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12796         esac
12797         case "$endhostent_r_proto" in
12798         ''|0)   d_endhostent_r=undef
12799                 endhostent_r_proto=0
12800                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12801         * )     case "$endhostent_r_proto" in
12802                 REENTRANT_PROTO*) ;;
12803                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12804                 esac
12805                 echo "Prototype: $try" ;;
12806         esac
12807         ;;
12808         *)      case "$usethreads" in
12809                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12810                 esac
12811                 d_endhostent_r=undef
12812                 endhostent_r_proto=0
12813                 ;;
12814         esac
12815         ;;
12816 *)      endhostent_r_proto=0
12817         ;;
12818 esac
12819
12820 : see if endnetent exists
12821 set endnetent d_endnent
12822 eval $inlibc
12823
12824 : see if endnetent_r exists
12825 set endnetent_r d_endnetent_r
12826 eval $inlibc
12827 case "$d_endnetent_r" in
12828 "$define")
12829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12830         case "$d_endnetent_r_proto:$usethreads" in
12831         ":define")      d_endnetent_r_proto=define
12832                 set d_endnetent_r_proto endnetent_r $hdrs
12833                 eval $hasproto ;;
12834         *)      ;;
12835         esac
12836         case "$d_endnetent_r_proto" in
12837         define)
12838         case "$endnetent_r_proto" in
12839         ''|0) try='int endnetent_r(struct netent_data*);'
12840         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12841         esac
12842         case "$endnetent_r_proto" in
12843         ''|0) try='void endnetent_r(struct netent_data*);'
12844         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12845         esac
12846         case "$endnetent_r_proto" in
12847         ''|0)   d_endnetent_r=undef
12848                 endnetent_r_proto=0
12849                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12850         * )     case "$endnetent_r_proto" in
12851                 REENTRANT_PROTO*) ;;
12852                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12853                 esac
12854                 echo "Prototype: $try" ;;
12855         esac
12856         ;;
12857         *)      case "$usethreads" in
12858                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12859                 esac
12860                 d_endnetent_r=undef
12861                 endnetent_r_proto=0
12862                 ;;
12863         esac
12864         ;;
12865 *)      endnetent_r_proto=0
12866         ;;
12867 esac
12868
12869 : see if endprotoent exists
12870 set endprotoent d_endpent
12871 eval $inlibc
12872
12873 : see if endprotoent_r exists
12874 set endprotoent_r d_endprotoent_r
12875 eval $inlibc
12876 case "$d_endprotoent_r" in
12877 "$define")
12878         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12879         case "$d_endprotoent_r_proto:$usethreads" in
12880         ":define")      d_endprotoent_r_proto=define
12881                 set d_endprotoent_r_proto endprotoent_r $hdrs
12882                 eval $hasproto ;;
12883         *)      ;;
12884         esac
12885         case "$d_endprotoent_r_proto" in
12886         define)
12887         case "$endprotoent_r_proto" in
12888         ''|0) try='int endprotoent_r(struct protoent_data*);'
12889         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12890         esac
12891         case "$endprotoent_r_proto" in
12892         ''|0) try='void endprotoent_r(struct protoent_data*);'
12893         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12894         esac
12895         case "$endprotoent_r_proto" in
12896         ''|0)   d_endprotoent_r=undef
12897                 endprotoent_r_proto=0
12898                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12899         * )     case "$endprotoent_r_proto" in
12900                 REENTRANT_PROTO*) ;;
12901                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12902                 esac
12903                 echo "Prototype: $try" ;;
12904         esac
12905         ;;
12906         *)      case "$usethreads" in
12907                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12908                 esac
12909                 d_endprotoent_r=undef
12910                 endprotoent_r_proto=0
12911                 ;;
12912         esac
12913         ;;
12914 *)      endprotoent_r_proto=0
12915         ;;
12916 esac
12917
12918 : see if endpwent exists
12919 set endpwent d_endpwent
12920 eval $inlibc
12921
12922 : see if this is a pwd.h system
12923 set pwd.h i_pwd
12924 eval $inhdr
12925
12926 case "$i_pwd" in
12927 $define)
12928         xxx=`./findhdr pwd.h`
12929         $cppstdin $cppflags $cppminus < $xxx >$$.h
12930
12931         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12932                 val="$define"
12933         else
12934                 val="$undef"
12935         fi
12936         set d_pwquota
12937         eval $setvar
12938
12939         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12940                 val="$define"
12941         else
12942                 val="$undef"
12943         fi
12944         set d_pwage
12945         eval $setvar
12946
12947         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12948                 val="$define"
12949         else
12950                 val="$undef"
12951         fi
12952         set d_pwchange
12953         eval $setvar
12954
12955         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12956                 val="$define"
12957         else
12958                 val="$undef"
12959         fi
12960         set d_pwclass
12961         eval $setvar
12962
12963         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12964                 val="$define"
12965         else
12966                 val="$undef"
12967         fi
12968         set d_pwexpire
12969         eval $setvar
12970
12971         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12972                 val="$define"
12973         else
12974                 val="$undef"
12975         fi
12976         set d_pwcomment
12977         eval $setvar
12978
12979         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12980                 val="$define"
12981         else
12982                 val="$undef"
12983         fi
12984         set d_pwgecos
12985         eval $setvar
12986
12987         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12988                 val="$define"
12989         else
12990                 val="$undef"
12991         fi
12992         set d_pwpasswd
12993         eval $setvar
12994
12995         $rm -f $$.h
12996         ;;
12997 *)
12998         val="$undef";
12999         set d_pwquota; eval $setvar
13000         set d_pwage; eval $setvar
13001         set d_pwchange; eval $setvar
13002         set d_pwclass; eval $setvar
13003         set d_pwexpire; eval $setvar
13004         set d_pwcomment; eval $setvar
13005         set d_pwgecos; eval $setvar
13006         set d_pwpasswd; eval $setvar
13007         ;;
13008 esac
13009
13010 : see if endpwent_r exists
13011 set endpwent_r d_endpwent_r
13012 eval $inlibc
13013 case "$d_endpwent_r" in
13014 "$define")
13015         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13016         case "$d_endpwent_r_proto:$usethreads" in
13017         ":define")      d_endpwent_r_proto=define
13018                 set d_endpwent_r_proto endpwent_r $hdrs
13019                 eval $hasproto ;;
13020         *)      ;;
13021         esac
13022         case "$d_endpwent_r_proto" in
13023         define)
13024         case "$endpwent_r_proto" in
13025         ''|0) try='int endpwent_r(FILE**);'
13026         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13027         esac
13028         case "$endpwent_r_proto" in
13029         ''|0) try='void endpwent_r(FILE**);'
13030         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13031         esac
13032         case "$endpwent_r_proto" in
13033         ''|0)   d_endpwent_r=undef
13034                 endpwent_r_proto=0
13035                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13036         * )     case "$endpwent_r_proto" in
13037                 REENTRANT_PROTO*) ;;
13038                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13039                 esac
13040                 echo "Prototype: $try" ;;
13041         esac
13042         ;;
13043         *)      case "$usethreads" in
13044                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13045                 esac
13046                 d_endpwent_r=undef
13047                 endpwent_r_proto=0
13048                 ;;
13049         esac
13050         ;;
13051 *)      endpwent_r_proto=0
13052         ;;
13053 esac
13054
13055 : see if endservent exists
13056 set endservent d_endsent
13057 eval $inlibc
13058
13059 : see if endservent_r exists
13060 set endservent_r d_endservent_r
13061 eval $inlibc
13062 case "$d_endservent_r" in
13063 "$define")
13064         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13065         case "$d_endservent_r_proto:$usethreads" in
13066         ":define")      d_endservent_r_proto=define
13067                 set d_endservent_r_proto endservent_r $hdrs
13068                 eval $hasproto ;;
13069         *)      ;;
13070         esac
13071         case "$d_endservent_r_proto" in
13072         define)
13073         case "$endservent_r_proto" in
13074         ''|0) try='int endservent_r(struct servent_data*);'
13075         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13076         esac
13077         case "$endservent_r_proto" in
13078         ''|0) try='void endservent_r(struct servent_data*);'
13079         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13080         esac
13081         case "$endservent_r_proto" in
13082         ''|0)   d_endservent_r=undef
13083                 endservent_r_proto=0
13084                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13085         * )     case "$endservent_r_proto" in
13086                 REENTRANT_PROTO*) ;;
13087                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13088                 esac
13089                 echo "Prototype: $try" ;;
13090         esac
13091         ;;
13092         *)      case "$usethreads" in
13093                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13094                 esac
13095                 d_endservent_r=undef
13096                 endservent_r_proto=0
13097                 ;;
13098         esac
13099         ;;
13100 *)      endservent_r_proto=0
13101         ;;
13102 esac
13103
13104 : Locate the flags for 'open()'
13105 echo " "
13106 $cat >try.c <<EOCP
13107 #include <sys/types.h>
13108 #ifdef I_FCNTL
13109 #include <fcntl.h>
13110 #endif
13111 #ifdef I_SYS_FILE
13112 #include <sys/file.h>
13113 #endif
13114 #$i_stdlib I_STDLIB
13115 #ifdef I_STDLIB
13116 #include <stdlib.h>
13117 #endif
13118 int main() {
13119         if(O_RDONLY);
13120 #ifdef O_TRUNC
13121         exit(0);
13122 #else
13123         exit(1);
13124 #endif
13125 }
13126 EOCP
13127 : check sys/file.h first to get FREAD on Sun
13128 if $test `./findhdr sys/file.h` && \
13129                 set try -DI_SYS_FILE && eval $compile; then
13130         h_sysfile=true;
13131         echo "<sys/file.h> defines the O_* constants..." >&4
13132         if $run ./try; then
13133                 echo "and you have the 3 argument form of open()." >&4
13134                 val="$define"
13135         else
13136                 echo "but not the 3 argument form of open().  Oh, well." >&4
13137                 val="$undef"
13138         fi
13139 elif $test `./findhdr fcntl.h` && \
13140                 set try -DI_FCNTL && eval $compile; then
13141         h_fcntl=true;
13142         echo "<fcntl.h> defines the O_* constants..." >&4
13143         if $run ./try; then
13144                 echo "and you have the 3 argument form of open()." >&4
13145                 val="$define"
13146         else
13147                 echo "but not the 3 argument form of open().  Oh, well." >&4
13148                 val="$undef"
13149         fi
13150 else
13151         val="$undef"
13152         echo "I can't find the O_* constant definitions!  You got problems." >&4
13153 fi
13154 set d_open3
13155 eval $setvar
13156 $rm_try
13157
13158 : see if this is a sys/file.h system
13159 val=''
13160 set sys/file.h val
13161 eval $inhdr
13162
13163 : do we need to include sys/file.h ?
13164 case "$val" in
13165 "$define")
13166         echo " "
13167         if $h_sysfile; then
13168                 val="$define"
13169                 echo "We'll be including <sys/file.h>." >&4
13170         else
13171                 val="$undef"
13172                 echo "We won't be including <sys/file.h>." >&4
13173         fi
13174         ;;
13175 *)
13176         h_sysfile=false
13177         ;;
13178 esac
13179 set i_sysfile
13180 eval $setvar
13181
13182 : see if fcntl.h is there
13183 val=''
13184 set fcntl.h val
13185 eval $inhdr
13186
13187 : see if we can include fcntl.h
13188 case "$val" in
13189 "$define")
13190         echo " "
13191         if $h_fcntl; then
13192                 val="$define"
13193                 echo "We'll be including <fcntl.h>." >&4
13194         else
13195                 val="$undef"
13196                 if $h_sysfile; then
13197         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13198                 else
13199                         echo "We won't be including <fcntl.h>." >&4
13200                 fi
13201         fi
13202         ;;
13203 *)
13204         h_fcntl=false
13205         val="$undef"
13206         ;;
13207 esac
13208 set i_fcntl
13209 eval $setvar
13210
13211 : see if fork exists
13212 set fork d_fork
13213 eval $inlibc
13214
13215 : see if pipe exists
13216 set pipe d_pipe
13217 eval $inlibc
13218
13219 : check for non-blocking I/O stuff
13220 case "$h_sysfile" in
13221 true) echo "#include <sys/file.h>" > head.c;;
13222 *)
13223        case "$h_fcntl" in
13224        true) echo "#include <fcntl.h>" > head.c;;
13225        *) echo "#include <sys/fcntl.h>" > head.c;;
13226        esac
13227        ;;
13228 esac
13229 echo " "
13230 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13231 case "$o_nonblock" in
13232 '')
13233         $cat head.c > try.c
13234         $cat >>try.c <<EOCP
13235 #include <stdio.h>
13236 #$i_stdlib I_STDLIB
13237 #ifdef I_STDLIB
13238 #include <stdlib.h>
13239 #endif
13240 #$i_fcntl I_FCNTL
13241 #ifdef I_FCNTL
13242 #include <fcntl.h>
13243 #endif
13244 int main() {
13245 #ifdef O_NONBLOCK
13246         printf("O_NONBLOCK\n");
13247         exit(0);
13248 #endif
13249 #ifdef O_NDELAY
13250         printf("O_NDELAY\n");
13251         exit(0);
13252 #endif
13253 #ifdef FNDELAY
13254         printf("FNDELAY\n");
13255         exit(0);
13256 #endif
13257         exit(0);
13258 }
13259 EOCP
13260         set try
13261         if eval $compile_ok; then
13262                 o_nonblock=`$run ./try`
13263                 case "$o_nonblock" in
13264                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13265                 *) echo "Seems like we can use $o_nonblock.";;
13266                 esac
13267         else
13268                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13269         fi
13270         ;;
13271 *) echo "Using $hint value $o_nonblock.";;
13272 esac
13273 $rm_try
13274
13275 echo " "
13276 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13277 case "$eagain" in
13278 '')
13279         case "$d_fork:$d_pipe:$d_alarm" in
13280         define:define:define)
13281         $cat head.c > try.c
13282         $cat >>try.c <<EOCP
13283 #include <errno.h>
13284 #include <sys/types.h>
13285 #include <signal.h>
13286 #include <stdio.h>
13287 #$i_stdlib I_STDLIB
13288 #ifdef I_STDLIB
13289 #include <stdlib.h>
13290 #endif
13291 #$i_fcntl I_FCNTL
13292 #ifdef I_FCNTL
13293 #include <fcntl.h>
13294 #endif
13295 #define MY_O_NONBLOCK $o_nonblock
13296 #ifndef errno  /* XXX need better Configure test */
13297 extern int errno;
13298 #endif
13299 #$i_unistd I_UNISTD
13300 #ifdef I_UNISTD
13301 #include <unistd.h>
13302 #endif
13303 #include <string.h>
13304 $signal_t blech(int x) { exit(3); }
13305 EOCP
13306         $cat >> try.c <<'EOCP'
13307 int main()
13308 {
13309         int pd[2];
13310         int pu[2];
13311         char buf[1];
13312         char string[100];
13313         int ret;
13314
13315         ret = pipe(pd); /* Down: child -> parent */
13316         if (ret != 0)
13317                 exit(3);
13318         ret = pipe(pu); /* Up: parent -> child */
13319         if (ret != 0)
13320                 exit(3);
13321         if (0 != fork()) {
13322                 close(pd[1]);   /* Parent reads from pd[0] */
13323                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13324 #ifdef F_SETFL
13325                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13326                         exit(1);
13327 #else
13328                 exit(4);
13329 #endif
13330                 signal(SIGALRM, blech);
13331                 alarm(5);
13332                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13333                         exit(2);
13334                 sprintf(string, "%d\n", ret);
13335                 ret = write(2, string, strlen(string));
13336                 if (ret != strlen(string))
13337                         exit(3);
13338                 alarm(0);
13339 #ifdef EAGAIN
13340                 if (errno == EAGAIN) {
13341                         printf("EAGAIN\n");
13342                         goto ok;
13343                 }
13344 #endif
13345 #ifdef EWOULDBLOCK
13346                 if (errno == EWOULDBLOCK)
13347                         printf("EWOULDBLOCK\n");
13348 #endif
13349         ok:
13350                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13351                 if (ret != 1)
13352                         exit(3);
13353                 sleep(2);                               /* Give it time to close our pipe */
13354                 alarm(5);
13355                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13356                 alarm(0);
13357                 sprintf(string, "%d\n", ret);
13358                 ret = write(4, string, strlen(string));
13359                 if (ret != strlen(string))
13360                         exit(3);
13361                 exit(0);
13362         }
13363
13364         close(pd[0]);                   /* We write to pd[1] */
13365         close(pu[1]);                   /* We read from pu[0] */
13366         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13367         if (ret != 1)
13368                 exit(3);
13369         close(pd[1]);                   /* Pipe pd is now fully closed! */
13370         exit(0);                                /* Bye bye, thank you for playing! */
13371 }
13372 EOCP
13373         set try
13374         if eval $compile_ok; then
13375                 echo "$startsh" >mtry
13376                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13377                 chmod +x mtry
13378                 $run ./mtry >/dev/null 2>&1
13379                 case $? in
13380                 0) eagain=`$cat try.out`;;
13381                 1) echo "Could not perform non-blocking setting!";;
13382                 2) echo "I did a successful read() for something that was not there!";;
13383                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13384                 4) echo "Could not find F_SETFL!";;
13385                 *) echo "Something terribly wrong happened during testing.";;
13386                 esac
13387                 rd_nodata=`$cat try.ret`
13388                 echo "A read() system call with no data present returns $rd_nodata."
13389                 case "$rd_nodata" in
13390                 0|-1) ;;
13391                 *)
13392                         echo "(That's peculiar, fixing that to be -1.)"
13393                         rd_nodata=-1
13394                         ;;
13395                 esac
13396                 case "$eagain" in
13397                 '')
13398                         echo "Forcing errno EAGAIN on read() with no data available."
13399                         eagain=EAGAIN
13400                         ;;
13401                 *)
13402                         echo "Your read() sets errno to $eagain when no data is available."
13403                         ;;
13404                 esac
13405                 status=`$cat try.err`
13406                 case "$status" in
13407                 0) echo "And it correctly returns 0 to signal EOF.";;
13408                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13409                 *) echo "However, your read() returns '$status' on EOF??";;
13410                 esac
13411                 val="$define"
13412                 if test "$status" = "$rd_nodata"; then
13413                         echo "WARNING: you can't distinguish between EOF and no data!"
13414                         val="$undef"
13415                 fi
13416         else
13417                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13418                 eagain=EAGAIN
13419         fi
13420         ;;
13421         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13422                 eagain=EAGAIN
13423                 val="$define"
13424                 ;;
13425         esac
13426         set d_eofnblk
13427         eval $setvar
13428         ;;
13429 *)
13430         echo "Using $hint value $eagain."
13431         echo "Your read() returns $rd_nodata when no data is present."
13432         case "$d_eofnblk" in
13433         "$define") echo "And you can see EOF because read() returns 0.";;
13434         "$undef") echo "But you can't see EOF status from read() returned value.";;
13435         *)
13436                 echo "(Assuming you can't see EOF status from read anyway.)"
13437                 d_eofnblk=$undef
13438                 ;;
13439         esac
13440         ;;
13441 esac
13442 $rm_try head.c mtry
13443
13444 : see if erf exists
13445 set erf d_erf
13446 eval $inlibc
13447
13448 : see if erfc exists
13449 set erfc d_erfc
13450 eval $inlibc
13451
13452 : see if exp2 exists
13453 set exp2 d_exp2
13454 eval $inlibc
13455
13456 : see if expm1 exists
13457 set expm1 d_expm1
13458 eval $inlibc
13459
13460 : see if _ptr and _cnt from stdio act std
13461 echo " "
13462
13463 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13464         echo "(Looks like you have stdio.h from BSD.)"
13465         case "$stdio_ptr" in
13466         '') stdio_ptr='((fp)->_p)'
13467                 ptr_lval=$define
13468                 ;;
13469         *)      ptr_lval=$d_stdio_ptr_lval;;
13470         esac
13471         case "$stdio_cnt" in
13472         '') stdio_cnt='((fp)->_r)'
13473                 cnt_lval=$define
13474                 ;;
13475         *)      cnt_lval=$d_stdio_cnt_lval;;
13476         esac
13477         case "$stdio_base" in
13478         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13479         esac
13480         case "$stdio_bufsiz" in
13481         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13482         esac
13483 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13484         echo "(Looks like you have stdio.h from Linux.)"
13485         case "$stdio_ptr" in
13486         '') stdio_ptr='((fp)->_IO_read_ptr)'
13487                 ptr_lval=$define
13488                 ;;
13489         *)      ptr_lval=$d_stdio_ptr_lval;;
13490         esac
13491         case "$stdio_cnt" in
13492         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13493                 cnt_lval=$undef
13494                 ;;
13495         *)      cnt_lval=$d_stdio_cnt_lval;;
13496         esac
13497         case "$stdio_base" in
13498         '') stdio_base='((fp)->_IO_read_base)';;
13499         esac
13500         case "$stdio_bufsiz" in
13501         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13502         esac
13503 else
13504         case "$stdio_ptr" in
13505         '') stdio_ptr='((fp)->_ptr)'
13506                 ptr_lval=$define
13507                 ;;
13508         *)      ptr_lval=$d_stdio_ptr_lval;;
13509         esac
13510         case "$stdio_cnt" in
13511         '') stdio_cnt='((fp)->_cnt)'
13512                 cnt_lval=$define
13513                 ;;
13514         *)      cnt_lval=$d_stdio_cnt_lval;;
13515         esac
13516         case "$stdio_base" in
13517         '') stdio_base='((fp)->_base)';;
13518         esac
13519         case "$stdio_bufsiz" in
13520         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13521         esac
13522 fi
13523
13524 : test whether _ptr and _cnt really work
13525 echo "Checking how std your stdio is..." >&4
13526 $cat >try.c <<EOP
13527 #include <stdio.h>
13528 #$i_stdlib I_STDLIB
13529 #ifdef I_STDLIB
13530 #include <stdlib.h>
13531 #endif
13532 #define FILE_ptr(fp)    $stdio_ptr
13533 #define FILE_cnt(fp)    $stdio_cnt
13534 int main() {
13535         FILE *fp = fopen("try.c", "r");
13536         char c = getc(fp);
13537         if (
13538                 18 <= FILE_cnt(fp) &&
13539                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13540         )
13541                 exit(0);
13542         exit(1);
13543 }
13544 EOP
13545 val="$undef"
13546 set try
13547 if eval $compile && $to try.c; then
13548         if $run ./try; then
13549                 echo "Your stdio acts pretty std."
13550                 val="$define"
13551         else
13552                 echo "Your stdio isn't very std."
13553         fi
13554 else
13555         echo "Your stdio doesn't appear very std."
13556 fi
13557 $rm_try
13558
13559 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13560 # direct buffer manipulation no longer works.  The Configure tests
13561 # should be changed to correctly detect this, but until then,
13562 # the following check should at least let perl compile and run.
13563 # (This quick fix should be updated before 5.8.1.)
13564 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13565 # A. Dougherty, June 3, 2002.
13566 case "$d_gnulibc" in
13567 $define)
13568         case "$gnulibc_version" in
13569         2.[01]*)  ;;
13570         2.2) ;;
13571         2.2.[0-9]) ;;
13572         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13573                 val="$undef"
13574                 ;;
13575         esac
13576         ;;
13577 esac
13578 set d_stdstdio
13579 eval $setvar
13580
13581 : Can _ptr be used as an lvalue?
13582 case "$d_stdstdio$ptr_lval" in
13583 $define$define) val=$define ;;
13584 *) val=$undef ;;
13585 esac
13586 set d_stdio_ptr_lval
13587 eval $setvar
13588
13589 : Can _cnt be used as an lvalue?
13590 case "$d_stdstdio$cnt_lval" in
13591 $define$define) val=$define ;;
13592 *) val=$undef ;;
13593 esac
13594 set d_stdio_cnt_lval
13595 eval $setvar
13596
13597
13598 : test whether setting _ptr sets _cnt as a side effect
13599 d_stdio_ptr_lval_sets_cnt="$undef"
13600 d_stdio_ptr_lval_nochange_cnt="$undef"
13601 case "$d_stdio_ptr_lval$d_stdstdio" in
13602 $define$define)
13603         echo "Checking to see what happens if we set the stdio ptr..." >&4
13604 $cat >try.c <<EOP
13605 #include <stdio.h>
13606 /* Can we scream? */
13607 /* Eat dust sed :-) */
13608 /* In the buffer space, no one can hear you scream. */
13609 #$i_stdlib I_STDLIB
13610 #ifdef I_STDLIB
13611 #include <stdlib.h>
13612 #endif
13613 #define FILE_ptr(fp)    $stdio_ptr
13614 #define FILE_cnt(fp)    $stdio_cnt
13615 #include <sys/types.h>
13616 int main() {
13617         FILE *fp = fopen("try.c", "r");
13618         int c;
13619         char *ptr;
13620         size_t cnt;
13621         if (!fp) {
13622             puts("Fail even to read");
13623             exit(1);
13624         }
13625         c = getc(fp); /* Read away the first # */
13626         if (c == EOF) {
13627             puts("Fail even to read");
13628             exit(1);
13629         }
13630         if (!(
13631                 18 <= FILE_cnt(fp) &&
13632                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13633         )) {
13634                 puts("Fail even to read");
13635                 exit (1);
13636         }
13637         ptr = (char*) FILE_ptr(fp);
13638         cnt = (size_t)FILE_cnt(fp);
13639
13640         FILE_ptr(fp) += 42;
13641
13642         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13643                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13644                 exit (1);
13645         }
13646         if (FILE_cnt(fp) <= 20) {
13647                 printf ("Fail (<20 chars to test)");
13648                 exit (1);
13649         }
13650         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13651                 puts("Fail compare");
13652                 exit (1);
13653         }
13654         if (cnt == FILE_cnt(fp)) {
13655                 puts("Pass_unchanged");
13656                 exit (0);
13657         }
13658         if (FILE_cnt(fp) == (cnt - 42)) {
13659                 puts("Pass_changed");
13660                 exit (0);
13661         }
13662         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13663         return 1;
13664
13665 }
13666 EOP
13667         set try
13668         if eval $compile && $to try.c; then
13669                 case `$run ./try` in
13670                 Pass_changed)
13671                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13672                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13673                 Pass_unchanged)
13674                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13675                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13676                 Fail*)
13677                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13678                 *)
13679                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13680         esac
13681         else
13682                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13683         fi
13684         $rm_try
13685         ;;
13686 esac
13687
13688 : see if _base is also standard
13689 val="$undef"
13690 case "$d_stdstdio" in
13691 $define)
13692         $cat >try.c <<EOP
13693 #include <stdio.h>
13694 #$i_stdlib I_STDLIB
13695 #ifdef I_STDLIB
13696 #include <stdlib.h>
13697 #endif
13698 #define FILE_base(fp)   $stdio_base
13699 #define FILE_bufsiz(fp) $stdio_bufsiz
13700 int main() {
13701         FILE *fp = fopen("try.c", "r");
13702         char c = getc(fp);
13703         if (
13704                 19 <= FILE_bufsiz(fp) &&
13705                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13706         )
13707                 exit(0);
13708         exit(1);
13709 }
13710 EOP
13711         set try
13712         if eval $compile && $to try.c; then
13713                 if $run ./try; then
13714                         echo "And its _base field acts std."
13715                         val="$define"
13716                 else
13717                         echo "But its _base field isn't std."
13718                 fi
13719         else
13720                 echo "However, it seems to be lacking the _base field."
13721         fi
13722         $rm_try
13723         ;;
13724 esac
13725 set d_stdiobase
13726 eval $setvar
13727
13728 : see if fast_stdio exists
13729 val="$undef"
13730 case "$d_stdstdio:$d_stdio_ptr_lval" in
13731 "$define:$define")
13732         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13733         *$define*)
13734                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13735                 val="$define"
13736                 ;;
13737         esac
13738         ;;
13739 esac
13740 set d_faststdio
13741 eval $setvar
13742
13743 : see if fchdir exists
13744 set fchdir d_fchdir
13745 eval $inlibc
13746
13747 : see if fchmod exists
13748 set fchmod d_fchmod
13749 eval $inlibc
13750
13751 : check for openat, unlinkat, renameat, linkat, fchmodat
13752 set openat d_openat
13753 eval $inlibc
13754
13755 set unlinkat d_unlinkat
13756 eval $inlibc
13757
13758 set renameat d_renameat
13759 eval $inlibc
13760
13761 set linkat d_linkat
13762 eval $inlibc
13763
13764 set fchmodat d_fchmodat
13765 eval $inlibc
13766
13767 : see if fchown exists
13768 set fchown d_fchown
13769 eval $inlibc
13770
13771 : see if this is an fcntl system
13772 set fcntl d_fcntl
13773 eval $inlibc
13774
13775 : See if fcntl-based locking works.
13776 echo " "
13777 $cat >try.c <<EOCP
13778 #$i_stdlib I_STDLIB
13779 #ifdef I_STDLIB
13780 #include <stdlib.h>
13781 #endif
13782 #include <unistd.h>
13783 #include <fcntl.h>
13784 #include <signal.h>
13785 $signal_t blech(int x) { exit(3); }
13786 int main() {
13787 #if defined(F_SETLK) && defined(F_SETLKW)
13788      struct flock flock;
13789      int retval, fd;
13790      fd = open("try.c", O_RDONLY);
13791      flock.l_type = F_RDLCK;
13792      flock.l_whence = SEEK_SET;
13793      flock.l_start = flock.l_len = 0;
13794      signal(SIGALRM, blech);
13795      alarm(10);
13796      retval = fcntl(fd, F_SETLK, &flock);
13797      close(fd);
13798      (retval < 0 ? exit(2) : exit(0));
13799 #else
13800      exit(2);
13801 #endif
13802 }
13803 EOCP
13804 echo "Checking if fcntl-based file locking works... "
13805 case "$d_fcntl" in
13806 "$define")
13807         set try
13808         if eval $compile_ok; then
13809                 if $run ./try; then
13810                         echo "Yes, it seems to work."
13811                         val="$define"
13812                 else
13813                         echo "Nope, it didn't work."
13814                         val="$undef"
13815                         case "$?" in
13816                         3) $cat >&4 <<EOM
13817 ***
13818 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13819 *** This is (almost) impossible.
13820 *** If your NFS lock daemons are not feeling well, something like
13821 *** this may happen, please investigate.  Cannot continue, aborting.
13822 ***
13823 EOM
13824                                 exit 1
13825                                 ;;
13826                         esac
13827                 fi
13828         else
13829                 echo "I'm unable to compile the test program, so I'll assume not."
13830                 val="$undef"
13831         fi
13832         ;;
13833 *) val="$undef";
13834         echo "Nope, since you don't even have fcntl()."
13835         ;;
13836 esac
13837 set d_fcntl_can_lock
13838 eval $setvar
13839 $rm_try
13840
13841 : check for fd_set items
13842 $cat <<EOM
13843
13844 Checking to see how well your C compiler handles fd_set and friends ...
13845 EOM
13846 $cat >try.c <<EOCP
13847 #$i_stdlib I_STDLIB
13848 #ifdef I_STDLIB
13849 #include <stdlib.h>
13850 #endif
13851 #$i_systime I_SYS_TIME
13852 #$i_sysselct I_SYS_SELECT
13853 #$d_socket HAS_SOCKET
13854 #include <sys/types.h>
13855 #ifdef HAS_SOCKET
13856 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13857 #endif
13858 #ifdef I_SYS_TIME
13859 #include <sys/time.h>
13860 #endif
13861 #ifdef I_SYS_SELECT
13862 #include <sys/select.h>
13863 #endif
13864 int main() {
13865         fd_set fds;
13866
13867 #ifdef TRYBITS
13868         if(fds.fds_bits);
13869 #endif
13870
13871 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13872         exit(0);
13873 #else
13874         exit(1);
13875 #endif
13876 }
13877 EOCP
13878 set try -DTRYBITS
13879 if eval $compile; then
13880         d_fds_bits="$define"
13881         d_fd_set="$define"
13882         echo "Well, your system knows about the normal fd_set typedef..." >&4
13883         if $run ./try; then
13884                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13885                 d_fd_macros="$define"
13886         else
13887                 $cat >&4 <<'EOM'
13888 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13889 EOM
13890                 d_fd_macros="$undef"
13891         fi
13892 else
13893         $cat <<'EOM'
13894 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13895 EOM
13896         set try
13897         if eval $compile; then
13898                 d_fds_bits="$undef"
13899                 d_fd_set="$define"
13900                 echo "Well, your system has some sort of fd_set available..." >&4
13901                 if $run ./try; then
13902                         echo "and you have the normal fd_set macros." >&4
13903                         d_fd_macros="$define"
13904                 else
13905                         $cat <<'EOM'
13906 but not the normal fd_set macros!  Gross!  More work for me...
13907 EOM
13908                         d_fd_macros="$undef"
13909                 fi
13910         else
13911         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13912                 d_fd_set="$undef"
13913                 d_fds_bits="$undef"
13914                 d_fd_macros="$undef"
13915         fi
13916 fi
13917 $rm_try
13918
13919 : see if fdclose exists
13920 set fdclose d_fdclose
13921 eval $inlibc
13922
13923 : see if fdim exists
13924 set fdim d_fdim
13925 eval $inlibc
13926
13927 : see if fegetround exists
13928 set fegetround d_fegetround
13929 eval $inlibc
13930
13931 : see if fgetpos exists
13932 set fgetpos d_fgetpos
13933 eval $inlibc
13934
13935 : see if finite exists
13936 set finite d_finite
13937 eval $inlibc
13938
13939 : see if finitel exists
13940 set finitel d_finitel
13941 eval $inlibc
13942
13943 : see if flock exists
13944 set flock d_flock
13945 eval $inlibc
13946
13947 : see if prototype for flock is available
13948 echo " "
13949 set d_flockproto flock $i_sysfile sys/file.h
13950 eval $hasproto
13951
13952 : see if fma exists
13953 set fma d_fma
13954 eval $inlibc
13955
13956 : see if fmax exists
13957 set fmax d_fmax
13958 eval $inlibc
13959
13960 : see if fmin exists
13961 set fmin d_fmin
13962 eval $inlibc
13963
13964 : see if fp_class exists
13965 set fp_class d_fp_class
13966 eval $inlibc
13967
13968 : check for fpclassify
13969 echo "Checking to see if you have fpclassify..." >&4
13970 $cat >try.c <<EOCP
13971 #include <math.h>
13972 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13973 EOCP
13974 set try
13975 if eval $compile; then
13976         val="$define"
13977         echo "You have fpclassify."
13978 else
13979         val="$undef"
13980         echo "You do not have fpclassify."
13981 fi
13982 $rm_try
13983 set d_fpclassify
13984 eval $setvar
13985
13986 : see if fp_classify exists
13987 set fp_classify d_fp_classify
13988 eval $inlibc
13989
13990 : see if fp_classl exists
13991 set fp_classl d_fp_classl
13992 eval $inlibc
13993
13994 : see if pathconf exists
13995 set pathconf d_pathconf
13996 eval $inlibc
13997
13998 : see if fpathconf exists
13999 set fpathconf d_fpathconf
14000 eval $inlibc
14001
14002 : see if fpclass exists
14003 set fpclass d_fpclass
14004 eval $inlibc
14005
14006 : see if fpclassl exists
14007 set fpclassl d_fpclassl
14008 eval $inlibc
14009
14010 : see if fpgetround exists
14011 set fpgetround d_fpgetround
14012 eval $inlibc
14013
14014 : check for fpos64_t
14015 echo " "
14016 echo "Checking to see if you have fpos64_t..." >&4
14017 $cat >try.c <<EOCP
14018 #include <stdio.h>
14019 int main() { fpos64_t x = 7; }
14020 EOCP
14021 set try
14022 if eval $compile; then
14023         val="$define"
14024         echo "You have fpos64_t."
14025 else
14026         val="$undef"
14027         echo "You do not have fpos64_t."
14028         case "$fpossize" in
14029         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14030         esac
14031 fi
14032 $rm_try
14033 set d_fpos64_t
14034 eval $setvar
14035
14036 : see if frexpl exists
14037 set frexpl d_frexpl
14038 eval $inlibc
14039
14040 : see if this is a sys/param system
14041 set sys/param.h i_sysparam
14042 eval $inhdr
14043
14044 : see if this is a sys/mount.h system
14045 set sys/mount.h i_sysmount
14046 eval $inhdr
14047
14048 : Check for fs_data_s
14049 echo " "
14050 echo "Checking to see if your system supports struct fs_data..." >&4
14051 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14052 eval $hasstruct
14053 case "$d_fs_data_s" in
14054 "$define")      echo "Yes, it does."   ;;
14055 *)              echo "No, it doesn't." ;;
14056 esac
14057
14058 : see if fseeko exists
14059 set fseeko d_fseeko
14060 eval $inlibc
14061 case "$longsize" in
14062 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14063 esac
14064
14065 : see if fsetpos exists
14066 set fsetpos d_fsetpos
14067 eval $inlibc
14068
14069 : see if fstatfs exists
14070 set fstatfs d_fstatfs
14071 eval $inlibc
14072
14073 : see if statvfs exists
14074 set statvfs d_statvfs
14075 eval $inlibc
14076
14077 : see if fstatvfs exists
14078 set fstatvfs d_fstatvfs
14079 eval $inlibc
14080
14081 : see if fsync exists
14082 set fsync d_fsync
14083 eval $inlibc
14084
14085 : see if ftello exists
14086 set ftello d_ftello
14087 eval $inlibc
14088 case "$longsize" in
14089 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14090 esac
14091
14092 : check for a working futimes
14093 d_futimes="$undef"
14094 echo " "
14095 echo "Checking if you have a working futimes()" >&4
14096 $cat >try.c <<EOCP
14097 #include <stdio.h>
14098 #include <sys/time.h>
14099 #include <errno.h>
14100 #include <fcntl.h>
14101
14102 int main ()
14103 {
14104     int fd, rv;
14105     fd = open ("try.c", O_RDWR);
14106     if (-1 == fd) exit (1);
14107     rv = futimes (fd, NULL);
14108     exit (rv == -1 ? errno : 0);
14109 }
14110 EOCP
14111 set try
14112 if eval $compile; then
14113     `$run ./try`
14114     rc=$?
14115     case "$rc" in
14116         0)  echo "Yes, you have" >&4
14117             d_futimes="$define"
14118             ;;
14119         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14120             ;;
14121     esac
14122 else
14123     echo "No, it does not (probably harmless)" >&4
14124 fi
14125 $rm_try
14126
14127 : look for gai_strerror
14128 echo " "
14129 $cat >try.c <<'EOCP'
14130 #include <sys/types.h>
14131 #include <sys/socket.h>
14132 #include <netdb.h>
14133 int main ()
14134 {
14135     return (gai_strerror (0) ? 0 : 1);
14136     }
14137 EOCP
14138 set try
14139 val="$undef"
14140 if eval $compile; then
14141     `$run ./try`
14142     case "$?" in
14143         0)  echo "A working gai_strerror() found." >&4
14144             val="$define" ;;
14145         *)  echo "gai_strerror() found, but it doesn't work" >&4
14146             ;;
14147         esac
14148 else
14149     echo "gai_strerror() NOT found." >&4
14150     fi
14151 set d_gai_strerror
14152 eval $setvar
14153 $rm_try
14154
14155 : see if ndbm.h is available
14156 set ndbm.h i_ndbm
14157 eval $inhdr
14158 : Compatibility location for RedHat 7.1
14159 set gdbm/ndbm.h i_gdbmndbm
14160 eval $inhdr
14161 : Compatibility location for Debian 4.0
14162 set gdbm-ndbm.h i_gdbm_ndbm
14163 eval $inhdr
14164
14165 val="$undef"
14166 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14167         : see if dbm_open exists
14168         set dbm_open d_dbm_open
14169         eval $inlibc
14170         case "$d_dbm_open" in
14171         $undef)
14172                 i_ndbm="$undef"
14173                 i_gdbmndbm="$undef"
14174                 i_gdbm_ndbm="$undef"
14175                 echo "We won't be including <ndbm.h>"
14176                 val="$undef"
14177                 ;;
14178         *) val="$define"
14179            ;;
14180         esac
14181 fi
14182 set d_ndbm
14183 eval $setvar
14184
14185 ndbm_hdr_protochk='name=$1; hdr=$2;
14186 eval "ihdr=\$""i_$name";
14187 val="$undef";
14188 if $test "$ihdr" = "$define"; then
14189         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14190         case "$d_cplusplus" in
14191         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14192         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14193         esac;
14194         case "$val" in
14195         $define) $echo "Your <$hdr> seems to have prototypes";;
14196         *) $echo "Your <$hdr> does not seem to have prototypes";;
14197         esac;
14198 fi;
14199 set "d_${name}_h_uses_prototypes";
14200 eval $setvar'
14201
14202 set ndbm ndbm.h
14203 eval $ndbm_hdr_protochk
14204 set gdbmndbm gdbm/ndbm.h
14205 eval $ndbm_hdr_protochk
14206 set gdbm_ndbm gdbm-ndbm.h
14207 eval $ndbm_hdr_protochk
14208
14209 : see if getaddrinfo exists
14210 set getaddrinfo d_getaddrinfo
14211 eval $inlibc
14212
14213 : see if getcwd exists
14214 set getcwd d_getcwd
14215 eval $inlibc
14216
14217 : see if getespwnam exists
14218 set getespwnam d_getespwnam
14219 eval $inlibc
14220
14221 : see if getfsstat exists
14222 set getfsstat d_getfsstat
14223 eval $inlibc
14224
14225 : see if getgrent exists
14226 set getgrent d_getgrent
14227 eval $inlibc
14228
14229 : see if getgrent_r exists
14230 set getgrent_r d_getgrent_r
14231 eval $inlibc
14232 case "$d_getgrent_r" in
14233 "$define")
14234         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14235         case "$d_getgrent_r_proto:$usethreads" in
14236         ":define")      d_getgrent_r_proto=define
14237                 set d_getgrent_r_proto getgrent_r $hdrs
14238                 eval $hasproto ;;
14239         *)      ;;
14240         esac
14241         case "$d_getgrent_r_proto" in
14242         define)
14243         case "$getgrent_r_proto" in
14244         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14253         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14254         esac
14255         case "$getgrent_r_proto" in
14256         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14257         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14258         esac
14259         case "$getgrent_r_proto" in
14260         ''|0) try='int getgrent_r(struct group*, char*, int);'
14261         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14262         esac
14263         case "$getgrent_r_proto" in
14264         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14265         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14266         esac
14267         case "$getgrent_r_proto" in
14268         ''|0)   d_getgrent_r=undef
14269                 getgrent_r_proto=0
14270                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14271         * )     case "$getgrent_r_proto" in
14272                 REENTRANT_PROTO*) ;;
14273                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14274                 esac
14275                 echo "Prototype: $try" ;;
14276         esac
14277         ;;
14278         *)      case "$usethreads" in
14279                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14280                 esac
14281                 d_getgrent_r=undef
14282                 getgrent_r_proto=0
14283                 ;;
14284         esac
14285         ;;
14286 *)      getgrent_r_proto=0
14287         ;;
14288 esac
14289
14290 : see if getgrgid_r exists
14291 set getgrgid_r d_getgrgid_r
14292 eval $inlibc
14293 case "$d_getgrgid_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14296         case "$d_getgrgid_r_proto:$usethreads" in
14297         ":define")      d_getgrgid_r_proto=define
14298                 set d_getgrgid_r_proto getgrgid_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_getgrgid_r_proto" in
14303         define)
14304         case "$getgrgid_r_proto" in
14305         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14306         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14307         esac
14308         case "$getgrgid_r_proto" in
14309         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14310         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14311         esac
14312         case "$getgrgid_r_proto" in
14313         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14314         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14315         esac
14316         case "$getgrgid_r_proto" in
14317         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14318         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14319         esac
14320         case "$getgrgid_r_proto" in
14321         ''|0)   d_getgrgid_r=undef
14322                 getgrgid_r_proto=0
14323                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14324         * )     case "$getgrgid_r_proto" in
14325                 REENTRANT_PROTO*) ;;
14326                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14327                 esac
14328                 echo "Prototype: $try" ;;
14329         esac
14330         ;;
14331         *)      case "$usethreads" in
14332                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14333                 esac
14334                 d_getgrgid_r=undef
14335                 getgrgid_r_proto=0
14336                 ;;
14337         esac
14338         ;;
14339 *)      getgrgid_r_proto=0
14340         ;;
14341 esac
14342
14343 : see if getgrnam_r exists
14344 set getgrnam_r d_getgrnam_r
14345 eval $inlibc
14346 case "$d_getgrnam_r" in
14347 "$define")
14348         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14349         case "$d_getgrnam_r_proto:$usethreads" in
14350         ":define")      d_getgrnam_r_proto=define
14351                 set d_getgrnam_r_proto getgrnam_r $hdrs
14352                 eval $hasproto ;;
14353         *)      ;;
14354         esac
14355         case "$d_getgrnam_r_proto" in
14356         define)
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14363         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14364         esac
14365         case "$getgrnam_r_proto" in
14366         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14367         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14368         esac
14369         case "$getgrnam_r_proto" in
14370         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14371         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14372         esac
14373         case "$getgrnam_r_proto" in
14374         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14376         esac
14377         case "$getgrnam_r_proto" in
14378         ''|0)   d_getgrnam_r=undef
14379                 getgrnam_r_proto=0
14380                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14381         * )     case "$getgrnam_r_proto" in
14382                 REENTRANT_PROTO*) ;;
14383                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14384                 esac
14385                 echo "Prototype: $try" ;;
14386         esac
14387         ;;
14388         *)      case "$usethreads" in
14389                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14390                 esac
14391                 d_getgrnam_r=undef
14392                 getgrnam_r_proto=0
14393                 ;;
14394         esac
14395         ;;
14396 *)      getgrnam_r_proto=0
14397         ;;
14398 esac
14399
14400 : see if gethostbyaddr exists
14401 set gethostbyaddr d_gethbyaddr
14402 eval $inlibc
14403
14404 : see if gethostbyname exists
14405 set gethostbyname d_gethbyname
14406 eval $inlibc
14407
14408 : see if gethostent exists
14409 set gethostent d_gethent
14410 eval $inlibc
14411
14412 : see how we will look up host name
14413 echo " "
14414 call=''
14415 if set gethostname val -f d_gethname; eval $csym; $val; then
14416         echo 'gethostname() found.' >&4
14417         d_gethname="$define"
14418         call=gethostname
14419 fi
14420 if set uname val -f d_uname; eval $csym; $val; then
14421         if ./xenix; then
14422                 $cat <<'EOM'
14423 uname() was found, but you're running xenix, and older versions of xenix
14424 have a broken uname(). If you don't really know whether your xenix is old
14425 enough to have a broken system call, use the default answer.
14426
14427 EOM
14428                 dflt=y
14429                 case "$d_uname" in
14430                 "$define") dflt=n;;
14431                 esac
14432                 rp='Is your uname() broken?'
14433                 . ./myread
14434                 case "$ans" in
14435                 n*) d_uname="$define"; call=uname;;
14436                 esac
14437         else
14438                 echo 'uname() found.' >&4
14439                 d_uname="$define"
14440                 case "$call" in
14441                 '') call=uname ;;
14442                 esac
14443         fi
14444 fi
14445 case "$d_gethname" in
14446 '') d_gethname="$undef";;
14447 esac
14448 case "$d_uname" in
14449 '') d_uname="$undef";;
14450 esac
14451 case "$d_uname$d_gethname" in
14452 *define*)
14453         dflt=n
14454         cat <<EOM
14455
14456 Every now and then someone has a $call() that lies about the hostname
14457 but can't be fixed for political or economic reasons.  If you wish, I can
14458 pretend $call() isn't there and maybe compute hostname at run-time
14459 thanks to the '$phostname' command.
14460
14461 EOM
14462         rp="Shall I ignore $call() from now on?"
14463         . ./myread
14464         case "$ans" in
14465         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14466         esac;;
14467 esac
14468 case "$phostname" in
14469 '') aphostname='';;
14470 *) case "$aphostname" in
14471         /*) ;;
14472         *) set X $phostname
14473                 shift
14474                 file=$1
14475                 shift
14476                 file=`./loc $file $file $pth`
14477                 aphostname=`echo $file $*`
14478                 ;;
14479         esac
14480         ;;
14481 esac
14482 case "$d_uname$d_gethname" in
14483 *define*) ;;
14484 *)
14485         case "$phostname" in
14486         '')
14487                 echo "There will be no way for $package to get your hostname." >&4;;
14488         *)
14489         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14490                 ;;
14491         esac;;
14492 esac
14493 case "$d_phostname" in
14494 '') d_phostname="$undef";;
14495 esac
14496
14497 : see if gethostbyaddr_r exists
14498 set gethostbyaddr_r d_gethostbyaddr_r
14499 eval $inlibc
14500 case "$d_gethostbyaddr_r" in
14501 "$define")
14502         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14503         case "$d_gethostbyaddr_r_proto:$usethreads" in
14504         ":define")      d_gethostbyaddr_r_proto=define
14505                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14506                 eval $hasproto ;;
14507         *)      ;;
14508         esac
14509         case "$d_gethostbyaddr_r_proto" in
14510         define)
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14541         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14542         esac
14543         case "$gethostbyaddr_r_proto" in
14544         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14545         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14546         esac
14547         case "$gethostbyaddr_r_proto" in
14548         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14549         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14550         esac
14551         case "$gethostbyaddr_r_proto" in
14552         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14553         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14554         esac
14555         case "$gethostbyaddr_r_proto" in
14556         ''|0)   d_gethostbyaddr_r=undef
14557                 gethostbyaddr_r_proto=0
14558                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14559         * )     case "$gethostbyaddr_r_proto" in
14560                 REENTRANT_PROTO*) ;;
14561                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14562                 esac
14563                 echo "Prototype: $try" ;;
14564         esac
14565         ;;
14566         *)      case "$usethreads" in
14567                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14568                 esac
14569                 d_gethostbyaddr_r=undef
14570                 gethostbyaddr_r_proto=0
14571                 ;;
14572         esac
14573         ;;
14574 *)      gethostbyaddr_r_proto=0
14575         ;;
14576 esac
14577
14578 : see if gethostbyname_r exists
14579 set gethostbyname_r d_gethostbyname_r
14580 eval $inlibc
14581 case "$d_gethostbyname_r" in
14582 "$define")
14583         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14584         case "$d_gethostbyname_r_proto:$usethreads" in
14585         ":define")      d_gethostbyname_r_proto=define
14586                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14587                 eval $hasproto ;;
14588         *)      ;;
14589         esac
14590         case "$d_gethostbyname_r_proto" in
14591         define)
14592         case "$gethostbyname_r_proto" in
14593         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14594         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14595         esac
14596         case "$gethostbyname_r_proto" in
14597         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14598         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14599         esac
14600         case "$gethostbyname_r_proto" in
14601         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14602         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14603         esac
14604         case "$gethostbyname_r_proto" in
14605         ''|0)   d_gethostbyname_r=undef
14606                 gethostbyname_r_proto=0
14607                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14608         * )     case "$gethostbyname_r_proto" in
14609                 REENTRANT_PROTO*) ;;
14610                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14611                 esac
14612                 echo "Prototype: $try" ;;
14613         esac
14614         ;;
14615         *)      case "$usethreads" in
14616                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14617                 esac
14618                 d_gethostbyname_r=undef
14619                 gethostbyname_r_proto=0
14620                 ;;
14621         esac
14622         ;;
14623 *)      gethostbyname_r_proto=0
14624         ;;
14625 esac
14626
14627 : see if gethostent_r exists
14628 set gethostent_r d_gethostent_r
14629 eval $inlibc
14630 case "$d_gethostent_r" in
14631 "$define")
14632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14633         case "$d_gethostent_r_proto:$usethreads" in
14634         ":define")      d_gethostent_r_proto=define
14635                 set d_gethostent_r_proto gethostent_r $hdrs
14636                 eval $hasproto ;;
14637         *)      ;;
14638         esac
14639         case "$d_gethostent_r_proto" in
14640         define)
14641         case "$gethostent_r_proto" in
14642         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14651         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14652         esac
14653         case "$gethostent_r_proto" in
14654         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14655         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14656         esac
14657         case "$gethostent_r_proto" in
14658         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14659         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14660         esac
14661         case "$gethostent_r_proto" in
14662         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14663         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14664         esac
14665         case "$gethostent_r_proto" in
14666         ''|0)   d_gethostent_r=undef
14667                 gethostent_r_proto=0
14668                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14669         * )     case "$gethostent_r_proto" in
14670                 REENTRANT_PROTO*) ;;
14671                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14672                 esac
14673                 echo "Prototype: $try" ;;
14674         esac
14675         ;;
14676         *)      case "$usethreads" in
14677                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14678                 esac
14679                 d_gethostent_r=undef
14680                 gethostent_r_proto=0
14681                 ;;
14682         esac
14683         ;;
14684 *)      gethostent_r_proto=0
14685         ;;
14686 esac
14687
14688 : see if prototypes for various gethostxxx netdb.h functions are available
14689 echo " "
14690 set d_gethostprotos gethostent $i_netdb netdb.h
14691 eval $hasproto
14692
14693 : see if getitimer exists
14694 set getitimer d_getitimer
14695 eval $inlibc
14696
14697 : see if getlogin exists
14698 set getlogin d_getlogin
14699 eval $inlibc
14700
14701 : see if getlogin_r exists
14702 set getlogin_r d_getlogin_r
14703 eval $inlibc
14704 case "$d_getlogin_r" in
14705 "$define")
14706         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14707         case "$d_getlogin_r_proto:$usethreads" in
14708         ":define")      d_getlogin_r_proto=define
14709                 set d_getlogin_r_proto getlogin_r $hdrs
14710                 eval $hasproto ;;
14711         *)      ;;
14712         esac
14713         case "$d_getlogin_r_proto" in
14714         define)
14715         case "$getlogin_r_proto" in
14716         ''|0) try='int getlogin_r(char*, size_t);'
14717         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14718         esac
14719         case "$getlogin_r_proto" in
14720         ''|0) try='int getlogin_r(char*, int);'
14721         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14722         esac
14723         case "$getlogin_r_proto" in
14724         ''|0) try='char* getlogin_r(char*, size_t);'
14725         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14726         esac
14727         case "$getlogin_r_proto" in
14728         ''|0) try='char* getlogin_r(char*, int);'
14729         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14730         esac
14731         case "$getlogin_r_proto" in
14732         ''|0)   d_getlogin_r=undef
14733                 getlogin_r_proto=0
14734                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14735         * )     case "$getlogin_r_proto" in
14736                 REENTRANT_PROTO*) ;;
14737                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14738                 esac
14739                 echo "Prototype: $try" ;;
14740         esac
14741         ;;
14742         *)      case "$usethreads" in
14743                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14744                 esac
14745                 d_getlogin_r=undef
14746                 getlogin_r_proto=0
14747                 ;;
14748         esac
14749         ;;
14750 *)      getlogin_r_proto=0
14751         ;;
14752 esac
14753
14754 : see if getmnt exists
14755 set getmnt d_getmnt
14756 eval $inlibc
14757
14758 : see if getmntent exists
14759 set getmntent d_getmntent
14760 eval $inlibc
14761
14762 : see if getnameinfo exists
14763 set getnameinfo d_getnameinfo
14764 eval $inlibc
14765
14766 : see if getnetbyaddr exists
14767 set getnetbyaddr d_getnbyaddr
14768 eval $inlibc
14769
14770 : see if getnetbyname exists
14771 set getnetbyname d_getnbyname
14772 eval $inlibc
14773
14774 : see if getnetent exists
14775 set getnetent d_getnent
14776 eval $inlibc
14777
14778 : see if getnetbyaddr_r exists
14779 set getnetbyaddr_r d_getnetbyaddr_r
14780 eval $inlibc
14781 case "$d_getnetbyaddr_r" in
14782 "$define")
14783         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14784         case "$d_getnetbyaddr_r_proto:$usethreads" in
14785         ":define")      d_getnetbyaddr_r_proto=define
14786                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14787                 eval $hasproto ;;
14788         *)      ;;
14789         esac
14790         case "$d_getnetbyaddr_r_proto" in
14791         define)
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14810         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14811         esac
14812         case "$getnetbyaddr_r_proto" in
14813         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14814         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14815         esac
14816         case "$getnetbyaddr_r_proto" in
14817         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14818         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14819         esac
14820         case "$getnetbyaddr_r_proto" in
14821         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14822         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14823         esac
14824         case "$getnetbyaddr_r_proto" in
14825         ''|0)   d_getnetbyaddr_r=undef
14826                 getnetbyaddr_r_proto=0
14827                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14828         * )     case "$getnetbyaddr_r_proto" in
14829                 REENTRANT_PROTO*) ;;
14830                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14831                 esac
14832                 echo "Prototype: $try" ;;
14833         esac
14834         ;;
14835         *)      case "$usethreads" in
14836                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14837                 esac
14838                 d_getnetbyaddr_r=undef
14839                 getnetbyaddr_r_proto=0
14840                 ;;
14841         esac
14842         ;;
14843 *)      getnetbyaddr_r_proto=0
14844         ;;
14845 esac
14846
14847 : see if getnetbyname_r exists
14848 set getnetbyname_r d_getnetbyname_r
14849 eval $inlibc
14850 case "$d_getnetbyname_r" in
14851 "$define")
14852         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14853         case "$d_getnetbyname_r_proto:$usethreads" in
14854         ":define")      d_getnetbyname_r_proto=define
14855                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14856                 eval $hasproto ;;
14857         *)      ;;
14858         esac
14859         case "$d_getnetbyname_r_proto" in
14860         define)
14861         case "$getnetbyname_r_proto" in
14862         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14863         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14864         esac
14865         case "$getnetbyname_r_proto" in
14866         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14867         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14868         esac
14869         case "$getnetbyname_r_proto" in
14870         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14871         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14872         esac
14873         case "$getnetbyname_r_proto" in
14874         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14875         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14876         esac
14877         case "$getnetbyname_r_proto" in
14878         ''|0)   d_getnetbyname_r=undef
14879                 getnetbyname_r_proto=0
14880                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14881         * )     case "$getnetbyname_r_proto" in
14882                 REENTRANT_PROTO*) ;;
14883                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14884                 esac
14885                 echo "Prototype: $try" ;;
14886         esac
14887         ;;
14888         *)      case "$usethreads" in
14889                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14890                 esac
14891                 d_getnetbyname_r=undef
14892                 getnetbyname_r_proto=0
14893                 ;;
14894         esac
14895         ;;
14896 *)      getnetbyname_r_proto=0
14897         ;;
14898 esac
14899
14900 : see if getnetent_r exists
14901 set getnetent_r d_getnetent_r
14902 eval $inlibc
14903 case "$d_getnetent_r" in
14904 "$define")
14905         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14906         case "$d_getnetent_r_proto:$usethreads" in
14907         ":define")      d_getnetent_r_proto=define
14908                 set d_getnetent_r_proto getnetent_r $hdrs
14909                 eval $hasproto ;;
14910         *)      ;;
14911         esac
14912         case "$d_getnetent_r_proto" in
14913         define)
14914         case "$getnetent_r_proto" in
14915         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14924         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14925         esac
14926         case "$getnetent_r_proto" in
14927         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14928         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14929         esac
14930         case "$getnetent_r_proto" in
14931         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14932         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14933         esac
14934         case "$getnetent_r_proto" in
14935         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14936         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14937         esac
14938         case "$getnetent_r_proto" in
14939         ''|0)   d_getnetent_r=undef
14940                 getnetent_r_proto=0
14941                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14942         * )     case "$getnetent_r_proto" in
14943                 REENTRANT_PROTO*) ;;
14944                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14945                 esac
14946                 echo "Prototype: $try" ;;
14947         esac
14948         ;;
14949         *)      case "$usethreads" in
14950                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14951                 esac
14952                 d_getnetent_r=undef
14953                 getnetent_r_proto=0
14954                 ;;
14955         esac
14956         ;;
14957 *)      getnetent_r_proto=0
14958         ;;
14959 esac
14960
14961 : see if prototypes for various getnetxxx netdb.h functions are available
14962 echo " "
14963 set d_getnetprotos getnetent $i_netdb netdb.h
14964 eval $hasproto
14965
14966 : see if getpagesize exists
14967 set getpagesize d_getpagsz
14968 eval $inlibc
14969
14970 : Optional checks for getprotobyname and getprotobynumber
14971
14972 : see if getprotobyname exists
14973 set getprotobyname d_getpbyname
14974 eval $inlibc
14975
14976 : see if getprotobynumber exists
14977 set getprotobynumber d_getpbynumber
14978 eval $inlibc
14979
14980 : see if getprotoent exists
14981 set getprotoent d_getpent
14982 eval $inlibc
14983
14984 : see if getpgid exists
14985 set getpgid d_getpgid
14986 eval $inlibc
14987
14988 : see if getpgrp2 exists
14989 set getpgrp2 d_getpgrp2
14990 eval $inlibc
14991
14992 : see if getppid exists
14993 set getppid d_getppid
14994 eval $inlibc
14995
14996 : see if getpriority exists
14997 set getpriority d_getprior
14998 eval $inlibc
14999
15000 : see if getprotobyname_r exists
15001 set getprotobyname_r d_getprotobyname_r
15002 eval $inlibc
15003 case "$d_getprotobyname_r" in
15004 "$define")
15005         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15006         case "$d_getprotobyname_r_proto:$usethreads" in
15007         ":define")      d_getprotobyname_r_proto=define
15008                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15009                 eval $hasproto ;;
15010         *)      ;;
15011         esac
15012         case "$d_getprotobyname_r_proto" in
15013         define)
15014         case "$getprotobyname_r_proto" in
15015         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15016         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15017         esac
15018         case "$getprotobyname_r_proto" in
15019         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15020         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15021         esac
15022         case "$getprotobyname_r_proto" in
15023         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15024         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15025         esac
15026         case "$getprotobyname_r_proto" in
15027         ''|0)   d_getprotobyname_r=undef
15028                 getprotobyname_r_proto=0
15029                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15030         * )     case "$getprotobyname_r_proto" in
15031                 REENTRANT_PROTO*) ;;
15032                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15033                 esac
15034                 echo "Prototype: $try" ;;
15035         esac
15036         ;;
15037         *)      case "$usethreads" in
15038                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15039                 esac
15040                 d_getprotobyname_r=undef
15041                 getprotobyname_r_proto=0
15042                 ;;
15043         esac
15044         ;;
15045 *)      getprotobyname_r_proto=0
15046         ;;
15047 esac
15048
15049 : see if getprotobynumber_r exists
15050 set getprotobynumber_r d_getprotobynumber_r
15051 eval $inlibc
15052 case "$d_getprotobynumber_r" in
15053 "$define")
15054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15055         case "$d_getprotobynumber_r_proto:$usethreads" in
15056         ":define")      d_getprotobynumber_r_proto=define
15057                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15058                 eval $hasproto ;;
15059         *)      ;;
15060         esac
15061         case "$d_getprotobynumber_r_proto" in
15062         define)
15063         case "$getprotobynumber_r_proto" in
15064         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15065         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15066         esac
15067         case "$getprotobynumber_r_proto" in
15068         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15069         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15070         esac
15071         case "$getprotobynumber_r_proto" in
15072         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15073         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15074         esac
15075         case "$getprotobynumber_r_proto" in
15076         ''|0)   d_getprotobynumber_r=undef
15077                 getprotobynumber_r_proto=0
15078                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15079         * )     case "$getprotobynumber_r_proto" in
15080                 REENTRANT_PROTO*) ;;
15081                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15082                 esac
15083                 echo "Prototype: $try" ;;
15084         esac
15085         ;;
15086         *)      case "$usethreads" in
15087                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15088                 esac
15089                 d_getprotobynumber_r=undef
15090                 getprotobynumber_r_proto=0
15091                 ;;
15092         esac
15093         ;;
15094 *)      getprotobynumber_r_proto=0
15095         ;;
15096 esac
15097
15098 : see if getprotoent_r exists
15099 set getprotoent_r d_getprotoent_r
15100 eval $inlibc
15101 case "$d_getprotoent_r" in
15102 "$define")
15103         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15104         case "$d_getprotoent_r_proto:$usethreads" in
15105         ":define")      d_getprotoent_r_proto=define
15106                 set d_getprotoent_r_proto getprotoent_r $hdrs
15107                 eval $hasproto ;;
15108         *)      ;;
15109         esac
15110         case "$d_getprotoent_r_proto" in
15111         define)
15112         case "$getprotoent_r_proto" in
15113         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15114         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15115         esac
15116         case "$getprotoent_r_proto" in
15117         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15118         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15119         esac
15120         case "$getprotoent_r_proto" in
15121         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15122         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15123         esac
15124         case "$getprotoent_r_proto" in
15125         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15126         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15127         esac
15128         case "$getprotoent_r_proto" in
15129         ''|0)   d_getprotoent_r=undef
15130                 getprotoent_r_proto=0
15131                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15132         * )     case "$getprotoent_r_proto" in
15133                 REENTRANT_PROTO*) ;;
15134                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15135                 esac
15136                 echo "Prototype: $try" ;;
15137         esac
15138         ;;
15139         *)      case "$usethreads" in
15140                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15141                 esac
15142                 d_getprotoent_r=undef
15143                 getprotoent_r_proto=0
15144                 ;;
15145         esac
15146         ;;
15147 *)      getprotoent_r_proto=0
15148         ;;
15149 esac
15150
15151 : see if prototypes for various getprotoxxx netdb.h functions are available
15152 echo " "
15153 set d_getprotoprotos getprotoent $i_netdb netdb.h
15154 eval $hasproto
15155
15156 : see if getprpwnam exists
15157 set getprpwnam d_getprpwnam
15158 eval $inlibc
15159
15160 : see if getpwent exists
15161 set getpwent d_getpwent
15162 eval $inlibc
15163
15164 : see if getpwent_r exists
15165 set getpwent_r d_getpwent_r
15166 eval $inlibc
15167 case "$d_getpwent_r" in
15168 "$define")
15169         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15170         case "$d_getpwent_r_proto:$usethreads" in
15171         ":define")      d_getpwent_r_proto=define
15172                 set d_getpwent_r_proto getpwent_r $hdrs
15173                 eval $hasproto ;;
15174         *)      ;;
15175         esac
15176         case "$d_getpwent_r_proto" in
15177         define)
15178         case "$getpwent_r_proto" in
15179         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15188         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15189         esac
15190         case "$getpwent_r_proto" in
15191         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15192         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15193         esac
15194         case "$getpwent_r_proto" in
15195         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15196         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15197         esac
15198         case "$getpwent_r_proto" in
15199         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15200         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15201         esac
15202         case "$getpwent_r_proto" in
15203         ''|0)   d_getpwent_r=undef
15204                 getpwent_r_proto=0
15205                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15206         * )     case "$getpwent_r_proto" in
15207                 REENTRANT_PROTO*) ;;
15208                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15209                 esac
15210                 echo "Prototype: $try" ;;
15211         esac
15212         ;;
15213         *)      case "$usethreads" in
15214                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15215                 esac
15216                 d_getpwent_r=undef
15217                 getpwent_r_proto=0
15218                 ;;
15219         esac
15220         ;;
15221 *)      getpwent_r_proto=0
15222         ;;
15223 esac
15224
15225 : see if getpwnam_r exists
15226 set getpwnam_r d_getpwnam_r
15227 eval $inlibc
15228 case "$d_getpwnam_r" in
15229 "$define")
15230         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15231         case "$d_getpwnam_r_proto:$usethreads" in
15232         ":define")      d_getpwnam_r_proto=define
15233                 set d_getpwnam_r_proto getpwnam_r $hdrs
15234                 eval $hasproto ;;
15235         *)      ;;
15236         esac
15237         case "$d_getpwnam_r_proto" in
15238         define)
15239         case "$getpwnam_r_proto" in
15240         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15241         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15242         esac
15243         case "$getpwnam_r_proto" in
15244         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15245         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15246         esac
15247         case "$getpwnam_r_proto" in
15248         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15249         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15250         esac
15251         case "$getpwnam_r_proto" in
15252         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15253         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15254         esac
15255         case "$getpwnam_r_proto" in
15256         ''|0)   d_getpwnam_r=undef
15257                 getpwnam_r_proto=0
15258                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15259         * )     case "$getpwnam_r_proto" in
15260                 REENTRANT_PROTO*) ;;
15261                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15262                 esac
15263                 echo "Prototype: $try" ;;
15264         esac
15265         ;;
15266         *)      case "$usethreads" in
15267                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15268                 esac
15269                 d_getpwnam_r=undef
15270                 getpwnam_r_proto=0
15271                 ;;
15272         esac
15273         ;;
15274 *)      getpwnam_r_proto=0
15275         ;;
15276 esac
15277
15278 : see if getpwuid_r exists
15279 set getpwuid_r d_getpwuid_r
15280 eval $inlibc
15281 case "$d_getpwuid_r" in
15282 "$define")
15283         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15284         case "$d_getpwuid_r_proto:$usethreads" in
15285         ":define")      d_getpwuid_r_proto=define
15286                 set d_getpwuid_r_proto getpwuid_r $hdrs
15287                 eval $hasproto ;;
15288         *)      ;;
15289         esac
15290         case "$d_getpwuid_r_proto" in
15291         define)
15292         case "$getpwuid_r_proto" in
15293         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15294         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15295         esac
15296         case "$getpwuid_r_proto" in
15297         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15298         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15299         esac
15300         case "$getpwuid_r_proto" in
15301         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15302         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15303         esac
15304         case "$getpwuid_r_proto" in
15305         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15306         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15307         esac
15308         case "$getpwuid_r_proto" in
15309         ''|0)   d_getpwuid_r=undef
15310                 getpwuid_r_proto=0
15311                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15312         * )     case "$getpwuid_r_proto" in
15313                 REENTRANT_PROTO*) ;;
15314                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15315                 esac
15316                 echo "Prototype: $try" ;;
15317         esac
15318         ;;
15319         *)      case "$usethreads" in
15320                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15321                 esac
15322                 d_getpwuid_r=undef
15323                 getpwuid_r_proto=0
15324                 ;;
15325         esac
15326         ;;
15327 *)      getpwuid_r_proto=0
15328         ;;
15329 esac
15330
15331 : Optional checks for getsbyname and getsbyport
15332
15333 : see if getservbyname exists
15334 set getservbyname d_getsbyname
15335 eval $inlibc
15336
15337 : see if getservbyport exists
15338 set getservbyport d_getsbyport
15339 eval $inlibc
15340
15341 : see if getservent exists
15342 set getservent d_getsent
15343 eval $inlibc
15344
15345 : see if getservbyname_r exists
15346 set getservbyname_r d_getservbyname_r
15347 eval $inlibc
15348 case "$d_getservbyname_r" in
15349 "$define")
15350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15351         case "$d_getservbyname_r_proto:$usethreads" in
15352         ":define")      d_getservbyname_r_proto=define
15353                 set d_getservbyname_r_proto getservbyname_r $hdrs
15354                 eval $hasproto ;;
15355         *)      ;;
15356         esac
15357         case "$d_getservbyname_r_proto" in
15358         define)
15359         case "$getservbyname_r_proto" in
15360         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15361         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15362         esac
15363         case "$getservbyname_r_proto" in
15364         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15365         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15366         esac
15367         case "$getservbyname_r_proto" in
15368         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15369         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15370         esac
15371         case "$getservbyname_r_proto" in
15372         ''|0)   d_getservbyname_r=undef
15373                 getservbyname_r_proto=0
15374                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15375         * )     case "$getservbyname_r_proto" in
15376                 REENTRANT_PROTO*) ;;
15377                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15378                 esac
15379                 echo "Prototype: $try" ;;
15380         esac
15381         ;;
15382         *)      case "$usethreads" in
15383                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15384                 esac
15385                 d_getservbyname_r=undef
15386                 getservbyname_r_proto=0
15387                 ;;
15388         esac
15389         ;;
15390 *)      getservbyname_r_proto=0
15391         ;;
15392 esac
15393
15394 : see if getservbyport_r exists
15395 set getservbyport_r d_getservbyport_r
15396 eval $inlibc
15397 case "$d_getservbyport_r" in
15398 "$define")
15399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15400         case "$d_getservbyport_r_proto:$usethreads" in
15401         ":define")      d_getservbyport_r_proto=define
15402                 set d_getservbyport_r_proto getservbyport_r $hdrs
15403                 eval $hasproto ;;
15404         *)      ;;
15405         esac
15406         case "$d_getservbyport_r_proto" in
15407         define)
15408         case "$getservbyport_r_proto" in
15409         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15410         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15411         esac
15412         case "$getservbyport_r_proto" in
15413         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15414         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15415         esac
15416         case "$getservbyport_r_proto" in
15417         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15418         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15419         esac
15420         case "$getservbyport_r_proto" in
15421         ''|0)   d_getservbyport_r=undef
15422                 getservbyport_r_proto=0
15423                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15424         * )     case "$getservbyport_r_proto" in
15425                 REENTRANT_PROTO*) ;;
15426                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15427                 esac
15428                 echo "Prototype: $try" ;;
15429         esac
15430         ;;
15431         *)      case "$usethreads" in
15432                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15433                 esac
15434                 d_getservbyport_r=undef
15435                 getservbyport_r_proto=0
15436                 ;;
15437         esac
15438         ;;
15439 *)      getservbyport_r_proto=0
15440         ;;
15441 esac
15442
15443 : see if getservent_r exists
15444 set getservent_r d_getservent_r
15445 eval $inlibc
15446 case "$d_getservent_r" in
15447 "$define")
15448         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15449         case "$d_getservent_r_proto:$usethreads" in
15450         ":define")      d_getservent_r_proto=define
15451                 set d_getservent_r_proto getservent_r $hdrs
15452                 eval $hasproto ;;
15453         *)      ;;
15454         esac
15455         case "$d_getservent_r_proto" in
15456         define)
15457         case "$getservent_r_proto" in
15458         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15459         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15460         esac
15461         case "$getservent_r_proto" in
15462         ''|0) try='int getservent_r(struct servent*, char*, int);'
15463         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15464         esac
15465         case "$getservent_r_proto" in
15466         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15467         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15468         esac
15469         case "$getservent_r_proto" in
15470         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15471         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15472         esac
15473         case "$getservent_r_proto" in
15474         ''|0)   d_getservent_r=undef
15475                 getservent_r_proto=0
15476                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15477         * )     case "$getservent_r_proto" in
15478                 REENTRANT_PROTO*) ;;
15479                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15480                 esac
15481                 echo "Prototype: $try" ;;
15482         esac
15483         ;;
15484         *)      case "$usethreads" in
15485                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15486                 esac
15487                 d_getservent_r=undef
15488                 getservent_r_proto=0
15489                 ;;
15490         esac
15491         ;;
15492 *)      getservent_r_proto=0
15493         ;;
15494 esac
15495
15496 : see if prototypes for various getservxxx netdb.h functions are available
15497 echo " "
15498 set d_getservprotos getservent $i_netdb netdb.h
15499 eval $hasproto
15500
15501 : see if getspnam exists
15502 set getspnam d_getspnam
15503 eval $inlibc
15504
15505 : see if this is a shadow.h system
15506 set shadow.h i_shadow
15507 eval $inhdr
15508
15509 : see if getspnam_r exists
15510 set getspnam_r d_getspnam_r
15511 eval $inlibc
15512 case "$d_getspnam_r" in
15513 "$define")
15514         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15515         case "$d_getspnam_r_proto:$usethreads" in
15516         ":define")      d_getspnam_r_proto=define
15517                 set d_getspnam_r_proto getspnam_r $hdrs
15518                 eval $hasproto ;;
15519         *)      ;;
15520         esac
15521         case "$d_getspnam_r_proto" in
15522         define)
15523         case "$getspnam_r_proto" in
15524         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15525         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15526         esac
15527         case "$getspnam_r_proto" in
15528         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15529         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15530         esac
15531         case "$getspnam_r_proto" in
15532         ''|0)   d_getspnam_r=undef
15533                 getspnam_r_proto=0
15534                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15535         * )     case "$getspnam_r_proto" in
15536                 REENTRANT_PROTO*) ;;
15537                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15538                 esac
15539                 echo "Prototype: $try" ;;
15540         esac
15541         ;;
15542         *)      case "$usethreads" in
15543                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15544                 esac
15545                 d_getspnam_r=undef
15546                 getspnam_r_proto=0
15547                 ;;
15548         esac
15549         ;;
15550 *)      getspnam_r_proto=0
15551         ;;
15552 esac
15553
15554 : see if gettimeofday or ftime exists
15555 set gettimeofday d_gettimeod
15556 eval $inlibc
15557 case "$d_gettimeod" in
15558 "$undef")
15559         set ftime d_ftime 
15560         eval $inlibc
15561         ;;
15562 *)
15563         val="$undef"; set d_ftime; eval $setvar
15564         ;;
15565 esac
15566 case "$d_gettimeod$d_ftime" in
15567 "$undef$undef")
15568         echo " "
15569         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15570         ;;
15571 esac
15572
15573 : see if gmtime_r exists
15574 set gmtime_r d_gmtime_r
15575 eval $inlibc
15576 case "$d_gmtime_r" in
15577 "$define")
15578         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15579         case "$d_gmtime_r_proto:$usethreads" in
15580         ":define")      d_gmtime_r_proto=define
15581                 set d_gmtime_r_proto gmtime_r $hdrs
15582                 eval $hasproto ;;
15583         *)      ;;
15584         esac
15585         case "$d_gmtime_r_proto" in
15586         define)
15587         case "$gmtime_r_proto" in
15588         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15589         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15590         esac
15591         case "$gmtime_r_proto" in
15592         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15593         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15594         esac
15595         case "$gmtime_r_proto" in
15596         ''|0)   d_gmtime_r=undef
15597                 gmtime_r_proto=0
15598                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15599         * )     case "$gmtime_r_proto" in
15600                 REENTRANT_PROTO*) ;;
15601                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15602                 esac
15603                 echo "Prototype: $try" ;;
15604         esac
15605         ;;
15606         *)      case "$usethreads" in
15607                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15608                 esac
15609                 d_gmtime_r=undef
15610                 gmtime_r_proto=0
15611                 ;;
15612         esac
15613         ;;
15614 *)      gmtime_r_proto=0
15615         ;;
15616 esac
15617
15618 : see if hasmntopt exists
15619 set hasmntopt d_hasmntopt
15620 eval $inlibc
15621
15622 : see if this is a netinet/in.h or sys/in.h system
15623 set netinet/in.h i_niin sys/in.h i_sysin
15624 eval $inhdr
15625
15626 : see if arpa/inet.h has to be included
15627 set arpa/inet.h i_arpainet
15628 eval $inhdr
15629
15630 : see if htonl --and friends-- exists
15631 val=''
15632 set htonl val
15633 eval $inlibc
15634
15635 : Maybe they are macros.
15636 case "$val" in
15637 $undef)
15638         $cat >htonl.c <<EOM
15639 #include <stdio.h>
15640 #include <sys/types.h>
15641 #$i_niin I_NETINET_IN
15642 #$i_sysin I_SYS_IN
15643 #$i_arpainet I_ARPA_INET
15644 #ifdef I_NETINET_IN
15645 #include <netinet/in.h>
15646 #endif
15647 #ifdef I_SYS_IN
15648 #include <sys/in.h>
15649 #endif
15650 #ifdef I_ARPA_INET
15651 #include <arpa/inet.h>
15652 #endif
15653 #ifdef htonl
15654 printf("Defined as a macro.");
15655 #endif
15656 EOM
15657         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15658         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15659                 val="$define"
15660                 echo "But it seems to be defined as a macro." >&4
15661         fi
15662         $rm -f htonl.?
15663         ;;
15664 esac
15665 set d_htonl
15666 eval $setvar
15667
15668 : see if hypot exists
15669 set hypot d_hypot
15670 eval $inlibc
15671
15672 : see if ilogb exists
15673 set ilogb d_ilogb
15674 eval $inlibc
15675
15676 : see if ilogbl exists
15677 set ilogbl d_ilogbl
15678 eval $inlibc
15679
15680 : check whether inet_aton exists
15681 set inet_aton d_inetaton
15682 eval $inlibc
15683
15684 : see if inet_ntop exists
15685 set inet_ntop d_inetntop
15686 eval $inlibc
15687
15688 : see if inet_pton exists
15689 set inet_pton d_inetpton
15690 eval $inlibc
15691
15692 : Look for isascii
15693 echo " "
15694 $cat >isascii.c <<EOCP
15695 #include <stdio.h>
15696 #include <ctype.h>
15697 #$i_stdlib I_STDLIB
15698 #ifdef I_STDLIB
15699 #include <stdlib.h>
15700 #endif
15701 int main() {
15702         int c = 'A';
15703         if (isascii(c))
15704                 exit(0);
15705         else
15706                 exit(1);
15707 }
15708 EOCP
15709 set isascii
15710 if eval $compile; then
15711         echo "isascii() found." >&4
15712         val="$define"
15713 else
15714         echo "isascii() NOT found." >&4
15715         val="$undef"
15716 fi
15717 set d_isascii
15718 eval $setvar
15719 $rm -f isascii*
15720
15721 : Look for isblank
15722 echo " "
15723 $cat >isblank.c <<'EOCP'
15724 #include <stdio.h>
15725 #include <ctype.h>
15726 int main() {
15727         int c = ' ';
15728         if (isblank(c))
15729                 return 0 ;
15730         else
15731                 return 1 ;
15732 }
15733 EOCP
15734 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15735         echo "isblank() found." >&4
15736         val="$define"
15737 else
15738         echo "isblank() NOT found." >&4
15739         val="$undef"
15740 fi
15741 set d_isblank
15742 eval $setvar
15743 $rm -f isblank*
15744
15745 : check for isfinite
15746 echo "Checking to see if you have isfinite..." >&4
15747 $cat >try.c <<EOCP
15748 #include <math.h>
15749 int main() { return isfinite(0.0); }
15750 EOCP
15751 set try
15752 if eval $compile; then
15753         val="$define"
15754         echo "You have isfinite."
15755 else
15756         val="$undef"
15757         echo "You do not have isfinite."
15758 fi
15759 $rm_try
15760 set d_isfinite
15761 eval $setvar
15762
15763 : see if isfinitel exists
15764 set isfinitel d_isfinitel
15765 eval $inlibc
15766
15767 : check for isinf
15768 echo "Checking to see if you have isinf..." >&4
15769 $cat >try.c <<EOCP
15770 #include <math.h>
15771 int main() { return isinf(0.0); }
15772 EOCP
15773 set try
15774 if eval $compile; then
15775         val="$define"
15776         echo "You have isinf."
15777 else
15778         val="$undef"
15779         echo "You do not have isinf."
15780 fi
15781 $rm_try
15782 set d_isinf
15783 eval $setvar
15784
15785 : see if isinfl exists
15786 set isinfl d_isinfl
15787 eval $inlibc
15788
15789 : check for isless
15790 echo "Checking to see if you have isless..." >&4
15791 $cat >try.c <<EOCP
15792 #include <math.h>
15793 int main() { return isless(0.0); }
15794 EOCP
15795 set try
15796 if eval $compile; then
15797         val="$define"
15798         echo "You have isless."
15799 else
15800         val="$undef"
15801         echo "You do not have isless."
15802 fi
15803 $rm_try
15804 set d_isless
15805 eval $setvar
15806
15807 : check for isnan
15808 echo "Checking to see if you have isnan..." >&4
15809 $cat >try.c <<EOCP
15810 #include <math.h>
15811 int main() { return isnan(0.0); }
15812 EOCP
15813 set try
15814 if eval $compile; then
15815         val="$define"
15816         echo "You have isnan."
15817 else
15818         val="$undef"
15819         echo "You do not have isnan."
15820 fi
15821 $rm_try
15822 set d_isnan
15823 eval $setvar
15824
15825 : see if isnanl exists
15826 set isnanl d_isnanl
15827 eval $inlibc
15828
15829 : check for isnormal
15830 echo "Checking to see if you have isnormal..." >&4
15831 $cat >try.c <<EOCP
15832 #include <math.h>
15833 int main() { return isnormal(0.0); }
15834 EOCP
15835 set try
15836 if eval $compile; then
15837         val="$define"
15838         echo "You have isnormal."
15839 else
15840         val="$undef"
15841         echo "You do not have isnormal."
15842 fi
15843 $rm_try
15844 set d_isnormal
15845 eval $setvar
15846
15847 : see if j0 exists
15848 set j0 d_j0
15849 eval $inlibc
15850
15851 : see if j0l exists
15852 set j0l d_j0l
15853 eval $inlibc
15854
15855 : see if killpg exists
15856 set killpg d_killpg
15857 eval $inlibc
15858
15859 : see if localeconv exists
15860 set localeconv d_locconv
15861 eval $inlibc
15862
15863 : see if libc has the POSIX.1-2008 currency locale rules
15864 case "$d_locconv:$d_lc_monetary_2008" in
15865 $define:)
15866         $cat >try.c <<EOCP
15867 #include <locale.h>
15868 int main() {
15869         struct lconv *lc = localeconv();
15870         char int_p_cs_precedes = lc->int_p_cs_precedes;
15871         return 0;
15872 }
15873 EOCP
15874         set try
15875         if eval $compile; then
15876                 d_lc_monetary_2008="$define"
15877         else
15878                 d_lc_monetary_2008="$undef"
15879         fi;
15880         $rm_try
15881         ;;
15882 esac
15883
15884 : see if lchown exists
15885 echo " "
15886 $cat > try.c <<'EOCP'
15887 /* System header to define __stub macros and hopefully few prototypes,
15888     which can conflict with char lchown(); below.  */
15889 #include <assert.h>
15890 /* Override any gcc2 internal prototype to avoid an error.  */
15891 /* We use char because int might match the return type of a gcc2
15892    builtin and then its argument prototype would still apply.  */
15893 char lchown();
15894 int main() {
15895     /*  The GNU C library defines this for functions which it implements
15896         to always fail with ENOSYS.  Some functions are actually named
15897         something starting with __ and the normal name is an alias.  */
15898 #if defined (__stub_lchown) || defined (__stub___lchown)
15899 choke me
15900 #else
15901 lchown();
15902 #endif
15903 ; return 0; }
15904 EOCP
15905 set try
15906 if eval $compile; then
15907     $echo "lchown() found." >&4
15908     val="$define"
15909 else
15910     $echo "lchown() NOT found." >&4
15911     val="$undef"
15912 fi
15913 set d_lchown
15914 eval $setvar
15915
15916 : See if number of significant digits in a double precision number is known
15917 echo " "
15918 $cat >ldbl_dig.c <<EOM
15919 #include <limits.h>
15920 #include <float.h>
15921 #ifdef LDBL_DIG
15922 printf("Contains LDBL_DIG");
15923 #endif
15924 EOM
15925 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15926 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15927         echo "LDBL_DIG found." >&4
15928         val="$define"
15929 else
15930         echo "LDBL_DIG NOT found." >&4
15931         val="$undef"
15932 fi
15933 $rm -f ldbl_dig.?
15934 set d_ldbl_dig
15935 eval $setvar
15936
15937 : see if lgamma exists
15938 set lgamma d_lgamma
15939 eval $inlibc
15940
15941 : see if lgamma_r exists
15942 set lgamma_r d_lgamma_r
15943 eval $inlibc
15944
15945 : check to see if math.h defines _LIB_VERSION
15946 d_libm_lib_version="$undef"
15947 echo " "
15948 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15949 $cat >try.c <<EOCP
15950 #include <unistd.h>
15951 #include <math.h>
15952 int main (int argc, char *argv[])
15953 {
15954     printf ("%d\n", _LIB_VERSION);
15955     return (0);
15956     } /* main */
15957 EOCP
15958 set try
15959 if eval $compile; then
15960     foo=`$run ./try`
15961     echo "Yes, it does ($foo)" >&4
15962     d_libm_lib_version="$define"
15963 else
15964     echo "No, it does not (probably harmless)" >&4
15965     fi
15966 $rm_try
15967
15968 : see if link exists
15969 set link d_link
15970 eval $inlibc
15971
15972 : see if llrint exists
15973 set llrint d_llrint
15974 eval $inlibc
15975
15976 : see if llrintl exists
15977 set llrintl d_llrintl
15978 eval $inlibc
15979
15980 : see if llround exists
15981 set llround d_llround
15982 eval $inlibc
15983
15984 : see if llroundl exists
15985 set llroundl d_llroundl
15986 eval $inlibc
15987
15988 : see if localeconv_l exists
15989 set localeconv_l d_localeconv_l
15990 eval $inlibc
15991
15992 : see if localtime_r exists
15993 set localtime_r d_localtime_r
15994 eval $inlibc
15995 case "$d_localtime_r" in
15996 "$define")
15997         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15998         case "$d_localtime_r_proto:$usethreads" in
15999         ":define")      d_localtime_r_proto=define
16000                 set d_localtime_r_proto localtime_r $hdrs
16001                 eval $hasproto ;;
16002         *)      ;;
16003         esac
16004         case "$d_localtime_r_proto" in
16005         define)
16006         case "$localtime_r_proto" in
16007         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16008         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16009         esac
16010         case "$localtime_r_proto" in
16011         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16012         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16013         esac
16014         case "$localtime_r_proto" in
16015         ''|0)   d_localtime_r=undef
16016                 localtime_r_proto=0
16017                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16018         * )     case "$localtime_r_proto" in
16019                 REENTRANT_PROTO*) ;;
16020                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16021                 esac
16022                 echo "Prototype: $try" ;;
16023         esac
16024         ;;
16025         *)      case "$usethreads" in
16026                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16027                 esac
16028                 d_localtime_r=undef
16029                 localtime_r_proto=0
16030                 ;;
16031         esac
16032         ;;
16033 *)      localtime_r_proto=0
16034         ;;
16035 esac
16036
16037 : see if localtime_r calls tzset
16038 case "$localtime_r_proto" in
16039 REENTRANT_PROTO*)
16040         $cat >try.c <<EOCP
16041 /*  Does our libc's localtime_r call tzset ?
16042  *  return 0 if so, 1 otherwise.
16043  */
16044 #$i_systypes    I_SYS_TYPES
16045 #$i_unistd      I_UNISTD
16046 #$i_time        I_TIME
16047 #$i_stdlib      I_STDLIB
16048 #$i_malloc      I_MALLOC
16049 #ifdef I_SYS_TYPES
16050 #  include <sys/types.h>
16051 #endif
16052 #ifdef I_UNISTD
16053 #  include <unistd.h>
16054 #endif
16055 #ifdef I_TIME
16056 #  include <time.h>
16057 #endif
16058 #ifdef I_STDLIB
16059 #include <stdlib.h>
16060 #endif
16061 #include <string.h>
16062 #ifdef I_MALLOC
16063 #  include <malloc.h>
16064 #endif
16065 int main()
16066 {
16067     time_t t = time(0L);
16068     char w_tz[]="TZ" "=GMT+5",
16069          e_tz[]="TZ" "=GMT-5",
16070         *tz_e = (char*)malloc(16),
16071         *tz_w = (char*)malloc(16);
16072     struct tm tm_e, tm_w;
16073     memset(&tm_e,'\0',sizeof(struct tm));
16074     memset(&tm_w,'\0',sizeof(struct tm));
16075     strcpy(tz_e,e_tz);
16076     strcpy(tz_w,w_tz);
16077
16078     putenv(tz_e);
16079     localtime_r(&t, &tm_e);
16080
16081     putenv(tz_w);
16082     localtime_r(&t, &tm_w);
16083
16084     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16085         return 1;
16086     return 0;
16087 }
16088 EOCP
16089         set try
16090         if eval $compile; then
16091             if $run ./try; then
16092                 d_localtime_r_needs_tzset=undef;
16093             else
16094                 d_localtime_r_needs_tzset=define;
16095             fi;
16096         else
16097             d_localtime_r_needs_tzset=undef;
16098         fi;
16099      ;;
16100   *)
16101      d_localtime_r_needs_tzset=undef;
16102      ;;
16103 esac
16104 $rm_try
16105
16106 : see if lockf exists
16107 set lockf d_lockf
16108 eval $inlibc
16109
16110 : see if log1p exists
16111 set log1p d_log1p
16112 eval $inlibc
16113
16114 : see if log2 exists
16115 set log2 d_log2
16116 eval $inlibc
16117
16118 : see if logb exists
16119 set logb d_logb
16120 eval $inlibc
16121
16122 : see if lrint exists
16123 set lrint d_lrint
16124 eval $inlibc
16125
16126 : see if lrintl exists
16127 set lrintl d_lrintl
16128 eval $inlibc
16129
16130 : see if lround exists
16131 set lround d_lround
16132 eval $inlibc
16133
16134 : see if lroundl exists
16135 set lroundl d_lroundl
16136 eval $inlibc
16137
16138 : see if prototype for lseek is available
16139 echo " "
16140 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16141 eval $hasproto
16142
16143 : see if lstat exists
16144 set lstat d_lstat
16145 eval $inlibc
16146
16147 : see if madvise exists
16148 set madvise d_madvise
16149 eval $inlibc
16150
16151 : see if malloc_size exists
16152 set malloc_size d_malloc_size
16153 eval $inlibc
16154
16155 : see if malloc_size_good exists
16156 set malloc_good_size d_malloc_good_size
16157 eval $inlibc
16158
16159 : see if mblen exists
16160 set mblen d_mblen
16161 eval $inlibc
16162
16163 : see if mbrlen exists
16164 set mbrlen d_mbrlen
16165 eval $inlibc
16166
16167 : see if mbrtowc exists
16168 set mbrtowc d_mbrtowc
16169 eval $inlibc
16170
16171 : see if mbstowcs exists
16172 set mbstowcs d_mbstowcs
16173 eval $inlibc
16174
16175 : see if mbtowc exists
16176 set mbtowc d_mbtowc
16177 eval $inlibc
16178
16179 : see if memmem exists
16180 set memmem d_memmem
16181 eval $inlibc
16182
16183 : see if memrchr exists
16184 set memrchr d_memrchr
16185 eval $inlibc
16186
16187 : see if mkdir exists
16188 set mkdir d_mkdir
16189 eval $inlibc
16190
16191 : see if mkdtemp exists
16192 set mkdtemp d_mkdtemp
16193 eval $inlibc
16194
16195 : see if mkfifo exists
16196 set mkfifo d_mkfifo
16197 eval $inlibc
16198
16199 : see if mkostemp exists
16200 set mkostemp d_mkostemp
16201 eval $inlibc
16202
16203 : see if mkstemp exists
16204 set mkstemp d_mkstemp
16205 eval $inlibc
16206
16207 : see if mkstemps exists
16208 set mkstemps d_mkstemps
16209 eval $inlibc
16210
16211 : see if mktime exists
16212 set mktime d_mktime
16213 eval $inlibc
16214
16215 : see if sys/mman.h has to be included
16216 set sys/mman.h i_sysmman
16217 eval $inhdr
16218
16219 : see if mmap exists
16220 set mmap d_mmap
16221 eval $inlibc
16222 : see what shmat returns
16223 : default to something harmless
16224 mmaptype='void *'
16225 case "$i_sysmman$d_mmap" in
16226 "$define$define")
16227         $cat >mmap.c <<'END'
16228 #include <sys/mman.h>
16229 void *mmap();
16230 END
16231         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16232                 mmaptype='void *'
16233         else
16234                 mmaptype='caddr_t'
16235         fi
16236         echo "and it returns ($mmaptype)." >&4
16237         ;;
16238 esac
16239
16240 : see if sqrtl exists
16241 set sqrtl d_sqrtl
16242 eval $inlibc
16243
16244 : see if scalbnl exists
16245 set scalbnl d_scalbnl
16246 eval $inlibc
16247
16248 : see if truncl exists
16249 set truncl d_truncl
16250 eval $inlibc
16251
16252 : see if modfl exists
16253 set modfl d_modfl
16254 eval $inlibc
16255
16256 : see if prototype for modfl is available
16257 echo " "
16258 set d_modflproto modfl define math.h
16259 eval $hasproto
16260
16261 if $test "$uselongdouble" = "$define"; then
16262     message=""
16263     if $test "$d_sqrtl" != "$define"; then
16264         message="$message sqrtl"
16265     fi
16266     if $test "$d_modfl" != "$define"; then
16267         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16268             echo "You have both truncl and copysignl, so I can emulate modfl."
16269         else
16270             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16271                 echo "You have both aintl and copysignl, so I can emulate modfl."
16272             else
16273                 message="$message modfl"
16274             fi
16275         fi
16276     fi
16277     if $test "$d_frexpl" != "$define"; then
16278         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16279             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16280         else
16281             message="$message frexpl"
16282         fi
16283     fi
16284     if $test "$d_ldexpl" != "$define"; then
16285         message="$message ldexpl"
16286     fi
16287
16288     if $test "$message" != ""; then
16289         $cat <<EOM >&4
16290
16291 *** You requested the use of long doubles but you do not seem to have
16292 *** the following mathematical functions needed for long double support:
16293 ***    $message
16294 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16295 *** Cannot continue, aborting.
16296
16297 EOM
16298
16299         exit 1
16300     fi
16301 fi
16302
16303 : see if mprotect exists
16304 set mprotect d_mprotect
16305 eval $inlibc
16306
16307 : see if msgctl exists
16308 set msgctl d_msgctl
16309 eval $inlibc
16310
16311 : see if msgget exists
16312 set msgget d_msgget
16313 eval $inlibc
16314
16315 : see if msgsnd exists
16316 set msgsnd d_msgsnd
16317 eval $inlibc
16318
16319 : see if msgrcv exists
16320 set msgrcv d_msgrcv
16321 eval $inlibc
16322
16323 : see how much of the 'msg*(2)' library is present.
16324 h_msg=true
16325 echo " "
16326 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16327 *"$undef"*) h_msg=false;;
16328 esac
16329 case "$osname" in
16330 freebsd)
16331     case "`ipcs 2>&1`" in
16332     "SVID messages"*"not configured"*)
16333         echo "Your $osname does not have the msg*(2) configured." >&4
16334         h_msg=false
16335         val="$undef"
16336         set msgctl d_msgctl
16337         eval $setvar
16338         set msgget d_msgget
16339         eval $setvar
16340         set msgsnd d_msgsnd
16341         eval $setvar
16342         set msgrcv d_msgrcv
16343         eval $setvar
16344         ;;
16345     esac
16346     ;;
16347 esac
16348 : we could also check for sys/ipc.h ...
16349 if $h_msg && $test `./findhdr sys/msg.h`; then
16350         echo "You have the full msg*(2) library." >&4
16351         val="$define"
16352 else
16353         echo "You don't have the full msg*(2) library." >&4
16354         val="$undef"
16355 fi
16356 set d_msg
16357 eval $setvar
16358
16359 : Check for msghdr_s
16360 echo " "
16361 echo "Checking to see if your system supports struct msghdr..." >&4
16362 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16363 eval $hasstruct
16364 case "$d_msghdr_s" in
16365 "$define")      echo "Yes, it does."   ;;
16366 *)              echo "No, it doesn't." ;;
16367 esac
16368
16369 : see if msync exists
16370 set msync d_msync
16371 eval $inlibc
16372
16373 : see if munmap exists
16374 set munmap d_munmap
16375 eval $inlibc
16376
16377 : see if nan exists
16378 set nan d_nan
16379 eval $inlibc
16380
16381 : see if nanosleep exists
16382 set nanosleep d_nanosleep
16383 eval $inlibc
16384
16385 : see if nearbyint exists
16386 set nearbyint d_nearbyint
16387 eval $inlibc
16388
16389 : see if nextafter exists
16390 set nextafter d_nextafter
16391 eval $inlibc
16392
16393 : see if nexttoward exists
16394 set nexttoward d_nexttoward
16395 eval $inlibc
16396
16397 : see if nice exists
16398 set nice d_nice
16399 eval $inlibc
16400
16401 : see if this is a langinfo.h system
16402 set langinfo.h i_langinfo
16403 eval $inhdr
16404
16405 : see if nl_langinfo exists
16406 set nl_langinfo d_nl_langinfo
16407 eval $inlibc
16408
16409 : see if this is a quadmath.h system
16410 set quadmath.h i_quadmath
16411 eval $inhdr
16412
16413 : Check basic sizes
16414 echo " "
16415 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16416
16417 case "$use64bitint:$d_quad:$quadtype" in
16418 define:define:?*)
16419         ivtype="$quadtype"
16420         uvtype="$uquadtype"
16421         ivsize=8
16422         uvsize=8
16423         ;;
16424 *)      ivtype="long"
16425         uvtype="unsigned long"
16426         ivsize=$longsize
16427         uvsize=$longsize
16428         ;;
16429 esac
16430
16431 case "$uselongdouble:$d_longdbl" in
16432 define:define)
16433         nvtype="long double"
16434         nvsize=$longdblsize
16435         ;;
16436 *)      nvtype=double
16437         nvsize=$doublesize
16438         ;;
16439 esac
16440
16441 case "$usequadmath:$i_quadmath" in
16442 define:define)
16443   nvtype="__float128"
16444   nvsize=16
16445   case "$libs" in
16446   *quadmath*) ;;
16447   *) $cat <<EOM >&4
16448
16449 *** You requested the use of the quadmath library, but you
16450 *** do not seem to have the quadmath library installed.
16451 *** Cannot continue, aborting.
16452 EOM
16453     exit 1
16454     ;;
16455   esac
16456   ;;
16457 define:*) $cat <<EOM >&4
16458
16459 *** You requested the use of the quadmath library, but you
16460 *** do not seem to have the required header, <quadmath.h>.
16461 EOM
16462   case "$gccversion" in
16463   [23].*|4.[0-5]*)
16464    $cat <<EOM >&4
16465 *** Your gcc looks a bit old:
16466 *** $gccversion
16467 EOM
16468     ;;
16469   '')
16470    $cat <<EOM >&4
16471 *** You are not running a gcc.
16472 EOM
16473     ;;
16474   esac
16475   $cat <<EOM >&4
16476 *** For the quadmath library you need at least gcc 4.6.
16477 *** Cannot continue, aborting.
16478 EOM
16479   exit 1
16480   ;;
16481 esac
16482
16483 $echo "(IV will be "$ivtype", $ivsize bytes)"
16484 $echo "(UV will be "$uvtype", $uvsize bytes)"
16485 $echo "(NV will be "$nvtype", $nvsize bytes)"
16486
16487 $cat >try.c <<EOCP
16488 #$i_inttypes I_INTTYPES
16489 #ifdef I_INTTYPES
16490 #include <inttypes.h>
16491 #endif
16492 #include <stdio.h>
16493 int main() {
16494 #ifdef INT8
16495    int8_t i =  INT8_MAX;
16496   uint8_t u = UINT8_MAX;
16497   printf("int8_t\n");
16498 #endif
16499 #ifdef INT16
16500    int16_t i =  INT16_MAX;
16501   uint16_t u = UINT16_MAX;
16502   printf("int16_t\n");
16503 #endif
16504 #ifdef INT32
16505    int32_t i =  INT32_MAX;
16506   uint32_t u = UINT32_MAX;
16507   printf("int32_t\n");
16508 #endif
16509 }
16510 EOCP
16511
16512 i8type="signed char"
16513 u8type="unsigned char"
16514 i8size=1
16515 u8size=1
16516
16517 case "$i16type" in
16518 '')     case "$shortsize" in
16519         2)      i16type=short
16520                 u16type="unsigned short"
16521                 i16size=$shortsize
16522                 u16size=$shortsize
16523                 ;;
16524         esac
16525         ;;
16526 esac
16527 case "$i16type" in
16528 '')     set try -DINT16
16529         if eval $compile; then
16530                 case "`$run ./try`" in
16531                 int16_t)
16532                         i16type=int16_t
16533                         u16type=uint16_t
16534                         i16size=2
16535                         u16size=2
16536                         ;;
16537                 esac
16538         fi
16539         ;;
16540 esac
16541 case "$i16type" in
16542 '')     if $test $shortsize -ge 2; then
16543                 i16type=short
16544                 u16type="unsigned short"
16545                 i16size=$shortsize
16546                 u16size=$shortsize
16547         fi
16548         ;;
16549 esac
16550
16551 case "$i32type" in
16552 '')     case "$longsize" in
16553         4)      i32type=long
16554                 u32type="unsigned long"
16555                 i32size=$longsize
16556                 u32size=$longsize
16557                 ;;
16558         *)      case "$intsize" in
16559                 4)      i32type=int
16560                         u32type="unsigned int"
16561                         i32size=$intsize
16562                         u32size=$intsize
16563                         ;;
16564                 esac
16565                 ;;
16566         esac
16567         ;;
16568 esac
16569 case "$i32type" in
16570 '')     set try -DINT32
16571         if eval $compile; then
16572                 case "`$run ./try`" in
16573                 int32_t)
16574                         i32type=int32_t
16575                         u32type=uint32_t
16576                         i32size=4
16577                         u32size=4
16578                         ;;
16579                 esac
16580         fi
16581         ;;
16582 esac
16583 case "$i32type" in
16584 '')     if $test $intsize -ge 4; then
16585                 i32type=int
16586                 u32type="unsigned int"
16587                 i32size=$intsize
16588                 u32size=$intsize
16589         fi
16590         ;;
16591 esac
16592
16593 case "$i64type" in
16594 '')     case "$d_quad:$quadtype" in
16595         define:?*)
16596                 i64type="$quadtype"
16597                 u64type="$uquadtype"
16598                 i64size=8
16599                 u64size=8
16600                 ;;
16601         esac
16602         ;;
16603 esac
16604
16605 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16606 $cat <<EOP >try.c
16607 #include <stdio.h>
16608 #$i_stdlib I_STDLIB
16609 #ifdef I_STDLIB
16610 #include <stdlib.h>
16611 #endif
16612 #include <sys/types.h>
16613 #include <signal.h>
16614 #ifdef SIGFPE
16615 /* volatile so that the compiler has to store it out to memory */
16616 volatile int bletched = 0;
16617 $signal_t blech(int s) { bletched = 1; }
16618 #endif
16619 int main() {
16620     $uvtype u = 0;
16621     $nvtype d;
16622     int     n = 8 * $uvsize;
16623     int     i;
16624 #ifdef SIGFPE
16625     signal(SIGFPE, blech);
16626 #endif
16627
16628     for (i = 0; i < n; i++) {
16629       u = u << 1 | ($uvtype)1;
16630       d = ($nvtype)u;
16631       if (($uvtype)d != u)
16632         break;
16633       if (d <= 0)
16634         break;
16635       d = ($nvtype)(u - 1);
16636       if (($uvtype)d != (u - 1))
16637         break;
16638 #ifdef SIGFPE
16639       if (bletched)
16640         break;
16641 #endif
16642     }
16643     printf("%d\n", ((i == n) ? -n : i));
16644     exit(0);
16645 }
16646 EOP
16647 set try
16648
16649 d_nv_preserves_uv="$undef"
16650 if eval $compile; then
16651         nv_preserves_uv_bits="`$run ./try`"
16652 fi
16653 case "$nv_preserves_uv_bits" in
16654 \-[1-9]*)
16655         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16656         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16657         d_nv_preserves_uv="$define"
16658         ;;
16659 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16660         d_nv_preserves_uv="$undef" ;;
16661 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16662         nv_preserves_uv_bits="0" ;;
16663 esac
16664 $rm_try
16665
16666 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16667 $cat <<EOP >try.c
16668 #include <stdio.h>
16669
16670 typedef $nvtype NV;
16671
16672 int
16673 main() {
16674   NV value = 2;
16675   int count = 1;
16676
16677   while(count < 256) {
16678     /* volatile so that the compiler has to store it out to memory */
16679     volatile NV up = value + 1.0;
16680     volatile NV negated = -value;
16681     volatile NV down = negated - 1.0;
16682     volatile NV got_up = up - value;
16683     int up_good = got_up == 1.0;
16684     int got_down = down - negated;
16685     int down_good = got_down == -1.0;
16686
16687     if (down_good != up_good) {
16688       fprintf(stderr,
16689               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16690               up_good, (double) got_up, down_good, (double) got_down,
16691               count, (double) value);
16692       return 1;
16693     }
16694     if (!up_good) {
16695       while (1) {
16696         if (count > 8) {
16697           count -= 8;
16698           fputs("256.0", stdout);
16699         } else {
16700           count--;
16701           fputs("2.0", stdout);
16702         }
16703         if (!count) {
16704           puts("");
16705           return 0;
16706         }
16707         fputs("*", stdout);
16708       }
16709     }
16710     value *= 2;
16711     ++count;
16712   }
16713   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16714           count, (double) value);
16715   return 1;
16716 }
16717 EOP
16718 set try
16719
16720 nv_overflows_integers_at='0'
16721 if eval $compile; then
16722     xxx="`$run ./try`"
16723     case "$?" in
16724         0)
16725             case "$xxx" in
16726                 2*)  cat >&4 <<EOM
16727 The largest integer your NVs can preserve is equal to $xxx
16728 EOM
16729                     nv_overflows_integers_at="$xxx"
16730                     ;;
16731                 *)  cat >&4 <<EOM
16732 Cannot determine the largest integer value your NVs can hold, unexpected output
16733 '$xxx'
16734 EOM
16735                     ;;
16736             esac
16737             ;;
16738         *)  cat >&4 <<EOM
16739 Cannot determine the largest integer value your NVs can hold
16740 EOM
16741             ;;
16742     esac
16743 fi
16744 $rm_try
16745
16746 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16747 $cat <<EOP >try.c
16748 #include <stdio.h>
16749 #$i_stdlib I_STDLIB
16750 #ifdef I_STDLIB
16751 #include <stdlib.h>
16752 #endif
16753 #include <string.h>
16754 #include <sys/types.h>
16755 #include <signal.h>
16756 #ifdef SIGFPE
16757 /* volatile so that the compiler has to store it out to memory */
16758 volatile int bletched = 0;
16759 $signal_t blech(int s) { bletched = 1; }
16760 #endif
16761
16762 int checkit($nvtype d, const char *where) {
16763     void *v = &d;
16764     unsigned char *p = (unsigned char *)v;
16765     unsigned char *end = p + sizeof(d);
16766     int fail = 0;
16767
16768     while (p < end)
16769         fail += *p++;
16770
16771     if (!fail)
16772         return 0;
16773
16774     p = (unsigned char *)v;
16775     printf("No - %s: 0x", where);
16776     while (p < end)
16777         printf ("%02X", *p++);
16778     printf("\n");
16779     return 1;
16780 }
16781
16782 int main(int argc, char **argv) {
16783     $nvtype d = 0.0;
16784     int fail = 0;
16785     fail += checkit(d, "0.0");
16786
16787     /* The compiler shouldn't be assuming that bletched is 0  */
16788     d = bletched;
16789
16790     fail += checkit(d, "bleched");
16791
16792 #ifdef SIGFPE
16793     signal(SIGFPE, blech);
16794 #endif
16795
16796     /* Paranoia - the compiler should have no way of knowing that ANSI says
16797        that argv[argc] will always be NULL.  Actually, if it did assume this it
16798        would be buggy, as this is C and main() can be called from elsewhere in
16799        the program.  */
16800     d = argv[argc] ? 1 : 0;
16801
16802     if (d) {
16803         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16804     }
16805
16806     fail += checkit(d, "ternary");
16807
16808     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16809
16810     if (d != 0.0) {
16811         printf("No - memset doesn't give 0.0\n");
16812         /* This might just blow up:  */
16813         printf("(gives %g)\n", d);
16814         return 1;
16815     }
16816
16817 #ifdef SIGFPE
16818     if (bletched) {
16819         printf("No - something bleched\n");
16820         return 1;
16821     }
16822 #endif
16823     if (fail) {
16824       printf("No - %d fail(s)\n", fail);
16825       return 1;
16826     }
16827     printf("Yes\n");
16828     return 0;
16829 }
16830 EOP
16831 set try
16832
16833 d_nv_zero_is_allbits_zero="$undef"
16834 if eval $compile; then
16835     xxx="`$run ./try`"
16836     case "$?" in
16837         0)
16838             case "$xxx" in
16839                 Yes)  cat >&4 <<EOM
16840 0.0 is represented as all bits zero in memory
16841 EOM
16842                     d_nv_zero_is_allbits_zero="$define"
16843                     ;;
16844                 *)  cat >&4 <<EOM
16845 0.0 is not represented as all bits zero in memory
16846 EOM
16847                     d_nv_zero_is_allbits_zero="$undef"
16848                     ;;
16849             esac
16850             ;;
16851         *)  cat >&4 <<EOM
16852 0.0 is not represented as all bits zero in memory
16853 EOM
16854             d_nv_zero_is_allbits_zero="$undef"
16855             ;;
16856     esac
16857 fi
16858 $rm_try
16859
16860 : check for off64_t
16861 echo " "
16862 echo "Checking to see if you have off64_t..." >&4
16863 $cat >try.c <<EOCP
16864 #include <sys/types.h>
16865 #include <unistd.h>
16866 int main() { off64_t x = 7; }
16867 EOCP
16868 set try
16869 if eval $compile; then
16870         val="$define"
16871         echo "You have off64_t."
16872 else
16873         val="$undef"
16874         echo "You do not have off64_t."
16875         case "$lseeksize" in
16876         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16877         esac
16878 fi
16879 $rm_try
16880 set d_off64_t
16881 eval $setvar
16882
16883 : how to create joinable pthreads
16884 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16885         echo " "
16886         echo "Checking what constant to use for creating joinable pthreads..." >&4
16887         $cat >try.c <<'EOCP'
16888 #include <pthread.h>
16889 int main() {
16890     int detachstate = JOINABLE;
16891 }
16892 EOCP
16893         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16894         if eval $compile; then
16895                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16896                 val="$undef" # Yes, undef.
16897                 set d_old_pthread_create_joinable
16898                 eval $setvar
16899                 val=""
16900                 set old_pthread_create_joinable
16901                 eval $setvar
16902         else
16903                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16904                 if eval $compile; then
16905                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16906                         val="$define"
16907                         set d_old_pthread_create_joinable
16908                         eval $setvar
16909                         val=PTHREAD_CREATE_UNDETACHED
16910                         set old_pthread_create_joinable
16911                         eval $setvar
16912                 else
16913                         set try -DJOINABLE=__UNDETACHED
16914                         if eval $compile; then
16915                                 echo "You seem to use __UNDETACHED." >&4
16916                                 val="$define"
16917                                 set d_old_pthread_create_joinable
16918                                 eval $setvar
16919                                 val=__UNDETACHED
16920                                 set old_pthread_create_joinable
16921                                 eval $setvar
16922                         else
16923                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16924                                 val="$define"
16925                                 set d_old_pthread_create_joinable
16926                                 eval $setvar
16927                                 val=0
16928                                 set old_pthread_create_joinable
16929                                 eval $setvar
16930                         fi
16931                 fi
16932         fi
16933         $rm_try
16934 else
16935     d_old_pthread_create_joinable="$undef"
16936     old_pthread_create_joinable=""
16937 fi
16938
16939 : see if pause exists
16940 set pause d_pause
16941 eval $inlibc
16942
16943 : see if pipe2 exists
16944 set pipe2 d_pipe2
16945 eval $inlibc
16946
16947 : see if poll exists
16948 set poll d_poll
16949 eval $inlibc
16950
16951 : see if prctl exists
16952 set prctl d_prctl
16953 eval $inlibc
16954
16955 : see if prctl supports PR_SET_NAME
16956 d_prctl_set_name=$undef
16957 case $d_prctl in
16958     $define)
16959         $cat >try.c <<EOM
16960 #ifdef __ANDROID__
16961 #include <unistd.h>
16962 #endif
16963 #include <sys/prctl.h>
16964
16965 int main (int argc, char *argv[])
16966 {
16967     return (prctl (PR_SET_NAME, "Test"));
16968     } /* main */
16969 EOM
16970         set try
16971         if eval $compile_ok && $run ./try; then
16972             echo "Your prctl (PR_SET_NAME, ...) works"
16973             d_prctl_set_name=$define
16974             fi
16975         $rm_try
16976         ;;
16977     esac
16978
16979 : see if readlink exists
16980 set readlink d_readlink
16981 eval $inlibc
16982
16983 : Check if there is a /proc symlink to the abs path of
16984 : the executing program.  We will honor hints of d_procselfexe=$undef
16985 : or procselfexe being non-empty, otherwise will try to determine both
16986 : if we have readlink.
16987 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16988 : referenced, and AmigaOS does not have a proc filesystem anyway.
16989 echo " "
16990 val="$undef"
16991 if $test "X$d_procselfexe" = Xundef; then
16992         procselfexe=''
16993 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16994         val="$define"
16995 elif $test "X$d_readlink" = Xdefine; then
16996         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16997         : and it feels more tidy to avoid an extra level of symlink
16998         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16999         while test $# -gt 0; do
17000             type=$1; try=$2
17001             shift; shift
17002             if $issymlink $try; then
17003                 $ls -l $try > reflect
17004                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17005                     echo "You have $type-like $try."
17006                     procselfexe='"'$try'"'
17007                     val="$define"
17008                     : This will break out of the loop
17009                     set X; shift
17010                 fi
17011             fi
17012         done
17013 fi
17014 $rm -f reflect
17015 set d_procselfexe
17016 eval $setvar
17017
17018 : backward compatibility for d_hvfork
17019 if test X$d_hvfork != X; then
17020         d_vfork="$d_hvfork"
17021         d_hvfork=''
17022 fi
17023 : see if there is a vfork
17024 val=''
17025 set vfork val
17026 eval $inlibc
17027
17028 d_pseudofork=$undef
17029
17030 : Ok, but do we want to use it. vfork is reportedly unreliable in
17031 : perl on Solaris 2.x, and probably elsewhere.
17032 case "$val" in
17033 $define)
17034         echo " "
17035         case "$usevfork" in
17036         false) dflt='n';;
17037         *) dflt='y';;
17038         esac
17039         cat <<'EOM'
17040
17041 Perl can only use a vfork() that doesn't suffer from strict
17042 restrictions on calling functions or modifying global data in
17043 the child.  For example, glibc-2.1 contains such a vfork()
17044 that is unsuitable.  If your system provides a proper fork()
17045 call, chances are that you do NOT want perl to use vfork().
17046
17047 EOM
17048         rp="Do you still want to use vfork()?"
17049         . ./myread
17050         case "$ans" in
17051         y|Y) ;;
17052         *)
17053                 echo "Ok, we won't use vfork()."
17054                 val="$undef"
17055                 ;;
17056         esac
17057         ;;
17058 esac
17059 set d_vfork
17060 eval $setvar
17061 case "$d_vfork" in
17062 $define) usevfork='true';;
17063 *) usevfork='false';;
17064 esac
17065
17066 : see whether the pthread_atfork exists
17067 $cat >try.c <<EOP
17068 #include <pthread.h>
17069 #include <stdio.h>
17070 int main() {
17071 #ifdef  PTHREAD_ATFORK
17072         pthread_atfork(NULL,NULL,NULL);
17073 #endif
17074 }
17075 EOP
17076
17077 : see if pthread_atfork exists
17078 set try -DPTHREAD_ATFORK
17079 if eval $compile; then
17080     val="$define"
17081 else
17082     val="$undef"
17083 fi
17084 case "$usethreads" in
17085 $define)
17086         case "$val" in
17087         $define) echo 'pthread_atfork found.' >&4        ;;
17088         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17089         esac
17090 esac
17091 set d_pthread_atfork
17092 eval $setvar
17093
17094 : see if pthread_attr_setscope exists
17095 set pthread_attr_setscope d_pthread_attr_setscope
17096 eval $inlibc
17097
17098 : see whether the various POSIXish _yields exist
17099 $cat >try.c <<EOP
17100 #include <pthread.h>
17101 #include <stdio.h>
17102 int main() {
17103 #ifdef SCHED_YIELD
17104         sched_yield();
17105 #else
17106 #ifdef PTHREAD_YIELD
17107         pthread_yield();
17108 #else
17109 #ifdef PTHREAD_YIELD_NULL
17110         pthread_yield(NULL);
17111 #endif
17112 #endif
17113 #endif
17114 }
17115 EOP
17116 : see if sched_yield exists
17117 set try -DSCHED_YIELD
17118 if eval $compile; then
17119     val="$define"
17120     sched_yield='sched_yield()'
17121 else
17122     val="$undef"
17123 fi
17124 case "$usethreads" in
17125 $define)
17126         case "$val" in
17127         $define) echo 'sched_yield() found.' >&4        ;;
17128         *)       echo 'sched_yield() NOT found.' >&4    ;;
17129         esac
17130 esac
17131 set d_sched_yield
17132 eval $setvar
17133
17134 : see if pthread_yield exists
17135 set try -DPTHREAD_YIELD
17136 if eval $compile; then
17137     val="$define"
17138     case "$sched_yield" in
17139     '') sched_yield='pthread_yield()' ;;
17140     esac
17141 else
17142     set try -DPTHREAD_YIELD_NULL
17143     if eval $compile; then
17144         val="$define"
17145         case "$sched_yield" in
17146         '') sched_yield='pthread_yield(NULL)' ;;
17147         esac
17148     else
17149         val="$undef"
17150     fi
17151 fi
17152 case "$usethreads" in
17153 $define)
17154         case "$val" in
17155         $define) echo 'pthread_yield() found.' >&4      ;;
17156         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17157         esac
17158         ;;
17159 esac
17160 set d_pthread_yield
17161 eval $setvar
17162 case "$sched_yield" in
17163 '') sched_yield=undef ;;
17164 esac
17165 $rm_try
17166
17167 : check for ptrdiff_t
17168 echo " "
17169 echo "Checking to see if you have ptrdiff_t..." >&4
17170 $cat >try.c <<EOCP
17171 #include <stddef.h>
17172 int main() { ptrdiff_t x = 7; }
17173 EOCP
17174 set try
17175 if eval $compile; then
17176         val="$define"
17177         echo "You have ptrdiff_t."
17178 else
17179         val="$undef"
17180         echo "You do not have ptrdiff_t."
17181 fi
17182 $rm_try
17183 set d_ptrdiff_t
17184 eval $setvar
17185
17186 : see if random_r exists
17187 set random_r d_random_r
17188 eval $inlibc
17189 case "$d_random_r" in
17190 "$define")
17191         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17192         case "$d_random_r_proto:$usethreads" in
17193         ":define")      d_random_r_proto=define
17194                 set d_random_r_proto random_r $hdrs
17195                 eval $hasproto ;;
17196         *)      ;;
17197         esac
17198         case "$d_random_r_proto" in
17199         define)
17200         case "$random_r_proto" in
17201         ''|0) try='int random_r(int*, struct random_data*);'
17202         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17203         esac
17204         case "$random_r_proto" in
17205         ''|0) try='int random_r(long*, struct random_data*);'
17206         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17207         esac
17208         case "$random_r_proto" in
17209         ''|0) try='int random_r(struct random_data*, int32_t*);'
17210         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17211         esac
17212         case "$random_r_proto" in
17213         ''|0)   d_random_r=undef
17214                 random_r_proto=0
17215                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17216         * )     case "$random_r_proto" in
17217                 REENTRANT_PROTO*) ;;
17218                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17219                 esac
17220                 echo "Prototype: $try" ;;
17221         esac
17222         ;;
17223         *)      case "$usethreads" in
17224                 define) echo "random_r has no prototype, not using it." >&4 ;;
17225                 esac
17226                 d_random_r=undef
17227                 random_r_proto=0
17228                 ;;
17229         esac
17230         ;;
17231 *)      random_r_proto=0
17232         ;;
17233 esac
17234
17235 : see if readdir and friends exist
17236 set readdir d_readdir
17237 eval $inlibc
17238 set seekdir d_seekdir
17239 eval $inlibc
17240 set telldir d_telldir
17241 eval $inlibc
17242 set rewinddir d_rewinddir
17243 eval $inlibc
17244
17245 : see if readdir64_r exists
17246 set readdir64_r d_readdir64_r
17247 eval $inlibc
17248 case "$d_readdir64_r" in
17249 "$define")
17250         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17251         case "$d_readdir64_r_proto:$usethreads" in
17252         ":define")      d_readdir64_r_proto=define
17253                 set d_readdir64_r_proto readdir64_r $hdrs
17254                 eval $hasproto ;;
17255         *)      ;;
17256         esac
17257         case "$d_readdir64_r_proto" in
17258         define)
17259         case "$readdir64_r_proto" in
17260         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17261         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17262         esac
17263         case "$readdir64_r_proto" in
17264         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17265         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17266         esac
17267         case "$readdir64_r_proto" in
17268         ''|0)   d_readdir64_r=undef
17269                 readdir64_r_proto=0
17270                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17271         * )     case "$readdir64_r_proto" in
17272                 REENTRANT_PROTO*) ;;
17273                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17274                 esac
17275                 echo "Prototype: $try" ;;
17276         esac
17277         ;;
17278         *)      case "$usethreads" in
17279                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17280                 esac
17281                 d_readdir64_r=undef
17282                 readdir64_r_proto=0
17283                 ;;
17284         esac
17285         ;;
17286 *)      readdir64_r_proto=0
17287         ;;
17288 esac
17289
17290 : see if readdir_r exists
17291 set readdir_r d_readdir_r
17292 eval $inlibc
17293 case "$d_readdir_r" in
17294 "$define")
17295         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17296         case "$d_readdir_r_proto:$usethreads" in
17297         ":define")      d_readdir_r_proto=define
17298                 set d_readdir_r_proto readdir_r $hdrs
17299                 eval $hasproto ;;
17300         *)      ;;
17301         esac
17302         case "$d_readdir_r_proto" in
17303         define)
17304         case "$readdir_r_proto" in
17305         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17306         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17307         esac
17308         case "$readdir_r_proto" in
17309         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17310         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17311         esac
17312         case "$readdir_r_proto" in
17313         ''|0)   d_readdir_r=undef
17314                 readdir_r_proto=0
17315                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17316         * )     case "$readdir_r_proto" in
17317                 REENTRANT_PROTO*) ;;
17318                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17319                 esac
17320                 echo "Prototype: $try" ;;
17321         esac
17322         ;;
17323         *)      case "$usethreads" in
17324                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17325                 esac
17326                 d_readdir_r=undef
17327                 readdir_r_proto=0
17328                 ;;
17329         esac
17330         ;;
17331 *)      readdir_r_proto=0
17332         ;;
17333 esac
17334
17335 : see if readv exists
17336 set readv d_readv
17337 eval $inlibc
17338
17339 : see if recvmsg exists
17340 set recvmsg d_recvmsg
17341 eval $inlibc
17342
17343 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17344 echo " "
17345 if set regcomp val -f d_regcomp; eval $csym; $val; then
17346         echo 'regcomp() found.' >&4
17347         d_regcomp="$define"
17348         d_regcmp="$undef"
17349         d_re_comp="$undef"
17350 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17351         echo 'regcmp() found.' >&4
17352         d_regcmp="$define"
17353         d_regcomp="$undef"
17354         d_re_comp="$undef"
17355 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17356         echo 're_comp() found, assuming re_exec() also exists.' >&4
17357         d_re_comp="$define"
17358         d_regcomp="$undef"
17359         d_regcmp="$undef"
17360 else
17361         $cat >&4 <<EOM
17362 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17363 EOM
17364         d_regcmp="$undef"
17365         d_re_comp="$undef"
17366         d_regcomp="$undef"
17367 fi
17368
17369 : see if remainder exists
17370 set remainder d_remainder
17371 eval $inlibc
17372
17373 : see if remquo exists
17374 set remquo d_remquo
17375 eval $inlibc
17376
17377 : see if rename exists
17378 set rename d_rename
17379 eval $inlibc
17380
17381 : see if rint exists
17382 set rint d_rint
17383 eval $inlibc
17384
17385 : see if rmdir exists
17386 set rmdir d_rmdir
17387 eval $inlibc
17388
17389 : see if round exists
17390 set round d_round
17391 eval $inlibc
17392
17393 : see if prototype for sbrk is available
17394 echo " "
17395 set d_sbrkproto sbrk $i_unistd unistd.h
17396 eval $hasproto
17397
17398 : see if scalbn exists
17399 set scalbn d_scalbn
17400 eval $inlibc
17401
17402 : see if select exists
17403 set select d_select
17404 eval $inlibc
17405
17406 : see if semctl exists
17407 set semctl d_semctl
17408 eval $inlibc
17409
17410 : see if semget exists
17411 set semget d_semget
17412 eval $inlibc
17413
17414 : see if semop exists
17415 set semop d_semop
17416 eval $inlibc
17417
17418 : see how much of the 'sem*(2)' library is present.
17419 h_sem=true
17420 echo " "
17421 case "$d_semctl$d_semget$d_semop" in
17422 *"$undef"*) h_sem=false;;
17423 esac
17424 case "$osname" in
17425 freebsd)
17426     case "`ipcs 2>&1`" in
17427     "SVID messages"*"not configured"*)
17428         echo "Your $osname does not have the sem*(2) configured." >&4
17429         h_sem=false
17430         val="$undef"
17431         set semctl d_semctl
17432         eval $setvar
17433         set semget d_semget
17434         eval $setvar
17435         set semop d_semop
17436         eval $setvar
17437         ;;
17438     esac
17439     ;;
17440 esac
17441 : we could also check for sys/ipc.h ...
17442 if $h_sem && $test `./findhdr sys/sem.h`; then
17443         echo "You have the full sem*(2) library." >&4
17444         val="$define"
17445 else
17446         echo "You don't have the full sem*(2) library." >&4
17447         val="$undef"
17448 fi
17449 set d_sem
17450 eval $setvar
17451
17452 : see whether sys/sem.h defines union semun
17453 echo " "
17454 $cat > try.c <<'END'
17455 #include <sys/types.h>
17456 #include <sys/ipc.h>
17457 #include <sys/sem.h>
17458 int main () { union semun semun; semun.buf = 0; }
17459 END
17460 set try
17461 if eval $compile; then
17462     echo "You have union semun in <sys/sem.h>." >&4
17463     val="$define"
17464 else
17465     echo "You do not have union semun in <sys/sem.h>." >&4
17466     val="$undef"
17467 fi
17468 $rm_try
17469 set d_union_semun
17470 eval $setvar
17471
17472 : see how to do semctl IPC_STAT
17473 case "$d_sem" in
17474 $define)
17475     echo " "
17476     $cat > tryh.h <<END
17477 #ifndef S_IRUSR
17478 #   ifdef S_IREAD
17479 #       define S_IRUSR S_IREAD
17480 #       define S_IWUSR S_IWRITE
17481 #       define S_IXUSR S_IEXEC
17482 #   else
17483 #       define S_IRUSR 0400
17484 #       define S_IWUSR 0200
17485 #       define S_IXUSR 0100
17486 #   endif
17487 #   define S_IRGRP (S_IRUSR>>3)
17488 #   define S_IWGRP (S_IWUSR>>3)
17489 #   define S_IXGRP (S_IXUSR>>3)
17490 #   define S_IROTH (S_IRUSR>>6)
17491 #   define S_IWOTH (S_IWUSR>>6)
17492 #   define S_IXOTH (S_IXUSR>>6)
17493 #endif
17494 #ifndef S_IRWXU
17495 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17496 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17497 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17498 #endif
17499 END
17500     : see whether semctl IPC_STAT can use union semun
17501     case "$d_semctl_semun" in
17502     '')
17503       val="$undef"
17504       $cat > try.c <<END
17505 #include <sys/types.h>
17506 #include <sys/ipc.h>
17507 #include <sys/sem.h>
17508 #include <sys/stat.h>
17509 #include <stdio.h>
17510 #include <errno.h>
17511 #include "tryh.h"
17512 #ifndef errno
17513 extern int errno;
17514 #endif
17515 #$d_union_semun HAS_UNION_SEMUN
17516 int main() {
17517     union semun
17518 #ifndef HAS_UNION_SEMUN
17519     {
17520         int val;
17521         struct semid_ds *buf;
17522         unsigned short *array;
17523     }
17524 #endif
17525     arg;
17526     int sem, st;
17527
17528 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17529     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17530     if (sem > -1) {
17531         struct semid_ds argbuf;
17532         arg.buf = &argbuf;
17533 #       ifdef IPC_STAT
17534         st = semctl(sem, 0, IPC_STAT, arg);
17535         if (st == 0)
17536             printf("semun\n");
17537         else
17538 #       endif /* IPC_STAT */
17539             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17540 #       ifdef IPC_RMID
17541         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17542 #       endif /* IPC_RMID */
17543             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17544     } else
17545 #endif /* IPC_PRIVATE && ... */
17546         printf("semget failed: errno = %d\n", errno);
17547   return 0;
17548 }
17549 END
17550       set try
17551       if eval $compile; then
17552           xxx=`$run ./try`
17553           case "$xxx" in
17554           semun) val="$define" ;;
17555           esac
17556       fi
17557       $rm_try
17558       set d_semctl_semun
17559       eval $setvar
17560       ;;
17561     esac
17562     case "$d_semctl_semun" in
17563     $define)
17564         echo "You can use union semun for semctl IPC_STAT." >&4
17565         also='also'
17566         ;;
17567     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17568         also=''
17569         ;;
17570     esac
17571
17572     : see whether semctl IPC_STAT can use struct semid_ds pointer
17573     case "$d_semctl_semid_ds" in
17574     '')
17575       val="$undef"
17576       $cat > try.c <<'END'
17577 #include <sys/types.h>
17578 #include <sys/ipc.h>
17579 #include <sys/sem.h>
17580 #include <sys/stat.h>
17581 #include "tryh.h"
17582 #include <stdio.h>
17583 #include <errno.h>
17584 #ifndef errno
17585 extern int errno;
17586 #endif
17587 int main() {
17588     union semun
17589 #ifndef HAS_UNION_SEMUN
17590     {
17591         int val;
17592         struct semid_ds *buf;
17593         unsigned short *array;
17594     }
17595 #endif
17596     arg;
17597     struct semid_ds argbuf;
17598     int sem, st;
17599
17600 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17601     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17602     if (sem > -1) {
17603         arg.buf = &argbuf;
17604 #       ifdef IPC_STAT
17605         st = semctl(sem, 0, IPC_STAT, arg);
17606         if (st == 0)
17607             printf("semid_ds\n");
17608         else
17609 #       endif /* IPC_STAT */
17610             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17611 #       ifdef IPC_RMID
17612         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17613 #       endif /* IPC_RMID */
17614             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17615     } else
17616 #endif /* IPC_PRIVATE && ... */
17617         printf("semget failed: errno = %d\n", errno);
17618
17619     return 0;
17620 }
17621 END
17622       set try
17623       if eval $compile; then
17624           xxx=`$run ./try`
17625           case "$xxx" in
17626           semid_ds) val="$define" ;;
17627           esac
17628       fi
17629       $rm_try
17630       set d_semctl_semid_ds
17631       eval $setvar
17632       ;;
17633     esac
17634     case "$d_semctl_semid_ds" in
17635     $define)
17636         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17637         ;;
17638     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17639         ;;
17640     esac
17641     ;;
17642 *)  val="$undef"
17643
17644     # We do not have the full sem*(2) library, so assume we can not
17645     # use either.
17646
17647     set d_semctl_semun
17648     eval $setvar
17649
17650     set d_semctl_semid_ds
17651     eval $setvar
17652     ;;
17653 esac
17654 $rm_try tryh.h
17655
17656 : see if sendmsg exists
17657 set sendmsg d_sendmsg
17658 eval $inlibc
17659
17660 : see if setegid exists
17661 set setegid d_setegid
17662 eval $inlibc
17663
17664 : see if seteuid exists
17665 set seteuid d_seteuid
17666 eval $inlibc
17667
17668 : see if setgrent exists
17669 set setgrent d_setgrent
17670 eval $inlibc
17671
17672 : see if setgrent_r exists
17673 set setgrent_r d_setgrent_r
17674 eval $inlibc
17675 case "$d_setgrent_r" in
17676 "$define")
17677         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17678         case "$d_setgrent_r_proto:$usethreads" in
17679         ":define")      d_setgrent_r_proto=define
17680                 set d_setgrent_r_proto setgrent_r $hdrs
17681                 eval $hasproto ;;
17682         *)      ;;
17683         esac
17684         case "$d_setgrent_r_proto" in
17685         define)
17686         case "$setgrent_r_proto" in
17687         ''|0) try='int setgrent_r(FILE**);'
17688         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17689         esac
17690         case "$setgrent_r_proto" in
17691         ''|0) try='void setgrent_r(FILE**);'
17692         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17693         esac
17694         case "$setgrent_r_proto" in
17695         ''|0)   d_setgrent_r=undef
17696                 setgrent_r_proto=0
17697                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17698         * )     case "$setgrent_r_proto" in
17699                 REENTRANT_PROTO*) ;;
17700                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17701                 esac
17702                 echo "Prototype: $try" ;;
17703         esac
17704         ;;
17705         *)      case "$usethreads" in
17706                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17707                 esac
17708                 d_setgrent_r=undef
17709                 setgrent_r_proto=0
17710                 ;;
17711         esac
17712         ;;
17713 *)      setgrent_r_proto=0
17714         ;;
17715 esac
17716
17717 : see if sethostent exists
17718 set sethostent d_sethent
17719 eval $inlibc
17720
17721 : see if sethostent_r exists
17722 set sethostent_r d_sethostent_r
17723 eval $inlibc
17724 case "$d_sethostent_r" in
17725 "$define")
17726         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17727         case "$d_sethostent_r_proto:$usethreads" in
17728         ":define")      d_sethostent_r_proto=define
17729                 set d_sethostent_r_proto sethostent_r $hdrs
17730                 eval $hasproto ;;
17731         *)      ;;
17732         esac
17733         case "$d_sethostent_r_proto" in
17734         define)
17735         case "$sethostent_r_proto" in
17736         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17737         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17738         esac
17739         case "$sethostent_r_proto" in
17740         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17741         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17742         esac
17743         case "$sethostent_r_proto" in
17744         ''|0)   d_sethostent_r=undef
17745                 sethostent_r_proto=0
17746                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17747         * )     case "$sethostent_r_proto" in
17748                 REENTRANT_PROTO*) ;;
17749                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17750                 esac
17751                 echo "Prototype: $try" ;;
17752         esac
17753         ;;
17754         *)      case "$usethreads" in
17755                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17756                 esac
17757                 d_sethostent_r=undef
17758                 sethostent_r_proto=0
17759                 ;;
17760         esac
17761         ;;
17762 *)      sethostent_r_proto=0
17763         ;;
17764 esac
17765
17766 : see if setitimer exists
17767 set setitimer d_setitimer
17768 eval $inlibc
17769
17770 : see if setlinebuf exists
17771 set setlinebuf d_setlinebuf
17772 eval $inlibc
17773
17774 : see if setlocale exists
17775 set setlocale d_setlocale
17776 eval $inlibc
17777
17778 : see if locale.h is available
17779 set locale.h i_locale
17780 eval $inhdr
17781
17782 : see if setlocale_r exists
17783 set setlocale_r d_setlocale_r
17784 eval $inlibc
17785 case "$d_setlocale_r" in
17786 "$define")
17787         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17788         case "$d_setlocale_r_proto:$usethreads" in
17789         ":define")      d_setlocale_r_proto=define
17790                 set d_setlocale_r_proto setlocale_r $hdrs
17791                 eval $hasproto ;;
17792         *)      ;;
17793         esac
17794         case "$d_setlocale_r_proto" in
17795         define)
17796         case "$setlocale_r_proto" in
17797         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17798         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17799         esac
17800         case "$setlocale_r_proto" in
17801         ''|0)   d_setlocale_r=undef
17802                 setlocale_r_proto=0
17803                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17804         * )     case "$setlocale_r_proto" in
17805                 REENTRANT_PROTO*) ;;
17806                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17807                 esac
17808                 echo "Prototype: $try" ;;
17809         esac
17810         ;;
17811         *)      case "$usethreads" in
17812                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17813                 esac
17814                 d_setlocale_r=undef
17815                 setlocale_r_proto=0
17816                 ;;
17817         esac
17818         ;;
17819 *)      setlocale_r_proto=0
17820         ;;
17821 esac
17822
17823 : see if setnetent exists
17824 set setnetent d_setnent
17825 eval $inlibc
17826
17827 : see if setnetent_r exists
17828 set setnetent_r d_setnetent_r
17829 eval $inlibc
17830 case "$d_setnetent_r" in
17831 "$define")
17832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17833         case "$d_setnetent_r_proto:$usethreads" in
17834         ":define")      d_setnetent_r_proto=define
17835                 set d_setnetent_r_proto setnetent_r $hdrs
17836                 eval $hasproto ;;
17837         *)      ;;
17838         esac
17839         case "$d_setnetent_r_proto" in
17840         define)
17841         case "$setnetent_r_proto" in
17842         ''|0) try='int setnetent_r(int, struct netent_data*);'
17843         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17844         esac
17845         case "$setnetent_r_proto" in
17846         ''|0) try='void setnetent_r(int, struct netent_data*);'
17847         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17848         esac
17849         case "$setnetent_r_proto" in
17850         ''|0)   d_setnetent_r=undef
17851                 setnetent_r_proto=0
17852                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17853         * )     case "$setnetent_r_proto" in
17854                 REENTRANT_PROTO*) ;;
17855                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17856                 esac
17857                 echo "Prototype: $try" ;;
17858         esac
17859         ;;
17860         *)      case "$usethreads" in
17861                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17862                 esac
17863                 d_setnetent_r=undef
17864                 setnetent_r_proto=0
17865                 ;;
17866         esac
17867         ;;
17868 *)      setnetent_r_proto=0
17869         ;;
17870 esac
17871
17872 : see if setprotoent exists
17873 set setprotoent d_setpent
17874 eval $inlibc
17875
17876 : see if setpgid exists
17877 set setpgid d_setpgid
17878 eval $inlibc
17879
17880 : see if setpgrp2 exists
17881 set setpgrp2 d_setpgrp2
17882 eval $inlibc
17883
17884 : see if setpriority exists
17885 set setpriority d_setprior
17886 eval $inlibc
17887
17888 : see if setproctitle exists
17889 set setproctitle d_setproctitle
17890 eval $inlibc
17891
17892 : see if setprotoent_r exists
17893 set setprotoent_r d_setprotoent_r
17894 eval $inlibc
17895 case "$d_setprotoent_r" in
17896 "$define")
17897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17898         case "$d_setprotoent_r_proto:$usethreads" in
17899         ":define")      d_setprotoent_r_proto=define
17900                 set d_setprotoent_r_proto setprotoent_r $hdrs
17901                 eval $hasproto ;;
17902         *)      ;;
17903         esac
17904         case "$d_setprotoent_r_proto" in
17905         define)
17906         case "$setprotoent_r_proto" in
17907         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17908         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17909         esac
17910         case "$setprotoent_r_proto" in
17911         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17912         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17913         esac
17914         case "$setprotoent_r_proto" in
17915         ''|0)   d_setprotoent_r=undef
17916                 setprotoent_r_proto=0
17917                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17918         * )     case "$setprotoent_r_proto" in
17919                 REENTRANT_PROTO*) ;;
17920                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17921                 esac
17922                 echo "Prototype: $try" ;;
17923         esac
17924         ;;
17925         *)      case "$usethreads" in
17926                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17927                 esac
17928                 d_setprotoent_r=undef
17929                 setprotoent_r_proto=0
17930                 ;;
17931         esac
17932         ;;
17933 *)      setprotoent_r_proto=0
17934         ;;
17935 esac
17936
17937 : see if setpwent exists
17938 set setpwent d_setpwent
17939 eval $inlibc
17940
17941 : see if setpwent_r exists
17942 set setpwent_r d_setpwent_r
17943 eval $inlibc
17944 case "$d_setpwent_r" in
17945 "$define")
17946         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17947         case "$d_setpwent_r_proto:$usethreads" in
17948         ":define")      d_setpwent_r_proto=define
17949                 set d_setpwent_r_proto setpwent_r $hdrs
17950                 eval $hasproto ;;
17951         *)      ;;
17952         esac
17953         case "$d_setpwent_r_proto" in
17954         define)
17955         case "$setpwent_r_proto" in
17956         ''|0) try='int setpwent_r(FILE**);'
17957         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17958         esac
17959         case "$setpwent_r_proto" in
17960         ''|0) try='void setpwent_r(FILE**);'
17961         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17962         esac
17963         case "$setpwent_r_proto" in
17964         ''|0)   d_setpwent_r=undef
17965                 setpwent_r_proto=0
17966                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17967         * )     case "$setpwent_r_proto" in
17968                 REENTRANT_PROTO*) ;;
17969                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17970                 esac
17971                 echo "Prototype: $try" ;;
17972         esac
17973         ;;
17974         *)      case "$usethreads" in
17975                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17976                 esac
17977                 d_setpwent_r=undef
17978                 setpwent_r_proto=0
17979                 ;;
17980         esac
17981         ;;
17982 *)      setpwent_r_proto=0
17983         ;;
17984 esac
17985
17986 : see if setregid exists
17987 set setregid d_setregid
17988 eval $inlibc
17989 set setresgid d_setresgid
17990 eval $inlibc
17991
17992 : see if setreuid exists
17993 set setreuid d_setreuid
17994 eval $inlibc
17995 set setresuid d_setresuid
17996 eval $inlibc
17997
17998 : see if setrgid exists
17999 set setrgid d_setrgid
18000 eval $inlibc
18001
18002 : see if setruid exists
18003 set setruid d_setruid
18004 eval $inlibc
18005
18006 : see if setservent exists
18007 set setservent d_setsent
18008 eval $inlibc
18009
18010 : see if setservent_r exists
18011 set setservent_r d_setservent_r
18012 eval $inlibc
18013 case "$d_setservent_r" in
18014 "$define")
18015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18016         case "$d_setservent_r_proto:$usethreads" in
18017         ":define")      d_setservent_r_proto=define
18018                 set d_setservent_r_proto setservent_r $hdrs
18019                 eval $hasproto ;;
18020         *)      ;;
18021         esac
18022         case "$d_setservent_r_proto" in
18023         define)
18024         case "$setservent_r_proto" in
18025         ''|0) try='int setservent_r(int, struct servent_data*);'
18026         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18027         esac
18028         case "$setservent_r_proto" in
18029         ''|0) try='void setservent_r(int, struct servent_data*);'
18030         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18031         esac
18032         case "$setservent_r_proto" in
18033         ''|0)   d_setservent_r=undef
18034                 setservent_r_proto=0
18035                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18036         * )     case "$setservent_r_proto" in
18037                 REENTRANT_PROTO*) ;;
18038                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18039                 esac
18040                 echo "Prototype: $try" ;;
18041         esac
18042         ;;
18043         *)      case "$usethreads" in
18044                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18045                 esac
18046                 d_setservent_r=undef
18047                 setservent_r_proto=0
18048                 ;;
18049         esac
18050         ;;
18051 *)      setservent_r_proto=0
18052         ;;
18053 esac
18054
18055 : see if setsid exists
18056 set setsid d_setsid
18057 eval $inlibc
18058
18059 : see if setvbuf exists
18060 set setvbuf d_setvbuf
18061 eval $inlibc
18062
18063 : see if shmctl exists
18064 set shmctl d_shmctl
18065 eval $inlibc
18066
18067 : see if shmget exists
18068 set shmget d_shmget
18069 eval $inlibc
18070
18071 : see if shmat exists
18072 set shmat d_shmat
18073 eval $inlibc
18074 : see what shmat returns
18075 case "$d_shmat" in
18076 "$define")
18077         $cat >shmat.c <<'END'
18078 #include <sys/shm.h>
18079 void *shmat();
18080 END
18081         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18082                 shmattype='void *'
18083         else
18084                 shmattype='char *'
18085         fi
18086         echo "and it returns ($shmattype)." >&4
18087         : see if a prototype for shmat is available
18088         xxx=`./findhdr sys/shm.h`
18089         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18090         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18091                 val="$define"
18092         else
18093                 val="$undef"
18094         fi
18095         $rm -f shmat.[co]
18096         ;;
18097 *)
18098         val="$undef"
18099         ;;
18100 esac
18101 set d_shmatprototype
18102 eval $setvar
18103
18104 : see if shmdt exists
18105 set shmdt d_shmdt
18106 eval $inlibc
18107
18108 : see how much of the 'shm*(2)' library is present.
18109 h_shm=true
18110 echo " "
18111 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18112 *"$undef"*) h_shm=false;;
18113 esac
18114 case "$osname" in
18115 freebsd)
18116     case "`ipcs 2>&1`" in
18117     "SVID shared memory"*"not configured"*)
18118         echo "Your $osname does not have the shm*(2) configured." >&4
18119         h_shm=false
18120         val="$undef"
18121         set shmctl d_shmctl
18122         eval $setvar
18123         set shmget d_shmget
18124         eval $setvar
18125         set shmat d_shmat
18126         eval $setvar
18127         set shmdt d_shmdt
18128         eval $setvar
18129         ;;
18130     esac
18131     ;;
18132 esac
18133 : we could also check for sys/ipc.h ...
18134 if $h_shm && $test `./findhdr sys/shm.h`; then
18135         echo "You have the full shm*(2) library." >&4
18136         val="$define"
18137 else
18138         echo "You don't have the full shm*(2) library." >&4
18139         val="$undef"
18140 fi
18141 set d_shm
18142 eval $setvar
18143
18144 : see if we have sigaction
18145 echo " "
18146 if set sigaction val -f d_sigaction; eval $csym; $val; then
18147         echo 'sigaction() found.' >&4
18148         $cat > try.c <<EOP
18149 #include <stdio.h>
18150 #include <sys/types.h>
18151 #include <signal.h>
18152 #$i_stdlib I_STDLIB
18153 #ifdef I_STDLIB
18154 #include <stdlib.h>
18155 #endif
18156 int main()
18157 {
18158     struct sigaction act, oact;
18159     act.sa_flags = 0;
18160     oact.sa_handler = 0;
18161     /* so that act and oact are used */
18162     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18163 }
18164 EOP
18165         set try
18166         if eval $compile_ok; then
18167                 val="$define"
18168         else
18169                 echo "But you don't seem to have a usable struct sigaction." >&4
18170                 val="$undef"
18171         fi
18172 else
18173         echo 'sigaction NOT found.' >&4
18174         val="$undef"
18175 fi
18176 set d_sigaction; eval $setvar
18177 $rm_try
18178
18179 : see what type pids are declared as in the kernel
18180 rp="What is the type of process ids on this system?"
18181 set pid_t pidtype int stdio.h sys/types.h
18182 eval $typedef_ask
18183
18184 : see what type uids are declared as in the kernel
18185 echo " "
18186 echo "Looking for the type for user ids returned by getuid()."
18187 set uid_t uidtype xxx stdio.h sys/types.h
18188 eval $typedef
18189 case "$uidtype" in
18190 xxx)
18191         xxx=`./findhdr sys/user.h`
18192         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18193         case $1 in
18194         unsigned) dflt="$1 $2" ;;
18195         *) dflt="$1" ;;
18196         esac
18197         ;;
18198 *) dflt="$uidtype";;
18199 esac
18200 case "$uidtype" in
18201 uid_t)  echo "uid_t found." ;;
18202 *)      rp="What is the type for user ids returned by getuid()?"
18203         . ./myread
18204         uidtype="$ans"
18205         ;;
18206 esac
18207
18208 : Define hasfield_t macro for Configure internal use
18209 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18210 while $test $# -ge 2; do
18211     case "$1" in
18212         $define) echo "#include <$2>";;
18213     esac ;
18214     shift 2;
18215 done > try.c;
18216 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18217 set try;
18218 if eval $compile; then
18219         val="$define";
18220 else
18221         val="$undef";
18222 fi;
18223 set $varname;
18224 eval $setvar;
18225 $rm_try'
18226
18227 : see what siginfo fields we have
18228 case "$d_sigaction" in
18229 "$define")
18230         echo "Checking if your siginfo_t has si_errno field...">&4
18231         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18232         eval $hasfield_t;
18233
18234         echo "Checking if your siginfo_t has si_pid field...">&4
18235         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18236         eval $hasfield_t;
18237
18238         echo "Checking if your siginfo_t has si_uid field...">&4
18239         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18240         eval $hasfield_t;
18241
18242         echo "Checking if your siginfo_t has si_addr field...">&4
18243         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18244         eval $hasfield_t;
18245
18246         echo "Checking if your siginfo_t has si_status field...">&4
18247         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18248         eval $hasfield_t;
18249
18250         echo "Checking if your siginfo_t has si_band field...">&4
18251         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18252         eval $hasfield_t;
18253
18254         echo "Checking if your siginfo_t has si_value field...">&4
18255         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18256         eval $hasfield_t;
18257
18258         echo "Checking if your siginfo_t has si_fd field...">&4
18259         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18260         eval $hasfield_t;
18261
18262         ;;
18263 *)
18264         d_siginfo_si_errno="$undef"
18265         d_siginfo_si_pid="$undef"
18266         d_siginfo_si_uid="$undef"
18267         d_siginfo_si_addr="$undef"
18268         d_siginfo_si_status="$undef"
18269         d_siginfo_si_band="$undef"
18270         d_siginfo_si_value="$undef"
18271         d_siginfo_si_fd="$undef"
18272         ;;
18273 esac
18274
18275 : see if this is a sunmath.h system
18276 set sunmath.h i_sunmath
18277 eval $inhdr
18278
18279 : see if signbit exists
18280 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18281 $cat >try.c <<EOCP
18282 #$i_sunmath I_SUNMATH
18283 #include <math.h>
18284 #ifdef I_SUNMATH  /* Solaris special math library */
18285 #  include <sunmath.h>
18286 #endif
18287 #define NV $nvtype
18288 int main(int argc, char **argv)
18289 {
18290     NV x = 0.0;
18291     NV y = -1.0;
18292     if ((signbit(x) == 0) && (signbit(y) != 0))
18293         return 0;
18294     else
18295         return 1;
18296 }
18297 EOCP
18298 val="$undef"
18299 set try
18300 if eval $compile; then
18301     if $run ./try; then
18302         $echo "Yes." >&4
18303         val="$define"
18304     else
18305         $echo "Signbit seems to be available, but doesn't work as I expected."
18306         $echo "I won't use it." >&4
18307         val="$undef"
18308     fi
18309 else
18310     $echo "Nope." >&4
18311     dflt="$undef"
18312 fi
18313 set d_signbit
18314 eval $setvar
18315 $rm_try
18316
18317 : see if sigprocmask exists
18318 set sigprocmask d_sigprocmask
18319 eval $inlibc
18320
18321 : see if sigsetjmp exists
18322 echo " "
18323 case "$d_sigsetjmp" in
18324 '')
18325         $cat >try.c <<EOP
18326 #include <setjmp.h>
18327 #$i_stdlib I_STDLIB
18328 #ifdef I_STDLIB
18329 #include <stdlib.h>
18330 #endif
18331 sigjmp_buf env;
18332 int set = 1;
18333 int main()
18334 {
18335         if (sigsetjmp(env,1))
18336                 exit(set);
18337         set = 0;
18338         siglongjmp(env, 1);
18339         exit(1);
18340 }
18341 EOP
18342         set try
18343         if eval $compile; then
18344                 if $run ./try >/dev/null 2>&1; then
18345                         echo "POSIX sigsetjmp found." >&4
18346                         val="$define"
18347                 else
18348                         $cat >&4 <<EOM
18349 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18350 I'll ignore them.
18351 EOM
18352                         val="$undef"
18353                 fi
18354         else
18355                 echo "sigsetjmp not found." >&4
18356                 val="$undef"
18357         fi
18358         ;;
18359 *) val="$d_sigsetjmp"
18360         case "$d_sigsetjmp" in
18361         $define) echo "POSIX sigsetjmp found." >&4;;
18362         $undef) echo "sigsetjmp not found." >&4;;
18363         esac
18364         ;;
18365 esac
18366 set d_sigsetjmp
18367 eval $setvar
18368 $rm_try
18369
18370 : see if snprintf exists
18371 set snprintf d_snprintf
18372 eval $inlibc
18373
18374 : see if vsnprintf exists
18375 set vsnprintf d_vsnprintf
18376 eval $inlibc
18377
18378 case "$d_snprintf-$d_vsnprintf" in
18379 "$define-$define")
18380     $cat <<EOM
18381 Checking whether your snprintf() and vsnprintf() work okay...
18382 EOM
18383     $cat >try.c <<'EOCP'
18384 /* v?snprintf testing logic courtesy of Russ Allbery.
18385  * According to C99:
18386  * - if the buffer is too short it still must be \0-terminated
18387  * - if the buffer is too short the potentially required length
18388  *   must be returned and not -1
18389  * - if the buffer is NULL the potentially required length
18390  *   must be returned and not -1 or core dump
18391  */
18392 #include <stdio.h>
18393 #include <stdarg.h>
18394
18395 char buf[2];
18396
18397 int test (char *format, ...)
18398 {
18399     va_list args;
18400     int count;
18401
18402     va_start (args, format);
18403     count = vsnprintf (buf, sizeof buf, format, args);
18404     va_end (args);
18405     return count;
18406 }
18407
18408 int main ()
18409 {
18410     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18411              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18412 }
18413 EOCP
18414     set try
18415     if eval $compile; then
18416         `$run ./try`
18417         case "$?" in
18418         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18419         *) cat <<EOM >&4
18420 Your snprintf() and snprintf() don't seem to be working okay.
18421 EOM
18422            d_snprintf="$undef"
18423            d_vsnprintf="$undef"
18424            ;;
18425         esac
18426     else
18427         echo "(I can't seem to compile the test program--assuming they don't)"
18428         d_snprintf="$undef"
18429         d_vsnprintf="$undef"
18430     fi
18431     $rm_try
18432     ;;
18433 esac
18434
18435 : see if sockatmark exists
18436 set sockatmark d_sockatmark
18437 eval $inlibc
18438
18439 : see if prototype for sockatmark is available
18440 echo " "
18441 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18442 eval $hasproto
18443
18444 : see if socks5_init exists
18445 set socks5_init d_socks5_init
18446 eval $inlibc
18447
18448 : see if srand48_r exists
18449 set srand48_r d_srand48_r
18450 eval $inlibc
18451 case "$d_srand48_r" in
18452 "$define")
18453         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18454         case "$d_srand48_r_proto:$usethreads" in
18455         ":define")      d_srand48_r_proto=define
18456                 set d_srand48_r_proto srand48_r $hdrs
18457                 eval $hasproto ;;
18458         *)      ;;
18459         esac
18460         case "$d_srand48_r_proto" in
18461         define)
18462         case "$srand48_r_proto" in
18463         ''|0) try='int srand48_r(long, struct drand48_data*);'
18464         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18465         esac
18466         case "$srand48_r_proto" in
18467         ''|0)   d_srand48_r=undef
18468                 srand48_r_proto=0
18469                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18470         * )     case "$srand48_r_proto" in
18471                 REENTRANT_PROTO*) ;;
18472                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18473                 esac
18474                 echo "Prototype: $try" ;;
18475         esac
18476         ;;
18477         *)      case "$usethreads" in
18478                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18479                 esac
18480                 d_srand48_r=undef
18481                 srand48_r_proto=0
18482                 ;;
18483         esac
18484         ;;
18485 *)      srand48_r_proto=0
18486         ;;
18487 esac
18488
18489 : see if srandom_r exists
18490 set srandom_r d_srandom_r
18491 eval $inlibc
18492 case "$d_srandom_r" in
18493 "$define")
18494         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18495         case "$d_srandom_r_proto:$usethreads" in
18496         ":define")      d_srandom_r_proto=define
18497                 set d_srandom_r_proto srandom_r $hdrs
18498                 eval $hasproto ;;
18499         *)      ;;
18500         esac
18501         case "$d_srandom_r_proto" in
18502         define)
18503         case "$srandom_r_proto" in
18504         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18505         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18506         esac
18507         case "$srandom_r_proto" in
18508         ''|0)   d_srandom_r=undef
18509                 srandom_r_proto=0
18510                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18511         * )     case "$srandom_r_proto" in
18512                 REENTRANT_PROTO*) ;;
18513                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18514                 esac
18515                 echo "Prototype: $try" ;;
18516         esac
18517         ;;
18518         *)      case "$usethreads" in
18519                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18520                 esac
18521                 d_srandom_r=undef
18522                 srandom_r_proto=0
18523                 ;;
18524         esac
18525         ;;
18526 *)      srandom_r_proto=0
18527         ;;
18528 esac
18529
18530 : see if prototype for setresgid is available
18531 echo " "
18532 set d_sresgproto setresgid $i_unistd unistd.h
18533 eval $hasproto
18534
18535 : see if prototype for setresuid is available
18536 echo " "
18537 set d_sresuproto setresuid $i_unistd unistd.h
18538 eval $hasproto
18539
18540 : see if stat exists
18541 set stat d_stat
18542 eval $inlibc
18543
18544 : see if sys/stat.h is available
18545 set sys/stat.h i_sysstat
18546 eval $inhdr
18547
18548 : see if stat knows about block sizes
18549 echo " "
18550 echo "Checking to see if your struct stat has st_blocks field..." >&4
18551 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18552 eval $hasfield
18553
18554 : see if this is a sys/vfs.h system
18555 set sys/vfs.h i_sysvfs
18556 eval $inhdr
18557
18558 : see if this is a sys/statfs.h system
18559 set sys/statfs.h i_sysstatfs
18560 eval $inhdr
18561
18562 : Check for statfs_s
18563 echo " "
18564 echo "Checking to see if your system supports struct statfs..." >&4
18565 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
18566 eval $hasstruct
18567 case "$d_statfs_s" in
18568 "$define")      echo "Yes, it does."   ;;
18569 *)              echo "No, it doesn't." ;;
18570 esac
18571
18572 : see if struct statfs knows about f_flags
18573 case "$d_statfs_s" in
18574 define)
18575         echo " "
18576         echo "Checking to see if your struct statfs has f_flags field..." >&4
18577         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
18578         eval $hasfield
18579         ;;
18580 *)      val="$undef"
18581         set d_statfs_f_flags
18582         eval $setvar
18583         ;;
18584 esac
18585 case "$d_statfs_f_flags" in
18586 "$define")      echo "Yes, it does."   ;;
18587 *)              echo "No, it doesn't." ;;
18588 esac
18589
18590 : see what flavor, if any, of static inline is supported
18591 echo " "
18592 echo "Checking to see if your system supports static inline..."
18593 $cat > try.c <<'EOCP'
18594 #include <stdlib.h>
18595 extern int f_via_a(int x);
18596 extern int f_via_b(int x);
18597 int main(int argc, char **argv)
18598 {
18599     int y;
18600
18601     y = f_via_a(0);
18602 #ifdef USE_B
18603     y = f_via_b(0);
18604 #endif
18605     if (y == 42) {
18606         return EXIT_SUCCESS;
18607     }
18608     else {
18609         return EXIT_FAILURE;
18610     }
18611 }
18612 EOCP
18613 $cat > a.c <<'EOCP'
18614 static INLINE int f(int x) {
18615     int y;
18616     y = x + 42;
18617     return y;
18618 }
18619
18620 int f_via_a(int x)
18621 {
18622     return f(x);
18623 }
18624 EOCP
18625 $cat > b.c <<'EOCP'
18626 extern int f(int x);
18627
18628 int f_via_b(int x)
18629 {
18630     return f(x);
18631 }
18632 EOCP
18633
18634 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18635 case "$perl_static_inline" in
18636 '')     # Check the various possibilities, and break out on success.
18637         # For gcc, prefer __inline__, which will still permit
18638         # cflags.SH to add in -ansi.
18639         case "$gccversion" in
18640                 '') xxx="inline __inline__ __inline _inline";;
18641                 *)  xxx="__inline__ inline __inline _inline";;
18642         esac
18643         for inline in $xxx; do
18644                 set try -DINLINE=$inline a.c
18645                 if eval $compile && $run ./try; then
18646                         # Now make sure there is no external linkage of static
18647                         # functions
18648                         set try -DINLINE=$inline -DUSE_B a.c b.c
18649                         if eval $compile && $run ./try; then
18650                                 $echo "Your compiler supports static $inline, " >&4
18651                                 $echo "but it also creates an external definition," >&4
18652                                 $echo "so I won't use it." >&4
18653                                 val=$undef
18654                         else
18655                                 $echo "Your compiler supports static $inline." >&4
18656                                 val=$define
18657                                 perl_static_inline="static $inline";
18658                                 break;
18659                         fi
18660                 else
18661                         $echo "Your compiler does NOT support static $inline." >&4
18662                         val="$undef"
18663                 fi
18664         done
18665         ;;
18666 *inline*) # Some variant of inline exists.
18667         echo "Keeping your $hint value of $perl_static_inline."
18668         val=$define
18669         ;;
18670 static)  # No inline capabilities
18671         echo "Keeping your $hint value of $perl_static_inline."
18672         val=$undef
18673         ;;
18674 *)  # Unrecognized previous value -- blindly trust the supplied
18675         # value and hope it makes sense.  Use old value for
18676         # d_static_inline, if there is one.
18677         echo "Keeping your $hint value of $perl_static_inline."
18678         case "$d_static_inline" in
18679                 '') val=$define ;;
18680                 *)  val=$d_static_inline ;;
18681         esac
18682         ;;
18683 esac
18684 # Fallback to plain 'static' if nothing worked.
18685 case "$perl_static_inline" in
18686 '')
18687         perl_static_inline="static"
18688         val=$undef
18689         ;;
18690 esac
18691 set d_static_inline
18692 eval $setvar
18693 $rm -f a.[co] b.[co]
18694 $rm_try
18695
18696 : Check stream access
18697 $cat >&4 <<EOM
18698 Checking how to access stdio streams by file descriptor number...
18699 EOM
18700 case "$stdio_stream_array" in
18701 '')     $cat >try.c <<EOCP
18702 #include <stdio.h>
18703 int main() {
18704   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18705     printf("yes\n");
18706 }
18707 EOCP
18708         for s in _iob __iob __sF
18709         do
18710                 set try -DSTDIO_STREAM_ARRAY=$s
18711                 if eval $compile; then
18712                         case "`$run ./try`" in
18713                         yes)    stdio_stream_array=$s; break ;;
18714                         esac
18715                 fi
18716         done
18717         $rm_try
18718 esac
18719 case "$stdio_stream_array" in
18720 '')     $cat >&4 <<EOM
18721 I can't figure out how to access stdio streams by file descriptor number.
18722 EOM
18723         d_stdio_stream_array="$undef"
18724         ;;
18725 *)      $cat >&4 <<EOM
18726 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18727 EOM
18728         d_stdio_stream_array="$define"
18729         ;;
18730 esac
18731
18732 : see if strcoll exists
18733 set strcoll d_strcoll
18734 eval $inlibc
18735
18736 : see if strerror_l exists
18737 set strerror_l d_strerror_l
18738 eval $inlibc
18739
18740 : see if strerror_r exists
18741 set strerror_r d_strerror_r
18742 eval $inlibc
18743 case "$d_strerror_r" in
18744 "$define")
18745         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18746         case "$d_strerror_r_proto:$usethreads" in
18747         ":define")      d_strerror_r_proto=define
18748                 set d_strerror_r_proto strerror_r $hdrs
18749                 eval $hasproto ;;
18750         *)      ;;
18751         esac
18752         case "$d_strerror_r_proto" in
18753         define)
18754         case "$strerror_r_proto" in
18755         ''|0) try='int strerror_r(int, char*, size_t);'
18756         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18757         esac
18758         case "$strerror_r_proto" in
18759         ''|0) try='int strerror_r(int, char*, int);'
18760         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18761         esac
18762         case "$strerror_r_proto" in
18763         ''|0) try='char* strerror_r(int, char*, size_t);'
18764         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18765         esac
18766         case "$strerror_r_proto" in
18767         ''|0)   d_strerror_r=undef
18768                 strerror_r_proto=0
18769                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18770         * )     case "$strerror_r_proto" in
18771                 REENTRANT_PROTO*) ;;
18772                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18773                 esac
18774                 echo "Prototype: $try" ;;
18775         esac
18776         ;;
18777         *)      case "$usethreads" in
18778                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18779                 esac
18780                 d_strerror_r=undef
18781                 strerror_r_proto=0
18782                 ;;
18783         esac
18784         ;;
18785 *)      strerror_r_proto=0
18786         ;;
18787 esac
18788
18789 : see if strftime exists
18790 set strftime d_strftime
18791 eval $inlibc
18792
18793 : see if strlcat exists
18794 set strlcat d_strlcat
18795 eval $inlibc
18796
18797 : see if strlcpy exists
18798 set strlcpy d_strlcpy
18799 eval $inlibc
18800
18801 : see if strnlen exists
18802 set strnlen d_strnlen
18803 eval $inlibc
18804
18805 : see if strtod exists
18806 set strtod d_strtod
18807 eval $inlibc
18808
18809 : see if strtod_l exists
18810 set strtod_l d_strtod_l
18811 eval $inlibc
18812
18813 : see if strtol exists
18814 set strtol d_strtol
18815 eval $inlibc
18816
18817 : see if strtold exists
18818 set strtold d_strtold
18819 eval $inlibc
18820
18821 : see if strtold_l exists
18822 set strtold_l d_strtold_l
18823 eval $inlibc
18824
18825 : see if strtoll exists
18826 set strtoll d_strtoll
18827 eval $inlibc
18828
18829 case "$d_longlong-$d_strtoll" in
18830 "$define-$define")
18831         $cat <<EOM
18832 Checking whether your strtoll() works okay...
18833 EOM
18834         $cat >try.c <<'EOCP'
18835 #include <errno.h>
18836 #ifdef __hpux
18837 #define strtoll __strtoll
18838 #endif
18839 #ifdef __EMX__
18840 #define strtoll _strtoll
18841 #endif
18842 #include <stdio.h>
18843 extern long long int strtoll(char *s, char **, int);
18844 static int bad = 0;
18845 int check(char *s, long long ell, int een) {
18846         long long gll;
18847         errno = 0;
18848         gll = strtoll(s, 0, 10);
18849         if (!((gll == ell) && (errno == een)))
18850                 bad++;
18851 }
18852 int main() {
18853         check(" 1",                                      1LL, 0);
18854         check(" 0",                                      0LL, 0);
18855         check("-1",                                     -1LL, 0);
18856         check("-9223372036854775808", -9223372036854775808LL, 0);
18857         check("-9223372036854775808", -9223372036854775808LL, 0);
18858         check(" 9223372036854775807",  9223372036854775807LL, 0);
18859         check("-9223372036854775808", -9223372036854775808LL, 0);
18860         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18861         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18862         if (!bad)
18863                 printf("ok\n");
18864 }
18865 EOCP
18866         set try
18867         if eval $compile; then
18868                 yyy=`$run ./try`
18869                 case "$yyy" in
18870                 ok) echo "Your strtoll() seems to be working okay." ;;
18871                 *) cat <<EOM >&4
18872 Your strtoll() doesn't seem to be working okay.
18873 EOM
18874                    d_strtoll="$undef"
18875                    ;;
18876                 esac
18877         else
18878                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18879                 d_strtoll="$undef"
18880         fi
18881         ;;
18882 esac
18883
18884 : see if strtoq exists
18885 set strtoq d_strtoq
18886 eval $inlibc
18887
18888 : see if strtoul exists
18889 set strtoul d_strtoul
18890 eval $inlibc
18891
18892 case "$d_strtoul" in
18893 "$define")
18894         $cat <<EOM
18895 Checking whether your strtoul() works okay...
18896 EOM
18897         $cat >try.c <<'EOCP'
18898 #include <errno.h>
18899 #include <stdio.h>
18900 extern unsigned long int strtoul(char *s, char **, int);
18901 static int bad = 0;
18902 void check(char *s, unsigned long eul, int een) {
18903         unsigned long gul;
18904         errno = 0;
18905         gul = strtoul(s, 0, 10);
18906         if (!((gul == eul) && (errno == een)))
18907                 bad++;
18908 }
18909 int main() {
18910         check(" 1", 1L, 0);
18911         check(" 0", 0L, 0);
18912 EOCP
18913         case "$longsize" in
18914         8)
18915             $cat >>try.c <<'EOCP'
18916         check("18446744073709551615", 18446744073709551615UL, 0);
18917         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18918 #if 0 /* strtoul() for /^-/ strings is undefined. */
18919         check("-1", 18446744073709551615UL, 0);
18920         check("-18446744073709551614", 2, 0);
18921         check("-18446744073709551615", 1, 0);
18922         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18923         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18924 #endif
18925 EOCP
18926                 ;;
18927         4)
18928                     $cat >>try.c <<'EOCP'
18929         check("4294967295", 4294967295UL, 0);
18930         check("4294967296", 4294967295UL, ERANGE);
18931 #if 0 /* strtoul() for /^-/ strings is undefined. */
18932         check("-1", 4294967295UL, 0);
18933         check("-4294967294", 2, 0);
18934         check("-4294967295", 1, 0);
18935         check("-4294967296", 4294967295UL, ERANGE);
18936         check("-4294967297", 4294967295UL, ERANGE);
18937 #endif
18938 EOCP
18939                 ;;
18940         *)
18941 : Should we write these tests to be more portable by sprintf-ing
18942 : ~0 and then manipulating that char string as input for strtol?
18943                 ;;
18944         esac
18945         $cat >>try.c <<'EOCP'
18946         if (!bad)
18947                 printf("ok\n");
18948         return 0;
18949 }
18950 EOCP
18951         set try
18952         if eval $compile; then
18953                 case "`$run ./try`" in
18954                 ok) echo "Your strtoul() seems to be working okay." ;;
18955                 *) cat <<EOM >&4
18956 Your strtoul() doesn't seem to be working okay.
18957 EOM
18958                    d_strtoul="$undef"
18959                    ;;
18960                 esac
18961         else
18962                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18963                 d_strtoul="$undef"
18964         fi
18965         ;;
18966 esac
18967
18968 : see if strtoull exists
18969 set strtoull d_strtoull
18970 eval $inlibc
18971
18972 case "$d_longlong-$d_strtoull" in
18973 "$define-$define")
18974         $cat <<EOM
18975 Checking whether your strtoull() works okay...
18976 EOM
18977         $cat >try.c <<'EOCP'
18978 #include <errno.h>
18979 #ifdef __hpux
18980 #define strtoull __strtoull
18981 #endif
18982 #include <stdio.h>
18983 extern unsigned long long int strtoull(char *s, char **, int);
18984 static int bad = 0;
18985 int check(char *s, long long eull, int een) {
18986         long long gull;
18987         errno = 0;
18988         gull = strtoull(s, 0, 10);
18989         if (!((gull == eull) && (errno == een)))
18990                 bad++;
18991 }
18992 int main() {
18993         check(" 1",                                        1LL, 0);
18994         check(" 0",                                        0LL, 0);
18995         check("18446744073709551615",  18446744073709551615ULL, 0);
18996         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18997 #if 0 /* strtoull() for /^-/ strings is undefined. */
18998         check("-1",                    18446744073709551615ULL, 0);
18999         check("-18446744073709551614",                     2LL, 0);
19000         check("-18446744073709551615",                     1LL, 0);
19001         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19002         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19003 #endif
19004         if (!bad)
19005                 printf("ok\n");
19006 }
19007 EOCP
19008         set try
19009         if eval $compile; then
19010                 case "`$run ./try`" in
19011                 ok) echo "Your strtoull() seems to be working okay." ;;
19012                 *) cat <<EOM >&4
19013 Your strtoull() doesn't seem to be working okay.
19014 EOM
19015                    d_strtoull="$undef"
19016                    ;;
19017                 esac
19018         else
19019                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19020                 d_strtoull="$undef"
19021         fi
19022         ;;
19023 esac
19024
19025 : see if strtouq exists
19026 set strtouq d_strtouq
19027 eval $inlibc
19028
19029 case "$d_strtouq" in
19030 "$define")
19031         $cat <<EOM
19032 Checking whether your strtouq() works okay...
19033 EOM
19034         $cat >try.c <<'EOCP'
19035 #include <errno.h>
19036 #include <stdio.h>
19037 extern unsigned long long int strtouq(char *s, char **, int);
19038 static int bad = 0;
19039 void check(char *s, unsigned long long eull, int een) {
19040         unsigned long long gull;
19041         errno = 0;
19042         gull = strtouq(s, 0, 10);
19043         if (!((gull == eull) && (errno == een)))
19044                 bad++;
19045 }
19046 int main() {
19047         check(" 1",                                        1LL, 0);
19048         check(" 0",                                        0LL, 0);
19049         check("18446744073709551615",  18446744073709551615ULL, 0);
19050         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19051 #if 0 /* strtouq() for /^-/ strings is undefined. */
19052         check("-1",                    18446744073709551615ULL, 0);
19053         check("-18446744073709551614",                     2LL, 0);
19054         check("-18446744073709551615",                     1LL, 0);
19055         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19056         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19057 #endif
19058         if (!bad)
19059                 printf("ok\n");
19060         return 0;
19061 }
19062 EOCP
19063         set try
19064         if eval $compile; then
19065                 case "`$run ./try`" in
19066                 ok) echo "Your strtouq() seems to be working okay." ;;
19067                 *) cat <<EOM >&4
19068 Your strtouq() doesn't seem to be working okay.
19069 EOM
19070                    d_strtouq="$undef"
19071                    ;;
19072                 esac
19073         else
19074                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19075                 d_strtouq="$undef"
19076         fi
19077         ;;
19078 esac
19079
19080 : see if strxfrm exists
19081 set strxfrm d_strxfrm
19082 eval $inlibc
19083
19084 : see if symlink exists
19085 set symlink d_symlink
19086 eval $inlibc
19087
19088 : see if syscall exists
19089 set syscall d_syscall
19090 eval $inlibc
19091
19092 : see if prototype for syscall is available
19093 echo " "
19094 set d_syscallproto syscall $i_unistd unistd.h
19095 eval $hasproto
19096
19097 : see if sysconf exists
19098 set sysconf d_sysconf
19099 eval $inlibc
19100
19101 : see if sys_errlist[] exists
19102 echo " "
19103 if test "X$d_syserrlst" = X; then
19104         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19105                 echo "You have sys_errlist[], so we could roll our own strerror."
19106                 d_syserrlst="$define"
19107         else
19108                 echo "You don't have sys_errlist[], so strerror() is welcome."
19109                 d_syserrlst="$undef"
19110         fi
19111 fi
19112
19113 : see if system exists
19114 set system d_system
19115 eval $inlibc
19116
19117 : see if tcgetpgrp exists
19118 set tcgetpgrp d_tcgetpgrp
19119 eval $inlibc
19120
19121 : see if tcsetpgrp exists
19122 set tcsetpgrp d_tcsetpgrp
19123 eval $inlibc
19124
19125 : see if prototype for telldir is available
19126 echo " "
19127 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19128 eval $hasproto
19129
19130 : see if tgamma exists
19131 set tgamma d_tgamma
19132 eval $inlibc
19133
19134 : check for thread_safe_nl_langinfo_l item
19135 $cat <<EOM
19136
19137 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19138 EOM
19139 $cat >try.c <<EOCP
19140 #$i_stdlib I_STDLIB
19141 #ifdef I_STDLIB
19142 #  include <stdlib.h>
19143 #endif
19144 #include <string.h>
19145 #$i_langinfo I_LANGINFO
19146 #ifdef I_LANGINFO
19147 #  include <langinfo.h>
19148 #endif
19149 #$i_pthread I_PTHREAD
19150 #ifdef I_PTHREAD
19151 #  include <pthread.h>
19152 #endif
19153 #$i_locale I_LOCALE
19154 #ifdef I_LOCALE
19155 #  include <locale.h>
19156 #endif
19157
19158 void *
19159 thread_start(void * arg)
19160 {
19161     nl_langinfo(RADIXCHAR);
19162 }
19163
19164 int main() {
19165     char * main_buffer;
19166     char save_main_buffer[1000];
19167     pthread_t subthread;
19168     pthread_attr_t attr;
19169
19170     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19171
19172     /* If too large for our generous allowance, just assume we don't have
19173      * it. */
19174     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19175         exit(1);
19176     }
19177
19178     strcpy(save_main_buffer, main_buffer);
19179
19180     if (pthread_attr_init(&attr) != 0) {
19181         exit(1);
19182     }
19183
19184     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19185         exit(1);
19186     }
19187
19188     if (pthread_join(subthread, NULL) != 0) {
19189         exit(1);
19190     }
19191
19192     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19193 }
19194 EOCP
19195 case "$usethreads" in
19196     define)
19197         set try
19198         if eval $compile; then
19199             echo "Your system has nl_langinfo_l()..." >&4
19200             if $run ./try; then
19201                 echo "and it is thread-safe (just as I'd hoped)." >&4
19202                 d_thread_safe_nl_langinfo_l="$define"
19203                 echo "$d_thread_safe_nl_langinfo_l" >&4
19204             else
19205                 echo "but it isn't thread-safe, so we won't use it." >&4
19206             fi
19207         else
19208             echo "your system does not have nl_langinfo_l()" >&4
19209         fi
19210         ;;
19211     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19212 esac
19213 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19214         d_thread_safe_nl_langinfo_l="$undef"
19215 fi
19216 $rm_try
19217
19218 : see if time exists
19219 echo " "
19220 if test "X$d_time" = X -o X"$timetype" = X; then
19221     if set time val -f d_time; eval $csym; $val; then
19222                 echo 'time() found.' >&4
19223                 val="$define"
19224                 rp="What is the type returned by time() on this system?"
19225                 set time_t timetype long stdio.h sys/types.h
19226                 eval $typedef_ask
19227     else
19228                 echo 'time() not found, hope that will do.' >&4
19229                 val="$undef"
19230                 timetype='int';
19231     fi
19232     set d_time
19233     eval $setvar
19234 fi
19235
19236 : see if timegm exists
19237 set timegm d_timegm
19238 eval $inlibc
19239
19240 : see if this is a sys/times.h system
19241 set sys/times.h i_systimes
19242 eval $inhdr
19243
19244 : see if times exists
19245 echo " "
19246 if set times val -f d_times; eval $csym; $val; then
19247         echo 'times() found.' >&4
19248         d_times="$define"
19249         inc=''
19250         case "$i_systimes" in
19251         "$define") inc='sys/times.h';;
19252         esac
19253         rp="What is the type returned by times() on this system?"
19254         set clock_t clocktype long stdio.h sys/types.h $inc
19255         eval $typedef_ask
19256 else
19257         echo 'times() NOT found, hope that will do.' >&4
19258         d_times="$undef"
19259         clocktype='int'
19260 fi
19261
19262 : see if tmpnam_r exists
19263 set tmpnam_r d_tmpnam_r
19264 eval $inlibc
19265 case "$d_tmpnam_r" in
19266 "$define")
19267         hdrs="$i_systypes sys/types.h define stdio.h "
19268         case "$d_tmpnam_r_proto:$usethreads" in
19269         ":define")      d_tmpnam_r_proto=define
19270                 set d_tmpnam_r_proto tmpnam_r $hdrs
19271                 eval $hasproto ;;
19272         *)      ;;
19273         esac
19274         case "$d_tmpnam_r_proto" in
19275         define)
19276         case "$tmpnam_r_proto" in
19277         ''|0) try='char* tmpnam_r(char*);'
19278         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19279         esac
19280         case "$tmpnam_r_proto" in
19281         ''|0)   d_tmpnam_r=undef
19282                 tmpnam_r_proto=0
19283                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19284         * )     case "$tmpnam_r_proto" in
19285                 REENTRANT_PROTO*) ;;
19286                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19287                 esac
19288                 echo "Prototype: $try" ;;
19289         esac
19290         ;;
19291         *)      case "$usethreads" in
19292                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19293                 esac
19294                 d_tmpnam_r=undef
19295                 tmpnam_r_proto=0
19296                 ;;
19297         esac
19298         ;;
19299 *)      tmpnam_r_proto=0
19300         ;;
19301 esac
19302
19303 : see if trunc exists
19304 set trunc d_trunc
19305 eval $inlibc
19306
19307 : see if truncate exists
19308 set truncate d_truncate
19309 eval $inlibc
19310
19311 : see if ttyname_r exists
19312 set ttyname_r d_ttyname_r
19313 eval $inlibc
19314 case "$d_ttyname_r" in
19315 "$define")
19316         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19317         case "$d_ttyname_r_proto:$usethreads" in
19318         ":define")      d_ttyname_r_proto=define
19319                 set d_ttyname_r_proto ttyname_r $hdrs
19320                 eval $hasproto ;;
19321         *)      ;;
19322         esac
19323         case "$d_ttyname_r_proto" in
19324         define)
19325         case "$ttyname_r_proto" in
19326         ''|0) try='int ttyname_r(int, char*, size_t);'
19327         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19328         esac
19329         case "$ttyname_r_proto" in
19330         ''|0) try='int ttyname_r(int, char*, int);'
19331         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19332         esac
19333         case "$ttyname_r_proto" in
19334         ''|0) try='char* ttyname_r(int, char*, int);'
19335         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19336         esac
19337         case "$ttyname_r_proto" in
19338         ''|0)   d_ttyname_r=undef
19339                 ttyname_r_proto=0
19340                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19341         * )     case "$ttyname_r_proto" in
19342                 REENTRANT_PROTO*) ;;
19343                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19344                 esac
19345                 echo "Prototype: $try" ;;
19346         esac
19347         ;;
19348         *)      case "$usethreads" in
19349                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19350                 esac
19351                 d_ttyname_r=undef
19352                 ttyname_r_proto=0
19353                 ;;
19354         esac
19355         ;;
19356 *)      ttyname_r_proto=0
19357         ;;
19358 esac
19359
19360 : see if tzname[] exists
19361 echo " "
19362 if set tzname val -a d_tzname; eval $csym; $val; then
19363         val="$define"
19364         echo 'tzname[] found.' >&4
19365 else
19366         val="$undef"
19367         echo 'tzname[] NOT found.' >&4
19368 fi
19369 set d_tzname
19370 eval $setvar
19371
19372 : Check if is a multiplatform env
19373 case "$osname" in
19374 darwin) multiarch="$define" ;;
19375 esac
19376 case "$multiarch" in
19377 ''|[nN]*) multiarch="$undef" ;;
19378 esac
19379
19380 : check for ordering of bytes in a UV
19381 echo " "
19382 case "$multiarch" in
19383 *$define*)
19384         $cat <<EOM
19385 You seem to be doing a multiarchitecture build,
19386 skipping the byteorder check.
19387
19388 EOM
19389         byteorder='ffff'
19390         ;;
19391 *)
19392         case "$byteorder" in
19393         '')
19394                 $cat <<'EOM'
19395 In the following, larger digits indicate more significance.  A big-endian
19396 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19397 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19398 machines may have weird orders like 3412.  A Cray will report 87654321,
19399 an Alpha will report 12345678. If the test program works the default is
19400 probably right.
19401 I'm now running the test program...
19402 EOM
19403                 $cat >try.c <<EOCP
19404 #include <stdio.h>
19405 #$i_stdlib I_STDLIB
19406 #ifdef I_STDLIB
19407 #include <stdlib.h>
19408 #endif
19409 #include <sys/types.h>
19410 typedef $uvtype UV;
19411 int main()
19412 {
19413         int i;
19414         union {
19415                 UV l;
19416                 char c[$uvsize];
19417         } u;
19418
19419         if ($uvsize > 4)
19420                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19421         else
19422                 u.l = (UV)0x04030201;
19423         for (i = 0; i < $uvsize; i++)
19424                 printf("%c", u.c[i]+'0');
19425         printf("\n");
19426         exit(0);
19427 }
19428 EOCP
19429                 xxx_prompt=y
19430                 set try
19431                 if eval $compile && $run ./try > /dev/null; then
19432                         dflt=`$run ./try`
19433                         case "$dflt" in
19434                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19435                                 echo "(The test program ran ok.)"
19436                                 echo "byteorder=$dflt"
19437                                 xxx_prompt=n
19438                         ;;
19439                         ????|????????) echo "(The test program ran ok.)" ;;
19440                         *) echo "(The test program didn't run right for some reason.)" ;;
19441                         esac
19442                 else
19443                         dflt='4321'
19444                         cat <<'EOM'
19445 (I can't seem to compile the test program.  Guessing big-endian...)
19446 EOM
19447                 fi
19448                 case "$xxx_prompt" in
19449                 y)
19450                         rp="What is the order of bytes in $uvtype?"
19451                         . ./myread
19452                         byteorder="$ans"
19453                         ;;
19454                 *)      byteorder=$dflt
19455                         ;;
19456                 esac
19457                 ;;
19458         esac
19459         $rm_try
19460         ;;
19461 esac
19462
19463 : Checking 32bit alignedness
19464 $cat <<EOM
19465
19466 Checking to see whether you can access character data unalignedly...
19467 EOM
19468 case "$d_u32align" in
19469 '')   $cat >try.c <<EOCP
19470 #include <stdio.h>
19471 #$i_stdlib I_STDLIB
19472 #ifdef I_STDLIB
19473 #include <stdlib.h>
19474 #endif
19475 #define U32 $u32type
19476 #define BYTEORDER 0x$byteorder
19477 #define U8 $u8type
19478 #include <signal.h>
19479 #ifdef SIGBUS
19480 $signal_t bletch(int s) { exit(4); }
19481 #endif
19482 int main() {
19483 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19484     volatile U8 buf[8];
19485     volatile U32 *up;
19486     int i;
19487
19488     if (sizeof(U32) != 4) {
19489         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19490         exit(1);
19491     }
19492
19493     fflush(stdout);
19494
19495 #ifdef SIGBUS
19496     signal(SIGBUS, bletch);
19497 #endif
19498
19499     buf[0] = 0;
19500     buf[1] = 0;
19501     buf[2] = 0;
19502     buf[3] = 1;
19503     buf[4] = 0;
19504     buf[5] = 0;
19505     buf[6] = 0;
19506     buf[7] = 1;
19507
19508     for (i = 0; i < 4; i++) {
19509         up = (U32*)(buf + i);
19510         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19511                (*up == 1 << (8*(3-i)))  /* little-endian */
19512               )
19513            )
19514         {
19515             printf("read failed (%x)\n", *up);
19516             exit(2);
19517         }
19518     }
19519
19520     /* write test */
19521     for (i = 0; i < 4; i++) {
19522         up = (U32*)(buf + i);
19523         *up = 0xBeef;
19524         if (*up != 0xBeef) {
19525             printf("write failed (%x)\n", *up);
19526             exit(3);
19527         }
19528     }
19529
19530     exit(0);
19531 #else
19532     printf("1\n");
19533     exit(1);
19534 #endif
19535     return 0;
19536 }
19537 EOCP
19538 set try
19539 if eval $compile_ok; then
19540         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19541         $run ./try 2>&1 >/dev/null
19542         case "$?" in
19543         0)      cat >&4 <<EOM
19544 You can access character data pretty unalignedly.
19545 EOM
19546                 d_u32align="$undef"
19547                 ;;
19548         *)      cat >&4 <<EOM
19549 It seems that you must access character data in an aligned manner.
19550 EOM
19551                 d_u32align="$define"
19552                 ;;
19553         esac
19554 else
19555         rp='Can you access character data at unaligned addresses?'
19556         dflt='n'
19557         . ./myread
19558         case "$ans" in
19559         [yY]*)  d_u32align="$undef"  ;;
19560         *)      d_u32align="$define" ;;
19561         esac
19562 fi
19563 $rm_try
19564 ;;
19565 esac
19566
19567 : see if ualarm exists
19568 set ualarm d_ualarm
19569 eval $inlibc
19570
19571 : see if umask exists
19572 set umask d_umask
19573 eval $inlibc
19574
19575 : see if unordered exists
19576 set unordered d_unordered
19577 eval $inlibc
19578
19579 : see if unsetenv exists
19580 set unsetenv d_unsetenv
19581 eval $inlibc
19582
19583 : see if usleep exists
19584 set usleep d_usleep
19585 eval $inlibc
19586
19587 : see if prototype for usleep is available
19588 echo " "
19589 set d_usleepproto usleep $i_unistd unistd.h
19590 eval $hasproto
19591
19592 : see if ustat exists
19593 set ustat d_ustat
19594 eval $inlibc
19595
19596 : see if closedir exists
19597 set closedir d_closedir
19598 eval $inlibc
19599
19600 case "$d_closedir" in
19601 "$define")
19602         echo " "
19603         echo "Checking whether closedir() returns a status..." >&4
19604         cat > try.c <<EOM
19605 #$i_dirent I_DIRENT             /**/
19606 #$i_sysdir I_SYS_DIR            /**/
19607 #$i_sysndir I_SYS_NDIR          /**/
19608 #$i_systypes I_SYS_TYPES        /**/
19609
19610 #if defined(I_SYS_TYPES)
19611 #include <sys/types.h>
19612 #endif
19613 #if defined(I_DIRENT)
19614 #include <dirent.h>
19615 #else
19616 #ifdef I_SYS_NDIR
19617 #include <sys/ndir.h>
19618 #else
19619 #ifdef I_SYS_DIR
19620 #include <sys/dir.h>
19621 #endif
19622 #endif
19623 #endif
19624 int main() { return closedir(opendir(".")); }
19625 EOM
19626         set try
19627         if eval $compile_ok; then
19628                 if $run ./try > /dev/null 2>&1 ; then
19629                         echo "Yes, it does."
19630                         val="$undef"
19631                 else
19632                         echo "No, it doesn't."
19633                         val="$define"
19634                 fi
19635         else
19636                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19637                 val="$define"
19638         fi
19639         ;;
19640 *)
19641         val="$undef";
19642         ;;
19643 esac
19644 set d_void_closedir
19645 eval $setvar
19646 $rm_try
19647
19648 : see if there is a wait4
19649 set wait4 d_wait4
19650 eval $inlibc
19651
19652 : see if waitpid exists
19653 set waitpid d_waitpid
19654 eval $inlibc
19655
19656 : look for wcscmp
19657 echo " "
19658 $cat >try.c <<'EOCP'
19659 #include <stdio.h>
19660 #include <wchar.h>
19661 int main ()
19662 {
19663     wchar_t *s = L" ";
19664     return (wcscmp (s, s) ? 1 : 0);
19665     }
19666 EOCP
19667 set try
19668 val="$undef"
19669 if eval $compile; then
19670     `$run ./try`
19671     case "$?" in
19672         0)  echo "A working wcscmp() found." >&4
19673             val="$define" ;;
19674         *)  echo "wcscmp() found, but it doesn't work" >&4
19675             ;;
19676         esac
19677 else
19678     echo "wcscmp() NOT found." >&4
19679     fi
19680 set d_wcscmp
19681 eval $setvar
19682 $rm_try
19683
19684 : see if wcstombs exists
19685 set wcstombs d_wcstombs
19686 eval $inlibc
19687
19688 : look for wcsxfrm
19689 echo " "
19690 $cat >try.c <<'EOCP'
19691 #include <errno.h>
19692 #include <wchar.h>
19693 int main ()
19694 {
19695     wchar_t dst[4], *src = L" ";
19696     errno = 0;
19697     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19698     }
19699 EOCP
19700 set try
19701 val="$undef"
19702 if eval $compile; then
19703     `$run ./try`
19704     case "$?" in
19705         0)  echo "A working wcsxfrm() found." >&4
19706             val="$define" ;;
19707         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19708             ;;
19709         esac
19710 else
19711     echo "wcsxfrm() NOT found." >&4
19712     fi
19713 set d_wcsxfrm
19714 eval $setvar
19715 $rm_try
19716
19717 : see if wctomb exists
19718 set wctomb d_wctomb
19719 eval $inlibc
19720
19721 : see if writev exists
19722 set writev d_writev
19723 eval $inlibc
19724
19725 : check for alignment requirements
19726 echo " "
19727 case "$alignbytes" in
19728     '') echo "Checking alignment constraints..." >&4
19729         $cat >try.c <<EOCP
19730 #include <stdio.h>
19731 struct foobar {
19732     char foo;
19733     $nvtype bar;
19734 } try_algn;
19735 int main()
19736 {
19737     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19738     return(0);
19739 }
19740 EOCP
19741         set try
19742         if eval $compile_ok; then
19743             dflt=`$run ./try`
19744         else
19745             dflt='8'
19746             echo "(I can't seem to compile the test program...)"
19747         fi
19748         case "$multiarch" in
19749             *$define*)
19750                 : The usual safe value is 8, but Darwin with -Duselongdouble
19751                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19752                 : Configure to pick a larger value if needed.
19753                 if $test "$dflt" -lt 8; then
19754                     dflt='8'
19755                     echo "Setting alignment to 8 for multiarch support.">&4
19756                 fi
19757                 ;;
19758         esac
19759         ;;
19760     *) dflt="$alignbytes"
19761         ;;
19762 esac
19763 rp="Doubles must be aligned on a how-many-byte boundary?"
19764 . ./myread
19765 alignbytes="$ans"
19766 $rm_try
19767
19768 : set the base revision
19769 baserev=5.0
19770
19771 : length of character in bytes. Is always 1, otherwise it is not C
19772 : This used to be a test using sizeof
19773 charsize=1
19774
19775 : Check for the number of bits in a character
19776 case "$charbits" in
19777 '')     echo "Checking how long a character is (in bits)..." >&4
19778         $cat >try.c <<EOCP
19779 #include <stdio.h>
19780 int main ()
19781 {
19782     int n;
19783     unsigned char c;
19784     for (c = 1, n = 0; c; c <<= 1, n++) ;
19785     printf ("%d\n", n);
19786     return (0);
19787     }
19788 EOCP
19789         set try
19790         if eval $compile_ok; then
19791                 dflt=`$run ./try`
19792         else
19793                 dflt='8'
19794                 echo "(I can't seem to compile the test program.  Guessing...)"
19795         fi
19796         ;;
19797 *)
19798         dflt="$charbits"
19799         ;;
19800 esac
19801 rp="What is the length of a character (in bits)?"
19802 . ./myread
19803 charbits="$ans"
19804 $rm_try
19805 case "$charbits" in
19806 8)      ;;
19807 *)      cat >&4 << EOM
19808 Your system has an unsigned character size of $charbits bits, which
19809 is rather unusual (normally it is 8 bits).  Perl likely will not work
19810 correctly on your system, with subtle bugs in various places.
19811 EOM
19812         rp='Do you really want to continue?'
19813         dflt='n'
19814         . ./myread
19815         case "$ans" in
19816                 [yY])   echo >&4 "Okay, continuing."    ;;
19817                 *)      exit 1                          ;;
19818         esac
19819 esac
19820
19821 : how do we concatenate cpp tokens here?
19822 echo " "
19823 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19824 $cat >cpp_stuff.c <<'EOCP'
19825 #define RCAT(a,b)a/**/b
19826 #define ACAT(a,b)a ## b
19827 RCAT(Rei,ser)
19828 ACAT(Cir,cus)
19829 EOCP
19830 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19831 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19832         echo "Oh!  Smells like ANSI's been here." >&4
19833         echo "We can catify or stringify, separately or together!"
19834         cpp_stuff=42
19835 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19836         echo "Ah, yes!  The good old days!" >&4
19837         echo "However, in the good old days we don't know how to stringify and"
19838         echo "catify at the same time."
19839         cpp_stuff=1
19840 else
19841         $cat >&4 <<EOM
19842 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19843 You're going to have to edit the values of CAT[2-5] in config.h...
19844 EOM
19845         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19846 fi
19847 $rm -f cpp_stuff.*
19848
19849 : see if this is a db.h system
19850 set db.h i_db
19851 eval $inhdr
19852
19853 case "$i_db" in
19854 $define)
19855         : Check db version.
19856         echo " "
19857         echo "Checking Berkeley DB version ..." >&4
19858         $cat >try.c <<EOCP
19859 #$d_const HASCONST
19860 #ifndef HASCONST
19861 #define const
19862 #endif
19863 #include <sys/types.h>
19864 #include <stdio.h>
19865 #$i_stdlib I_STDLIB
19866 #ifdef I_STDLIB
19867 #include <stdlib.h>
19868 #endif
19869 #include <db.h>
19870 int main(int argc, char *argv[])
19871 {
19872 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19873     int Major, Minor, Patch ;
19874     unsigned long Version ;
19875     (void)db_version(&Major, &Minor, &Patch) ;
19876     if (argc == 2) {
19877         printf("%d %d %d %d %d %d\n",
19878                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19879                Major, Minor, Patch);
19880         exit(0);
19881     }
19882     printf("You have Berkeley DB Version 2 or greater.\n");
19883
19884     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19885                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19886     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19887                 Major, Minor, Patch) ;
19888
19889     /* check that db.h & libdb are compatible */
19890     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19891         printf("db.h and libdb are incompatible.\n") ;
19892         exit(3);
19893     }
19894
19895     printf("db.h and libdb are compatible.\n") ;
19896
19897     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19898                 + DB_VERSION_PATCH ;
19899
19900     /* needs to be >= 2.3.4 */
19901     if (Version < 2003004) {
19902     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19903         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19904         exit(2);
19905     }
19906
19907     exit(0);
19908 #else
19909 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19910     if (argc == 2) {
19911         printf("1 0 0\n");
19912         exit(0);
19913     }
19914     printf("You have Berkeley DB Version 1.\n");
19915     exit(0);    /* DB version < 2: the coast is clear. */
19916 #else
19917     exit(1);    /* <db.h> not Berkeley DB? */
19918 #endif
19919 #endif
19920 }
19921 EOCP
19922         set try
19923         if eval $compile_ok && $run ./try; then
19924                 echo 'Looks OK.' >&4
19925                 set `$run ./try 1`
19926                 db_version_major=$1
19927                 db_version_minor=$2
19928                 db_version_patch=$3
19929         else
19930                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19931                 i_db=$undef
19932                 case " $libs " in
19933                 *"-ldb "*)
19934                         : Remove db from list of libraries to use
19935                         echo "Removing unusable -ldb from library list" >&4
19936                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19937                         shift
19938                         libs="$*"
19939                         echo "libs = $libs" >&4
19940                         ;;
19941                 esac
19942         fi
19943         $rm_try
19944         ;;
19945 esac
19946
19947 case "$i_db" in
19948 define)
19949         : Check the return type needed for hash
19950         echo " "
19951         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19952         $cat >try.c <<EOCP
19953 #$d_const HASCONST
19954 #ifndef HASCONST
19955 #define const
19956 #endif
19957 #include <sys/types.h>
19958 #include <db.h>
19959
19960 #ifndef DB_VERSION_MAJOR
19961 u_int32_t hash_cb (const void* ptr, size_t size)
19962 {
19963         return 0;
19964 }
19965 HASHINFO info;
19966 int main()
19967 {
19968         info.hash = hash_cb;
19969 }
19970 #endif
19971 EOCP
19972         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19973                 if $contains warning try.out >>/dev/null 2>&1 ; then
19974                         db_hashtype='int'
19975                 else
19976                         db_hashtype='u_int32_t'
19977                 fi
19978         else
19979                 : XXX Maybe we should just give up here.
19980                 db_hashtype=u_int32_t
19981                 $cat try.out >&4
19982                 echo "Help:  I can't seem to compile the db test program." >&4
19983                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19984         fi
19985         $rm_try
19986         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19987         ;;
19988 *)      db_hashtype=u_int32_t
19989         ;;
19990 esac
19991 case "$i_db" in
19992 define)
19993         : Check the return type needed for prefix
19994         echo " "
19995         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19996         cat >try.c <<EOCP
19997 #$d_const HASCONST
19998 #ifndef HASCONST
19999 #define const
20000 #endif
20001 #include <sys/types.h>
20002 #include <db.h>
20003
20004 #ifndef DB_VERSION_MAJOR
20005 size_t prefix_cb (const DBT *key1, const DBT *key2)
20006 {
20007         return 0;
20008 }
20009 BTREEINFO info;
20010 int main()
20011 {
20012         info.prefix = prefix_cb;
20013 }
20014 #endif
20015 EOCP
20016         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20017                 if $contains warning try.out >>/dev/null 2>&1 ; then
20018                         db_prefixtype='int'
20019                 else
20020                         db_prefixtype='size_t'
20021                 fi
20022         else
20023                 db_prefixtype='size_t'
20024                 : XXX Maybe we should just give up here.
20025                 $cat try.out >&4
20026                 echo "Help:  I can't seem to compile the db test program." >&4
20027                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20028         fi
20029         $rm_try
20030         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20031         ;;
20032 *)      db_prefixtype='size_t'
20033         ;;
20034 esac
20035
20036 : Include . in @INC
20037 $cat <<EOM
20038
20039 Historically Perl has provided a final fallback of the current working
20040 directory '.' when searching for a library. This, however, can lead to
20041 problems when a Perl program which loads optional modules is called from
20042 a shared directory. This can lead to executing unexpected code.
20043
20044 EOM
20045
20046 # When changing to exclude by default:
20047 case "$default_inc_excludes_dot" in
20048     $undef|false|[nN]*) dflt="n" ;;
20049     *)                  dflt="y" ;;
20050 esac
20051 # To turn exclude off by default:
20052 #case "$default_inc_excludes_dot" in
20053 #    $define|true|[yY]*) dflt="y" ;;
20054 #    *)                  dflt="n" ;;
20055 #esac
20056
20057 rp='Exclude '.' from @INC by default? '
20058 . ./myread
20059 case "$ans" in
20060     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20061     *)          default_inc_excludes_dot="$define" ;;
20062 esac
20063
20064 : Check what kind of inf/nan your system has
20065 $echo "Checking the kind of infinities and nans you have..." >&4
20066 $echo "(The following tests may crash.  That's okay.)" >&4
20067 $cat >try.c <<EOP
20068 #define DOUBLESIZE $doublesize
20069 #$d_longdbl HAS_LONG_DOUBLE
20070 #ifdef HAS_LONG_DOUBLE
20071 #define LONG_DOUBLESIZE $longdblsize
20072 #define LONG_DOUBLEKIND $longdblkind
20073 #endif
20074 #include <math.h>
20075 #include <string.h>
20076 #include <stdio.h>
20077 /* Note that whether the sign bit is on or off
20078  * for NaN depends on the CPU/FPU, and possibly
20079  * can be affected by the build toolchain.
20080  *
20081  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20082  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20083  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20084  * (respectively) as opposed to the more usual
20085  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20086  *
20087  * Pre-IEEE-754 floating point format do not even have inf/nan support
20088  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20089  * to even mention, causing immediate SIGFPE or equivalent: this is
20090  * the case with VAX floating point, for example.
20091  */
20092 static void bytes(void *v, unsigned int n) {
20093   unsigned char *p = (unsigned char *)v;
20094   int i;
20095   for (i = 0; i < n; i++) {
20096     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20097   }
20098 }
20099 int main(int argc, char *argv[]) {
20100    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20101     * because some compilers are 'smart' and not only warn but refuse to
20102     * compile such 'illegal' values. */
20103    double dinf = exp(1e9);
20104    double dnan = sqrt(-1.0);
20105 #ifdef HAS_LONG_DOUBLE
20106    long double ldinf = (long double)exp(1e9);
20107    long double ldnan = (long double)sqrt(-1.0);
20108 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20109 /* the 80-bit long doubles might have garbage in their excess bytes */
20110     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20111     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20112 # endif
20113   if (argc == 2) {
20114     switch (argv[1][0]) {
20115     case '1': bytes(&dinf, sizeof(dinf)); break;
20116     case '2': bytes(&dnan, sizeof(dnan)); break;
20117     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20118     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20119 #endif
20120     }
20121   }
20122   return 0;
20123 }
20124 EOP
20125 set try
20126 if eval $compile; then
20127     doubleinfbytes=`$run ./try 1`
20128     doublenanbytes=`$run ./try 2`
20129     case "$d_longdbl" in
20130     $define)
20131       longdblinfbytes=`$run ./try 3`
20132       longdblnanbytes=`$run ./try 4`
20133       ;;
20134     esac
20135 else
20136     # Defaults in case the above test program failed.
20137     case "$doublekind" in
20138     1) # IEEE 754 32-bit LE
20139        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20140        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20141        ;;
20142     2) # IEEE 754 32-bit BE
20143        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20144        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20145        ;;
20146     3) # IEEE 754 64-bit LE
20147        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20148        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20149        ;;
20150     4) # IEEE 754 64-bit BE
20151        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20152        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20153        ;;
20154     5) # IEEE 754 128-bit LE
20155        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20156        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20157        ;;
20158     6) # IEEE 754 128-bit BE
20159        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20160        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20161        ;;
20162     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20163        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20164        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20165        ;;
20166     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20167        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20168        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20169        ;;
20170     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20171        doubleinfbytes=$undef
20172        doublenanbytes=$undef
20173        ;;
20174     *) # No idea.
20175        doubleinfbytes=$undef
20176        doublenanbytes=$undef
20177        ;;
20178     esac
20179     case "$longdblkind" in
20180     1) # IEEE 754 128-bit LE
20181        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20182        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20183        ;;
20184     2) # IEEE 754 128-bit BE
20185        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20186        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20187        ;;
20188     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20189        case "$longdblsize" in
20190        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20191            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20192            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20193            ;;
20194        16) # x86_64
20195            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20196            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20197            ;;
20198        *)  # No idea.
20199            longdblinfbytes=$undef
20200            longdblnanbytes=$undef
20201        ;;
20202        esac
20203        ;;
20204     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20205        case "$longdblsize" in
20206        12) # 32-bit system
20207            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20208            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20209            ;;
20210        16) # 64-bit system
20211            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20212            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20213            ;;
20214        *)  # No idea.
20215            longdblinfbytes=$undef
20216            longdblnanbytes=$undef
20217        ;;
20218        esac
20219        ;;
20220     5) # 128-bit LE-LE "double double"
20221        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20222        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20223        ;;
20224     6) # 128-bit BE-BE "double double"
20225        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20226        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20227        ;;
20228     7) # 128-bit LE-BE "double double"
20229        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20230        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20231        ;;
20232     8) # 128-bit BE-LE "double double"
20233        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20234        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20235        ;;
20236     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20237        longdblinfbytes=$undef
20238        longdblnanbytes=$undef
20239        ;;
20240     *) # No idea.
20241        longdblinfbytes=$undef
20242        longdblnanbytes=$undef
20243        ;;
20244     esac
20245 fi
20246 # In case the program crashed the values are empty, turn them undef.
20247 case "$doubleinfbytes" in
20248 '') doubleinfbytes=$undef ;;
20249 esac
20250 case "$doublenanbytes" in
20251 '') doublenanbytes=$undef ;;
20252 esac
20253 case "$longdblinfbytes" in
20254 '') longdblinfbytes=$undef ;;
20255 esac
20256 case "$longdblnanbytes" in
20257 '') longdblnanbytes=$undef ;;
20258 esac
20259 $rm_try
20260
20261 : Check the length of the double mantissa
20262 $echo "Checking how many mantissa bits your doubles have..." >&4
20263 $cat >try.c <<EOP
20264 #$i_sunmath I_SUNMATH
20265 #include <float.h>
20266 #ifdef I_SUNMATH
20267 # include <sunmath.h>
20268 #endif
20269 #ifdef DBL_MANT_DIG
20270 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20271 #endif
20272 #include <stdio.h>
20273 int main(int argc, char *argv[]) {
20274 #ifdef BITS
20275   printf("%d\n", BITS);
20276 #endif
20277   return 0;
20278 }
20279 EOP
20280 set try
20281 if eval $compile; then
20282     doublemantbits=`$run ./try`
20283 else
20284     doublemantbits="$undef"
20285 fi
20286 $rm_try
20287
20288 : Check the length of the longdouble mantissa
20289 $echo "Checking how many mantissa bits your long doubles have..." >&4
20290 $cat >try.c <<EOP
20291 #$i_sunmath I_SUNMATH
20292 #include <float.h>
20293 #ifdef I_SUNMATH
20294 # include <sunmath.h>
20295 #endif
20296 #$d_longdbl HAS_LONG_DOUBLE
20297 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20298 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20299 /* This format has no implicit bit.  Beware, however, that for
20300  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20301  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20302  * and the top bit must have been one since 387, zero is plain invalid.
20303  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20304 #  define BITS LDBL_MANT_DIG
20305 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20306 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20307  * reason e.g. Irix thinks 107.  But in any case, we want only
20308  * the number of real bits, the implicit bits are of no interest.  */
20309 #  define BITS 2 * (DBL_MANT_DIG - 1)
20310 # else
20311 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20312 # endif
20313 #endif
20314 #include <stdio.h>
20315 int main(int argc, char *argv[]) {
20316 #ifdef BITS
20317   printf("%d\n", BITS);
20318 #endif
20319   return 0;
20320 }
20321 EOP
20322 set try
20323 if eval $compile; then
20324     longdblmantbits=`$run ./try`
20325 else
20326     longdblmantbits="$undef"
20327 fi
20328 $rm_try
20329
20330 : Check the length of the NV mantissa
20331 $echo "Checking how many mantissa bits your NVs have..." >&4
20332 if test "X$usequadmath" = "X$define"; then
20333   nvmantbits=112 # 128-1-15
20334 else
20335   if test "X$nvsize" = "X$doublesize"; then
20336     nvmantbits="$doublemantbits"
20337   else
20338      if test "X$nvsize" = "X$longdblsize"; then
20339        nvmantbits="$longdblmantbits"
20340      else
20341        nvmantbits="$undef"
20342      fi
20343   fi
20344 fi
20345
20346 : How can we generate normalized random numbers ?
20347 echo " "
20348 echo "Using our internal random number implementation..." >&4
20349
20350 case "$ccflags" in
20351 *-Dmy_rand=*|*-Dmy_srand=*)
20352         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20353         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20354         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20355         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20356         ;;
20357 esac
20358
20359 randfunc=Perl_drand48
20360 drand01="Perl_drand48()"
20361 seedfunc="Perl_drand48_init"
20362 randbits=48
20363 randseedtype=U32
20364
20365 : Probe whether dtrace builds an object, as newer Illumos requires an input
20366 : object file that uses at least one of the probes defined in the .d file
20367 case "$usedtrace" in
20368 $define)
20369     case "$dtracexnolibs" in
20370     $define|true|[yY]*)
20371         dtracexnolibs=$define
20372         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20373         ;;
20374     ' '|'')
20375         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20376              dtracexnolibs=$define
20377              echo "Your dtrace accepts -xnolibs"
20378         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20379              dtracexnolibs=$undef
20380              echo "Your dtrace doesn't accept -xnolibs"
20381         else
20382              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20383              exit 1
20384         fi
20385         ;;
20386     *)
20387         dtracexnolibs=$undef
20388         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20389         ;;
20390     esac
20391     case $dtracexnolibs in
20392     $define) xnolibs=-xnolibs ;;
20393     *) xnolibs= ;;
20394     esac
20395
20396     case "$dtraceobject" in
20397     $define|true|[yY]*)
20398         dtraceobject=$define
20399         ;;
20400     ' '|'')
20401         $cat >try.c <<EOM
20402 #include "perldtrace.h"
20403 int main(void) {
20404     PERL_LOADED_FILE("dummy");
20405     return 0;
20406 }
20407 EOM
20408         dtraceobject=$undef
20409         if $cc -c -o try.o $optimize $ccflags try.c \
20410                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20411                 dtraceobject=$define
20412             echo "Your dtrace builds an object file"
20413         fi
20414         ;;
20415     *) dtraceobject=$undef ;;
20416     esac
20417     $rm_try perldtrace.o perldtrace.h
20418 esac
20419
20420 : Determine if this is an EBCDIC system
20421 echo " "
20422 echo "Determining whether or not we are on an EBCDIC system..." >&4
20423 $cat >try.c <<'EOM'
20424 int main()
20425 {
20426   if ('M'==0xd4) return 0;
20427   return 1;
20428 }
20429 EOM
20430
20431 val=$undef
20432 set try
20433 if eval $compile_ok; then
20434         if $run ./try; then
20435                 echo "You seem to speak EBCDIC." >&4
20436                 val="$define"
20437         else
20438                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20439         fi
20440 else
20441         echo "I'm unable to compile the test program." >&4
20442         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20443 fi
20444 $rm_try
20445 set ebcdic
20446 eval $setvar
20447
20448 : Check how to flush
20449 echo " "
20450 $cat >&4 <<EOM
20451 Checking how to flush all pending stdio output...
20452 EOM
20453 # I only know how to find the first 32 possibly open files on SunOS.
20454 # See also hints/sunos_4_1.sh and util.c  --AD
20455 case "$osname" in
20456 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20457 esac
20458 $cat >>try.c <<EOCP
20459 #include <stdio.h>
20460 #$i_stdlib I_STDLIB
20461 #ifdef I_STDLIB
20462 #include <stdlib.h>
20463 #endif
20464 #$i_unistd I_UNISTD
20465 #ifdef I_UNISTD
20466 # include <unistd.h>
20467 #endif
20468 #$d_sysconf HAS_SYSCONF
20469 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20470 #ifdef HAS_STDIO_STREAM_ARRAY
20471 # define STDIO_STREAM_ARRAY $stdio_stream_array
20472 #endif
20473 int main() {
20474   FILE* p;
20475   unlink("try.out");
20476   p = fopen("try.out", "w");
20477 #ifdef TRY_FPUTC
20478   fputc('x', p);
20479 #else
20480 # ifdef TRY_FPRINTF
20481   fprintf(p, "x");
20482 # endif
20483 #endif
20484 #ifdef TRY_FFLUSH_NULL
20485   fflush(NULL);
20486 #endif
20487 #ifdef TRY_FFLUSH_ALL
20488   {
20489     long open_max = -1;
20490 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20491     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20492 # else
20493 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20494     open_max = sysconf(_SC_OPEN_MAX);
20495 #  else
20496 #   ifdef FOPEN_MAX
20497     open_max = FOPEN_MAX;
20498 #   else
20499 #    ifdef OPEN_MAX
20500     open_max = OPEN_MAX;
20501 #    else
20502 #     ifdef _NFILE
20503     open_max = _NFILE;
20504 #     endif
20505 #    endif
20506 #   endif
20507 #  endif
20508 # endif
20509 # ifdef HAS_STDIO_STREAM_ARRAY
20510     if (open_max > 0) {
20511       long i;
20512       for (i = 0; i < open_max; i++)
20513             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20514                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20515                 STDIO_STREAM_ARRAY[i]._flag)
20516                 fflush(&STDIO_STREAM_ARRAY[i]);
20517     }
20518   }
20519 # endif
20520 #endif
20521   _exit(42);
20522 }
20523 EOCP
20524 : first we have to find out how _not_ to flush
20525 $to try.c
20526 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20527     output=''
20528     set try -DTRY_FPUTC
20529     if eval $compile; then
20530             $run ./try 2>/dev/null
20531             code="$?"
20532             $from try.out
20533             if $test ! -s try.out -a "X$code" = X42; then
20534                 output=-DTRY_FPUTC
20535             fi
20536     fi
20537     case "$output" in
20538     '')
20539             set try -DTRY_FPRINTF
20540             if eval $compile; then
20541                     $run ./try 2>/dev/null
20542                     code="$?"
20543                     $from try.out
20544                     if $test ! -s try.out -a "X$code" = X42; then
20545                         output=-DTRY_FPRINTF
20546                     fi
20547             fi
20548         ;;
20549     esac
20550 fi
20551 : check for fflush NULL behavior
20552 case "$fflushNULL" in
20553 '')     set try -DTRY_FFLUSH_NULL $output
20554         if eval $compile; then
20555                 $run ./try 2>/dev/null
20556                 code="$?"
20557                 $from try.out
20558                 if $test -s try.out -a "X$code" = X42; then
20559                         fflushNULL="`$cat try.out`"
20560                 else
20561                         if $test "X$code" != X42; then
20562                                 $cat >&4 <<EOM
20563 (If this test failed, don't worry, we'll try another method shortly.)
20564 EOM
20565                         fi
20566                 fi
20567         fi
20568         $rm -f core try.core core.try.*
20569         case "$fflushNULL" in
20570         x)      $cat >&4 <<EOM
20571 Your fflush(NULL) works okay for output streams.
20572 Let's see if it clobbers input pipes...
20573 EOM
20574 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20575 # bug that improperly flushes the input end of pipes.  So we avoid the
20576 # autoflush on fork/system/exec support for now. :-(
20577 $cat >tryp.c <<EOCP
20578 #include <stdio.h>
20579 int
20580 main(int argc, char **argv)
20581 {
20582     char buf[1024];
20583     int i;
20584     char *bp = buf;
20585     while (1) {
20586         while ((i = getc(stdin)) != -1
20587                && (*bp++ = i) != '\n'
20588                && bp < &buf[1024])
20589         /* DO NOTHING */ ;
20590         *bp = '\0';
20591         fprintf(stdout, "%s", buf);
20592         fflush(NULL);
20593         if (i == -1)
20594             return 0;
20595         bp = buf;
20596     }
20597 }
20598 EOCP
20599                 fflushNULL="$define"
20600                 set tryp
20601                 if eval $compile; then
20602                     $rm -f tryp.out
20603                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20604                     if $test "X$targethost" != X; then
20605                         $to tryp.c
20606                         $to tryp
20607                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20608                     else
20609                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20610                     fi
20611                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20612                        $cat >&4 <<EOM
20613 fflush(NULL) seems to behave okay with input streams.
20614 EOM
20615                         fflushNULL="$define"
20616                     else
20617                         $cat >&4 <<EOM
20618 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20619 EOM
20620                         fflushNULL="$undef"
20621                     fi
20622                 fi
20623                 $rm -f core tryp.c tryp.core core.tryp.*
20624                 ;;
20625         '')     $cat >&4 <<EOM
20626 Your fflush(NULL) isn't working (contrary to ANSI C).
20627 EOM
20628                 fflushNULL="$undef"
20629                 ;;
20630         *)      $cat >&4 <<EOM
20631 Cannot figure out whether your fflush(NULL) works or not.
20632 I'm assuming it doesn't (contrary to ANSI C).
20633 EOM
20634                 fflushNULL="$undef"
20635                 ;;
20636         esac
20637         ;;
20638 $define|true|[yY]*)
20639         fflushNULL="$define"
20640         ;;
20641 *)
20642         fflushNULL="$undef"
20643         ;;
20644 esac
20645 : check explicit looping only if NULL did not work, and if the pipe
20646 : bug does not show up on an explicit flush too
20647 case "$fflushNULL" in
20648 "$undef")
20649         $cat >tryp.c <<EOCP
20650 #include <stdio.h>
20651 int
20652 main(int argc, char **argv)
20653 {
20654     char buf[1024];
20655     int i;
20656     char *bp = buf;
20657     while (1) {
20658         while ((i = getc(stdin)) != -1
20659                && (*bp++ = i) != '\n'
20660                && bp < &buf[1024])
20661         /* DO NOTHING */ ;
20662         *bp = '\0';
20663         fprintf(stdout, "%s", buf);
20664         fflush(stdin);
20665         if (i == -1)
20666             return 0;
20667         bp = buf;
20668     }
20669 }
20670 EOCP
20671         set tryp
20672         if eval $compile; then
20673             $rm -f tryp.out
20674             if $test "X$targethost" != X; then
20675                 $to tryp.c
20676                 $to tryp
20677                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20678             else
20679                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20680             fi
20681             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20682                $cat >&4 <<EOM
20683 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20684 EOM
20685                 : now check for fflushall behaviour
20686                 case "$fflushall" in
20687                 '')     set try -DTRY_FFLUSH_ALL $output
20688                         if eval $compile; then
20689                                 $cat >&4 <<EOM
20690 (Now testing the other method--but note that this also may fail.)
20691 EOM
20692                                 $run ./try 2>/dev/null
20693                                 code=$?
20694                                 $from try.out
20695                                 if $test -s try.out -a "X$code" = X42; then
20696                                         fflushall="`$cat try.out`"
20697                                 fi
20698                         fi
20699                         $rm_try
20700                         case "$fflushall" in
20701                         x)      $cat >&4 <<EOM
20702 Whew. Flushing explicitly all the stdio streams works.
20703 EOM
20704                                 fflushall="$define"
20705                                 ;;
20706                         '')     $cat >&4 <<EOM
20707 Sigh. Flushing explicitly all the stdio streams doesn't work.
20708 EOM
20709                                 fflushall="$undef"
20710                                 ;;
20711                         *)      $cat >&4 <<EOM
20712 Cannot figure out whether flushing stdio streams explicitly works or not.
20713 I'm assuming it doesn't.
20714 EOM
20715                                 fflushall="$undef"
20716                                 ;;
20717                         esac
20718                         ;;
20719                 "$define"|true|[yY]*)
20720                         fflushall="$define"
20721                         ;;
20722                 *)
20723                         fflushall="$undef"
20724                         ;;
20725                 esac
20726             else
20727                 $cat >&4 <<EOM
20728 All is futile.  Even fflush(stdin) clobbers input pipes!
20729 EOM
20730                 fflushall="$undef"
20731             fi
20732         else
20733             fflushall="$undef"
20734         fi
20735         $rm -f core tryp.c tryp.core core.tryp.*
20736         ;;
20737 *)      fflushall="$undef"
20738         ;;
20739 esac
20740
20741 case "$fflushNULL$fflushall" in
20742 undefundef)
20743         $cat <<EOM
20744 OK, I give up.  I cannot figure out how to flush pending stdio output.
20745 We won't be flushing handles at all before fork/exec/popen.
20746 EOM
20747         ;;
20748 esac
20749 $rm_try tryp
20750
20751 : Store the full pathname to the ar program for use in the C program
20752 : Respect a hint or command line value for full_ar.
20753 case "$full_ar" in
20754 '') full_ar=$ar ;;
20755 esac
20756
20757 : Store the full pathname to the sed program for use in the C program
20758 full_sed=$sed
20759
20760 : see what type gids are declared as in the kernel
20761 echo " "
20762 echo "Looking for the type for group ids returned by getgid()."
20763 set gid_t gidtype xxx stdio.h sys/types.h
20764 eval $typedef
20765 case "$gidtype" in
20766 xxx)
20767         xxx=`./findhdr sys/user.h`
20768         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20769         case $1 in
20770         unsigned) dflt="$1 $2" ;;
20771         *) dflt="$1" ;;
20772         esac
20773         ;;
20774 *) dflt="$gidtype";;
20775 esac
20776 case "$gidtype" in
20777 gid_t) echo "gid_t found." ;;
20778 *)      rp="What is the type for group ids returned by getgid()?"
20779         . ./myread
20780         gidtype="$ans"
20781         ;;
20782 esac
20783
20784 : Check the size of GID
20785 echo " "
20786 case "$gidtype" in
20787 *_t) zzz="$gidtype"     ;;
20788 *)   zzz="gid"          ;;
20789 esac
20790 echo "Checking the size of $zzz..." >&4
20791 cat > try.c <<EOCP
20792 #include <sys/types.h>
20793 #include <stdio.h>
20794 #$i_stdlib I_STDLIB
20795 #ifdef I_STDLIB
20796 #include <stdlib.h>
20797 #endif
20798 int main() {
20799     printf("%d\n", (int)sizeof($gidtype));
20800     exit(0);
20801 }
20802 EOCP
20803 set try
20804 if eval $compile_ok; then
20805         yyy=`$run ./try`
20806         case "$yyy" in
20807         '')     gidsize=4
20808                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20809                 ;;
20810         *)      gidsize=$yyy
20811                 echo "Your $zzz is $gidsize bytes long."
20812                 ;;
20813         esac
20814 else
20815         gidsize=4
20816         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20817 fi
20818
20819 : Check if GID is signed
20820 echo " "
20821 case "$gidtype" in
20822 *_t) zzz="$gidtype"     ;;
20823 *)   zzz="gid"          ;;
20824 esac
20825 echo "Checking the sign of $zzz..." >&4
20826 cat > try.c <<EOCP
20827 #include <sys/types.h>
20828 #include <stdio.h>
20829 int main() {
20830         $gidtype foo = -1;
20831         if (foo < 0)
20832                 printf("-1\n");
20833         else
20834                 printf("1\n");
20835 }
20836 EOCP
20837 set try
20838 if eval $compile; then
20839         yyy=`$run ./try`
20840         case "$yyy" in
20841         '')     gidsign=1
20842                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20843                 ;;
20844         *)      gidsign=$yyy
20845                 case "$gidsign" in
20846                  1) echo "Your $zzz is unsigned." ;;
20847                 -1) echo "Your $zzz is signed."   ;;
20848                 esac
20849                 ;;
20850         esac
20851 else
20852         gidsign=1
20853         echo "(I can't compile the test program--guessing unsigned.)" >&4
20854 fi
20855
20856 : Check 64bit sizes
20857 echo " "
20858
20859 if $test X"$quadtype" != X; then
20860
20861 echo "Checking how to print 64-bit integers..." >&4
20862
20863 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20864         $cat >try.c <<'EOCP'
20865 #include <sys/types.h>
20866 #include <stdio.h>
20867 int main() {
20868   int q = 12345678901;
20869   printf("%ld\n", q);
20870 }
20871 EOCP
20872         set try
20873         if eval $compile; then
20874                 yyy=`$run ./try`
20875                 case "$yyy" in
20876                 12345678901)
20877                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20878                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20879                         echo "We will use %d."
20880                         ;;
20881                 esac
20882         fi
20883 fi
20884
20885 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20886         $cat >try.c <<'EOCP'
20887 #include <sys/types.h>
20888 #include <stdio.h>
20889 int main() {
20890   long q = 12345678901;
20891   printf("%ld\n", q);
20892 }
20893 EOCP
20894         set try
20895         if eval $compile; then
20896                 yyy=`$run ./try`
20897                 case "$yyy" in
20898                 12345678901)
20899                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20900                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20901                         echo "We will use %ld."
20902                         ;;
20903                 esac
20904         fi
20905 fi
20906
20907 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20908         $cat >try.c <<'EOCP'
20909 #include <sys/types.h>
20910 #include <inttypes.h>
20911 #include <stdio.h>
20912 int main() {
20913   int64_t q = 12345678901;
20914   printf("%" PRId64 "\n", q);
20915 }
20916 EOCP
20917         set try
20918         if eval $compile; then
20919                 yyy=`$run ./try`
20920                 case "$yyy" in
20921                 12345678901)
20922                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20923                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20924                         echo "We will use the C9X style."
20925                         ;;
20926                 esac
20927         fi
20928 fi
20929
20930 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20931         $cat >try.c <<EOCP
20932 #include <sys/types.h>
20933 #include <stdio.h>
20934 int main() {
20935   $quadtype q = 12345678901;
20936   printf("%Ld\n", q);
20937 }
20938 EOCP
20939         set try
20940         if eval $compile; then
20941                 yyy=`$run ./try`
20942                 case "$yyy" in
20943                 12345678901)
20944                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20945                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20946                         echo "We will use %Ld."
20947                         ;;
20948                 esac
20949         fi
20950 fi
20951
20952 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20953         $cat >try.c <<'EOCP'
20954 #include <sys/types.h>
20955 #include <stdio.h>
20956 int main() {
20957   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20958   printf("%lld\n", q);
20959 }
20960 EOCP
20961         set try
20962         if eval $compile; then
20963                 yyy=`$run ./try`
20964                 case "$yyy" in
20965                 12345678901)
20966                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20967                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20968                         echo "We will use the %lld style."
20969                         ;;
20970                 esac
20971         fi
20972 fi
20973
20974 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20975         $cat >try.c <<EOCP
20976 #include <sys/types.h>
20977 #include <stdio.h>
20978 int main() {
20979   $quadtype q = 12345678901;
20980   printf("%qd\n", q);
20981 }
20982 EOCP
20983         set try
20984         if eval $compile; then
20985                 yyy=`$run ./try`
20986                 case "$yyy" in
20987                 12345678901)
20988                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20989                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20990                         echo "We will use %qd."
20991                         ;;
20992                 esac
20993         fi
20994 fi
20995
20996 if $test X"$sPRId64" = X; then
20997         echo "Cannot figure out how to print 64-bit integers." >&4
20998 fi
20999 $rm_try
21000
21001 fi
21002
21003 case "$sPRId64" in
21004 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21005         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21006         ;;
21007 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21008         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21009         ;;
21010 esac
21011
21012 : Check format strings for internal types
21013 echo " "
21014 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21015
21016 if $test X"$ivsize" = X8; then
21017         ivdformat="$sPRId64"
21018         uvuformat="$sPRIu64"
21019         uvoformat="$sPRIo64"
21020         uvxformat="$sPRIx64"
21021         uvXUformat="$sPRIXU64"
21022 else
21023         if $test X"$ivsize" = X"$longsize"; then
21024                 ivdformat='"ld"'
21025                 uvuformat='"lu"'
21026                 uvoformat='"lo"'
21027                 uvxformat='"lx"'
21028                 uvXUformat='"lX"'
21029         else
21030                 if $test X"$ivsize" = X"$intsize"; then
21031                         ivdformat='"d"'
21032                         uvuformat='"u"'
21033                         uvoformat='"o"'
21034                         uvxformat='"x"'
21035                         uvXUformat='"X"'
21036                 else
21037                         : far out
21038                         if $test X"$ivsize" = X"$shortsize"; then
21039                                 ivdformat='"hd"'
21040                                 uvuformat='"hu"'
21041                                 uvoformat='"ho"'
21042                                 uvxformat='"hx"'
21043                                 uvXUformat='"hX"'
21044                         fi
21045                 fi
21046         fi
21047 fi
21048
21049 if $test X"$usequadmath" = X"$define"; then
21050     nveformat='"Qe"'
21051     nvfformat='"Qf"'
21052     nvgformat='"Qg"'
21053     nvEUformat='"QE"'
21054     nvFUformat='"QF"'
21055     nvGUformat='"QG"'
21056 else
21057     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21058         nveformat="$sPRIeldbl"
21059         nvfformat="$sPRIfldbl"
21060         nvgformat="$sPRIgldbl"
21061         nvEUformat="$sPRIEUldbl"
21062         nvFUformat="$sPRIFUldbl"
21063         nvGUformat="$sPRIGUldbl"
21064     else
21065         nveformat='"e"'
21066         nvfformat='"f"'
21067         nvgformat='"g"'
21068         nvEUformat='"E"'
21069         nvFUformat='"F"'
21070         nvGUformat='"G"'
21071     fi
21072 fi
21073
21074 case "$ivdformat" in
21075 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21076     exit 1
21077     ;;
21078 esac
21079
21080 : Check format string for GID
21081
21082 echo " "
21083 $echo "Checking the format string to be used for gids..." >&4
21084
21085 case "$gidsign" in
21086 -1)     if $test X"$gidsize" = X"$ivsize"; then
21087                 gidformat="$ivdformat"
21088         else
21089                 if $test X"$gidsize" = X"$longsize"; then
21090                         gidformat='"ld"'
21091                 else
21092                         if $test X"$gidsize" = X"$intsize"; then
21093                                 gidformat='"d"'
21094                         else
21095                                 if $test X"$gidsize" = X"$shortsize"; then
21096                                         gidformat='"hd"'
21097                                 fi
21098                         fi
21099                 fi
21100         fi
21101         ;;
21102 *)      if $test X"$gidsize" = X"$uvsize"; then
21103                 gidformat="$uvuformat"
21104         else
21105                 if $test X"$gidsize" = X"$longsize"; then
21106                         gidformat='"lu"'
21107                 else
21108                         if $test X"$gidsize" = X"$intsize"; then
21109                                 gidformat='"u"'
21110                         else
21111                                 if $test X"$gidsize" = X"$shortsize"; then
21112                                         gidformat='"hu"'
21113                                 fi
21114                         fi
21115                 fi
21116         fi
21117         ;;
21118 esac
21119
21120 : see if getgroups exists
21121 set getgroups d_getgrps
21122 eval $inlibc
21123
21124 : see if setgroups exists
21125 set setgroups d_setgrps
21126 eval $inlibc
21127
21128 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21129 echo " "
21130 case "$d_getgrps$d_setgrps" in
21131 *define*)
21132         case "$groupstype" in
21133         '') dflt="$gidtype" ;;
21134         *)  dflt="$groupstype" ;;
21135         esac
21136         $cat <<EOM
21137 What type of pointer is the second argument to getgroups() and setgroups()?
21138 Usually this is the same as group ids, $gidtype, but not always.
21139
21140 EOM
21141         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21142         . ./myread
21143         groupstype="$ans"
21144         ;;
21145 *)  groupstype="$gidtype";;
21146 esac
21147
21148 : check whether make sets MAKE
21149 echo " "
21150 echo "Checking if your $make program sets \$(MAKE)..." >&4
21151 case "$make_set_make" in
21152 '')
21153         $sed 's/^X //' > testmake.mak << 'EOF'
21154 Xall:
21155 X       @echo 'maketemp="$(MAKE)"'
21156 EOF
21157         case "`$make -f testmake.mak 2>/dev/null`" in
21158         *maketemp=*) make_set_make='#' ;;
21159         *)      make_set_make="MAKE=$make" ;;
21160         esac
21161         $rm -f testmake.mak
21162         ;;
21163 esac
21164 case "$make_set_make" in
21165 '#') echo "Yup, it does.";;
21166 *) echo "Nope, it doesn't.";;
21167 esac
21168
21169 : see what type is used for mode_t
21170 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21171 set mode_t modetype int stdio.h sys/types.h
21172 eval $typedef_ask
21173
21174 : see if we need va_copy
21175 echo " "
21176 $cat >try.c <<EOCP
21177 #include <stdarg.h>
21178 #include <stdio.h>
21179 #include <stdlib.h>
21180 #include <signal.h>
21181
21182 int
21183 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21184 {
21185   return vfprintf(f, fmt, *valp);
21186 }
21187
21188 int
21189 myvfprintf(FILE *f, const  char *fmt, va_list val)
21190 {
21191   return ivfprintf(f, fmt, &val);
21192 }
21193
21194 int
21195 myprintf(char *fmt, ...)
21196 {
21197   va_list val;
21198   va_start(val, fmt);
21199   return myvfprintf(stdout, fmt, val);
21200 }
21201
21202 int
21203 main(int ac, char **av)
21204 {
21205   signal(SIGSEGV, exit);
21206
21207   myprintf("%s%cs all right, then\n", "that", '\'');
21208   exit(0);
21209 }
21210 EOCP
21211 set try
21212 if eval $compile && $run ./try 2>&1 >/dev/null; then
21213         case "`$run ./try`" in
21214         "that's all right, then")
21215                 okay=yes
21216                 ;;
21217         esac
21218 fi
21219 case "$okay" in
21220 yes)    echo "It seems that you don't need va_copy()." >&4
21221         need_va_copy="$undef"
21222         ;;
21223 *)      echo "It seems that va_copy() or similar will be needed." >&4
21224         need_va_copy="$define"
21225         ;;
21226 esac
21227 $rm_try
21228
21229 : see what type is used for size_t
21230 rp="What is the type used for the length parameter for string functions?"
21231 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21232 eval $typedef_ask
21233
21234 : check for type of arguments to gethostbyaddr.
21235 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21236         case "$d_gethbyaddr" in
21237         $define)
21238                 $cat <<EOM
21239
21240 Checking to see what type of arguments are accepted by gethostbyaddr().
21241 EOM
21242                 hdrs="$define sys/types.h
21243                         $d_socket sys/socket.h
21244                         $i_niin netinet/in.h
21245                         $i_netdb netdb.h
21246                         $i_unistd unistd.h"
21247                 : The first arg can 'char *' or 'void *'
21248                 : The second arg is some of integral type
21249                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21250                         for yyy in size_t long int; do
21251                                 case "$netdb_host_type" in
21252                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21253                                         if ./protochk "$try" $hdrs; then
21254                                                 echo "Your system accepts $xxx for the first arg."
21255                                                 echo "...and $yyy for the second arg."
21256                                                 netdb_host_type="$xxx"
21257                                                 netdb_hlen_type="$yyy"
21258                                         fi
21259                                         ;;
21260                                 esac
21261                         done
21262                 done
21263                 : In case none of those worked, prompt the user.
21264                 case "$netdb_host_type" in
21265                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21266                         dflt='char *'
21267                         . ./myread
21268                         netdb_host_type=$ans
21269                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21270                         dflt="$sizetype"
21271                         . ./myread
21272                         netdb_hlen_type=$ans
21273                         ;;
21274                 esac
21275                 ;;
21276         *)      : no gethostbyaddr, so pick harmless defaults
21277                 netdb_host_type='char *'
21278                 netdb_hlen_type="$sizetype"
21279                 ;;
21280         esac
21281         # Remove the "const" if needed. -- but then we'll have a
21282         # prototype clash!
21283         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21284 fi
21285
21286 : check for type of argument to gethostbyname.
21287 if test "X$netdb_name_type" = X ; then
21288         case "$d_gethbyname" in
21289         $define)
21290                 $cat <<EOM
21291
21292 Checking to see what type of argument is accepted by gethostbyname().
21293 EOM
21294                 hdrs="$define sys/types.h
21295                         $d_socket sys/socket.h
21296                         $i_niin netinet/in.h
21297                         $i_netdb netdb.h
21298                         $i_unistd unistd.h"
21299                 for xxx in "const char *" "char *"; do
21300                         case "$netdb_name_type" in
21301                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21302                                 if ./protochk "$try" $hdrs; then
21303                                         echo "Your system accepts $xxx."
21304                                         netdb_name_type="$xxx"
21305                                 fi
21306                                 ;;
21307                         esac
21308                 done
21309                 : In case none of those worked, prompt the user.
21310                 case "$netdb_name_type" in
21311                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21312                         dflt='char *'
21313                         . ./myread
21314                         netdb_name_type=$ans
21315                         ;;
21316                 esac
21317                 ;;
21318         *)      : no gethostbyname, so pick harmless default
21319                 netdb_name_type='char *'
21320                 ;;
21321         esac
21322 fi
21323
21324 : check for type of 1st argument to getnetbyaddr.
21325 if test "X$netdb_net_type" = X ; then
21326         case "$d_getnbyaddr" in
21327         $define)
21328                 $cat <<EOM
21329
21330 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21331 EOM
21332                 hdrs="$define sys/types.h
21333                         $d_socket sys/socket.h
21334                         $i_niin netinet/in.h
21335                         $i_netdb netdb.h
21336                         $i_unistd unistd.h"
21337                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21338                         case "$netdb_net_type" in
21339                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21340                                 if ./protochk "$try" $hdrs; then
21341                                         echo "Your system accepts $xxx."
21342                                         netdb_net_type="$xxx"
21343                                 fi
21344                                 ;;
21345                         esac
21346                 done
21347                 : In case none of those worked, prompt the user.
21348                 case "$netdb_net_type" in
21349                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21350                         dflt='long'
21351                         . ./myread
21352                         netdb_net_type=$ans
21353                         ;;
21354                 esac
21355                 ;;
21356         *)      : no getnetbyaddr, so pick harmless default
21357                 netdb_net_type='long'
21358                 ;;
21359         esac
21360 fi
21361 : locate the preferred pager for this system
21362 fn=f/
21363 case "$pager" in
21364 '')
21365         dflt=''
21366         case "$pg" in
21367         /*) dflt=$pg;;
21368         [a-zA-Z]:/*) dflt=$pg;;
21369         esac
21370         case "$more" in
21371         /*) dflt=$more;;
21372         [a-zA-Z]:/*) dflt=$more;;
21373         esac
21374         case "$less" in
21375         /*) dflt=$less;;
21376         [a-zA-Z]:/*) dflt=$less;;
21377         esac
21378         case "$dflt" in
21379         '') dflt=/usr/ucb/more;;
21380         esac
21381         ;;
21382 *)      dflt="$pager"
21383         ;;
21384 esac
21385 fn="f/($dflt)"
21386 echo " "
21387 rp='What pager is used on your system?'
21388 . ./getfile
21389 pager="$ans"
21390
21391 : see if ar generates random libraries by itself
21392 echo " "
21393 echo "Checking how to generate random libraries on your machine..." >&4
21394 echo 'int bar1() { return bar2(); }' > bar1.c
21395 echo 'int bar2() { return 2; }' > bar2.c
21396 $cat > foo.c <<EOP
21397 #$i_stdlib I_STDLIB
21398 #ifdef I_STDLIB
21399 #include <stdlib.h>
21400 #endif
21401 int main() { printf("%d\n", bar1()); exit(0); }
21402 EOP
21403 $cc $ccflags -c bar1.c >/dev/null 2>&1
21404 $cc $ccflags -c bar2.c >/dev/null 2>&1
21405 $cc $ccflags -c foo.c >/dev/null 2>&1
21406 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21407 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21408         $run ./foobar >/dev/null 2>&1; then
21409         echo "$ar appears to generate random libraries itself."
21410         orderlib=false
21411         if [ "X$ranlib" = "X" ]; then
21412             ranlib=":"
21413         fi
21414 elif $ar s bar$_a >/dev/null 2>&1 &&
21415         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21416         $run ./foobar >/dev/null 2>&1; then
21417                 echo "a table of contents needs to be added with '$ar s'."
21418                 orderlib=false
21419                 ranlib="$ar s"
21420 elif $ar ts bar$_a >/dev/null 2>&1 &&
21421         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21422         $run ./foobar >/dev/null 2>&1; then
21423                 echo "a table of contents needs to be added with '$ar ts'."
21424                 orderlib=false
21425                 ranlib="$ar ts"
21426 else
21427         case "$ranlib" in
21428         :) ranlib='';;
21429         '')
21430                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21431                 $test -f $ranlib || ranlib=''
21432                 ;;
21433         esac
21434         if $test -n "$ranlib"; then
21435                 echo "your system has '$ranlib'; we'll use that."
21436                 orderlib=false
21437         else
21438                 echo "your system doesn't seem to support random libraries"
21439                 echo "so we'll use lorder and tsort to order the libraries."
21440                 orderlib=true
21441                 ranlib=":"
21442         fi
21443 fi
21444 $rm -f foo* bar*
21445
21446 : Check the max offset that gmtime and localtime accept
21447 echo "Checking max offsets that gmtime () accepts"
21448
21449 case "$sGMTIME_min/$sGMTIME_max" in
21450     0/0|/)
21451         $cat >try.c <<EOCP
21452 #include <sys/types.h>
21453 #include <stdio.h>
21454 #include <time.h>
21455
21456 int i;
21457 struct tm *tmp;
21458 time_t pt;
21459
21460 void gm_check (time_t t, int min_year, int max_year)
21461 {
21462     tmp = gmtime (&t);
21463     if ( tmp == NULL ||
21464         /* Check tm_year overflow */
21465          tmp->tm_year < min_year || tmp->tm_year > max_year)
21466         tmp = NULL;
21467     else
21468         pt = t;
21469     } /* gm_check */
21470
21471 int check_max ()
21472 {
21473     tmp = NULL;
21474     pt  = 0;
21475 #ifdef MAXLONG
21476     gm_check (MAXLONG, 69, 0x7fffffff);
21477 #endif
21478     if (tmp == NULL || tmp->tm_year < 0) {
21479         for (i = 63; i >= 0; i--) {
21480             time_t x = pt | ((time_t)1 << i);
21481             if (x < 0 || x < pt) continue;
21482             gm_check (x, 69, 0x7fffffff);
21483             }
21484         }
21485     printf ("sGMTIME_max=%ld\n", pt);
21486     return (0);
21487     } /* check_max */
21488
21489 int check_min ()
21490 {
21491     tmp = NULL;
21492     pt  = 0;
21493 #ifdef MINLONG
21494     gm_check (MINLONG, -1900, 70);
21495 #endif
21496     if (tmp == NULL) {
21497         for (i = 36; i >= 0; i--) {
21498             time_t x = pt - ((time_t)1 << i);
21499             if (x > 0) continue;
21500             gm_check (x, -1900, 70);
21501             }
21502         }
21503     printf ("sGMTIME_min=%ld\n", pt);
21504     return (0);
21505     } /* check_min */
21506
21507 int main (int argc, char *argv[])
21508 {
21509     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21510     check_max ();
21511     check_min ();
21512     return (0);
21513     } /* main */
21514 EOCP
21515         set try
21516         if eval $compile; then
21517             eval `$run ./try 2>/dev/null`
21518         else
21519             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21520             fi
21521         $rm_try
21522         ;;
21523     esac
21524
21525 echo "Checking max offsets that localtime () accepts"
21526
21527 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21528     0/0|/)
21529         $cat >try.c <<EOCP
21530 #include <sys/types.h>
21531 #include <stdio.h>
21532 #include <time.h>
21533
21534 int i;
21535 struct tm *tmp;
21536 time_t pt;
21537
21538 void local_check (time_t t, int min_year, int max_year)
21539 {
21540     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21541         tmp = NULL;
21542     else
21543         tmp = localtime (&t);
21544     if ( tmp == NULL ||
21545         /* Check tm_year overflow */
21546          tmp->tm_year < min_year || tmp->tm_year > max_year)
21547         tmp = NULL;
21548     else
21549         pt = t;
21550     } /* local_check */
21551
21552 int check_max ()
21553 {
21554     tmp = NULL;
21555     pt  = 0;
21556 #ifdef MAXLONG
21557     local_check (MAXLONG, 69, 0x7fffffff);
21558 #endif
21559     if (tmp == NULL || tmp->tm_year < 0) {
21560         for (i = 63; i >= 0; i--) {
21561             time_t x = pt | ((time_t)1 << i);
21562             if (x < 0 || x < pt) continue;
21563             local_check (x, 69, 0x7fffffff);
21564             }
21565         }
21566     printf ("sLOCALTIME_max=%ld\n", pt);
21567     return (0);
21568    } /* check_max */
21569
21570 int check_min ()
21571 {
21572     tmp = NULL;
21573     pt  = 0;
21574 #ifdef MINLONG
21575     local_check (MINLONG, -1900, 70);
21576 #endif
21577     if (tmp == NULL) {
21578         for (i = 36; i >= 0; i--) {
21579             time_t x = pt - ((time_t)1 << i);
21580             if (x > 0) continue;
21581             local_check (x, -1900, 70);
21582             }
21583         }
21584     printf ("sLOCALTIME_min=%ld\n", pt);
21585     return (0);
21586     } /* check_min */
21587
21588 int main (int argc, char *argv[])
21589 {
21590     check_max ();
21591     check_min ();
21592     return (0);
21593     } /* main */
21594 EOCP
21595         set try
21596         if eval $compile; then
21597             eval `$run ./try 2>/dev/null`
21598         else
21599             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21600             fi
21601         $rm_try
21602         ;;
21603     esac
21604
21605 : check for type of arguments to select.
21606 case "$selecttype" in
21607 '') case "$d_select" in
21608         $define)
21609                 echo " "
21610                 $cat <<EOM
21611 Checking to see what type of arguments are accepted by select().
21612 EOM
21613                 hdrs="$define sys/types.h
21614                         $i_systime sys/time.h
21615                         $i_sysselct sys/select.h
21616                         $d_socket sys/socket.h"
21617                 : The first arg can be int, unsigned, or size_t
21618                 : The last arg may or may not be 'const'
21619                 val=''
21620                 : void pointer has been seen but using that
21621                 : breaks the selectminbits test
21622                 for xxx in 'fd_set *' 'int *'; do
21623                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21624                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21625                                         case "$val" in
21626                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21627                                                 if ./protochk "$try" $hdrs; then
21628                                                         echo "Your system accepts $xxx."
21629                                                         val="$xxx"
21630                                                 fi
21631                                                 ;;
21632                                         esac
21633                                 done
21634                         done
21635                 done
21636                 case "$val" in
21637                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21638                         case "$d_fd_set" in
21639                                 $define) dflt="fd_set *" ;;
21640                                 *)              dflt="int *" ;;
21641                         esac
21642                         . ./myread
21643                         val=$ans
21644                         ;;
21645                 esac
21646                 selecttype="$val"
21647                 ;;
21648         *)      : no select, so pick a harmless default
21649                 selecttype='int *'
21650                 ;;
21651         esac
21652         ;;
21653 esac
21654
21655 : check for the select 'width'
21656 case "$selectminbits" in
21657 '') safebits=`expr $ptrsize \* 8`
21658     case "$d_select" in
21659         $define)
21660                 $cat <<EOM
21661
21662 Checking to see on how many bits at a time your select() operates...
21663 EOM
21664                 $cat >try.c <<EOCP
21665 #include <sys/types.h>
21666 #$i_time I_TIME
21667 #$i_systime I_SYS_TIME
21668 #$i_systimek I_SYS_TIME_KERNEL
21669 #ifdef I_TIME
21670 #   include <time.h>
21671 #endif
21672 #ifdef I_SYS_TIME
21673 #   ifdef I_SYS_TIME_KERNEL
21674 #       define KERNEL
21675 #   endif
21676 #   include <sys/time.h>
21677 #   ifdef I_SYS_TIME_KERNEL
21678 #       undef KERNEL
21679 #   endif
21680 #endif
21681 #$i_sysselct I_SYS_SELECT
21682 #ifdef I_SYS_SELECT
21683 #include <sys/select.h>
21684 #endif
21685 #$d_socket HAS_SOCKET
21686 #ifdef HAS_SOCKET
21687 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21688 #endif
21689 #include <stdio.h>
21690 #$i_stdlib I_STDLIB
21691 #ifdef I_STDLIB
21692 #include <stdlib.h>
21693 #endif
21694 $selecttype b;
21695 #define S sizeof(*(b))
21696 #define MINBITS 64
21697 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21698 #define NBITS  (NBYTES * 8)
21699 int main() {
21700     char *s = (char *)malloc(NBYTES);
21701     struct timeval t;
21702     int i;
21703     FILE* fp;
21704     int fd;
21705
21706     if (!s)
21707         exit(1);
21708     fclose(stdin);
21709     fp = fopen("try.c", "r");
21710     if (fp == 0)
21711       exit(2);
21712     fd = fileno(fp);
21713     if (fd < 0)
21714       exit(3);
21715     b = ($selecttype)s;
21716     for (i = 0; i < NBITS; i++)
21717         FD_SET(i, b);
21718     t.tv_sec  = 0;
21719     t.tv_usec = 0;
21720     select(fd + 1, b, 0, 0, &t);
21721     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21722     free(s);
21723     printf("%d\n", i + 1);
21724     return 0;
21725 }
21726 EOCP
21727                 set try
21728                 if eval $compile_ok; then
21729                         selectminbits=`$run ./try 2>/dev/null`
21730                         case "$selectminbits" in
21731                         '')     cat >&4 <<EOM
21732 Cannot figure out on how many bits at a time your select() operates.
21733 I'll play safe and guess it is $safebits bits.
21734 EOM
21735                                 selectminbits=$safebits
21736                                 bits="$safebits bits"
21737                                 ;;
21738                         1)      bits="1 bit" ;;
21739                         *)      bits="$selectminbits bits" ;;
21740                         esac
21741                         echo "Your select() operates on $bits at a time." >&4
21742                 else
21743                         rp='What is the minimum number of bits your select() operates on?'
21744                         case "$byteorder" in
21745                         12345678)       dflt=64 ;;
21746                         1234)           dflt=32 ;;
21747                         *)              dflt=1  ;;
21748                         esac
21749                         . ./myread
21750                         val=$ans
21751                         selectminbits="$val"
21752                 fi
21753                 $rm_try
21754                 ;;
21755         *)      : no select, so pick a harmless default
21756                 selectminbits=$safebits
21757                 ;;
21758         esac
21759         ;;
21760 esac
21761
21762 : Trace out the files included by signal.h, then look for SIGxxx names.
21763 case "$sig_num_init" in
21764 '')
21765 if [ "X$fieldn" = X ]; then
21766         : Just make some guesses.  We check them later.
21767         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21768 else
21769         xxx=`echo '#include <signal.h>' |
21770         $cppstdin $cppminus $cppflags 2>/dev/null |
21771         $grep '^[       ]*#.*include' |
21772         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21773                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21774 fi
21775 xxxfiles=''
21776 for xx in $xxx /dev/null ; do
21777         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21778 done
21779 case "$xxxfiles" in
21780 '')     xxxfiles=`./findhdr signal.h` ;;
21781 esac
21782 xxx=`awk '
21783 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21784         print substr($2, 4, 20)
21785 }
21786 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21787         print substr($3, 4, 20)
21788 }' $xxxfiles`
21789 : Append some common names just in case the awk scan failed.
21790 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21791 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21792 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21793 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21794 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21795
21796 : generate a few handy files for later
21797 $cat > signal.c <<EOCP
21798 #include <sys/types.h>
21799 #include <signal.h>
21800 #$i_stdlib I_STDLIB
21801 #ifdef I_STDLIB
21802 #include <stdlib.h>
21803 #endif
21804 #include <stdio.h>
21805 int main() {
21806
21807 /* Strange style to avoid deeply-nested #if/#else/#endif */
21808 #ifndef NSIG
21809 #  ifdef _NSIG
21810 #    define NSIG (_NSIG)
21811 #  endif
21812 #endif
21813
21814 #ifndef NSIG
21815 #  ifdef SIGMAX
21816 #    define NSIG (SIGMAX+1)
21817 #  endif
21818 #endif
21819
21820 #ifndef NSIG
21821 #  ifdef SIG_MAX
21822 #    define NSIG (SIG_MAX+1)
21823 #  endif
21824 #endif
21825
21826 #ifndef NSIG
21827 #  ifdef _SIG_MAX
21828 #    define NSIG (_SIG_MAX+1)
21829 #  endif
21830 #endif
21831
21832 #ifndef NSIG
21833 #  ifdef MAXSIG
21834 #    define NSIG (MAXSIG+1)
21835 #  endif
21836 #endif
21837
21838 #ifndef NSIG
21839 #  ifdef MAX_SIG
21840 #    define NSIG (MAX_SIG+1)
21841 #  endif
21842 #endif
21843
21844 #ifndef NSIG
21845 #  ifdef SIGARRAYSIZE
21846 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21847 #  endif
21848 #endif
21849
21850 #ifndef NSIG
21851 #  ifdef _sys_nsig
21852 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21853 #  endif
21854 #endif
21855
21856 /* Default to some arbitrary number that's big enough to get most
21857    of the common signals.
21858 */
21859 #ifndef NSIG
21860 #    define NSIG 50
21861 #endif
21862
21863 printf("NSIG %d\n", NSIG);
21864
21865 #ifndef JUST_NSIG
21866
21867 EOCP
21868
21869 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21870 {
21871         printf "#ifdef SIG"; printf $1; printf "\n"
21872         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21873         printf $1; printf ");\n"
21874         printf "#endif\n"
21875 }
21876 END {
21877         printf "#endif /* JUST_NSIG */\n";
21878         printf "exit(0);\n}\n";
21879 }
21880 ' >>signal.c
21881 $cat >signal.awk <<'EOP'
21882 BEGIN { ndups = 0 }
21883 $1 ~ /^NSIG$/ { nsig = $2 }
21884 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21885     if ($2 > maxsig) { maxsig = $2 }
21886     if (sig_name[$2]) {
21887         dup_name[ndups] = $1
21888         dup_num[ndups] = $2
21889         ndups++
21890     }
21891     else {
21892         sig_name[$2] = $1
21893         sig_num[$2] = $2
21894     }
21895 }
21896 END {
21897     if (nsig == 0) {
21898         nsig = maxsig + 1
21899     }
21900     printf("NSIG %d\n", nsig);
21901     for (n = 1; n < nsig; n++) {
21902         if (sig_name[n]) {
21903             printf("%s %d\n", sig_name[n], sig_num[n])
21904         }
21905         else {
21906             printf("NUM%d %d\n", n, n)
21907         }
21908     }
21909     for (n = 0; n < ndups; n++) {
21910         printf("%s %d\n", dup_name[n], dup_num[n])
21911     }
21912 }
21913 EOP
21914 $cat >signal_cmd <<EOS
21915 $startsh
21916 if $test -s signal.lst; then
21917     echo "Using your existing signal.lst file"
21918         exit 0
21919 fi
21920 xxx="$xxx"
21921 EOS
21922 $cat >>signal_cmd <<'EOS'
21923
21924 set signal
21925 if eval $compile_ok; then
21926         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21927                 $uniq | $awk -f signal.awk >signal.lst
21928 else
21929         echo "(I can't seem be able to compile the whole test program)" >&4
21930         echo "(I'll try it in little pieces.)" >&4
21931         set signal -DJUST_NSIG
21932         if eval $compile_ok; then
21933                 $run ./signal$_exe > signal.nsg
21934                 $cat signal.nsg
21935         else
21936                 echo "I can't seem to figure out how many signals you have." >&4
21937                 echo "Guessing 50." >&4
21938                 echo 'NSIG 50' > signal.nsg
21939         fi
21940         : Now look at all the signal names, one at a time.
21941         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21942                 $cat > signal.c <<EOCP
21943 #include <sys/types.h>
21944 #include <signal.h>
21945 #include <stdio.h>
21946 int main() {
21947 printf("$xx %d\n", SIG${xx});
21948 return 0;
21949 }
21950 EOCP
21951                 set signal
21952                 if eval $compile; then
21953                         echo "SIG${xx} found."
21954                         $run ./signal$_exe  >> signal.ls1
21955                 else
21956                         echo "SIG${xx} NOT found."
21957                 fi
21958         done
21959         if $test -s signal.ls1; then
21960                 $cat signal.nsg signal.ls1 |
21961                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21962         fi
21963
21964 fi
21965 if $test -s signal.lst; then
21966         :
21967 else
21968         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21969         echo 'kill -l' >signal
21970         set X `csh -f <signal`
21971         $rm -f signal
21972         shift
21973         case $# in
21974         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21975         esac
21976         echo $@ | $tr ' ' $trnl | \
21977             $awk '{ printf "%s %d\n", $1, ++s; }
21978                   END { printf "NSIG %d\n", ++s }' >signal.lst
21979 fi
21980 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21981 EOS
21982 chmod a+x signal_cmd
21983 $eunicefix signal_cmd
21984 ;;
21985 esac
21986
21987 : generate list of signal names
21988 case "$sig_num_init" in
21989 '')
21990 echo " "
21991 case "$sig_name_init" in
21992 '') doinit=yes ;;
21993 *)  case "$sig_num_init" in
21994     ''|*,*) doinit=yes ;;
21995     esac ;;
21996 esac
21997 case "$doinit" in
21998 yes)
21999         echo "Generating a list of signal names and numbers..." >&4
22000         . ./signal_cmd
22001         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22002         sig_name=`$awk 'BEGIN { printf "ZERO " }
22003                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22004         sig_num=`$awk  'BEGIN { printf "0 " }
22005                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22006         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22007                              !/^NSIG/   { printf "\"%s\", ", $1 }
22008                              END        { printf "0\n" }' signal.lst`
22009         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22010                              !/^NSIG/   { printf "%d, ", $2}
22011                              END        { printf "0\n"}' signal.lst`
22012         ;;
22013 esac
22014 echo "The following $sig_count signals are available:"
22015 echo " "
22016 echo $sig_name | $awk \
22017 'BEGIN { linelen = 0 }
22018 {
22019         for (i = 1; i <= NF; i++) {
22020                 name = "SIG" $i " "
22021                 linelen = linelen + length(name)
22022                 if (linelen > 70) {
22023                         printf "\n"
22024                         linelen = length(name)
22025                 }
22026                 printf "%s", name
22027         }
22028         printf "\n"
22029 }'
22030 sig_size=`echo $sig_name | awk '{print NF}'`
22031 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22032 ;;
22033 esac
22034
22035 : Check size of size
22036 echo " "
22037 case "$sizetype" in
22038 *_t) zzz="$sizetype"    ;;
22039 *)   zzz="filesize"     ;;
22040 esac
22041 echo "Checking the size of $zzz..." >&4
22042 cat > try.c <<EOCP
22043 #include <sys/types.h>
22044 #include <stdio.h>
22045 #$i_stdlib I_STDLIB
22046 #ifdef I_STDLIB
22047 #include <stdlib.h>
22048 #endif
22049 int main() {
22050     printf("%d\n", (int)sizeof($sizetype));
22051     exit(0);
22052 }
22053 EOCP
22054 set try
22055 if eval $compile_ok; then
22056         yyy=`$run ./try`
22057         case "$yyy" in
22058         '')     sizesize=4
22059                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22060                 ;;
22061         *)      sizesize=$yyy
22062                 echo "Your $zzz size is $sizesize bytes."
22063                 ;;
22064         esac
22065 else
22066         sizesize=4
22067         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22068 fi
22069
22070 : check for socklen_t
22071 echo " "
22072 echo "Checking to see if you have socklen_t..." >&4
22073 $cat >try.c <<EOCP
22074 #include <sys/types.h>
22075 #$d_socket HAS_SOCKET
22076 #ifdef HAS_SOCKET
22077 #include <sys/socket.h>
22078 #endif
22079 int main() { socklen_t x = 16; }
22080 EOCP
22081 set try
22082 if eval $compile; then
22083         val="$define"
22084         echo "You have socklen_t."
22085 else
22086         val="$undef"
22087         echo "You do not have socklen_t."
22088         case "$sizetype" in
22089         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22090         esac
22091 fi
22092 $rm_try
22093 set d_socklen_t
22094 eval $setvar
22095
22096 : see if this is a socks.h system
22097 set socks.h i_socks
22098 eval $inhdr
22099
22100 : check for type of the size argument to socket calls
22101 case "$d_socket" in
22102 "$define")
22103         $cat <<EOM
22104
22105 Checking to see what type is the last argument of accept().
22106 EOM
22107         yyy=''
22108         case "$d_socklen_t" in
22109         "$define") yyy="$yyy socklen_t"
22110         esac
22111         yyy="$yyy $sizetype int long unsigned"
22112         for xxx in $yyy; do
22113                 case "$socksizetype" in
22114                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22115                         case "$usesocks" in
22116                         "$define")
22117                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22118                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22119                                         socksizetype="$xxx"
22120                                 fi
22121                                 ;;
22122                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22123                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22124                                         socksizetype="$xxx"
22125                                 fi
22126                                 ;;
22127                         esac
22128                         ;;
22129                 esac
22130         done
22131 : In case none of those worked, prompt the user.
22132         case "$socksizetype" in
22133         '')     rp='What is the type for socket address structure sizes?'
22134                 dflt='int'
22135                 . ./myread
22136                 socksizetype=$ans
22137                 ;;
22138         esac
22139         ;;
22140 *)      : no sockets, so pick relatively harmless default
22141         socksizetype='int'
22142         ;;
22143 esac
22144
22145 : see what type is used for signed size_t
22146 set ssize_t ssizetype int stdio.h sys/types.h
22147 eval $typedef
22148 dflt="$ssizetype"
22149 $cat > try.c <<EOM
22150 #include <stdio.h>
22151 #$i_stdlib I_STDLIB
22152 #ifdef I_STDLIB
22153 #include <stdlib.h>
22154 #endif
22155 #include <sys/types.h>
22156 #define Size_t $sizetype
22157 #define SSize_t $dflt
22158 int main()
22159 {
22160         if (sizeof(Size_t) == sizeof(SSize_t))
22161                 printf("$dflt\n");
22162         else if (sizeof(Size_t) == sizeof(int))
22163                 printf("int\n");
22164         else
22165                 printf("long\n");
22166         exit(0);
22167 }
22168 EOM
22169 echo " "
22170 set try
22171 if eval $compile_ok && $run ./try > /dev/null; then
22172         ssizetype=`$run ./try`
22173         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22174 else
22175         $cat >&4 <<EOM
22176 Help! I can't compile and run the ssize_t test program: please enlighten me!
22177 (This is probably a misconfiguration in your system or libraries, and
22178 you really ought to fix it.  Still, I'll try anyway.)
22179
22180 I need a type that is the same size as $sizetype, but is guaranteed to
22181 be signed.  Common values are ssize_t, int and long.
22182
22183 EOM
22184         rp="What signed type is the same size as $sizetype?"
22185         . ./myread
22186         ssizetype="$ans"
22187 fi
22188 $rm_try
22189
22190 : Check the size of st_ino
22191 $echo " "
22192 $echo "Checking the size of st_ino..." >&4
22193 $cat > try.c <<EOCP
22194 #include <sys/stat.h>
22195 #include <stdio.h>
22196 #$i_stdlib I_STDLIB
22197 #ifdef I_STDLIB
22198 #include <stdlib.h>
22199 #endif
22200 int main() {
22201     struct stat st;
22202     printf("%d\n", (int)sizeof(st.st_ino));
22203     exit(0);
22204 }
22205 EOCP
22206 set try
22207 if eval $compile_ok; then
22208         val=`$run ./try`
22209         case "$val" in
22210         '')     st_ino_size=4
22211                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22212                 ;;
22213         *)      st_ino_size=$val
22214                 $echo "Your st_ino is $st_ino_size bytes long."
22215                 ;;
22216         esac
22217 else
22218         st_ino_size=4
22219         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22220 fi
22221 $rm_try
22222
22223 : Check if st_ino is signed
22224 $echo " "
22225 $echo "Checking the sign of st_ino..." >&4
22226 $cat > try.c <<EOCP
22227 #include <sys/stat.h>
22228 #include <stdio.h>
22229 int main() {
22230         struct stat foo;
22231         foo.st_ino = -1;
22232         if (foo.st_ino < 0)
22233                 printf("-1\n");
22234         else
22235                 printf("1\n");
22236 }
22237 EOCP
22238 set try
22239 if eval $compile; then
22240         val=`$run ./try`
22241         case "$val" in
22242         '')     st_ino_sign=1
22243                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22244                 ;;
22245         *)      st_ino_sign=$val
22246                 case "$st_ino_sign" in
22247                  1) $echo "Your st_ino is unsigned." ;;
22248                 -1) $echo "Your st_ino is signed."   ;;
22249                 esac
22250                 ;;
22251         esac
22252 else
22253         st_ino_sign=1
22254         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22255 fi
22256 $rm_try
22257
22258 : see what type of char stdio uses.
22259 echo " "
22260 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22261 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22262         echo "Your stdio uses unsigned chars." >&4
22263         stdchar="unsigned char"
22264 else
22265         echo "Your stdio uses signed chars." >&4
22266         stdchar="char"
22267 fi
22268 $rm -f stdioh
22269
22270 : Check size of UID
22271 echo " "
22272 case "$uidtype" in
22273 *_t) zzz="$uidtype"     ;;
22274 *)   zzz="uid"          ;;
22275 esac
22276 echo "Checking the size of $zzz..." >&4
22277 cat > try.c <<EOCP
22278 #include <sys/types.h>
22279 #include <stdio.h>
22280 #$i_stdlib I_STDLIB
22281 #ifdef I_STDLIB
22282 #include <stdlib.h>
22283 #endif
22284 int main() {
22285     printf("%d\n", (int)sizeof($uidtype));
22286     exit(0);
22287 }
22288 EOCP
22289 set try
22290 if eval $compile_ok; then
22291         yyy=`$run ./try`
22292         case "$yyy" in
22293         '')     uidsize=4
22294                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22295                 ;;
22296         *)      uidsize=$yyy
22297                 echo "Your $zzz is $uidsize bytes long."
22298                 ;;
22299         esac
22300 else
22301         uidsize=4
22302         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22303 fi
22304
22305 : Check if UID is signed
22306 echo " "
22307 case "$uidtype" in
22308 *_t) zzz="$uidtype"     ;;
22309 *)   zzz="uid"          ;;
22310 esac
22311 echo "Checking the sign of $zzz..." >&4
22312 cat > try.c <<EOCP
22313 #include <sys/types.h>
22314 #include <stdio.h>
22315 int main() {
22316         $uidtype foo = -1;
22317         if (foo < 0)
22318                 printf("-1\n");
22319         else
22320                 printf("1\n");
22321 }
22322 EOCP
22323 set try
22324 if eval $compile; then
22325         yyy=`$run ./try`
22326         case "$yyy" in
22327         '')     uidsign=1
22328                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22329                 ;;
22330         *)      uidsign=$yyy
22331                 case "$uidsign" in
22332                  1) echo "Your $zzz is unsigned." ;;
22333                 -1) echo "Your $zzz is signed."   ;;
22334                 esac
22335                 ;;
22336         esac
22337 else
22338         uidsign=1
22339         echo "(I can't compile the test program--guessing unsigned.)" >&4
22340 fi
22341
22342 : Check format string for UID
22343 echo " "
22344 $echo "Checking the format string to be used for uids..." >&4
22345
22346 case "$uidsign" in
22347 -1)     if $test X"$uidsize" = X"$ivsize"; then
22348                 uidformat="$ivdformat"
22349         else
22350                 if $test X"$uidsize" = X"$longsize"; then
22351                         uidformat='"ld"'
22352                 else
22353                         if $test X"$uidsize" = X"$intsize"; then
22354                                 uidformat='"d"'
22355                         else
22356                                 if $test X"$uidsize" = X"$shortsize"; then
22357                                         uidformat='"hd"'
22358                                 fi
22359                         fi
22360                 fi
22361         fi
22362         ;;
22363 *)      if $test X"$uidsize" = X"$uvsize"; then
22364                 uidformat="$uvuformat"
22365         else
22366                 if $test X"$uidsize" = X"$longsize"; then
22367                         uidformat='"lu"'
22368                 else
22369                         if $test X"$uidsize" = X"$intsize"; then
22370                                 uidformat='"u"'
22371                         else
22372                                 if $test X"$uidsize" = X"$shortsize"; then
22373                                         uidformat='"hu"'
22374                                 fi
22375                         fi
22376                 fi
22377         fi
22378         ;;
22379 esac
22380
22381 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22382 echo " "
22383 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22384 $cat >try.c <<'EOM'
22385 /* Intentionally a long probe as I'd like to sanity check that the exact
22386    approach is going to work, as thinking it will work, but only having it
22387    part working at runtime is worse than not having it.  */
22388
22389 #include <sys/types.h>
22390 #include <sys/sysctl.h>
22391 #include <sys/param.h>
22392 #include <stdio.h>
22393 #include <string.h>
22394 #include <stdlib.h>
22395 #include <unistd.h>
22396
22397 int
22398 main(int argc, char **argv) {
22399     char *buffer;
22400     char *argv_leaf = strrchr(argv[0], '/');
22401     char *buffer_leaf;
22402     size_t size = 0;
22403     int mib[4];
22404
22405     mib[0] = CTL_KERN;
22406     mib[1] = KERN_PROC;
22407     mib[2] = KERN_PROC_PATHNAME;
22408     mib[3] = -1;
22409
22410     if (!argv_leaf) {
22411         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22412         return 1;
22413     }
22414
22415     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22416         perror("sysctl");
22417         return 2;
22418     }
22419
22420     if (size < strlen(argv_leaf) + 1) {
22421         fprintf(stderr, "size %lu is too short for a path\n",
22422                 (unsigned long) size);
22423         return 3;
22424     }
22425
22426     if (size > MAXPATHLEN * MAXPATHLEN) {
22427         fprintf(stderr, "size %lu is too long for a path\n",
22428                 (unsigned long) size);
22429         return 4;
22430     }
22431
22432     buffer = (char *)malloc(size);
22433     if (!buffer) {
22434         perror("malloc");
22435         return 5;
22436     }
22437
22438     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22439         perror("sysctl");
22440         return 6;
22441     }
22442
22443     if (strlen(buffer) + 1 != size) {
22444         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22445                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22446         return 7;
22447     }
22448
22449
22450     if (*buffer != '/') {
22451         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22452         return 8;
22453     }
22454
22455     if (strstr(buffer, "/./")) {
22456         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22457         return 9;
22458     }
22459
22460     if (strstr(buffer, "/../")) {
22461         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22462         return 10;
22463     }
22464
22465     buffer_leaf = strrchr(buffer, '/');
22466     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22467         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22468         return 11;
22469     }
22470
22471     free(buffer);
22472
22473     return 0;
22474 }
22475 EOM
22476
22477 val=$undef
22478 set try
22479 if eval $compile; then
22480         if $run ./try; then
22481                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22482                 val="$define"
22483         else
22484                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22485                 val="$undef"
22486         fi
22487 else
22488         echo "I'm unable to compile the test program." >&4
22489         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22490         val="$undef"
22491 fi
22492 $rm_try
22493 set usekernprocpathname
22494 eval $setvar
22495
22496 : Determine if we can use _NSGetExecutablePath to find executing program
22497 echo " "
22498 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22499 $cat >try.c <<'EOM'
22500 /* Intentionally a long probe as I'd like to sanity check that the exact
22501    approach is going to work, as thinking it will work, but only having it
22502    part working at runtime is worse than not having it.  */
22503 #include <mach-o/dyld.h>
22504 #include <stdio.h>
22505 #include <stdlib.h>
22506 #include <sys/param.h>
22507 #include <string.h>
22508
22509 int
22510 main(int argc, char **argv) {
22511     char buf[1];
22512     uint32_t size = sizeof(buf);
22513     int result;
22514     char *buffer;
22515     char *tidied;
22516     char *argv_leaf = strrchr(argv[0], '/');
22517     char *tidied_leaf;
22518
22519     if (!argv_leaf) {
22520         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22521         return 1;
22522     }
22523
22524     _NSGetExecutablePath(buf, &size);
22525     if (size > MAXPATHLEN * MAXPATHLEN) {
22526         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22527                 (unsigned int) size);
22528         return 2;
22529     }
22530
22531     buffer = (char *)malloc(size);
22532     if (!buffer) {
22533         perror("malloc");
22534         return 3;
22535     }
22536
22537     result = _NSGetExecutablePath(buffer, &size);
22538     if (result != 0) {
22539         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22540                 result, (unsigned int) size);
22541         return 4;
22542     }
22543
22544     tidied = realpath(buffer, NULL);
22545     if (!tidied) {
22546         perror("realpath");
22547         return 5;
22548     }
22549
22550     free(buffer);
22551
22552     if (*tidied != '/') {
22553         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22554         return 6;
22555     }
22556
22557     if (strstr(tidied, "/./")) {
22558         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22559         return 7;
22560     }
22561
22562     if (strstr(tidied, "/../")) {
22563         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22564         return 8;
22565     }
22566
22567     tidied_leaf = strrchr(tidied, '/');
22568     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22569         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22570         return 9;
22571     }
22572
22573     free(tidied);
22574
22575     return 0;
22576 }
22577 EOM
22578
22579 val=$undef
22580 set try
22581 if eval $compile; then
22582         if $run ./try; then
22583                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22584                 val="$define"
22585         else
22586                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22587         fi
22588 else
22589         echo "I'm unable to compile the test program." >&4
22590         echo "I'll assume no _NSGetExecutablePath here." >&4
22591 fi
22592 $rm_try
22593 set usensgetexecutablepath
22594 eval $setvar
22595
22596 : Check if site customization support was requested
22597 case "$usesitecustomize" in
22598     $define|true|[Yy]*)
22599         usesitecustomize="$define"
22600         ;;
22601     *)
22602         usesitecustomize="$undef"
22603         ;;
22604     esac
22605
22606 : determine compiler compiler
22607 case "$yacc" in
22608 '')
22609         dflt=yacc;;
22610 *)
22611         dflt="$yacc";;
22612 esac
22613 echo " "
22614 comp='yacc'
22615 if $test -f "$byacc$_exe"; then
22616         dflt="$byacc"
22617         comp="byacc or $comp"
22618 fi
22619 if $test -f "$bison$_exe"; then
22620         comp="$comp or bison -y"
22621 fi
22622 rp="Which compiler compiler ($comp) shall I use?"
22623 . ./myread
22624 yacc="$ans"
22625 case "$yacc" in
22626 *bis*)
22627         case "$yacc" in
22628         *-y*) ;;
22629         *)
22630                 yacc="$yacc -y"
22631                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22632                 ;;
22633         esac
22634         ;;
22635 esac
22636
22637 : see if this is a bfd.h system
22638 set bfd.h i_bfd
22639 eval $inhdr
22640
22641 : see if this is an execinfo.h system
22642 set execinfo.h i_execinfo
22643 eval $inhdr
22644
22645 : see if this is a fenv.h system
22646 set fenv.h i_fenv
22647 eval $inhdr
22648
22649 : see if this is a fp.h system
22650 set fp.h i_fp
22651 eval $inhdr
22652
22653 : see if this is a fp_class.h system
22654 set fp_class.h i_fp_class
22655 eval $inhdr
22656
22657 : see if gdbm.h is available
22658 set gdbm.h t_gdbm
22659 eval $inhdr
22660 case "$t_gdbm" in
22661 $define)
22662         : see if gdbm_open exists
22663         set gdbm_open d_gdbm_open
22664         eval $inlibc
22665         case "$d_gdbm_open" in
22666         $undef)
22667                 t_gdbm="$undef"
22668                 echo "We won't be including <gdbm.h>"
22669                 ;;
22670         esac
22671         ;;
22672 esac
22673 val="$t_gdbm"
22674 set i_gdbm
22675 eval $setvar
22676
22677 : see if this is a ieeefp.h system
22678 case "$i_ieeefp" in
22679 '' ) set ieeefp.h i_ieeefp
22680      eval $inhdr
22681      ;;
22682 esac
22683
22684 : see if this is a libutil.h system
22685 set libutil.h i_libutil
22686 eval $inhdr
22687
22688 : see if mach cthreads are available
22689 if test "X$usethreads" = "X$define"; then
22690         set mach/cthreads.h i_machcthr
22691         eval $inhdr
22692 else
22693         i_machcthr="$undef"
22694 fi
22695
22696 : see if this is a mntent.h system
22697 set mntent.h i_mntent
22698 eval $inhdr
22699
22700 : see if net/errno.h is available
22701 val=''
22702 set net/errno.h val
22703 eval $inhdr
22704
22705 : Unfortunately, it causes problems on some systems.  Arrgh.
22706 case "$val" in
22707 $define)
22708         cat > try.c <<'EOM'
22709 #include <stdio.h>
22710 #include <errno.h>
22711 #include <net/errno.h>
22712 int func()
22713 {
22714         return ENOTSOCK;
22715 }
22716 EOM
22717         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22718                 echo "We'll be including <net/errno.h>." >&4
22719         else
22720                 echo "We won't be including <net/errno.h>." >&4
22721                 val="$undef"
22722         fi
22723         $rm_try
22724         ;;
22725 esac
22726 set i_neterrno
22727 eval $setvar
22728
22729 : see if netinet/tcp.h is available
22730 set netinet/tcp.h i_netinettcp
22731 eval $inhdr
22732
22733 : see if this is a poll.h system
22734 set poll.h i_poll
22735 eval $inhdr
22736
22737 : see if this is a prot.h system
22738 set prot.h i_prot
22739 eval $inhdr
22740
22741 : Preprocessor symbols
22742 echo " "
22743 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22744 $cat <<'EOSH' > Cppsym.know
22745 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22746 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22747 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22748 arch_pwr ardent ARM ARM32 atarist att386 att3b
22749 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22750 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22751 byteorder byte_order
22752 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22753 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22754 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22755 ELF encore EPI EXTENSIONS
22756 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22757 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22758 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22759 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22760 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22761 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22762 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22763 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22764 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22765 ksr1
22766 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22767 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22768 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22769 luna88k Lynx
22770 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22771 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22772 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22773 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22774 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22775 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22776 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22777 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22778 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22779 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22780 ns32000 ns32016 ns32332 ns32k nsc32000
22781 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22782 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22783 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22784 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22785 QK_USER QNX
22786 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22787 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22788 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22789 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22790 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22791 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22792 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22793 SYSV4 SYSV5 sysV68 sysV88
22794 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22795 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22796 tower32_800 tower32_850 tss
22797 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22798 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22799 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22800 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22801 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22802 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22803 uxpm uxps
22804 vax venix VMESA vms
22805 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22806 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22807 z8000 zarch
22808 EOSH
22809 # Maybe put other stuff here too.
22810 ./tr '-' '_' <<EOSH >>Cppsym.know
22811 $osname
22812 EOSH
22813 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22814 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22815 $cat Cppsym.know > Cppsym.c
22816 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22817 $rm -f Cppsym.a Cppsym.b Cppsym.c
22818 cat <<EOSH > Cppsym
22819 $startsh
22820 if $test \$# -gt 0; then
22821     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22822     if $test -s Cppsym.got; then
22823         $rm -f Cppsym.got
22824         exit 0
22825     fi
22826     $rm -f Cppsym.got
22827     exit 1
22828 else
22829     $tr " " "$trnl" | ./Cppsym.try
22830     exit 0
22831 fi
22832 EOSH
22833 chmod +x Cppsym
22834 $eunicefix Cppsym
22835 cat <<EOSH > Cppsym.try
22836 $startsh
22837 cat <<'EOCP' > try.c
22838 #include <stdio.h>
22839 #if cpp_stuff == 1
22840 #define STRINGIFY(a)    "a"
22841 #endif
22842 #if cpp_stuff == 42
22843 #define StGiFy(a)  #a
22844 #define STRINGIFY(a)    StGiFy(a)
22845 #endif
22846 #if $cpp_stuff != 1 && $cpp_stuff != 42
22847 #   include "Bletch: How does this C preprocessor stringify macros?"
22848 #endif
22849 int main() {
22850 EOCP
22851 $awk \\
22852 EOSH
22853 cat <<'EOSH' >> Cppsym.try
22854 'length($1) > 0 {
22855     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22856     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22857     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22858     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22859 }' >> try.c
22860 echo 'return 0;}' >> try.c
22861 EOSH
22862 cat <<EOSH >> Cppsym.try
22863 ccflags="$ccflags"
22864 case "$osname-$gccversion" in
22865 irix-) ccflags="\$ccflags -woff 1178" ;;
22866 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22867 esac
22868 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22869 EOSH
22870 chmod +x Cppsym.try
22871 $eunicefix Cppsym.try
22872 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22873 : Add in any Linux cpp "predefined macros":
22874 case "$osname::$gccversion" in
22875   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22876     tHdrH=_tmpHdr
22877     rm -f $tHdrH'.h' $tHdrH
22878     touch $tHdrH'.h'
22879     # Filter out macro arguments, such as Linux's __INT8_C(c)
22880     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22881        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22882        if [ -s $tHdrH'_cppsym.real' ]; then
22883           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22884        fi
22885     fi
22886     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22887   ;;
22888 esac
22889 : now check the C compiler for additional symbols
22890 postprocess_cc_v=''
22891 case "$osname" in
22892 aix) postprocess_cc_v="|$tr , ' '" ;;
22893 esac
22894 $cat >ccsym <<EOS
22895 $startsh
22896 $cat >tmp.c <<EOF
22897 extern int foo;
22898 EOF
22899 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22900 do
22901         case "\$i" in
22902         -D*) echo "\$i" | $sed 's/^-D//';;
22903         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22904         esac
22905 done
22906 $rm_try
22907 EOS
22908 postprocess_cc_v=''
22909 chmod +x ccsym
22910 $eunicefix ccsym
22911 ./ccsym > ccsym1.raw
22912 if $test -s ccsym1.raw; then
22913     $sort ccsym1.raw | $uniq >ccsym.raw
22914 else
22915     mv ccsym1.raw ccsym.raw
22916 fi
22917
22918 $awk '/\=/ { print $0; next }
22919         { print $0"=1" }' ccsym.raw >ccsym.list
22920 $comm -13 Cppsym.true ccsym.list >ccsym.own
22921 $comm -12 Cppsym.true ccsym.list >ccsym.com
22922 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22923 also=''
22924 if $test -z ccsym.raw; then
22925         echo "Your C compiler doesn't seem to define any symbols!" >&4
22926         echo " "
22927         echo "However, your C preprocessor defines the following symbols:"
22928         $cat Cppsym.true
22929         ccsymbols=''
22930         cppsymbols=`$cat Cppsym.true`
22931         cppsymbols=`echo $cppsymbols`
22932         cppccsymbols="$cppsymbols"
22933 else
22934         if $test -s ccsym.com; then
22935                 echo "Your C compiler and pre-processor define these symbols:"
22936                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22937                 also='also '
22938                 symbols='ones'
22939                 cppccsymbols=`$cat ccsym.com`
22940                 cppccsymbols=`echo $cppccsymbols`
22941                 $test "$silent" || sleep 1
22942         fi
22943         if $test -s ccsym.cpp; then
22944                 $test "$also" && echo " "
22945                 echo "Your C pre-processor ${also}defines the following symbols:"
22946                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22947                 also='further '
22948                 cppsymbols=`$cat ccsym.cpp`
22949                 cppsymbols=`echo $cppsymbols`
22950                 $test "$silent" || sleep 1
22951         fi
22952         if $test -s ccsym.own; then
22953                 $test "$also" && echo " "
22954                 echo "Your C compiler ${also}defines the following cpp symbols:"
22955                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22956                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22957                 ccsymbols=`$cat ccsym.own`
22958                 ccsymbols=`echo $ccsymbols`
22959                 $test "$silent" || sleep 1
22960         fi
22961 fi
22962
22963 : add -D_FORTIFY_SOURCE if feasible and not already there
22964 case "$gccversion" in
22965 [456789].*)     case "$optimize$ccflags" in
22966         *-O*)   case "$ccflags$cppsymbols" in
22967                 *_FORTIFY_SOURCE=*) # Don't add it again.
22968                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22969                         ;;
22970                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22971                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22972                         ;;
22973                 esac
22974                 ;;
22975         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22976                 ;;
22977         esac
22978         ;;
22979 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22980         ;;
22981 esac
22982
22983 : script used to emit important warnings
22984 cat >warn <<EOS
22985 $startsh
22986 if test \$# -gt 0; then
22987         echo "\$@" >msg
22988 else
22989         cat >msg
22990 fi
22991 echo "*** WARNING:" >&4
22992 sed -e 's/^/*** /' <msg >&4
22993 echo "*** " >&4
22994 cat msg >>config.msg
22995 echo " " >>config.msg
22996 rm -f msg
22997 EOS
22998 chmod +x warn
22999 $eunicefix warn
23000
23001 : see if this is a termio system
23002 val="$undef"
23003 val2="$undef"
23004 val3="$undef"
23005 if $test `./findhdr termios.h`; then
23006     set tcsetattr i_termios
23007     eval $inlibc
23008     val3="$i_termios"
23009 fi
23010 echo " "
23011 case "$val3" in
23012     "$define") echo "You have POSIX termios.h... good!" >&4;;
23013     *)  if ./Cppsym pyr; then
23014             case "`$run /bin/universe`" in
23015                 ucb) if $test `./findhdr sgtty.h`; then
23016                         val2="$define"
23017                         echo "<sgtty.h> found." >&4
23018                     else
23019                         echo "System is pyramid with BSD universe."
23020                         ./warn "<sgtty.h> not found--you could have problems."
23021                     fi;;
23022                 *)  if $test `./findhdr termio.h`; then
23023                         val="$define"
23024                         echo "<termio.h> found." >&4
23025                     else
23026                         echo "System is pyramid with USG universe."
23027                         ./warn "<termio.h> not found--you could have problems."
23028                     fi;;
23029             esac
23030         elif ./usg; then
23031             if $test `./findhdr termio.h`; then
23032                 echo "<termio.h> found." >&4
23033                 val="$define"
23034             elif $test `./findhdr sgtty.h`; then
23035                 echo "<sgtty.h> found." >&4
23036                 val2="$define"
23037             else
23038                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23039             fi
23040         else
23041             if $test `./findhdr sgtty.h`; then
23042                 echo "<sgtty.h> found." >&4
23043                 val2="$define"
23044             elif $test `./findhdr termio.h`; then
23045                 echo "<termio.h> found." >&4
23046                 val="$define"
23047             else
23048                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23049             fi
23050         fi;;
23051 esac
23052 set i_termio; eval $setvar
23053 val=$val2; set i_sgtty; eval $setvar
23054 val=$val3; set i_termios; eval $setvar
23055
23056 : see if stdbool is available
23057 : we want a real compile instead of Inhdr because some Solaris systems
23058 : have stdbool.h, but it can only be used if the compiler indicates it
23059 : is sufficiently c99-compliant.
23060 echo " "
23061 $cat >try.c <<EOCP
23062 #include <stdio.h>
23063 #include <stdbool.h>
23064 int func(bool x)
23065 {
23066     return x ? 1 : 0;
23067 }
23068 int main(int argc, char **argv)
23069 {
23070     return func(0);
23071 }
23072 EOCP
23073 set try
23074 if eval $compile; then
23075         echo "<stdbool.h> found." >&4
23076         val="$define"
23077 else
23078         echo "<stdbool.h> NOT found." >&4
23079         val="$undef"
23080 fi
23081 $rm_try
23082 set i_stdbool
23083 eval $setvar
23084
23085 : see if stdint is available
23086 set stdint.h i_stdint
23087 eval $inhdr
23088
23089 : see if sys/access.h is available
23090 set sys/access.h i_sysaccess
23091 eval $inhdr
23092
23093 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23094 set sys/filio.h i_sysfilio
23095 eval $inhdr
23096 echo " "
23097 if $test `./findhdr sys/ioctl.h`; then
23098         val="$define"
23099         echo '<sys/ioctl.h> found.' >&4
23100 else
23101         val="$undef"
23102         if $test $i_sysfilio = "$define"; then
23103             echo '<sys/ioctl.h> NOT found.' >&4
23104         else
23105                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23106                 $test $i_termio = "$define" && xxx="termio.h"
23107                 $test $i_termios = "$define" && xxx="termios.h"
23108 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23109         fi
23110 fi
23111 set i_sysioctl
23112 eval $setvar
23113
23114 : see if socket ioctl defs are in sys/sockio.h
23115 echo " "
23116 xxx=`./findhdr sys/sockio.h`
23117 if $test "$xxx"; then
23118         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23119                 val="$define"
23120                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23121         else
23122                 val="$undef"
23123                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23124         fi
23125 else
23126         val="$undef"
23127         $cat <<EOM
23128 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23129 EOM
23130 fi
23131 set i_syssockio
23132 eval $setvar
23133
23134 : see if this is a syslog.h system
23135 set syslog.h i_syslog
23136 eval $inhdr
23137
23138 : see if this is a sys/mode.h system
23139 set sys/mode.h i_sysmode
23140 eval $inhdr
23141
23142 : see if there is a sys/poll.h file
23143 set sys/poll.h i_syspoll
23144 eval $inhdr
23145
23146 : see if sys/resource.h has to be included
23147 set sys/resource.h i_sysresrc
23148 eval $inhdr
23149
23150 : see if sys/security.h is available
23151 set sys/security.h i_syssecrt
23152 eval $inhdr
23153
23154 : see if this is a sys/statvfs.h system
23155 set sys/statvfs.h i_sysstatvfs
23156 eval $inhdr
23157
23158 : see if this is a sys/un.h system
23159 set sys/un.h i_sysun
23160 eval $inhdr
23161
23162 : see if this is a sys/utsname.h system
23163 set sys/utsname.h i_sysutsname
23164 eval $inhdr
23165
23166 : see if this is a syswait system
23167 set sys/wait.h i_syswait
23168 eval $inhdr
23169
23170 : see if this is a ustat.h system
23171 set ustat.h i_ustat
23172 eval $inhdr
23173
23174 : see if this is an utime system
23175 set utime.h i_utime
23176 eval $inhdr
23177
23178 : see if this is a vfork system
23179 case "$d_vfork" in
23180 "$define")
23181         set vfork.h i_vfork
23182         eval $inhdr
23183         ;;
23184 *)
23185         i_vfork="$undef"
23186         ;;
23187 esac
23188
23189 : see if wchar.h is present
23190 set wchar.h i_wchar
23191 eval $inhdr
23192
23193 : Check extensions
23194 echo " "
23195 echo "Looking for extensions..." >&4
23196 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23197 : contain old or inaccurate or duplicate values.
23198 nonxs_extensions=''
23199 xs_extensions=''
23200 : We do not use find because it might not be available.
23201 : We do not just use MANIFEST because the user may have dropped
23202 : some additional extensions into the source tree and expect them
23203 : to be built.
23204
23205 : Function to recursively find available extensions, ignoring DynaLoader
23206 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23207 : In 5.10.1 and later, extensions are stored in directories
23208 : like File-Glob instead of the older File/Glob/.
23209 find_extensions='
23210     for xxx in *; do
23211         case "$xxx" in
23212             DynaLoader|dynaload) ;;
23213             *)
23214             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23215             case "$this_ext" in
23216                 Scalar/List/Utils) this_ext="List/Util" ;;
23217                 PathTools)         this_ext="Cwd"       ;;
23218             esac;
23219             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23220             if $contains " $this_ext " "$tdir/$$.tmp"; then
23221                 echo >&4;
23222                 echo "Duplicate directories detected for extension $xxx" >&4;
23223                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23224                 case "$knowitall" in
23225                 "") dflt=y;;
23226                 *) dflt=n;;
23227                 esac;
23228                 . ../UU/myread;
23229                 case "$ans" in
23230                 n*|N*) ;;
23231                 *) echo >&4;
23232                     echo "Ok.  Stopping Configure." >&4;
23233                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23234                     exit 1;;
23235                 esac;
23236                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23237             fi;
23238             $ls -1 "$xxx" > "$tdir/$$.tmp";
23239             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23240                 xs_extensions="$xs_extensions $this_ext";
23241             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23242                 xs_extensions="$xs_extensions $this_ext";
23243             elif $test -d "$xxx"; then
23244                 nonxs_extensions="$nonxs_extensions $this_ext";
23245             fi;
23246             $rm -f "$tdir/$$.tmp";
23247             ;;
23248         esac;
23249     done'
23250 tdir=`pwd`
23251 cd "$rsrc/cpan"
23252 set X
23253 shift
23254 eval $find_extensions
23255 cd "$rsrc/dist"
23256 set X
23257 shift
23258 eval $find_extensions
23259 cd "$rsrc/ext"
23260 set X
23261 shift
23262 eval $find_extensions
23263 set X $xs_extensions
23264 shift
23265 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23266 set X $nonxs_extensions
23267 shift
23268 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23269 cd "$tdir"
23270 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23271
23272 : Now see which are supported on this system.
23273 avail_ext=''
23274 for xxx in $xs_extensions ; do
23275         case "$xxx" in
23276         Amiga*)
23277                 case "$osname" in
23278                 amigaos) avail_ext="$avail_ext $xxx" ;;
23279                 esac
23280                 ;;
23281         DB_File|db_file)
23282                 case "$i_db" in
23283                 $define) avail_ext="$avail_ext $xxx" ;;
23284                 esac
23285                 ;;
23286         GDBM_File|gdbm_fil)
23287                 case "$i_gdbm" in
23288                 $define) avail_ext="$avail_ext $xxx" ;;
23289                 esac
23290                 ;;
23291         IPC/SysV|ipc/sysv)
23292                 : XXX Do we need a useipcsysv variable here
23293                 case "${d_msg}${d_sem}${d_shm}" in
23294                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23295                 esac
23296                 ;;
23297         NDBM_File|ndbm_fil)
23298                 case "$d_ndbm" in
23299                 $define)
23300                     case "$osname-$use64bitint" in
23301                     hpux-define)
23302                         case "$libs" in
23303                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23304                         esac
23305                         ;;
23306                     *) avail_ext="$avail_ext $xxx" ;;
23307                     esac
23308                     ;;
23309                 esac
23310                 ;;
23311         ODBM_File|odbm_fil)
23312                 case "${i_dbm}${i_rpcsvcdbm}" in
23313                 *"${define}"*)
23314                     case "$d_cplusplus" in
23315                     define) ;; # delete as a function name will not work
23316                     *)  case "$osname-$use64bitint" in
23317                         hpux-define)
23318                             case "$libs" in
23319                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23320                             esac
23321                             ;;
23322                         *) avail_ext="$avail_ext $xxx" ;;
23323                         esac
23324                         ;;
23325                     esac
23326                     ;;
23327                 esac
23328                 ;;
23329         Opcode|opcode)
23330                 case "$useopcode" in
23331                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23332                 esac
23333                 ;;
23334         POSIX|posix)
23335                 case "$useposix" in
23336                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23337                 esac
23338                 ;;
23339         Socket|socket)
23340                 case "$d_socket" in
23341                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23342                 esac
23343                 ;;
23344         I18N/Langinfo|langinfo)
23345                 case "$uselanginfo" in
23346                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23347                 esac
23348                 ;;
23349         Sys/Syslog|sys/syslog)
23350                 case $osname in
23351                         amigaos) ;; # not really very useful on AmigaOS
23352                         *)
23353                         : XXX syslog requires socket
23354                         case "$d_socket" in
23355                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23356                         esac
23357                         ;;
23358                 esac
23359                 ;;
23360         Thread|thread)
23361                 case "$usethreads" in
23362                 true|$define|y)
23363                         case "$use5005threads" in
23364                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23365                         esac
23366                 esac
23367                 ;;
23368         threads|threads/shared)
23369                 # threads and threads::shared are special cases.
23370                 # To stop people from asking "Perl 5.8.0 was supposed
23371                 # to have this new fancy threads implementation but my
23372                 # perl doesn't have it" and from people trying to
23373                 # (re)install the threads module using CPAN.pm and
23374                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23375                 # the threads.pm and threads/shared.pm will always be
23376                 # there, croaking informatively ("you need to rebuild
23377                 # all of Perl with threads, sorry") when threads haven't
23378                 # been compiled in.
23379                 # --jhi
23380                 avail_ext="$avail_ext $xxx"
23381                 ;;
23382         VMS*)
23383                 ;;
23384         Win32*)
23385                 case "$osname" in
23386                 cygwin) avail_ext="$avail_ext $xxx" ;;
23387                 esac
23388                 ;;
23389         XS/APItest|xs/apitest)
23390                 # This is just for testing.  Skip it unless we have dynamic loading.
23391
23392                 case "$usedl" in
23393                 $define) avail_ext="$avail_ext $xxx" ;;
23394                 esac
23395                 ;;
23396         XS/Typemap|xs/typemap)
23397                 # This is just for testing.  Skip it unless we have dynamic loading.
23398                 case "$usedl" in
23399                 $define) avail_ext="$avail_ext $xxx" ;;
23400                 esac
23401                 ;;
23402         *)      avail_ext="$avail_ext $xxx"
23403                 ;;
23404         esac
23405 done
23406
23407 set X $avail_ext
23408 shift
23409 avail_ext="$*"
23410
23411 case "$onlyextensions" in
23412 '') ;;
23413 *)  keepextensions=''
23414     echo "You have requested that only certain extensions be included..." >&4
23415     for i in $onlyextensions; do
23416         case " $avail_ext " in
23417         *" $i "*)
23418             echo "Keeping extension $i."
23419             keepextensions="$keepextensions $i"
23420             ;;
23421         *) echo "Ignoring extension $i." ;;
23422         esac
23423     done
23424     avail_ext="$keepextensions"
23425     ;;
23426 esac
23427
23428 case "$noextensions" in
23429 '') ;;
23430 *)  keepextensions=''
23431     echo "You have requested that certain extensions be ignored..." >&4
23432     for i in $avail_ext; do
23433         case " $noextensions " in
23434         *" $i "*) echo "Ignoring extension $i." ;;
23435         *) echo "Keeping extension $i.";
23436            keepextensions="$keepextensions $i"
23437            ;;
23438         esac
23439     done
23440     avail_ext="$keepextensions"
23441     ;;
23442 esac
23443
23444 : Now see which nonxs extensions are supported on this system.
23445 : For now assume all are.
23446 nonxs_ext=''
23447 for xxx in $nonxs_extensions ; do
23448         case "$xxx" in
23449         VMS*)
23450                 ;;
23451         *)      nonxs_ext="$nonxs_ext $xxx"
23452                 ;;
23453         esac
23454 done
23455
23456 set X $nonxs_ext
23457 shift
23458 nonxs_ext="$*"
23459
23460 case $usedl in
23461 $define)
23462         $cat <<EOM
23463 A number of extensions are supplied with $package.  You may choose to
23464 compile these extensions for dynamic loading (the default), compile
23465 them into the $package executable (static loading), or not include
23466 them at all.  Answer "none" to include no extensions.
23467 Note that DynaLoader is always built and need not be mentioned here.
23468
23469 EOM
23470         case "$dynamic_ext" in
23471         '')
23472                 : Exclude those listed in static_ext
23473                 dflt=''
23474                 for xxx in $avail_ext; do
23475                         case " $static_ext " in
23476                         *" $xxx "*) ;;
23477                         *) dflt="$dflt $xxx" ;;
23478                         esac
23479                 done
23480                 set X $dflt
23481                 shift
23482                 dflt="$*"
23483                 ;;
23484         *)      dflt="$dynamic_ext"
23485                 # Perhaps we are reusing an old out-of-date config.sh.
23486                 case "$hint" in
23487                 previous)
23488                         if test X"$dynamic_ext" != X"$avail_ext"; then
23489                                 $cat <<EOM
23490 NOTICE:  Your previous config.sh list may be incorrect.
23491 The extensions now available to you are
23492         ${avail_ext}
23493 but the default list from your previous config.sh is
23494         ${dynamic_ext}
23495
23496 EOM
23497                         fi
23498                         ;;
23499                 esac
23500                 ;;
23501         esac
23502         case "$dflt" in
23503         '')     dflt=none;;
23504         esac
23505         rp="What extensions do you wish to load dynamically?"
23506         . ./myread
23507         case "$ans" in
23508         none) dynamic_ext=' ' ;;
23509         *) dynamic_ext="$ans" ;;
23510         esac
23511
23512         case "$static_ext" in
23513         '')
23514                 : Exclude those already listed in dynamic linking
23515                 dflt=''
23516                 for xxx in $avail_ext; do
23517                         case " $dynamic_ext " in
23518                         *" $xxx "*) ;;
23519                         *) dflt="$dflt $xxx" ;;
23520                         esac
23521                 done
23522                 set X $dflt
23523                 shift
23524                 dflt="$*"
23525                 ;;
23526         *)  dflt="$static_ext"
23527                 ;;
23528         esac
23529
23530         case "$dflt" in
23531         '')     dflt=none;;
23532         esac
23533         rp="What extensions do you wish to load statically?"
23534         . ./myread
23535         case "$ans" in
23536         none) static_ext=' ' ;;
23537         *) static_ext="$ans" ;;
23538         esac
23539         ;;
23540 *)
23541         $cat <<EOM
23542 A number of extensions are supplied with $package.  Answer "none"
23543 to include no extensions.
23544 Note that DynaLoader is always built and need not be mentioned here.
23545
23546 EOM
23547         case "$static_ext" in
23548         '') dflt="$avail_ext" ;;
23549         *)      dflt="$static_ext"
23550                 # Perhaps we are reusing an old out-of-date config.sh.
23551                 case "$hint" in
23552                 previous)
23553                         if test X"$static_ext" != X"$avail_ext"; then
23554                                 $cat <<EOM
23555 NOTICE:  Your previous config.sh list may be incorrect.
23556 The extensions now available to you are
23557         ${avail_ext}
23558 but the default list from your previous config.sh is
23559         ${static_ext}
23560
23561 EOM
23562                         fi
23563                         ;;
23564                 esac
23565                 ;;
23566         esac
23567         : Exclude those that are not xs extensions
23568         case "$dflt" in
23569         '')     dflt=none;;
23570         esac
23571         rp="What extensions do you wish to include?"
23572         . ./myread
23573         case "$ans" in
23574         none) static_ext=' ' ;;
23575         *) static_ext="$ans" ;;
23576         esac
23577         ;;
23578 esac
23579 #
23580 # Encode is a special case.  If we are building Encode as a static
23581 # extension, we need to explicitly list its subextensions as well.
23582 # For other nested extensions, this is handled automatically by
23583 # the appropriate Makefile.PL.
23584 case " $static_ext " in
23585         *" Encode "*) # Add the subextensions of Encode
23586         cd "$rsrc/cpan"
23587         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23588                 static_ext="$static_ext Encode/$xxx"
23589                 known_extensions="$known_extensions Encode/$xxx"
23590         done
23591         cd "$tdir"
23592         ;;
23593 esac
23594
23595 set X $dynamic_ext $static_ext $nonxs_ext
23596 shift
23597 extensions="$*"
23598
23599 # Sanity check:  We require an extension suitable for use with
23600 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23601 # should show up as failures in the test suite, but it's helpful to
23602 # catch them now.) The 'extensions' list is normally sorted
23603 # alphabetically, so we need to accept either
23604 #    DB_File ... Fcntl ... IO  ....
23605 # or something like
23606 #    Fcntl ... NDBM_File ... IO  ....
23607 case " $extensions"  in
23608 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23609 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23610 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23611 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23612    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23613    ;;
23614 esac
23615
23616 : Remove libraries needed only for extensions
23617 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23618 : The exception is SunOS 4.x, which needs them.
23619 case "${osname}X${osvers}" in
23620 sunos*X4*)
23621     perllibs="$libs"
23622     ;;
23623 *) case "$usedl" in
23624     $define|true|[yY]*)
23625             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23626             shift
23627             perllibs="$*"
23628             ;;
23629     *)  perllibs="$libs"
23630             ;;
23631     esac
23632     ;;
23633 esac
23634
23635 : Remove build directory name from cppstdin so it can be used from
23636 : either the present location or the final installed location.
23637 echo " "
23638 : Get out of the UU directory to get correct path name.
23639 cd ..
23640 case "$cppstdin" in
23641 `pwd`/cppstdin)
23642         echo "Stripping down cppstdin path name"
23643         cppstdin=cppstdin
23644         ;;
23645 esac
23646 cd UU
23647
23648 : end of configuration questions
23649 echo " "
23650 echo "End of configuration questions."
23651 echo " "
23652
23653 : back to where it started
23654 if test -d ../UU; then
23655         cd ..
23656 fi
23657
23658 : configuration may be unconditionally patched via a 'config.arch' file
23659 if $test -f config.arch; then
23660         echo "I see a config.arch file, loading it." >&4
23661         . ./config.arch
23662 fi
23663
23664 : configuration may be patched via a 'config.over' file
23665 if $test -f config.over; then
23666         echo " "
23667         dflt=y
23668         rp='I see a config.over file.  Do you wish to load it?'
23669         . UU/myread
23670         case "$ans" in
23671         n*) echo "OK, I'll ignore it.";;
23672         *)      . ./config.over
23673                 echo "Configuration override changes have been loaded."
23674                 ;;
23675         esac
23676 fi
23677
23678 : in case they want portability, strip down executable paths
23679 case "$d_portable" in
23680 "$define")
23681         echo " "
23682         echo "Stripping down executable paths..." >&4
23683         for file in $loclist $trylist; do
23684                 eval temp=\$$file
23685                 eval $file=`basename $temp`
23686         done
23687         ;;
23688 esac
23689
23690 : create config.sh file
23691 echo " "
23692 echo "Creating config.sh..." >&4
23693 $spitshell <<EOT >config.sh
23694 $startsh
23695 #
23696 # This file was produced by running the Configure script. It holds all the
23697 # definitions figured out by Configure. Should you modify one of these values,
23698 # do not forget to propagate your changes by running "Configure -der". You may
23699 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23700 #
23701
23702 # Package name      : $package
23703 # Source directory  : $src
23704 # Configuration time: $cf_time
23705 # Configured by     : $cf_by
23706 # Target system     : $myuname
23707
23708 EOT
23709 : Add in command line options if available
23710 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23711
23712 $spitshell <<EOT >>config.sh
23713
23714 Author='$Author'
23715 Date='$Date'
23716 Header='$Header'
23717 Id='$Id'
23718 Locker='$Locker'
23719 Log='$Log'
23720 RCSfile='$RCSfile'
23721 Revision='$Revision'
23722 Source='$Source'
23723 State='$State'
23724 _a='$_a'
23725 _exe='$_exe'
23726 _o='$_o'
23727 afs='$afs'
23728 afsroot='$afsroot'
23729 alignbytes='$alignbytes'
23730 aphostname='$aphostname'
23731 api_revision='$api_revision'
23732 api_subversion='$api_subversion'
23733 api_version='$api_version'
23734 api_versionstring='$api_versionstring'
23735 ar='$ar'
23736 archlib='$archlib'
23737 archlibexp='$archlibexp'
23738 archname64='$archname64'
23739 archname='$archname'
23740 archobjs='$archobjs'
23741 asctime_r_proto='$asctime_r_proto'
23742 awk='$awk'
23743 baserev='$baserev'
23744 bash='$bash'
23745 bin='$bin'
23746 bin_ELF='$bin_ELF'
23747 binexp='$binexp'
23748 bison='$bison'
23749 byacc='$byacc'
23750 byteorder='$byteorder'
23751 c='$c'
23752 castflags='$castflags'
23753 cat='$cat'
23754 cc='$cc'
23755 cccdlflags='$cccdlflags'
23756 ccdlflags='$ccdlflags'
23757 ccflags='$ccflags'
23758 ccflags_uselargefiles='$ccflags_uselargefiles'
23759 ccname='$ccname'
23760 ccsymbols='$ccsymbols'
23761 ccversion='$ccversion'
23762 cf_by='$cf_by'
23763 cf_email='$cf_email'
23764 cf_time='$cf_time'
23765 charbits='$charbits'
23766 charsize='$charsize'
23767 chgrp='$chgrp'
23768 chmod='$chmod'
23769 chown='$chown'
23770 clocktype='$clocktype'
23771 comm='$comm'
23772 compress='$compress'
23773 contains='$contains'
23774 cp='$cp'
23775 cpio='$cpio'
23776 cpp='$cpp'
23777 cpp_stuff='$cpp_stuff'
23778 cppccsymbols='$cppccsymbols'
23779 cppflags='$cppflags'
23780 cpplast='$cpplast'
23781 cppminus='$cppminus'
23782 cpprun='$cpprun'
23783 cppstdin='$cppstdin'
23784 cppsymbols='$cppsymbols'
23785 crypt_r_proto='$crypt_r_proto'
23786 cryptlib='$cryptlib'
23787 csh='$csh'
23788 ctermid_r_proto='$ctermid_r_proto'
23789 ctime_r_proto='$ctime_r_proto'
23790 d_Gconvert='$d_Gconvert'
23791 d_PRIEUldbl='$d_PRIEUldbl'
23792 d_PRIFUldbl='$d_PRIFUldbl'
23793 d_PRIGUldbl='$d_PRIGUldbl'
23794 d_PRIXU64='$d_PRIXU64'
23795 d_PRId64='$d_PRId64'
23796 d_PRIeldbl='$d_PRIeldbl'
23797 d_PRIfldbl='$d_PRIfldbl'
23798 d_PRIgldbl='$d_PRIgldbl'
23799 d_PRIi64='$d_PRIi64'
23800 d_PRIo64='$d_PRIo64'
23801 d_PRIu64='$d_PRIu64'
23802 d_PRIx64='$d_PRIx64'
23803 d_SCNfldbl='$d_SCNfldbl'
23804 d__fwalk='$d__fwalk'
23805 d_accept4='$d_accept4'
23806 d_access='$d_access'
23807 d_accessx='$d_accessx'
23808 d_acosh='$d_acosh'
23809 d_aintl='$d_aintl'
23810 d_alarm='$d_alarm'
23811 d_archlib='$d_archlib'
23812 d_asctime64='$d_asctime64'
23813 d_asctime_r='$d_asctime_r'
23814 d_asinh='$d_asinh'
23815 d_atanh='$d_atanh'
23816 d_atolf='$d_atolf'
23817 d_atoll='$d_atoll'
23818 d_attribute_deprecated='$d_attribute_deprecated'
23819 d_attribute_format='$d_attribute_format'
23820 d_attribute_malloc='$d_attribute_malloc'
23821 d_attribute_nonnull='$d_attribute_nonnull'
23822 d_attribute_noreturn='$d_attribute_noreturn'
23823 d_attribute_pure='$d_attribute_pure'
23824 d_attribute_unused='$d_attribute_unused'
23825 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23826 d_backtrace='$d_backtrace'
23827 d_bsd='$d_bsd'
23828 d_bsdgetpgrp='$d_bsdgetpgrp'
23829 d_bsdsetpgrp='$d_bsdsetpgrp'
23830 d_builtin_add_overflow='$d_builtin_add_overflow'
23831 d_builtin_choose_expr='$d_builtin_choose_expr'
23832 d_builtin_expect='$d_builtin_expect'
23833 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23834 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23835 d_c99_variadic_macros='$d_c99_variadic_macros'
23836 d_casti32='$d_casti32'
23837 d_castneg='$d_castneg'
23838 d_cbrt='$d_cbrt'
23839 d_chown='$d_chown'
23840 d_chroot='$d_chroot'
23841 d_chsize='$d_chsize'
23842 d_class='$d_class'
23843 d_clearenv='$d_clearenv'
23844 d_closedir='$d_closedir'
23845 d_cmsghdr_s='$d_cmsghdr_s'
23846 d_const='$d_const'
23847 d_copysign='$d_copysign'
23848 d_copysignl='$d_copysignl'
23849 d_cplusplus='$d_cplusplus'
23850 d_crypt='$d_crypt'
23851 d_crypt_r='$d_crypt_r'
23852 d_csh='$d_csh'
23853 d_ctermid='$d_ctermid'
23854 d_ctermid_r='$d_ctermid_r'
23855 d_ctime64='$d_ctime64'
23856 d_ctime_r='$d_ctime_r'
23857 d_cuserid='$d_cuserid'
23858 d_dbminitproto='$d_dbminitproto'
23859 d_difftime64='$d_difftime64'
23860 d_difftime='$d_difftime'
23861 d_dir_dd_fd='$d_dir_dd_fd'
23862 d_dirfd='$d_dirfd'
23863 d_dirnamlen='$d_dirnamlen'
23864 d_dladdr='$d_dladdr'
23865 d_dlerror='$d_dlerror'
23866 d_dlopen='$d_dlopen'
23867 d_dlsymun='$d_dlsymun'
23868 d_dosuid='$d_dosuid'
23869 d_double_has_inf='$d_double_has_inf'
23870 d_double_has_nan='$d_double_has_nan'
23871 d_double_has_negative_zero='$d_double_has_negative_zero'
23872 d_double_has_subnormals='$d_double_has_subnormals'
23873 d_double_style_cray='$d_double_style_cray'
23874 d_double_style_ibm='$d_double_style_ibm'
23875 d_double_style_ieee='$d_double_style_ieee'
23876 d_double_style_vax='$d_double_style_vax'
23877 d_drand48_r='$d_drand48_r'
23878 d_drand48proto='$d_drand48proto'
23879 d_dup2='$d_dup2'
23880 d_dup3='$d_dup3'
23881 d_duplocale='$d_duplocale'
23882 d_eaccess='$d_eaccess'
23883 d_endgrent='$d_endgrent'
23884 d_endgrent_r='$d_endgrent_r'
23885 d_endhent='$d_endhent'
23886 d_endhostent_r='$d_endhostent_r'
23887 d_endnent='$d_endnent'
23888 d_endnetent_r='$d_endnetent_r'
23889 d_endpent='$d_endpent'
23890 d_endprotoent_r='$d_endprotoent_r'
23891 d_endpwent='$d_endpwent'
23892 d_endpwent_r='$d_endpwent_r'
23893 d_endsent='$d_endsent'
23894 d_endservent_r='$d_endservent_r'
23895 d_eofnblk='$d_eofnblk'
23896 d_erf='$d_erf'
23897 d_erfc='$d_erfc'
23898 d_eunice='$d_eunice'
23899 d_exp2='$d_exp2'
23900 d_expm1='$d_expm1'
23901 d_faststdio='$d_faststdio'
23902 d_fchdir='$d_fchdir'
23903 d_fchmod='$d_fchmod'
23904 d_fchmodat='$d_fchmodat'
23905 d_fchown='$d_fchown'
23906 d_fcntl='$d_fcntl'
23907 d_fcntl_can_lock='$d_fcntl_can_lock'
23908 d_fd_macros='$d_fd_macros'
23909 d_fd_set='$d_fd_set'
23910 d_fdclose='$d_fdclose'
23911 d_fdim='$d_fdim'
23912 d_fds_bits='$d_fds_bits'
23913 d_fegetround='$d_fegetround'
23914 d_fgetpos='$d_fgetpos'
23915 d_finite='$d_finite'
23916 d_finitel='$d_finitel'
23917 d_flexfnam='$d_flexfnam'
23918 d_flock='$d_flock'
23919 d_flockproto='$d_flockproto'
23920 d_fma='$d_fma'
23921 d_fmax='$d_fmax'
23922 d_fmin='$d_fmin'
23923 d_fork='$d_fork'
23924 d_fp_class='$d_fp_class'
23925 d_fp_classify='$d_fp_classify'
23926 d_fp_classl='$d_fp_classl'
23927 d_fpathconf='$d_fpathconf'
23928 d_fpclass='$d_fpclass'
23929 d_fpclassify='$d_fpclassify'
23930 d_fpclassl='$d_fpclassl'
23931 d_fpgetround='$d_fpgetround'
23932 d_fpos64_t='$d_fpos64_t'
23933 d_freelocale='$d_freelocale'
23934 d_frexpl='$d_frexpl'
23935 d_fs_data_s='$d_fs_data_s'
23936 d_fseeko='$d_fseeko'
23937 d_fsetpos='$d_fsetpos'
23938 d_fstatfs='$d_fstatfs'
23939 d_fstatvfs='$d_fstatvfs'
23940 d_fsync='$d_fsync'
23941 d_ftello='$d_ftello'
23942 d_ftime='$d_ftime'
23943 d_futimes='$d_futimes'
23944 d_gai_strerror='$d_gai_strerror'
23945 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23946 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23947 d_getaddrinfo='$d_getaddrinfo'
23948 d_getcwd='$d_getcwd'
23949 d_getespwnam='$d_getespwnam'
23950 d_getfsstat='$d_getfsstat'
23951 d_getgrent='$d_getgrent'
23952 d_getgrent_r='$d_getgrent_r'
23953 d_getgrgid_r='$d_getgrgid_r'
23954 d_getgrnam_r='$d_getgrnam_r'
23955 d_getgrps='$d_getgrps'
23956 d_gethbyaddr='$d_gethbyaddr'
23957 d_gethbyname='$d_gethbyname'
23958 d_gethent='$d_gethent'
23959 d_gethname='$d_gethname'
23960 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23961 d_gethostbyname_r='$d_gethostbyname_r'
23962 d_gethostent_r='$d_gethostent_r'
23963 d_gethostprotos='$d_gethostprotos'
23964 d_getitimer='$d_getitimer'
23965 d_getlogin='$d_getlogin'
23966 d_getlogin_r='$d_getlogin_r'
23967 d_getmnt='$d_getmnt'
23968 d_getmntent='$d_getmntent'
23969 d_getnameinfo='$d_getnameinfo'
23970 d_getnbyaddr='$d_getnbyaddr'
23971 d_getnbyname='$d_getnbyname'
23972 d_getnent='$d_getnent'
23973 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23974 d_getnetbyname_r='$d_getnetbyname_r'
23975 d_getnetent_r='$d_getnetent_r'
23976 d_getnetprotos='$d_getnetprotos'
23977 d_getpagsz='$d_getpagsz'
23978 d_getpbyname='$d_getpbyname'
23979 d_getpbynumber='$d_getpbynumber'
23980 d_getpent='$d_getpent'
23981 d_getpgid='$d_getpgid'
23982 d_getpgrp2='$d_getpgrp2'
23983 d_getpgrp='$d_getpgrp'
23984 d_getppid='$d_getppid'
23985 d_getprior='$d_getprior'
23986 d_getprotobyname_r='$d_getprotobyname_r'
23987 d_getprotobynumber_r='$d_getprotobynumber_r'
23988 d_getprotoent_r='$d_getprotoent_r'
23989 d_getprotoprotos='$d_getprotoprotos'
23990 d_getprpwnam='$d_getprpwnam'
23991 d_getpwent='$d_getpwent'
23992 d_getpwent_r='$d_getpwent_r'
23993 d_getpwnam_r='$d_getpwnam_r'
23994 d_getpwuid_r='$d_getpwuid_r'
23995 d_getsbyname='$d_getsbyname'
23996 d_getsbyport='$d_getsbyport'
23997 d_getsent='$d_getsent'
23998 d_getservbyname_r='$d_getservbyname_r'
23999 d_getservbyport_r='$d_getservbyport_r'
24000 d_getservent_r='$d_getservent_r'
24001 d_getservprotos='$d_getservprotos'
24002 d_getspnam='$d_getspnam'
24003 d_getspnam_r='$d_getspnam_r'
24004 d_gettimeod='$d_gettimeod'
24005 d_gmtime64='$d_gmtime64'
24006 d_gmtime_r='$d_gmtime_r'
24007 d_gnulibc='$d_gnulibc'
24008 d_grpasswd='$d_grpasswd'
24009 d_hasmntopt='$d_hasmntopt'
24010 d_htonl='$d_htonl'
24011 d_hypot='$d_hypot'
24012 d_ilogb='$d_ilogb'
24013 d_ilogbl='$d_ilogbl'
24014 d_inc_version_list='$d_inc_version_list'
24015 d_inetaton='$d_inetaton'
24016 d_inetntop='$d_inetntop'
24017 d_inetpton='$d_inetpton'
24018 d_int64_t='$d_int64_t'
24019 d_ip_mreq='$d_ip_mreq'
24020 d_ip_mreq_source='$d_ip_mreq_source'
24021 d_ipv6_mreq='$d_ipv6_mreq'
24022 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24023 d_isascii='$d_isascii'
24024 d_isblank='$d_isblank'
24025 d_isfinite='$d_isfinite'
24026 d_isfinitel='$d_isfinitel'
24027 d_isinf='$d_isinf'
24028 d_isinfl='$d_isinfl'
24029 d_isless='$d_isless'
24030 d_isnan='$d_isnan'
24031 d_isnanl='$d_isnanl'
24032 d_isnormal='$d_isnormal'
24033 d_j0='$d_j0'
24034 d_j0l='$d_j0l'
24035 d_killpg='$d_killpg'
24036 d_lc_monetary_2008='$d_lc_monetary_2008'
24037 d_lchown='$d_lchown'
24038 d_ldbl_dig='$d_ldbl_dig'
24039 d_ldexpl='$d_ldexpl'
24040 d_lgamma='$d_lgamma'
24041 d_lgamma_r='$d_lgamma_r'
24042 d_libm_lib_version='$d_libm_lib_version'
24043 d_libname_unique='$d_libname_unique'
24044 d_link='$d_link'
24045 d_linkat='$d_linkat'
24046 d_llrint='$d_llrint'
24047 d_llrintl='$d_llrintl'
24048 d_llround='$d_llround'
24049 d_llroundl='$d_llroundl'
24050 d_localeconv_l='$d_localeconv_l'
24051 d_localtime64='$d_localtime64'
24052 d_localtime_r='$d_localtime_r'
24053 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24054 d_locconv='$d_locconv'
24055 d_lockf='$d_lockf'
24056 d_log1p='$d_log1p'
24057 d_log2='$d_log2'
24058 d_logb='$d_logb'
24059 d_long_double_style_ieee='$d_long_double_style_ieee'
24060 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24061 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24062 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24063 d_long_double_style_vax='$d_long_double_style_vax'
24064 d_longdbl='$d_longdbl'
24065 d_longlong='$d_longlong'
24066 d_lrint='$d_lrint'
24067 d_lrintl='$d_lrintl'
24068 d_lround='$d_lround'
24069 d_lroundl='$d_lroundl'
24070 d_lseekproto='$d_lseekproto'
24071 d_lstat='$d_lstat'
24072 d_madvise='$d_madvise'
24073 d_malloc_good_size='$d_malloc_good_size'
24074 d_malloc_size='$d_malloc_size'
24075 d_mblen='$d_mblen'
24076 d_mbrlen='$d_mbrlen'
24077 d_mbrtowc='$d_mbrtowc'
24078 d_mbstowcs='$d_mbstowcs'
24079 d_mbtowc='$d_mbtowc'
24080 d_memmem='$d_memmem'
24081 d_memrchr='$d_memrchr'
24082 d_mkdir='$d_mkdir'
24083 d_mkdtemp='$d_mkdtemp'
24084 d_mkfifo='$d_mkfifo'
24085 d_mkostemp='$d_mkostemp'
24086 d_mkstemp='$d_mkstemp'
24087 d_mkstemps='$d_mkstemps'
24088 d_mktime64='$d_mktime64'
24089 d_mktime='$d_mktime'
24090 d_mmap='$d_mmap'
24091 d_modfl='$d_modfl'
24092 d_modflproto='$d_modflproto'
24093 d_mprotect='$d_mprotect'
24094 d_msg='$d_msg'
24095 d_msg_ctrunc='$d_msg_ctrunc'
24096 d_msg_dontroute='$d_msg_dontroute'
24097 d_msg_oob='$d_msg_oob'
24098 d_msg_peek='$d_msg_peek'
24099 d_msg_proxy='$d_msg_proxy'
24100 d_msgctl='$d_msgctl'
24101 d_msgget='$d_msgget'
24102 d_msghdr_s='$d_msghdr_s'
24103 d_msgrcv='$d_msgrcv'
24104 d_msgsnd='$d_msgsnd'
24105 d_msync='$d_msync'
24106 d_munmap='$d_munmap'
24107 d_mymalloc='$d_mymalloc'
24108 d_nan='$d_nan'
24109 d_nanosleep='$d_nanosleep'
24110 d_ndbm='$d_ndbm'
24111 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24112 d_nearbyint='$d_nearbyint'
24113 d_newlocale='$d_newlocale'
24114 d_nextafter='$d_nextafter'
24115 d_nexttoward='$d_nexttoward'
24116 d_nice='$d_nice'
24117 d_nl_langinfo='$d_nl_langinfo'
24118 d_nv_preserves_uv='$d_nv_preserves_uv'
24119 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24120 d_off64_t='$d_off64_t'
24121 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24122 d_oldpthreads='$d_oldpthreads'
24123 d_oldsock='$d_oldsock'
24124 d_open3='$d_open3'
24125 d_openat='$d_openat'
24126 d_pathconf='$d_pathconf'
24127 d_pause='$d_pause'
24128 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24129 d_phostname='$d_phostname'
24130 d_pipe2='$d_pipe2'
24131 d_pipe='$d_pipe'
24132 d_poll='$d_poll'
24133 d_portable='$d_portable'
24134 d_prctl='$d_prctl'
24135 d_prctl_set_name='$d_prctl_set_name'
24136 d_printf_format_null='$d_printf_format_null'
24137 d_procselfexe='$d_procselfexe'
24138 d_pseudofork='$d_pseudofork'
24139 d_pthread_atfork='$d_pthread_atfork'
24140 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24141 d_pthread_yield='$d_pthread_yield'
24142 d_ptrdiff_t='$d_ptrdiff_t'
24143 d_pwage='$d_pwage'
24144 d_pwchange='$d_pwchange'
24145 d_pwclass='$d_pwclass'
24146 d_pwcomment='$d_pwcomment'
24147 d_pwexpire='$d_pwexpire'
24148 d_pwgecos='$d_pwgecos'
24149 d_pwpasswd='$d_pwpasswd'
24150 d_pwquota='$d_pwquota'
24151 d_qgcvt='$d_qgcvt'
24152 d_quad='$d_quad'
24153 d_querylocale='$d_querylocale'
24154 d_random_r='$d_random_r'
24155 d_re_comp='$d_re_comp'
24156 d_readdir64_r='$d_readdir64_r'
24157 d_readdir='$d_readdir'
24158 d_readdir_r='$d_readdir_r'
24159 d_readlink='$d_readlink'
24160 d_readv='$d_readv'
24161 d_recvmsg='$d_recvmsg'
24162 d_regcmp='$d_regcmp'
24163 d_regcomp='$d_regcomp'
24164 d_remainder='$d_remainder'
24165 d_remquo='$d_remquo'
24166 d_rename='$d_rename'
24167 d_renameat='$d_renameat'
24168 d_rewinddir='$d_rewinddir'
24169 d_rint='$d_rint'
24170 d_rmdir='$d_rmdir'
24171 d_round='$d_round'
24172 d_sbrkproto='$d_sbrkproto'
24173 d_scalbn='$d_scalbn'
24174 d_scalbnl='$d_scalbnl'
24175 d_sched_yield='$d_sched_yield'
24176 d_scm_rights='$d_scm_rights'
24177 d_seekdir='$d_seekdir'
24178 d_select='$d_select'
24179 d_sem='$d_sem'
24180 d_semctl='$d_semctl'
24181 d_semctl_semid_ds='$d_semctl_semid_ds'
24182 d_semctl_semun='$d_semctl_semun'
24183 d_semget='$d_semget'
24184 d_semop='$d_semop'
24185 d_sendmsg='$d_sendmsg'
24186 d_setegid='$d_setegid'
24187 d_seteuid='$d_seteuid'
24188 d_setgrent='$d_setgrent'
24189 d_setgrent_r='$d_setgrent_r'
24190 d_setgrps='$d_setgrps'
24191 d_sethent='$d_sethent'
24192 d_sethostent_r='$d_sethostent_r'
24193 d_setitimer='$d_setitimer'
24194 d_setlinebuf='$d_setlinebuf'
24195 d_setlocale='$d_setlocale'
24196 d_setlocale_r='$d_setlocale_r'
24197 d_setnent='$d_setnent'
24198 d_setnetent_r='$d_setnetent_r'
24199 d_setpent='$d_setpent'
24200 d_setpgid='$d_setpgid'
24201 d_setpgrp2='$d_setpgrp2'
24202 d_setpgrp='$d_setpgrp'
24203 d_setprior='$d_setprior'
24204 d_setproctitle='$d_setproctitle'
24205 d_setprotoent_r='$d_setprotoent_r'
24206 d_setpwent='$d_setpwent'
24207 d_setpwent_r='$d_setpwent_r'
24208 d_setregid='$d_setregid'
24209 d_setresgid='$d_setresgid'
24210 d_setresuid='$d_setresuid'
24211 d_setreuid='$d_setreuid'
24212 d_setrgid='$d_setrgid'
24213 d_setruid='$d_setruid'
24214 d_setsent='$d_setsent'
24215 d_setservent_r='$d_setservent_r'
24216 d_setsid='$d_setsid'
24217 d_setvbuf='$d_setvbuf'
24218 d_shm='$d_shm'
24219 d_shmat='$d_shmat'
24220 d_shmatprototype='$d_shmatprototype'
24221 d_shmctl='$d_shmctl'
24222 d_shmdt='$d_shmdt'
24223 d_shmget='$d_shmget'
24224 d_sigaction='$d_sigaction'
24225 d_siginfo_si_addr='$d_siginfo_si_addr'
24226 d_siginfo_si_band='$d_siginfo_si_band'
24227 d_siginfo_si_errno='$d_siginfo_si_errno'
24228 d_siginfo_si_fd='$d_siginfo_si_fd'
24229 d_siginfo_si_pid='$d_siginfo_si_pid'
24230 d_siginfo_si_status='$d_siginfo_si_status'
24231 d_siginfo_si_uid='$d_siginfo_si_uid'
24232 d_siginfo_si_value='$d_siginfo_si_value'
24233 d_signbit='$d_signbit'
24234 d_sigprocmask='$d_sigprocmask'
24235 d_sigsetjmp='$d_sigsetjmp'
24236 d_sin6_scope_id='$d_sin6_scope_id'
24237 d_sitearch='$d_sitearch'
24238 d_snprintf='$d_snprintf'
24239 d_sockaddr_in6='$d_sockaddr_in6'
24240 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24241 d_sockatmark='$d_sockatmark'
24242 d_sockatmarkproto='$d_sockatmarkproto'
24243 d_socket='$d_socket'
24244 d_socklen_t='$d_socklen_t'
24245 d_sockpair='$d_sockpair'
24246 d_socks5_init='$d_socks5_init'
24247 d_sqrtl='$d_sqrtl'
24248 d_srand48_r='$d_srand48_r'
24249 d_srandom_r='$d_srandom_r'
24250 d_sresgproto='$d_sresgproto'
24251 d_sresuproto='$d_sresuproto'
24252 d_stat='$d_stat'
24253 d_statblks='$d_statblks'
24254 d_statfs_f_flags='$d_statfs_f_flags'
24255 d_statfs_s='$d_statfs_s'
24256 d_static_inline='$d_static_inline'
24257 d_statvfs='$d_statvfs'
24258 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24259 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24260 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24261 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24262 d_stdio_stream_array='$d_stdio_stream_array'
24263 d_stdiobase='$d_stdiobase'
24264 d_stdstdio='$d_stdstdio'
24265 d_strcoll='$d_strcoll'
24266 d_strerror_l='$d_strerror_l'
24267 d_strerror_r='$d_strerror_r'
24268 d_strftime='$d_strftime'
24269 d_strlcat='$d_strlcat'
24270 d_strlcpy='$d_strlcpy'
24271 d_strnlen='$d_strnlen'
24272 d_strtod='$d_strtod'
24273 d_strtod_l='$d_strtod_l'
24274 d_strtol='$d_strtol'
24275 d_strtold='$d_strtold'
24276 d_strtold_l='$d_strtold_l'
24277 d_strtoll='$d_strtoll'
24278 d_strtoq='$d_strtoq'
24279 d_strtoul='$d_strtoul'
24280 d_strtoull='$d_strtoull'
24281 d_strtouq='$d_strtouq'
24282 d_strxfrm='$d_strxfrm'
24283 d_suidsafe='$d_suidsafe'
24284 d_symlink='$d_symlink'
24285 d_syscall='$d_syscall'
24286 d_syscallproto='$d_syscallproto'
24287 d_sysconf='$d_sysconf'
24288 d_sysernlst='$d_sysernlst'
24289 d_syserrlst='$d_syserrlst'
24290 d_system='$d_system'
24291 d_tcgetpgrp='$d_tcgetpgrp'
24292 d_tcsetpgrp='$d_tcsetpgrp'
24293 d_telldir='$d_telldir'
24294 d_telldirproto='$d_telldirproto'
24295 d_tgamma='$d_tgamma'
24296 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24297 d_time='$d_time'
24298 d_timegm='$d_timegm'
24299 d_times='$d_times'
24300 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24301 d_tm_tm_zone='$d_tm_tm_zone'
24302 d_tmpnam_r='$d_tmpnam_r'
24303 d_trunc='$d_trunc'
24304 d_truncate='$d_truncate'
24305 d_truncl='$d_truncl'
24306 d_ttyname_r='$d_ttyname_r'
24307 d_tzname='$d_tzname'
24308 d_u32align='$d_u32align'
24309 d_ualarm='$d_ualarm'
24310 d_umask='$d_umask'
24311 d_uname='$d_uname'
24312 d_union_semun='$d_union_semun'
24313 d_unlinkat='$d_unlinkat'
24314 d_unordered='$d_unordered'
24315 d_unsetenv='$d_unsetenv'
24316 d_uselocale='$d_uselocale'
24317 d_usleep='$d_usleep'
24318 d_usleepproto='$d_usleepproto'
24319 d_ustat='$d_ustat'
24320 d_vendorarch='$d_vendorarch'
24321 d_vendorbin='$d_vendorbin'
24322 d_vendorlib='$d_vendorlib'
24323 d_vendorscript='$d_vendorscript'
24324 d_vfork='$d_vfork'
24325 d_void_closedir='$d_void_closedir'
24326 d_voidsig='$d_voidsig'
24327 d_voidtty='$d_voidtty'
24328 d_vsnprintf='$d_vsnprintf'
24329 d_wait4='$d_wait4'
24330 d_waitpid='$d_waitpid'
24331 d_wcscmp='$d_wcscmp'
24332 d_wcstombs='$d_wcstombs'
24333 d_wcsxfrm='$d_wcsxfrm'
24334 d_wctomb='$d_wctomb'
24335 d_writev='$d_writev'
24336 d_xenix='$d_xenix'
24337 date='$date'
24338 db_hashtype='$db_hashtype'
24339 db_prefixtype='$db_prefixtype'
24340 db_version_major='$db_version_major'
24341 db_version_minor='$db_version_minor'
24342 db_version_patch='$db_version_patch'
24343 default_inc_excludes_dot='$default_inc_excludes_dot'
24344 direntrytype='$direntrytype'
24345 dlext='$dlext'
24346 dlsrc='$dlsrc'
24347 doubleinfbytes='$doubleinfbytes'
24348 doublekind='$doublekind'
24349 doublemantbits='$doublemantbits'
24350 doublenanbytes='$doublenanbytes'
24351 doublesize='$doublesize'
24352 drand01='$drand01'
24353 drand48_r_proto='$drand48_r_proto'
24354 dtrace='$dtrace'
24355 dtraceobject='$dtraceobject'
24356 dtracexnolibs='$dtracexnolibs'
24357 dynamic_ext='$dynamic_ext'
24358 eagain='$eagain'
24359 ebcdic='$ebcdic'
24360 echo='$echo'
24361 egrep='$egrep'
24362 emacs='$emacs'
24363 endgrent_r_proto='$endgrent_r_proto'
24364 endhostent_r_proto='$endhostent_r_proto'
24365 endnetent_r_proto='$endnetent_r_proto'
24366 endprotoent_r_proto='$endprotoent_r_proto'
24367 endpwent_r_proto='$endpwent_r_proto'
24368 endservent_r_proto='$endservent_r_proto'
24369 eunicefix='$eunicefix'
24370 exe_ext='$exe_ext'
24371 expr='$expr'
24372 extensions='$extensions'
24373 extern_C='$extern_C'
24374 extras='$extras'
24375 fflushNULL='$fflushNULL'
24376 fflushall='$fflushall'
24377 find='$find'
24378 firstmakefile='$firstmakefile'
24379 flex='$flex'
24380 fpossize='$fpossize'
24381 fpostype='$fpostype'
24382 freetype='$freetype'
24383 from='$from'
24384 full_ar='$full_ar'
24385 full_csh='$full_csh'
24386 full_sed='$full_sed'
24387 gccansipedantic='$gccansipedantic'
24388 gccosandvers='$gccosandvers'
24389 gccversion='$gccversion'
24390 getgrent_r_proto='$getgrent_r_proto'
24391 getgrgid_r_proto='$getgrgid_r_proto'
24392 getgrnam_r_proto='$getgrnam_r_proto'
24393 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24394 gethostbyname_r_proto='$gethostbyname_r_proto'
24395 gethostent_r_proto='$gethostent_r_proto'
24396 getlogin_r_proto='$getlogin_r_proto'
24397 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24398 getnetbyname_r_proto='$getnetbyname_r_proto'
24399 getnetent_r_proto='$getnetent_r_proto'
24400 getprotobyname_r_proto='$getprotobyname_r_proto'
24401 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24402 getprotoent_r_proto='$getprotoent_r_proto'
24403 getpwent_r_proto='$getpwent_r_proto'
24404 getpwnam_r_proto='$getpwnam_r_proto'
24405 getpwuid_r_proto='$getpwuid_r_proto'
24406 getservbyname_r_proto='$getservbyname_r_proto'
24407 getservbyport_r_proto='$getservbyport_r_proto'
24408 getservent_r_proto='$getservent_r_proto'
24409 getspnam_r_proto='$getspnam_r_proto'
24410 gidformat='$gidformat'
24411 gidsign='$gidsign'
24412 gidsize='$gidsize'
24413 gidtype='$gidtype'
24414 glibpth='$glibpth'
24415 gmake='$gmake'
24416 gmtime_r_proto='$gmtime_r_proto'
24417 gnulibc_version='$gnulibc_version'
24418 grep='$grep'
24419 groupcat='$groupcat'
24420 groupstype='$groupstype'
24421 gzip='$gzip'
24422 h_fcntl='$h_fcntl'
24423 h_sysfile='$h_sysfile'
24424 hint='$hint'
24425 hostcat='$hostcat'
24426 hostgenerate='$hostgenerate'
24427 hostosname='$hostosname'
24428 hostperl='$hostperl'
24429 html1dir='$html1dir'
24430 html1direxp='$html1direxp'
24431 html3dir='$html3dir'
24432 html3direxp='$html3direxp'
24433 i16size='$i16size'
24434 i16type='$i16type'
24435 i32size='$i32size'
24436 i32type='$i32type'
24437 i64size='$i64size'
24438 i64type='$i64type'
24439 i8size='$i8size'
24440 i8type='$i8type'
24441 i_arpainet='$i_arpainet'
24442 i_bfd='$i_bfd'
24443 i_bsdioctl='$i_bsdioctl'
24444 i_crypt='$i_crypt'
24445 i_db='$i_db'
24446 i_dbm='$i_dbm'
24447 i_dirent='$i_dirent'
24448 i_dlfcn='$i_dlfcn'
24449 i_execinfo='$i_execinfo'
24450 i_fcntl='$i_fcntl'
24451 i_fenv='$i_fenv'
24452 i_fp='$i_fp'
24453 i_fp_class='$i_fp_class'
24454 i_gdbm='$i_gdbm'
24455 i_gdbm_ndbm='$i_gdbm_ndbm'
24456 i_gdbmndbm='$i_gdbmndbm'
24457 i_grp='$i_grp'
24458 i_ieeefp='$i_ieeefp'
24459 i_inttypes='$i_inttypes'
24460 i_langinfo='$i_langinfo'
24461 i_libutil='$i_libutil'
24462 i_locale='$i_locale'
24463 i_machcthr='$i_machcthr'
24464 i_malloc='$i_malloc'
24465 i_mallocmalloc='$i_mallocmalloc'
24466 i_mntent='$i_mntent'
24467 i_ndbm='$i_ndbm'
24468 i_netdb='$i_netdb'
24469 i_neterrno='$i_neterrno'
24470 i_netinettcp='$i_netinettcp'
24471 i_niin='$i_niin'
24472 i_poll='$i_poll'
24473 i_prot='$i_prot'
24474 i_pthread='$i_pthread'
24475 i_pwd='$i_pwd'
24476 i_quadmath='$i_quadmath'
24477 i_rpcsvcdbm='$i_rpcsvcdbm'
24478 i_sgtty='$i_sgtty'
24479 i_shadow='$i_shadow'
24480 i_socks='$i_socks'
24481 i_stdbool='$i_stdbool'
24482 i_stdint='$i_stdint'
24483 i_stdlib='$i_stdlib'
24484 i_sunmath='$i_sunmath'
24485 i_sysaccess='$i_sysaccess'
24486 i_sysdir='$i_sysdir'
24487 i_sysfile='$i_sysfile'
24488 i_sysfilio='$i_sysfilio'
24489 i_sysin='$i_sysin'
24490 i_sysioctl='$i_sysioctl'
24491 i_syslog='$i_syslog'
24492 i_sysmman='$i_sysmman'
24493 i_sysmode='$i_sysmode'
24494 i_sysmount='$i_sysmount'
24495 i_sysndir='$i_sysndir'
24496 i_sysparam='$i_sysparam'
24497 i_syspoll='$i_syspoll'
24498 i_sysresrc='$i_sysresrc'
24499 i_syssecrt='$i_syssecrt'
24500 i_sysselct='$i_sysselct'
24501 i_syssockio='$i_syssockio'
24502 i_sysstat='$i_sysstat'
24503 i_sysstatfs='$i_sysstatfs'
24504 i_sysstatvfs='$i_sysstatvfs'
24505 i_systime='$i_systime'
24506 i_systimek='$i_systimek'
24507 i_systimes='$i_systimes'
24508 i_systypes='$i_systypes'
24509 i_sysuio='$i_sysuio'
24510 i_sysun='$i_sysun'
24511 i_sysutsname='$i_sysutsname'
24512 i_sysvfs='$i_sysvfs'
24513 i_syswait='$i_syswait'
24514 i_termio='$i_termio'
24515 i_termios='$i_termios'
24516 i_time='$i_time'
24517 i_unistd='$i_unistd'
24518 i_ustat='$i_ustat'
24519 i_utime='$i_utime'
24520 i_vfork='$i_vfork'
24521 i_wchar='$i_wchar'
24522 i_xlocale='$i_xlocale'
24523 ignore_versioned_solibs='$ignore_versioned_solibs'
24524 inc_version_list='$inc_version_list'
24525 inc_version_list_init='$inc_version_list_init'
24526 incpath='$incpath'
24527 incpth='$incpth'
24528 inews='$inews'
24529 initialinstalllocation='$initialinstalllocation'
24530 installarchlib='$installarchlib'
24531 installbin='$installbin'
24532 installhtml1dir='$installhtml1dir'
24533 installhtml3dir='$installhtml3dir'
24534 installman1dir='$installman1dir'
24535 installman3dir='$installman3dir'
24536 installprefix='$installprefix'
24537 installprefixexp='$installprefixexp'
24538 installprivlib='$installprivlib'
24539 installscript='$installscript'
24540 installsitearch='$installsitearch'
24541 installsitebin='$installsitebin'
24542 installsitehtml1dir='$installsitehtml1dir'
24543 installsitehtml3dir='$installsitehtml3dir'
24544 installsitelib='$installsitelib'
24545 installsiteman1dir='$installsiteman1dir'
24546 installsiteman3dir='$installsiteman3dir'
24547 installsitescript='$installsitescript'
24548 installstyle='$installstyle'
24549 installusrbinperl='$installusrbinperl'
24550 installvendorarch='$installvendorarch'
24551 installvendorbin='$installvendorbin'
24552 installvendorhtml1dir='$installvendorhtml1dir'
24553 installvendorhtml3dir='$installvendorhtml3dir'
24554 installvendorlib='$installvendorlib'
24555 installvendorman1dir='$installvendorman1dir'
24556 installvendorman3dir='$installvendorman3dir'
24557 installvendorscript='$installvendorscript'
24558 intsize='$intsize'
24559 issymlink='$issymlink'
24560 ivdformat='$ivdformat'
24561 ivsize='$ivsize'
24562 ivtype='$ivtype'
24563 known_extensions='$known_extensions'
24564 ksh='$ksh'
24565 ld='$ld'
24566 ld_can_script='$ld_can_script'
24567 lddlflags='$lddlflags'
24568 ldflags='$ldflags'
24569 ldflags_uselargefiles='$ldflags_uselargefiles'
24570 ldlibpthname='$ldlibpthname'
24571 less='$less'
24572 lib_ext='$lib_ext'
24573 libc='$libc'
24574 libperl='$libperl'
24575 libpth='$libpth'
24576 libs='$libs'
24577 libsdirs='$libsdirs'
24578 libsfiles='$libsfiles'
24579 libsfound='$libsfound'
24580 libspath='$libspath'
24581 libswanted='$libswanted'
24582 libswanted_uselargefiles='$libswanted_uselargefiles'
24583 line='$line'
24584 lint='$lint'
24585 lkflags='$lkflags'
24586 ln='$ln'
24587 lns='$lns'
24588 localtime_r_proto='$localtime_r_proto'
24589 locincpth='$locincpth'
24590 loclibpth='$loclibpth'
24591 longdblinfbytes='$longdblinfbytes'
24592 longdblkind='$longdblkind'
24593 longdblmantbits='$longdblmantbits'
24594 longdblnanbytes='$longdblnanbytes'
24595 longdblsize='$longdblsize'
24596 longlongsize='$longlongsize'
24597 longsize='$longsize'
24598 lp='$lp'
24599 lpr='$lpr'
24600 ls='$ls'
24601 lseeksize='$lseeksize'
24602 lseektype='$lseektype'
24603 mail='$mail'
24604 mailx='$mailx'
24605 make='$make'
24606 make_set_make='$make_set_make'
24607 mallocobj='$mallocobj'
24608 mallocsrc='$mallocsrc'
24609 malloctype='$malloctype'
24610 man1dir='$man1dir'
24611 man1direxp='$man1direxp'
24612 man1ext='$man1ext'
24613 man3dir='$man3dir'
24614 man3direxp='$man3direxp'
24615 man3ext='$man3ext'
24616 mips_type='$mips_type'
24617 mistrustnm='$mistrustnm'
24618 mkdir='$mkdir'
24619 mmaptype='$mmaptype'
24620 modetype='$modetype'
24621 more='$more'
24622 multiarch='$multiarch'
24623 mv='$mv'
24624 myarchname='$myarchname'
24625 mydomain='$mydomain'
24626 myhostname='$myhostname'
24627 myuname='$myuname'
24628 n='$n'
24629 need_va_copy='$need_va_copy'
24630 netdb_hlen_type='$netdb_hlen_type'
24631 netdb_host_type='$netdb_host_type'
24632 netdb_name_type='$netdb_name_type'
24633 netdb_net_type='$netdb_net_type'
24634 nm='$nm'
24635 nm_opt='$nm_opt'
24636 nm_so_opt='$nm_so_opt'
24637 nonxs_ext='$nonxs_ext'
24638 nroff='$nroff'
24639 nvEUformat='$nvEUformat'
24640 nvFUformat='$nvFUformat'
24641 nvGUformat='$nvGUformat'
24642 nv_overflows_integers_at='$nv_overflows_integers_at'
24643 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24644 nveformat='$nveformat'
24645 nvfformat='$nvfformat'
24646 nvgformat='$nvgformat'
24647 nvmantbits='$nvmantbits'
24648 nvsize='$nvsize'
24649 nvtype='$nvtype'
24650 o_nonblock='$o_nonblock'
24651 obj_ext='$obj_ext'
24652 old_pthread_create_joinable='$old_pthread_create_joinable'
24653 optimize='$optimize'
24654 orderlib='$orderlib'
24655 osname='$osname'
24656 osvers='$osvers'
24657 otherlibdirs='$otherlibdirs'
24658 package='$package'
24659 pager='$pager'
24660 passcat='$passcat'
24661 patchlevel='$patchlevel'
24662 path_sep='$path_sep'
24663 perl5='$perl5'
24664 perl='$perl'
24665 perl_patchlevel='$perl_patchlevel'
24666 perl_static_inline='$perl_static_inline'
24667 perladmin='$perladmin'
24668 perllibs='$perllibs'
24669 perlpath='$perlpath'
24670 pg='$pg'
24671 phostname='$phostname'
24672 pidtype='$pidtype'
24673 plibpth='$plibpth'
24674 pmake='$pmake'
24675 pr='$pr'
24676 prefix='$prefix'
24677 prefixexp='$prefixexp'
24678 privlib='$privlib'
24679 privlibexp='$privlibexp'
24680 procselfexe='$procselfexe'
24681 ptrsize='$ptrsize'
24682 quadkind='$quadkind'
24683 quadtype='$quadtype'
24684 randbits='$randbits'
24685 randfunc='$randfunc'
24686 random_r_proto='$random_r_proto'
24687 randseedtype='$randseedtype'
24688 ranlib='$ranlib'
24689 rd_nodata='$rd_nodata'
24690 readdir64_r_proto='$readdir64_r_proto'
24691 readdir_r_proto='$readdir_r_proto'
24692 revision='$revision'
24693 rm='$rm'
24694 rm_try='$rm_try'
24695 rmail='$rmail'
24696 run='$run'
24697 runnm='$runnm'
24698 sGMTIME_max='$sGMTIME_max'
24699 sGMTIME_min='$sGMTIME_min'
24700 sLOCALTIME_max='$sLOCALTIME_max'
24701 sLOCALTIME_min='$sLOCALTIME_min'
24702 sPRIEUldbl='$sPRIEUldbl'
24703 sPRIFUldbl='$sPRIFUldbl'
24704 sPRIGUldbl='$sPRIGUldbl'
24705 sPRIXU64='$sPRIXU64'
24706 sPRId64='$sPRId64'
24707 sPRIeldbl='$sPRIeldbl'
24708 sPRIfldbl='$sPRIfldbl'
24709 sPRIgldbl='$sPRIgldbl'
24710 sPRIi64='$sPRIi64'
24711 sPRIo64='$sPRIo64'
24712 sPRIu64='$sPRIu64'
24713 sPRIx64='$sPRIx64'
24714 sSCNfldbl='$sSCNfldbl'
24715 sched_yield='$sched_yield'
24716 scriptdir='$scriptdir'
24717 scriptdirexp='$scriptdirexp'
24718 sed='$sed'
24719 seedfunc='$seedfunc'
24720 selectminbits='$selectminbits'
24721 selecttype='$selecttype'
24722 sendmail='$sendmail'
24723 setgrent_r_proto='$setgrent_r_proto'
24724 sethostent_r_proto='$sethostent_r_proto'
24725 setlocale_r_proto='$setlocale_r_proto'
24726 setnetent_r_proto='$setnetent_r_proto'
24727 setprotoent_r_proto='$setprotoent_r_proto'
24728 setpwent_r_proto='$setpwent_r_proto'
24729 setservent_r_proto='$setservent_r_proto'
24730 sh='$sh'
24731 shar='$shar'
24732 sharpbang='$sharpbang'
24733 shmattype='$shmattype'
24734 shortsize='$shortsize'
24735 shrpenv='$shrpenv'
24736 shsharp='$shsharp'
24737 sig_count='$sig_count'
24738 sig_name='$sig_name'
24739 sig_name_init='$sig_name_init'
24740 sig_num='$sig_num'
24741 sig_num_init='$sig_num_init'
24742 sig_size='$sig_size'
24743 signal_t='$signal_t'
24744 sitearch='$sitearch'
24745 sitearchexp='$sitearchexp'
24746 sitebin='$sitebin'
24747 sitebinexp='$sitebinexp'
24748 sitehtml1dir='$sitehtml1dir'
24749 sitehtml1direxp='$sitehtml1direxp'
24750 sitehtml3dir='$sitehtml3dir'
24751 sitehtml3direxp='$sitehtml3direxp'
24752 sitelib='$sitelib'
24753 sitelib_stem='$sitelib_stem'
24754 sitelibexp='$sitelibexp'
24755 siteman1dir='$siteman1dir'
24756 siteman1direxp='$siteman1direxp'
24757 siteman3dir='$siteman3dir'
24758 siteman3direxp='$siteman3direxp'
24759 siteprefix='$siteprefix'
24760 siteprefixexp='$siteprefixexp'
24761 sitescript='$sitescript'
24762 sitescriptexp='$sitescriptexp'
24763 sizesize='$sizesize'
24764 sizetype='$sizetype'
24765 sleep='$sleep'
24766 smail='$smail'
24767 so='$so'
24768 sockethdr='$sockethdr'
24769 socketlib='$socketlib'
24770 socksizetype='$socksizetype'
24771 sort='$sort'
24772 spackage='$spackage'
24773 spitshell='$spitshell'
24774 srand48_r_proto='$srand48_r_proto'
24775 srandom_r_proto='$srandom_r_proto'
24776 src='$src'
24777 ssizetype='$ssizetype'
24778 st_ino_sign='$st_ino_sign'
24779 st_ino_size='$st_ino_size'
24780 startperl='$startperl'
24781 startsh='$startsh'
24782 static_ext='$static_ext'
24783 stdchar='$stdchar'
24784 stdio_base='$stdio_base'
24785 stdio_bufsiz='$stdio_bufsiz'
24786 stdio_cnt='$stdio_cnt'
24787 stdio_filbuf='$stdio_filbuf'
24788 stdio_ptr='$stdio_ptr'
24789 stdio_stream_array='$stdio_stream_array'
24790 strerror_r_proto='$strerror_r_proto'
24791 submit='$submit'
24792 subversion='$subversion'
24793 sysman='$sysman'
24794 sysroot='$sysroot'
24795 tail='$tail'
24796 tar='$tar'
24797 targetarch='$targetarch'
24798 targetdir='$targetdir'
24799 targetenv='$targetenv'
24800 targethost='$targethost'
24801 targetmkdir='$targetmkdir'
24802 targetport='$targetport'
24803 targetsh='$targetsh'
24804 tbl='$tbl'
24805 tee='$tee'
24806 test='$test'
24807 timeincl='$timeincl'
24808 timetype='$timetype'
24809 tmpnam_r_proto='$tmpnam_r_proto'
24810 to='$to'
24811 touch='$touch'
24812 tr='$tr'
24813 trnl='$trnl'
24814 troff='$troff'
24815 ttyname_r_proto='$ttyname_r_proto'
24816 u16size='$u16size'
24817 u16type='$u16type'
24818 u32size='$u32size'
24819 u32type='$u32type'
24820 u64size='$u64size'
24821 u64type='$u64type'
24822 u8size='$u8size'
24823 u8type='$u8type'
24824 uidformat='$uidformat'
24825 uidsign='$uidsign'
24826 uidsize='$uidsize'
24827 uidtype='$uidtype'
24828 uname='$uname'
24829 uniq='$uniq'
24830 uquadtype='$uquadtype'
24831 use5005threads='$use5005threads'
24832 use64bitall='$use64bitall'
24833 use64bitint='$use64bitint'
24834 usecbacktrace='$usecbacktrace'
24835 usecrosscompile='$usecrosscompile'
24836 usedevel='$usedevel'
24837 usedl='$usedl'
24838 usedtrace='$usedtrace'
24839 usefaststdio='$usefaststdio'
24840 useithreads='$useithreads'
24841 usekernprocpathname='$usekernprocpathname'
24842 uselanginfo='$uselanginfo'
24843 uselargefiles='$uselargefiles'
24844 uselongdouble='$uselongdouble'
24845 usemallocwrap='$usemallocwrap'
24846 usemorebits='$usemorebits'
24847 usemultiplicity='$usemultiplicity'
24848 usemymalloc='$usemymalloc'
24849 usenm='$usenm'
24850 usensgetexecutablepath='$usensgetexecutablepath'
24851 useopcode='$useopcode'
24852 useperlio='$useperlio'
24853 useposix='$useposix'
24854 usequadmath='$usequadmath'
24855 usereentrant='$usereentrant'
24856 userelocatableinc='$userelocatableinc'
24857 useshrplib='$useshrplib'
24858 usesitecustomize='$usesitecustomize'
24859 usesocks='$usesocks'
24860 usethreads='$usethreads'
24861 usevendorprefix='$usevendorprefix'
24862 useversionedarchname='$useversionedarchname'
24863 usevfork='$usevfork'
24864 usrinc='$usrinc'
24865 uuname='$uuname'
24866 uvXUformat='$uvXUformat'
24867 uvoformat='$uvoformat'
24868 uvsize='$uvsize'
24869 uvtype='$uvtype'
24870 uvuformat='$uvuformat'
24871 uvxformat='$uvxformat'
24872 vendorarch='$vendorarch'
24873 vendorarchexp='$vendorarchexp'
24874 vendorbin='$vendorbin'
24875 vendorbinexp='$vendorbinexp'
24876 vendorhtml1dir='$vendorhtml1dir'
24877 vendorhtml1direxp='$vendorhtml1direxp'
24878 vendorhtml3dir='$vendorhtml3dir'
24879 vendorhtml3direxp='$vendorhtml3direxp'
24880 vendorlib='$vendorlib'
24881 vendorlib_stem='$vendorlib_stem'
24882 vendorlibexp='$vendorlibexp'
24883 vendorman1dir='$vendorman1dir'
24884 vendorman1direxp='$vendorman1direxp'
24885 vendorman3dir='$vendorman3dir'
24886 vendorman3direxp='$vendorman3direxp'
24887 vendorprefix='$vendorprefix'
24888 vendorprefixexp='$vendorprefixexp'
24889 vendorscript='$vendorscript'
24890 vendorscriptexp='$vendorscriptexp'
24891 version='$version'
24892 version_patchlevel_string='$version_patchlevel_string'
24893 versiononly='$versiononly'
24894 vi='$vi'
24895 xlibpth='$xlibpth'
24896 yacc='$yacc'
24897 yaccflags='$yaccflags'
24898 zcat='$zcat'
24899 zip='$zip'
24900 EOT
24901
24902 : add special variables
24903 $test -f $src/patchlevel.h && \
24904 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24905 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24906 echo "PERL_CONFIG_SH=true" >>config.sh
24907
24908 : propagate old symbols
24909 if $test -f UU/config.sh; then
24910         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24911         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24912                 config.sh config.sh UU/oldconfig.sh |\
24913                 $sort | $uniq -u >UU/oldsyms
24914         set X `$cat UU/oldsyms`
24915         shift
24916         case $# in
24917         0) ;;
24918         *)
24919                 $cat <<EOM
24920 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24921 EOM
24922                 echo ": Variables propagated from previous config.sh file." >>config.sh
24923                 for sym in `$cat UU/oldsyms`; do
24924                         echo "    Propagating $hint variable "'$'"$sym..."
24925                         eval 'tmp="$'"${sym}"'"'
24926                         echo "$tmp" | \
24927                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24928                 done
24929                 ;;
24930         esac
24931 fi
24932
24933 : preserve RCS keywords in files with variable substitution, grrr
24934 Id='$Id'
24935
24936 : Finish up by extracting the .SH files
24937 case "$alldone" in
24938 exit)
24939         echo "Stopping at your request, leaving temporary files around."
24940         exit 0
24941         ;;
24942 cont)
24943         ;;
24944 '')
24945         dflt=''
24946         nostick=true
24947         $cat <<EOM
24948
24949 If you'd like to make any changes to the config.sh file before I begin
24950 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24951
24952 EOM
24953         rp="Press return or use a shell escape to edit config.sh:"
24954         . UU/myread
24955         nostick=''
24956         case "$ans" in
24957         '') ;;
24958         *) : in case they cannot read
24959                 sh 1>&4 -c "$ans";;
24960         esac
24961         ;;
24962 esac
24963
24964 : if this fails, just run all the .SH files by hand
24965 . ./config.sh
24966
24967 echo " "
24968 exec 1>&4
24969 pwd=`pwd`
24970 . ./UU/extract
24971 cd "$pwd"
24972
24973 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24974         dflt=y
24975         case "$silent" in
24976         true) ;;
24977         *)
24978                 $cat <<EOM
24979
24980 Now you need to generate make dependencies by running "$make depend".
24981 You might prefer to run it in background: "$make depend > makedepend.out &"
24982 It can take a while, so you might not want to run it right now.
24983
24984 EOM
24985                 ;;
24986         esac
24987         rp="Run $make depend now?"
24988         . UU/myread
24989         case "$ans" in
24990         y*)
24991                 $make depend && echo "Now you must run '$make'."
24992                 ;;
24993         *)
24994                 echo "You must run '$make depend' then '$make'."
24995                 ;;
24996         esac
24997 elif test -f [Mm]akefile; then
24998         echo " "
24999         echo "Now you must run a $make."
25000 else
25001         echo "Configure done."
25002 fi
25003
25004 if $test -f Policy.sh; then
25005     $cat <<EOM
25006
25007 If you compile $package on a different machine or from a different object
25008 directory, copy the Policy.sh file from this object directory to the
25009 new one before you run Configure -- this will help you with most of
25010 the policy defaults.
25011
25012 EOM
25013 fi
25014 if $test -f UU/config.msg; then
25015     echo "Hmm.  I also noted the following information while running:"
25016     echo " "
25017     $cat UU/config.msg >&4
25018 fi
25019 $rm -f kit*isdone ark*isdone
25020 $rm -rf UU
25021
25022 : End of Configure
25023