This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use balanced delimiters for multi-line s///gxe
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 uselanginfo=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_accept4=''
376 d_access=''
377 d_accessx=''
378 d_acosh=''
379 d_aintl=''
380 d_alarm=''
381 asctime_r_proto=''
382 d_asctime_r=''
383 d_asinh=''
384 d_atanh=''
385 d_attribute_deprecated=''
386 d_attribute_format=''
387 d_attribute_malloc=''
388 d_attribute_nonnull=''
389 d_attribute_noreturn=''
390 d_attribute_pure=''
391 d_attribute_unused=''
392 d_attribute_warn_unused_result=''
393 d_printf_format_null=''
394 d_backtrace=''
395 d_builtin_choose_expr=''
396 d_builtin_expect=''
397 d_builtin_add_overflow=''
398 d_builtin_mul_overflow=''
399 d_builtin_sub_overflow=''
400 d_c99_variadic_macros=''
401 d_casti32=''
402 castflags=''
403 d_castneg=''
404 d_cbrt=''
405 d_chown=''
406 d_chroot=''
407 d_chsize=''
408 d_class=''
409 d_clearenv=''
410 d_closedir=''
411 d_void_closedir=''
412 d_cmsghdr_s=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_dup3=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localeconv_l=''
632 d_localtime_r=''
633 d_localtime_r_needs_tzset=''
634 localtime_r_proto=''
635 d_locconv=''
636 d_lockf=''
637 d_log1p=''
638 d_log2=''
639 d_logb=''
640 d_ldexpl=''
641 d_long_double_style_ieee=''
642 d_long_double_style_ieee_doubledouble=''
643 d_long_double_style_ieee_extended=''
644 d_long_double_style_ieee_std=''
645 d_long_double_style_vax=''
646 d_longdbl=''
647 longdblkind=''
648 longdblsize=''
649 d_longlong=''
650 longlongsize=''
651 d_lrint=''
652 d_lrintl=''
653 d_lround=''
654 d_lroundl=''
655 d_lseekproto=''
656 d_lstat=''
657 d_madvise=''
658 d_malloc_good_size=''
659 d_malloc_size=''
660 d_malloc_usable_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_has_C_UTF8=''
767 d_setlocale=''
768 d_setlocale_accepts_any_locale_name=''
769 d_setlocale_r=''
770 setlocale_r_proto=''
771 d_setnent=''
772 d_setnetent_r=''
773 setnetent_r_proto=''
774 d_setpent=''
775 d_setpgid=''
776 d_setpgrp2=''
777 d_bsdsetpgrp=''
778 d_setpgrp=''
779 d_setprior=''
780 d_setproctitle=''
781 d_setprotoent_r=''
782 setprotoent_r_proto=''
783 d_setpwent=''
784 d_setpwent_r=''
785 setpwent_r_proto=''
786 d_setregid=''
787 d_setresgid=''
788 d_setresuid=''
789 d_setreuid=''
790 d_setrgid=''
791 d_setruid=''
792 d_setsent=''
793 d_setservent_r=''
794 setservent_r_proto=''
795 d_setsid=''
796 d_setvbuf=''
797 d_shm=''
798 d_shmat=''
799 d_shmatprototype=''
800 shmattype=''
801 d_shmctl=''
802 d_shmdt=''
803 d_shmget=''
804 d_sigaction=''
805 d_siginfo_si_addr=''
806 d_siginfo_si_band=''
807 d_siginfo_si_errno=''
808 d_siginfo_si_fd=''
809 d_siginfo_si_pid=''
810 d_siginfo_si_status=''
811 d_siginfo_si_uid=''
812 d_siginfo_si_value=''
813 d_signbit=''
814 d_sigprocmask=''
815 d_sigsetjmp=''
816 usesitecustomize=''
817 d_snprintf=''
818 d_vsnprintf=''
819 d_sockatmark=''
820 d_sockatmarkproto=''
821 d_ip_mreq=''
822 d_ip_mreq_source=''
823 d_ipv6_mreq=''
824 d_ipv6_mreq_source=''
825 d_msg_ctrunc=''
826 d_msg_dontroute=''
827 d_msg_oob=''
828 d_msg_peek=''
829 d_msg_proxy=''
830 d_oldsock=''
831 d_scm_rights=''
832 d_sin6_scope_id=''
833 d_sockaddr_in6=''
834 d_sockaddr_sa_len=''
835 d_socket=''
836 d_sockpair=''
837 sockethdr=''
838 socketlib=''
839 d_socklen_t=''
840 d_socks5_init=''
841 d_sqrtl=''
842 d_srand48_r=''
843 srand48_r_proto=''
844 d_srandom_r=''
845 srandom_r_proto=''
846 d_sresgproto=''
847 d_sresuproto=''
848 d_stat=''
849 d_statblks=''
850 d_statfs_f_flags=''
851 d_statfs_s=''
852 d_static_inline=''
853 perl_static_inline=''
854 d_fstatvfs=''
855 d_statvfs=''
856 d_stdio_cnt_lval=''
857 d_stdio_ptr_lval=''
858 d_stdio_ptr_lval_nochange_cnt=''
859 d_stdio_ptr_lval_sets_cnt=''
860 d_stdiobase=''
861 d_stdstdio=''
862 stdio_base=''
863 stdio_bufsiz=''
864 stdio_cnt=''
865 stdio_filbuf=''
866 stdio_ptr=''
867 d_strcoll=''
868 d_sysernlst=''
869 d_syserrlst=''
870 d_strerror_l=''
871 d_strerror_r=''
872 strerror_r_proto=''
873 d_strftime=''
874 d_strlcat=''
875 d_strlcpy=''
876 d_strnlen=''
877 d_strtod=''
878 d_strtod_l=''
879 d_strtol=''
880 d_strtold=''
881 d_strtold_l=''
882 d_strtoll=''
883 d_strtoq=''
884 d_strtoul=''
885 d_strtoull=''
886 d_strtouq=''
887 d_strxfrm=''
888 d_symlink=''
889 d_syscall=''
890 d_syscallproto=''
891 d_sysconf=''
892 d_system=''
893 d_tcgetpgrp=''
894 d_tcsetpgrp=''
895 d_telldirproto=''
896 d_tgamma=''
897 d_time=''
898 timetype=''
899 d_asctime64=''
900 d_ctime64=''
901 d_difftime64=''
902 d_gmtime64=''
903 d_localtime64=''
904 d_mktime64=''
905 d_timegm=''
906 clocktype=''
907 d_times=''
908 d_tmpnam_r=''
909 tmpnam_r_proto=''
910 d_towlower=''
911 d_towupper=''
912 d_trunc=''
913 d_truncate=''
914 d_truncl=''
915 d_ttyname_r=''
916 ttyname_r_proto=''
917 d_tzname=''
918 d_u32align=''
919 d_ualarm=''
920 d_umask=''
921 d_semctl_semid_ds=''
922 d_semctl_semun=''
923 d_union_semun=''
924 d_unordered=''
925 d_unsetenv=''
926 d_usleep=''
927 d_usleepproto=''
928 d_ustat=''
929 d_pseudofork=''
930 d_vfork=''
931 usevfork=''
932 d_voidsig=''
933 signal_t=''
934 d_wait4=''
935 d_waitpid=''
936 d_wcscmp=''
937 d_wcstombs=''
938 d_wcsxfrm=''
939 d_wctomb=''
940 d_writev=''
941 default_inc_excludes_dot=''
942 dlext=''
943 bin_ELF=''
944 cccdlflags=''
945 ccdlflags=''
946 dlsrc=''
947 ld=''
948 ld_can_script=''
949 lddlflags=''
950 usedl=''
951 doublesize=''
952 dtraceobject=''
953 dtracexnolibs=''
954 ebcdic=''
955 fflushNULL=''
956 fflushall=''
957 fpossize=''
958 fpostype=''
959 gccansipedantic=''
960 gccosandvers=''
961 gccversion=''
962 gidformat=''
963 gidsign=''
964 gidsize=''
965 gidtype=''
966 groupstype=''
967 h_fcntl=''
968 h_sysfile=''
969 html1dir=''
970 html1direxp=''
971 installhtml1dir=''
972 html3dir=''
973 html3direxp=''
974 installhtml3dir=''
975 i_arpainet=''
976 i_bfd=''
977 i_crypt=''
978 db_hashtype=''
979 db_prefixtype=''
980 db_version_major=''
981 db_version_minor=''
982 db_version_patch=''
983 i_db=''
984 i_dbm=''
985 i_rpcsvcdbm=''
986 d_dirnamlen=''
987 direntrytype=''
988 i_dirent=''
989 i_dlfcn=''
990 i_execinfo=''
991 i_fcntl=''
992 i_fenv=''
993 i_fp=''
994 i_fp_class=''
995 i_gdbm=''
996 d_grpasswd=''
997 i_grp=''
998 i_ieeefp=''
999 i_inttypes=''
1000 i_langinfo=''
1001 i_libutil=''
1002 i_locale=''
1003 i_machcthr=''
1004 i_malloc=''
1005 i_mallocmalloc=''
1006 i_mntent=''
1007 d_gdbm_ndbm_h_uses_prototypes=''
1008 d_gdbmndbm_h_uses_prototypes=''
1009 d_ndbm=''
1010 d_ndbm_h_uses_prototypes=''
1011 i_gdbm_ndbm=''
1012 i_gdbmndbm=''
1013 i_ndbm=''
1014 i_netdb=''
1015 i_neterrno=''
1016 i_netinettcp=''
1017 i_niin=''
1018 i_sysin=''
1019 i_poll=''
1020 i_prot=''
1021 i_pthread=''
1022 d_pwage=''
1023 d_pwchange=''
1024 d_pwclass=''
1025 d_pwcomment=''
1026 d_pwexpire=''
1027 d_pwgecos=''
1028 d_pwpasswd=''
1029 d_pwquota=''
1030 i_pwd=''
1031 i_quadmath=''
1032 i_shadow=''
1033 i_socks=''
1034 i_stdbool=''
1035 i_stdint=''
1036 i_stdlib=''
1037 i_sunmath=''
1038 i_sysaccess=''
1039 i_sysdir=''
1040 i_sysfile=''
1041 d_voidtty=''
1042 i_bsdioctl=''
1043 i_sysfilio=''
1044 i_sysioctl=''
1045 i_syssockio=''
1046 i_syslog=''
1047 i_sysmman=''
1048 i_sysmode=''
1049 i_sysmount=''
1050 i_sysndir=''
1051 i_sysparam=''
1052 i_syspoll=''
1053 i_sysresrc=''
1054 i_syssecrt=''
1055 i_sysselct=''
1056 i_sysstat=''
1057 i_sysstatfs=''
1058 i_sysstatvfs=''
1059 i_systimes=''
1060 i_systypes=''
1061 i_sysuio=''
1062 i_sysun=''
1063 i_sysutsname=''
1064 i_sysvfs=''
1065 i_syswait=''
1066 i_sgtty=''
1067 i_termio=''
1068 i_termios=''
1069 d_tm_tm_gmtoff=''
1070 d_tm_tm_zone=''
1071 i_systime=''
1072 i_systimek=''
1073 i_time=''
1074 timeincl=''
1075 i_unistd=''
1076 i_ustat=''
1077 i_utime=''
1078 i_vfork=''
1079 i_wchar=''
1080 i_wctype=''
1081 d_inc_version_list=''
1082 inc_version_list=''
1083 inc_version_list_init=''
1084 doubleinfbytes=''
1085 doublenanbytes=''
1086 longdblinfbytes=''
1087 longdblnanbytes=''
1088 installprefix=''
1089 installprefixexp=''
1090 installstyle=''
1091 installusrbinperl=''
1092 intsize=''
1093 longsize=''
1094 shortsize=''
1095 issymlink=''
1096 libc=''
1097 ldlibpthname=''
1098 libperl=''
1099 shrpenv=''
1100 useshrplib=''
1101 glibpth=''
1102 incpth=''
1103 libpth=''
1104 loclibpth=''
1105 plibpth=''
1106 xlibpth=''
1107 ignore_versioned_solibs=''
1108 libs=''
1109 libsdirs=''
1110 libsfiles=''
1111 libsfound=''
1112 libspath=''
1113 lns=''
1114 d_PRIEUldbl=''
1115 d_PRIFUldbl=''
1116 d_PRIGUldbl=''
1117 d_PRIeldbl=''
1118 d_PRIfldbl=''
1119 d_PRIgldbl=''
1120 d_SCNfldbl=''
1121 d_double_has_inf=''
1122 d_double_has_nan=''
1123 d_double_has_negative_zero=''
1124 d_double_has_subnormals=''
1125 d_double_style_cray=''
1126 d_double_style_ibm=''
1127 d_double_style_ieee=''
1128 d_double_style_vax=''
1129 doublekind=''
1130 sPRIEUldbl=''
1131 sPRIFUldbl=''
1132 sPRIGUldbl=''
1133 sPRIeldbl=''
1134 sPRIfldbl=''
1135 sPRIgldbl=''
1136 sSCNfldbl=''
1137 lseeksize=''
1138 lseektype=''
1139 make_set_make=''
1140 d_mymalloc=''
1141 freetype=''
1142 mallocobj=''
1143 mallocsrc=''
1144 malloctype=''
1145 usemallocwrap=''
1146 usemymalloc=''
1147 installman1dir=''
1148 man1dir=''
1149 man1direxp=''
1150 man1ext=''
1151 installman3dir=''
1152 man3dir=''
1153 man3direxp=''
1154 man3ext=''
1155 doublemantbits=''
1156 longdblmantbits=''
1157 nvmantbits=''
1158 modetype=''
1159 multiarch=''
1160 mydomain=''
1161 myhostname=''
1162 phostname=''
1163 c=''
1164 n=''
1165 d_eofnblk=''
1166 eagain=''
1167 o_nonblock=''
1168 rd_nodata=''
1169 need_va_copy=''
1170 netdb_hlen_type=''
1171 netdb_host_type=''
1172 netdb_name_type=''
1173 netdb_net_type=''
1174 groupcat=''
1175 hostcat=''
1176 passcat=''
1177 orderlib=''
1178 ranlib=''
1179 d_perl_otherlibdirs=''
1180 otherlibdirs=''
1181 package=''
1182 spackage=''
1183 pager=''
1184 api_revision=''
1185 api_subversion=''
1186 api_version=''
1187 api_versionstring=''
1188 patchlevel=''
1189 perl_patchlevel=''
1190 revision=''
1191 subversion=''
1192 version=''
1193 version_patchlevel_string=''
1194 perl5=''
1195 perladmin=''
1196 perlpath=''
1197 d_nv_preserves_uv=''
1198 d_nv_zero_is_allbits_zero=''
1199 i16size=''
1200 i16type=''
1201 i32size=''
1202 i32type=''
1203 i64size=''
1204 i64type=''
1205 i8size=''
1206 i8type=''
1207 ivsize=''
1208 ivtype=''
1209 nv_overflows_integers_at=''
1210 nv_preserves_uv_bits=''
1211 nvsize=''
1212 nvtype=''
1213 u16size=''
1214 u16type=''
1215 u32size=''
1216 u32type=''
1217 u64size=''
1218 u64type=''
1219 u8size=''
1220 u8type=''
1221 uvsize=''
1222 uvtype=''
1223 ivdformat=''
1224 nvEUformat=''
1225 nvFUformat=''
1226 nvGUformat=''
1227 nveformat=''
1228 nvfformat=''
1229 nvgformat=''
1230 uvXUformat=''
1231 uvoformat=''
1232 uvuformat=''
1233 uvxformat=''
1234 pidtype=''
1235 prefix=''
1236 prefixexp=''
1237 installprivlib=''
1238 privlib=''
1239 privlibexp=''
1240 ptrsize=''
1241 d_PRIXU64=''
1242 d_PRId64=''
1243 d_PRIi64=''
1244 d_PRIo64=''
1245 d_PRIu64=''
1246 d_PRIx64=''
1247 sPRIXU64=''
1248 sPRId64=''
1249 sPRIi64=''
1250 sPRIo64=''
1251 sPRIu64=''
1252 sPRIx64=''
1253 d_quad=''
1254 quadkind=''
1255 quadtype=''
1256 uquadtype=''
1257 drand01=''
1258 randbits=''
1259 randfunc=''
1260 randseedtype=''
1261 seedfunc=''
1262 installscript=''
1263 scriptdir=''
1264 scriptdirexp=''
1265 selectminbits=''
1266 selecttype=''
1267 sh=''
1268 targetsh=''
1269 sig_count=''
1270 sig_name=''
1271 sig_name_init=''
1272 sig_num=''
1273 sig_num_init=''
1274 sig_size=''
1275 d_sitearch=''
1276 installsitearch=''
1277 sitearch=''
1278 sitearchexp=''
1279 installsitebin=''
1280 sitebin=''
1281 sitebinexp=''
1282 installsitehtml1dir=''
1283 sitehtml1dir=''
1284 sitehtml1direxp=''
1285 installsitehtml3dir=''
1286 sitehtml3dir=''
1287 sitehtml3direxp=''
1288 installsitelib=''
1289 sitelib=''
1290 sitelib_stem=''
1291 sitelibexp=''
1292 installsiteman1dir=''
1293 siteman1dir=''
1294 siteman1direxp=''
1295 installsiteman3dir=''
1296 siteman3dir=''
1297 siteman3direxp=''
1298 siteprefix=''
1299 siteprefixexp=''
1300 installsitescript=''
1301 sitescript=''
1302 sitescriptexp=''
1303 sizesize=''
1304 sizetype=''
1305 d_libname_unique=''
1306 so=''
1307 socksizetype=''
1308 sharpbang=''
1309 shsharp=''
1310 spitshell=''
1311 src=''
1312 ssizetype=''
1313 st_ino_sign=''
1314 st_ino_size=''
1315 startperl=''
1316 startsh=''
1317 stdchar=''
1318 d_stdio_stream_array=''
1319 stdio_stream_array=''
1320 sysman=''
1321 sGMTIME_max=''
1322 sGMTIME_min=''
1323 sLOCALTIME_max=''
1324 sLOCALTIME_min=''
1325 trnl=''
1326 uidformat=''
1327 uidsign=''
1328 uidsize=''
1329 uidtype=''
1330 archname64=''
1331 use64bitall=''
1332 use64bitint=''
1333 usecbacktrace=''
1334 dtrace=''
1335 usedtrace=''
1336 usefaststdio=''
1337 usekernprocpathname=''
1338 ccflags_uselargefiles=''
1339 ldflags_uselargefiles=''
1340 libswanted_uselargefiles=''
1341 uselargefiles=''
1342 uselongdouble=''
1343 usemorebits=''
1344 usemultiplicity=''
1345 nm_opt=''
1346 nm_so_opt=''
1347 runnm=''
1348 usenm=''
1349 usensgetexecutablepath=''
1350 useperlio=''
1351 usequadmath=''
1352 usesocks=''
1353 d_oldpthreads=''
1354 use5005threads=''
1355 useithreads=''
1356 usereentrant=''
1357 usethreads=''
1358 incpath=''
1359 mips_type=''
1360 usrinc=''
1361 d_vendorarch=''
1362 installvendorarch=''
1363 vendorarch=''
1364 vendorarchexp=''
1365 d_vendorbin=''
1366 installvendorbin=''
1367 vendorbin=''
1368 vendorbinexp=''
1369 installvendorhtml1dir=''
1370 vendorhtml1dir=''
1371 vendorhtml1direxp=''
1372 installvendorhtml3dir=''
1373 vendorhtml3dir=''
1374 vendorhtml3direxp=''
1375 d_vendorlib=''
1376 installvendorlib=''
1377 vendorlib=''
1378 vendorlib_stem=''
1379 vendorlibexp=''
1380 installvendorman1dir=''
1381 vendorman1dir=''
1382 vendorman1direxp=''
1383 installvendorman3dir=''
1384 vendorman3dir=''
1385 vendorman3direxp=''
1386 usevendorprefix=''
1387 vendorprefix=''
1388 vendorprefixexp=''
1389 d_vendorscript=''
1390 installvendorscript=''
1391 vendorscript=''
1392 vendorscriptexp=''
1393 versiononly=''
1394 yacc=''
1395 yaccflags=''
1396 CONFIG=''
1397
1398 : Detect odd OSs
1399 define='define'
1400 undef='undef'
1401 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1402 rmlist=''
1403
1404 : We must find out about Eunice early
1405 eunicefix=':'
1406 if test -f /etc/unixtovms; then
1407         eunicefix=/etc/unixtovms
1408 fi
1409 if test -f /etc/unixtovms.exe; then
1410         eunicefix=/etc/unixtovms.exe
1411 fi
1412
1413 : Set executable suffix now -- needed before hints available
1414 if test -f "/libs/version.library"; then
1415 : Amiga OS
1416     _exe=""
1417 elif test -f "/system/gnu_library/bin/ar.pm"; then
1418 : Stratus VOS
1419     _exe=".pm"
1420 elif test -n "$DJGPP"; then
1421 : DOS DJGPP
1422     _exe=".exe"
1423 elif test -f /kern/cookiejar; then
1424 : MiNT
1425     _exe=""
1426 elif test -d c:/. -o -n "$is_os2" ; then
1427 : OS/2 or cygwin
1428     _exe=".exe"
1429 fi
1430
1431 groupstype=''
1432 i_whoami=''
1433 : Possible local include directories to search.
1434 : Set locincpth to "" in a hint file to defeat local include searches.
1435 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1436 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1437 :
1438 : no include file wanted by default
1439 inclwanted=''
1440
1441 : Enable -DEBUGGING and -DDEBUGGING from the command line
1442 EBUGGING=''
1443 DEBUGGING=''
1444
1445 : Trailing extension.  Override this in a hint file, if needed.
1446 : Extra object files, if any, needed on this platform.
1447 archobjs=''
1448 libnames=''
1449 : change the next line if compiling for Xenix/286 on Xenix/386
1450 xlibpth='/usr/lib/386 /lib/386'
1451 : Possible local library directories to search.
1452 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1453 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1454
1455 : general looking path for locating libraries
1456 glibpth="/lib /usr/lib $xlibpth"
1457 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1458 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1459 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1460 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1461
1462 : Private path used by Configure to find libraries.  Its value
1463 : is prepended to libpth. This variable takes care of special
1464 : machines, like the mips.  Usually, it should be empty.
1465 plibpth=''
1466
1467 : default library list
1468 libswanted=''
1469 : some systems want to use only the non-versioned libso:s
1470 ignore_versioned_solibs=''
1471 ccname=''
1472 ccversion=''
1473 perllibs=''
1474 : set useposix=false in your hint file to disable the POSIX extension.
1475 useposix=true
1476 : set useopcode=false in your hint file to disable the Opcode extension.
1477 useopcode=true
1478 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1479 uselanginfo=true
1480 archname64=''
1481 ccflags_uselargefiles=''
1482 ldflags_uselargefiles=''
1483 libswanted_uselargefiles=''
1484 : set usemultiplicity on the Configure command line to enable multiplicity.
1485 : set usesocks on the Configure command line to enable socks.
1486 archname=''
1487 : set usethreads on the Configure command line to enable threads.
1488 usereentrant='undef'
1489 : List of libraries we want.
1490 : If anyone needs extra -lxxx, put those in a hint file.
1491 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1492 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1493 : We probably want to search /usr/shlib before most other libraries.
1494 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1495 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1496 glibpth="/usr/shlib $glibpth"
1497 : Do not use vfork unless overridden by a hint file.
1498 usevfork=false
1499
1500 : Find the basic shell for Bourne shell scripts
1501 case "$sh" in
1502 '')
1503         case "$SYSTYPE" in
1504         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1505         *) xxx='/bin/sh';;
1506         esac
1507         if test -f "$xxx"; then
1508                 sh="$xxx"
1509         else
1510                 : Build up a list and do a single loop so we can 'break' out.
1511                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1512                 for xxx in sh bash ksh pdksh ash; do
1513                         for p in $pth; do
1514                                 try="$try ${p}/${xxx}"
1515                         done
1516                 done
1517                 for xxx in $try; do
1518                         if test -f "$xxx"; then
1519                                 sh="$xxx";
1520                                 break
1521                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1522                                 sh="$xxx";
1523                                 break
1524                         elif test -f "$xxx.exe"; then
1525                                 sh="$xxx";
1526                                 break
1527                         fi
1528                 done
1529         fi
1530         ;;
1531 esac
1532
1533 case "$sh" in
1534 '')     cat >&2 <<EOM
1535 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1536
1537 Usually it's in /bin/sh.  How did you even get this far?
1538 Please contact me (Perl Maintainers) at perlbug@perl.org and
1539 we'll try to straighten this all out.
1540 EOM
1541         exit 1
1542         ;;
1543 esac
1544
1545 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1546 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1547 targetsh=$sh
1548
1549 : see if sh knows # comments
1550 if `$sh -c '#' >/dev/null 2>&1`; then
1551         shsharp=true
1552         spitshell=cat
1553         xcat=/bin/cat
1554         test -f $xcat$_exe || xcat=/usr/bin/cat
1555         if test ! -f $xcat$_exe; then
1556                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1557                         if test -f $p/cat$_exe; then
1558                                 xcat=$p/cat
1559                                 break
1560                         fi
1561                 done
1562                 if test ! -f $xcat$_exe; then
1563                         echo "Can't find cat anywhere!"
1564                         exit 1
1565                 fi
1566         fi
1567         echo "#!$xcat" >sharp
1568         $eunicefix sharp
1569         chmod +x sharp
1570         ./sharp > today 2>/dev/null
1571         if test -s today; then
1572                 sharpbang='#!'
1573         else
1574                 echo "#! $xcat" > sharp
1575                 $eunicefix sharp
1576                 chmod +x sharp
1577                 ./sharp > today 2>/dev/null
1578                 if test -s today; then
1579                         sharpbang='#! '
1580                 else
1581                         sharpbang=': use '
1582                 fi
1583         fi
1584 else
1585         echo " "
1586         echo "Your $sh doesn't grok # comments--I will strip them later on."
1587         shsharp=false
1588         cd ..
1589         echo "exec grep -v '^[  ]*#'" >spitshell
1590         chmod +x spitshell
1591         $eunicefix spitshell
1592         spitshell=`pwd`/spitshell
1593         cd UU
1594         echo "I presume that if # doesn't work, #! won't work either!"
1595         sharpbang=': use '
1596 fi
1597 rm -f sharp today
1598
1599 : figure out how to guarantee sh startup
1600 case "$startsh" in
1601 '') startsh=${sharpbang}${sh} ;;
1602 *)
1603 esac
1604 cat >sharp <<EOSS
1605 $startsh
1606 set abc
1607 test "$?abc" != 1
1608 EOSS
1609
1610 chmod +x sharp
1611 $eunicefix sharp
1612 if ./sharp; then
1613         : echo "Yup, it does."
1614 else
1615         echo "Hmm... '$startsh' does not guarantee sh startup..."
1616         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1617 fi
1618 rm -f sharp
1619
1620 : Save command line options in file UU/cmdline.opt for later use in
1621 : generating config.sh.
1622 cat > cmdline.opt <<EOSH
1623 : Configure command line arguments.
1624 config_arg0='$0'
1625 config_args='$*'
1626 config_argc=$#
1627 EOSH
1628 argn=1
1629 args_exp=''
1630 args_sep=''
1631 for arg in "$@"; do
1632         cat >>cmdline.opt <<EOSH
1633 config_arg$argn='$arg'
1634 EOSH
1635         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1636 $arg
1637 EOC
1638         arg_exp=`cat cmdl.opt`
1639         args_exp="$args_exp$args_sep'$arg_exp'"
1640         argn=`expr $argn + 1`
1641         args_sep=' '
1642 done
1643 rm -f cmdl.opt
1644
1645 : produce awk script to parse command line options
1646 cat >options.awk <<'EOF'
1647 BEGIN {
1648         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1649
1650         len = length(optstr);
1651         for (i = 1; i <= len; i++) {
1652                 c = substr(optstr, i, 1);
1653                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1654                 if (a == ":") {
1655                         arg[c] = 1;
1656                         i++;
1657                 }
1658                 opt[c] = 1;
1659         }
1660 }
1661 {
1662         expect = 0;
1663         str = $0;
1664         if (substr(str, 1, 1) != "-") {
1665                 printf("'%s'\n", str);
1666                 next;
1667         }
1668         len = length($0);
1669         for (i = 2; i <= len; i++) {
1670                 c = substr(str, i, 1);
1671                 if (!opt[c]) {
1672                         printf("-%s\n", substr(str, i));
1673                         next;
1674                 }
1675                 printf("-%s\n", c);
1676                 if (arg[c]) {
1677                         if (i < len)
1678                                 printf("'%s'\n", substr(str, i + 1));
1679                         else
1680                                 expect = 1;
1681                         next;
1682                 }
1683         }
1684 }
1685 END {
1686         if (expect)
1687                 print "?";
1688 }
1689 EOF
1690
1691 : process the command line options
1692 set X `for arg in "$@"; do echo "X$arg"; done |
1693         sed -e s/X// | awk -f options.awk`
1694 eval "set $*"
1695 shift
1696 rm -f options.awk
1697
1698 : set up default values
1699 fastread=''
1700 reuseval=false
1701 config_sh=''
1702 alldone=''
1703 error=''
1704 silent=''
1705 extractsh=''
1706 knowitall=''
1707 rm -f optdef.sh posthint.sh
1708 cat >optdef.sh <<EOS
1709 $startsh
1710 EOS
1711
1712
1713 : option parsing
1714 while test $# -gt 0; do
1715         case "$1" in
1716         -d) shift; fastread=yes;;
1717         -e) shift; alldone=cont;;
1718         -f)
1719                 shift
1720                 cd ..
1721                 if test -r "$1"; then
1722                         config_sh="$1"
1723                 else
1724                         echo "$me: cannot read config file $1." >&2
1725                         error=true
1726                 fi
1727                 cd UU
1728                 shift;;
1729         --help|\
1730         -h) shift; error=true;;
1731         -r) shift; reuseval=true;;
1732         -s) shift; silent=true; realsilent=true;;
1733         -E) shift; alldone=exit;;
1734         -K) shift; knowitall=true;;
1735         -O) shift;;
1736         -S) shift; silent=true; extractsh=true;;
1737         -D)
1738                 shift
1739                 case "$1" in
1740                 *=)
1741                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1742                         echo "$me: ignoring -D $1" >&2
1743                         ;;
1744                 *=*) echo "$1" | \
1745                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1746                 *) echo "$1='define'" >> optdef.sh;;
1747                 esac
1748                 shift
1749                 ;;
1750         -U)
1751                 shift
1752                 case "$1" in
1753                 *=) echo "$1" >> optdef.sh;;
1754                 *=*)
1755                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1756                         echo "$me: ignoring -U $1" >&2
1757                         ;;
1758                 *) echo "$1='undef'" >> optdef.sh;;
1759                 esac
1760                 shift
1761                 ;;
1762         -A)
1763             shift
1764             xxx=''
1765             yyy="$1"
1766             zzz=''
1767             uuu=undef
1768             case "$yyy" in
1769             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1770                  case "$zzz" in
1771                  *:*) zzz='' ;;
1772                  *)   xxx=append
1773                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1774                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1775                  esac
1776                  ;;
1777             esac
1778             case "$xxx" in
1779             '')  case "$yyy" in
1780                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1781                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1782                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1783                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1784                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1785                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1786                  esac
1787                  ;;
1788             esac
1789             case "$xxx" in
1790             append)
1791                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1792             clear)
1793                 echo "$yyy=''"                  >> posthint.sh ;;
1794             define)
1795                 case "$zzz" in
1796                 '') zzz=define ;;
1797                 esac
1798                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1799             eval)
1800                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1801             prepend)
1802                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1803             undef)
1804                 case "$zzz" in
1805                 '') zzz="$uuu" ;;
1806                 esac
1807                 echo "$yyy=$zzz"                >> posthint.sh ;;
1808             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1809             esac
1810             shift
1811             ;;
1812         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1813             exit 0;;
1814         --) break;;
1815         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1816         *) break;;
1817         esac
1818 done
1819
1820 case "$error" in
1821 true)
1822         cat >&2 <<EOM
1823 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1824                  [-U symbol] [-U symbol=] [-A command:symbol...]
1825   -d : use defaults for all answers.
1826   -e : go on without questioning past the production of config.sh.
1827   -f : specify an alternate default configuration file.
1828   -h : print this help message and exit (with an error status).
1829   -r : reuse C symbols value if possible (skips costly nm extraction).
1830   -s : silent mode, only echoes questions and essential information.
1831   -D : define symbol to have some value:
1832          -D symbol         symbol gets the value 'define'
1833          -D symbol=value   symbol gets the value 'value'
1834        common used examples (see INSTALL for more info):
1835          -Duse64bitint            use 64bit integers
1836          -Duse64bitall            use 64bit integers and pointers
1837          -Dusethreads             use thread support
1838          -Dinc_version_list=none  do not include older perl trees in @INC
1839          -DEBUGGING=none          DEBUGGING options
1840          -Dcc=gcc                 choose your compiler
1841          -Dprefix=/opt/perl5      choose your destination
1842   -E : stop at the end of questions, after having produced config.sh.
1843   -K : do not use unless you know what you are doing.
1844   -O : ignored for backward compatibility
1845   -S : perform variable substitutions on all .SH files (can mix with -f)
1846   -U : undefine symbol:
1847          -U symbol    symbol gets the value 'undef'
1848          -U symbol=   symbol gets completely empty
1849        e.g.:  -Uversiononly
1850   -A : manipulate symbol after the platform specific hints have been applied:
1851          -A append:symbol=value   append value to symbol
1852          -A symbol=value          like append:, but with a separating space
1853          -A define:symbol=value   define symbol to have value
1854          -A clear:symbol          define symbol to be ''
1855          -A define:symbol         define symbol to be 'define'
1856          -A eval:symbol=value     define symbol to be eval of value
1857          -A prepend:symbol=value  prepend value to symbol
1858          -A undef:symbol          define symbol to be 'undef'
1859          -A undef:symbol=         define symbol to be ''
1860        e.g.:  -A prepend:libswanted='cl pthread '
1861               -A ccflags=-DSOME_MACRO
1862   -V : print version number and exit (with a zero status).
1863 EOM
1864         exit 1
1865         ;;
1866 esac
1867
1868 : Sanity checks
1869 case "$fastread$alldone" in
1870 yescont|yesexit) ;;
1871 *)
1872         case "$extractsh" in
1873         true) ;;
1874         *)
1875                 if test ! -t 0; then
1876                         echo "Say 'sh Configure', not 'sh <Configure'"
1877                         exit 1
1878                 fi
1879                 ;;
1880         esac
1881         ;;
1882 esac
1883
1884 exec 4>&1
1885 case "$silent" in
1886 true) exec 1>/dev/null;;
1887 esac
1888
1889 : run the defines and the undefines, if any, but leave the file out there...
1890 touch optdef.sh
1891 grep '\\' optdef.sh >/dev/null 2>&1
1892 if test $? = 0; then
1893     echo "Configure does not support \\ in -D arguments"
1894     exit 1
1895 fi
1896 . ./optdef.sh
1897 : create the posthint manipulation script and leave the file out there...
1898 touch posthint.sh
1899
1900 : set package name
1901 package='perl5'
1902 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1903 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1904 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1905 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1906 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1907 esac
1908
1909 : Some greps do not return status, grrr.
1910 echo "grimblepritz" >grimble
1911 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1912         contains=contains
1913 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1914         contains=grep
1915 else
1916         contains=contains
1917 fi
1918 rm -f grimble
1919 : the following should work in any shell
1920 case "$contains" in
1921 contains*)
1922         echo " "
1923         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1924         cat >contains <<'EOSS'
1925 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1926 EOSS
1927 chmod +x contains
1928 esac
1929
1930 : Find the path to the source tree
1931 case "$src" in
1932 '') case "$0" in
1933     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1934          case "$src" in
1935          /*)    ;;
1936          .)     ;;
1937          *)     src=`cd ../$src && pwd` ;;
1938          esac
1939          ;;
1940     *)   src='.';;
1941     esac;;
1942 esac
1943 case "$src" in
1944 '')     src=/
1945         rsrc=/
1946         ;;
1947 /*)     rsrc="$src";;
1948 *)      rsrc="../$src";;
1949 esac
1950 if test -f $rsrc/Configure && \
1951         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1952 then
1953    : found it, so we are ok.
1954 else
1955         rsrc=''
1956         for src in . .. ../.. ../../.. ../../../..; do
1957                 if test -f ../$src/Configure && \
1958                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1959                 then
1960                         rsrc=../$src
1961                         break
1962                 fi
1963         done
1964 fi
1965 case "$rsrc" in
1966 '')
1967         cat <<EOM >&4
1968
1969 Sorry, I can't seem to locate the source dir for $package.  Please start
1970 Configure with an explicit path -- i.e. /some/path/Configure.
1971
1972 EOM
1973         exit 1
1974         ;;
1975 ../.)   rsrc='..';;
1976 *)
1977         echo " "
1978         echo "Sources for $package found in \"$src\"." >&4
1979         ;;
1980 esac
1981
1982 : script used to extract .SH files with variable substitutions
1983 cat >extract <<'EOS'
1984 PERL_CONFIG_SH=true
1985 echo "Doing variable substitutions on .SH files..."
1986 if test -f MANIFEST; then
1987         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1988 else
1989         echo "(Looking for .SH files under the source directory.)"
1990         set x `(cd "$src"; find . -name "*.SH" -print)`
1991 fi
1992 shift
1993 case $# in
1994 0) set x `(cd "$src"; echo *.SH)`; shift;;
1995 esac
1996 if test ! -f "$src/$1"; then
1997         shift
1998 fi
1999 mkdir_p='
2000 name=$1;
2001 create="";
2002 while test $name; do
2003         if test ! -d "$name"; then
2004                 create="$name $create";
2005                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2006                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2007         else
2008                 name="";
2009         fi;
2010 done;
2011 for file in $create; do
2012         mkdir $file;
2013 done
2014 '
2015 for file in $*; do
2016         case "$src" in
2017         ".")
2018                 case "$file" in
2019                 */*)
2020                         dir=`expr X$file : 'X\(.*\)/'`
2021                         file=`expr X$file : 'X.*/\(.*\)'`
2022                         (cd "$dir" && . ./$file)
2023                         ;;
2024                 *)
2025                         . ./$file
2026                         ;;
2027                 esac
2028                 ;;
2029         *)
2030                 case "$file" in
2031                 */*)
2032                         dir=`expr X$file : 'X\(.*\)/'`
2033                         file=`expr X$file : 'X.*/\(.*\)'`
2034                         (set x $dir; shift; eval $mkdir_p)
2035                         sh <"$src/$dir/$file"
2036                         ;;
2037                 *)
2038                         sh <"$src/$file"
2039                         ;;
2040                 esac
2041                 ;;
2042         esac
2043 done
2044 if test -f "$src/config_h.SH"; then
2045         if test ! -f config.h; then
2046         : oops, they left it out of MANIFEST, probably, so do it anyway.
2047         . "$src/config_h.SH"
2048         fi
2049 fi
2050 EOS
2051
2052 : extract files and exit if asked to do so
2053 case "$extractsh" in
2054 true)
2055         case "$realsilent" in
2056         true) ;;
2057         *) exec 1>&4;;
2058         esac
2059         case "$config_sh" in
2060         '') config_sh='config.sh';;
2061         esac
2062         echo " "
2063         echo "Fetching answers from $config_sh..."
2064         cd ..
2065         . $config_sh
2066         . UU/optdef.sh
2067         echo " "
2068         . UU/extract
2069         rm -rf UU
2070         echo "Extraction done."
2071         exit 0
2072         ;;
2073 esac
2074
2075 : Eunice requires " " instead of "", can you believe it
2076 echo " "
2077 : Here we go...
2078 echo "Beginning of configuration questions for $package."
2079
2080 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2081
2082 : first determine how to suppress newline on echo command
2083 echo " "
2084 echo "Checking echo to see how to suppress newlines..."
2085 (echo "hi there\c" ; echo " ") >.echotmp
2086 if $contains c .echotmp >/dev/null 2>&1 ; then
2087         echo "...using -n."
2088         n='-n'
2089         c=''
2090 else
2091         cat <<'EOM'
2092 ...using \c
2093 EOM
2094         n=''
2095         c='\c'
2096 fi
2097 echo $n "The star should be here-->$c"
2098 echo '*'
2099 rm -f .echotmp
2100
2101 : Now test for existence of everything in MANIFEST
2102 echo " "
2103 if test -f "$rsrc/MANIFEST"; then
2104         echo "First let's make sure your kit is complete.  Checking..." >&4
2105         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2106                 (split -l 50 2>/dev/null || split -50)
2107         rm -f missing
2108         tmppwd=`pwd`
2109         for filelist in x??; do
2110                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2111                         >/dev/null 2>>"$tmppwd/missing")
2112         done
2113         if test -s missing; then
2114                 cat missing >&4
2115                 cat >&4 <<'EOM'
2116
2117 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2118
2119 You have the option of continuing the configuration process, despite the
2120 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2121 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2122 and contact the author (perlbug@perl.org).
2123
2124 EOM
2125                 echo $n "Continue? [n] $c" >&4
2126                 read ans
2127                 case "$ans" in
2128                 y*)
2129                         echo "Continuing..." >&4
2130                         rm -f missing
2131                         ;;
2132                 *)
2133                         echo "ABORTING..." >&4
2134                         kill $$
2135                         ;;
2136                 esac
2137         else
2138                 echo "Looks good..."
2139         fi
2140 else
2141         echo "There is no MANIFEST file.  I hope your kit is complete !"
2142 fi
2143 rm -f missing x??
2144
2145 : Find the appropriate value for a newline for tr
2146 if test -n "$DJGPP"; then
2147        trnl='\012'
2148 fi
2149 if test X"$trnl" = X; then
2150         case "`echo foo | tr '\n' x 2>/dev/null`" in
2151         foox) trnl='\n' ;;
2152         esac
2153 fi
2154 if test X"$trnl" = X; then
2155         case "`echo foo | tr '\012' x 2>/dev/null`" in
2156         foox) trnl='\012' ;;
2157         esac
2158 fi
2159 if test X"$trnl" = X; then
2160        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2161        fooxy) trnl='\n\r' ;;
2162        esac
2163 fi
2164 if test X"$trnl" = X; then
2165         cat <<EOM >&2
2166
2167 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2168
2169 EOM
2170         exit 1
2171 fi
2172
2173 : compute the number of columns on the terminal for proper question formatting
2174 case "$COLUMNS" in
2175 '') COLUMNS='80';;
2176 esac
2177
2178 : set up the echo used in my read
2179 myecho="case \"\$xxxm\" in
2180 '') echo $n \"\$rp $c\" >&4;;
2181 *) case \"\$rp\" in
2182         '') echo $n \"[\$xxxm] $c\";;
2183         *)
2184                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2185                         echo \"\$rp\" >&4
2186                         echo $n \"[\$xxxm] $c\" >&4
2187                 else
2188                         echo $n \"\$rp [\$xxxm] $c\" >&4
2189                 fi
2190                 ;;
2191         esac;;
2192 esac"
2193
2194 : now set up to do reads with possible shell escape and default assignment
2195 cat <<EOSC >myread
2196 $startsh
2197 xxxm=\$dflt
2198 $myecho
2199 ans='!'
2200 case "\$fastread" in
2201 yes) case "\$dflt" in
2202         '') ;;
2203         *) ans='';
2204                 case "\$silent-\$rp" in
2205                 true-) ;;
2206                 *) echo " " >&4;;
2207                 esac;;
2208         esac;;
2209 *) case "\$silent" in
2210         true) case "\$rp" in
2211                 '') ans='';;
2212                 esac;;
2213         esac;;
2214 esac
2215 while expr "X\$ans" : "X!" >/dev/null; do
2216         read answ
2217         set x \$xxxm
2218         shift
2219         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2220         case  "\$answ" in
2221         "!")
2222                 sh 1>&4
2223                 echo " "
2224                 $myecho
2225                 ;;
2226         !*)
2227                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2228                 shift
2229                 sh 1>&4 -c "\$*"
2230                 echo " "
2231                 $myecho
2232                 ;;
2233         "\$ans")
2234                 case "\$ans" in
2235                 \\&*)
2236                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2237                         shift
2238                         case "\$1" in
2239                         -d)
2240                                 fastread=yes
2241                                 echo "(OK, I'll run with -d after this question.)" >&4
2242                                 ;;
2243                         -*)
2244                                 echo "*** Sorry, \$1 not supported yet." >&4
2245                                 ;;
2246                         esac
2247                         $myecho
2248                         ans=!
2249                         ;;
2250                 esac;;
2251         *)
2252                 case "\$aok" in
2253                 y)
2254                         echo "*** Substitution done -- please confirm."
2255                         xxxm="\$ans"
2256                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2257                         xxxm="\$ans"
2258                         ans=!
2259                         ;;
2260                 *)
2261                         echo "*** Error -- try again."
2262                         ans=!
2263                         ;;
2264                 esac
2265                 $myecho
2266                 ;;
2267         esac
2268         case "\$ans\$xxxm\$nostick" in
2269         '')
2270                 ans=!
2271                 $myecho
2272                 ;;
2273         esac
2274 done
2275 case "\$ans" in
2276 '') ans="\$xxxm";;
2277 esac
2278 EOSC
2279
2280 : create .config dir to save info across Configure sessions
2281 test -d ../.config || mkdir ../.config
2282 cat >../.config/README <<EOF
2283 This directory created by Configure to save information that should
2284 persist across sessions for $package.
2285
2286 You may safely delete it if you wish.
2287 EOF
2288
2289 : See if we are using a devel version and want that
2290 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2291 case "$usedevel" in
2292 $define|true|[yY]*)
2293     usedevel="$define" ;;
2294 *) case "$xversion" in
2295    *[13579])
2296         cat >&4 <<EOH
2297 *** WHOA THERE!!! ***
2298
2299     This is an UNSTABLE DEVELOPMENT release.
2300     The version of this $package distribution is $xversion, that is, odd,
2301     (as opposed to even) and that signifies a development release.
2302     If you want a maintenance release, you want an even-numbered version.
2303
2304     Do ***NOT*** install this into production use.
2305     Data corruption and crashes are possible.
2306
2307     It is most seriously suggested that you do not continue any further
2308     unless you want to help in developing and debugging Perl.
2309
2310     If you *still* want to build perl, you can answer 'y' now,
2311     or pass -Dusedevel to Configure.
2312
2313 EOH
2314         rp='Do you really want to continue?'
2315         dflt='n'
2316         . ./myread
2317         case "$ans" in
2318         [yY]) echo >&4 "Okay, continuing."
2319               usedevel="$define" ;;
2320         *) echo >&4 "Okay, bye."
2321            exit 1
2322            ;;
2323         esac
2324         ;;
2325     esac
2326     usedevel="$undef"
2327     ;;
2328 esac
2329 case "$usedevel" in
2330 $define|true|[yY]*)
2331         case "$versiononly" in
2332         '') versiononly="$define" ;;
2333         esac
2334         case "$installusrbinperl" in
2335         '') installusrbinperl="$undef" ;;
2336         esac
2337         ;;
2338 esac
2339
2340 : general instructions
2341 needman=true
2342 firsttime=true
2343 user=`(logname) 2>/dev/null`
2344 case "$user" in
2345 '') user=`whoami 2>&1`;;
2346 esac
2347 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2348         firsttime=false
2349         echo " "
2350         rp='Would you like to see the instructions?'
2351         dflt=n
2352         . ./myread
2353         case "$ans" in
2354         [yY]*) ;;
2355         *) needman=false;;
2356         esac
2357 fi
2358 if $needman; then
2359         cat <<EOH
2360
2361 This installation shell script will examine your system and ask you questions
2362 to determine how the perl5 package should be installed. If you get
2363 stuck on a question, you may use a ! shell escape to start a subshell or
2364 execute a command.  Many of the questions will have default answers in square
2365 brackets; typing carriage return will give you the default.
2366
2367 On some of the questions which ask for file or directory names you are allowed
2368 to use the ~name construct to specify the login directory belonging to "name",
2369 even if you don't have a shell which knows about that.  Questions where this is
2370 allowed will be marked "(~name ok)".
2371
2372 EOH
2373         rp=''
2374         dflt='Type carriage return to continue'
2375         . ./myread
2376         cat <<'EOH'
2377
2378 The prompter used in this script allows you to use shell variables and
2379 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2380 in the default answer, as if the default line was a set of arguments given to a
2381 script shell.  This means you may also use $* to repeat the whole default line,
2382 so you do not have to re-type everything to add something to the default.
2383
2384 Every time there is a substitution, you will have to confirm.  If there is an
2385 error (e.g. an unmatched backtick), the default answer will remain unchanged
2386 and you will be prompted again.
2387
2388 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2389 the questions and use the computed defaults (or the previous answers if there
2390 was already a config.sh file). Type 'Configure -h' for a list of options.
2391 You may also start interactively and then answer '& -d' at any prompt to turn
2392 on the non-interactive behaviour for the remainder of the execution.
2393
2394 EOH
2395         . ./myread
2396         cat <<EOH
2397
2398 Much effort has been expended to ensure that this shell script will run on any
2399 Unix system.  If despite that it blows up on yours, your best bet is to edit
2400 Configure and run it again.  If you can't run Configure for some reason,
2401 you'll have to generate a config.sh file by hand.  Whatever problems you
2402 have, let me (perlbug@perl.org) know how I blew it.
2403
2404 This installation script affects things in two ways:
2405
2406 1) it may do direct variable substitutions on some of the files included
2407    in this kit.
2408 2) it builds a config.h file for inclusion in C programs.  You may edit
2409    any of these files as the need arises after running this script.
2410
2411 If you make a mistake on a question, there is no easy way to back up to it
2412 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2413 files.  Configure will offer to let you do this before it runs the SH files.
2414
2415 EOH
2416         dflt='Type carriage return to continue'
2417         . ./myread
2418         case "$firsttime" in
2419         true) echo $user >>../.config/instruct;;
2420         esac
2421 fi
2422
2423 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2424 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2425 if test "X$sysroot" = X; then
2426     sysroot=""
2427 else
2428     case "$cc" in
2429         *gcc*|*g++*)
2430             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2431             # _sysroot is used in places where we need --sysroot=foo
2432             # but using the rest of the flags could cause issues.
2433             _sysroot="--sysroot=$sysroot";
2434             case "$ccflags" in
2435                 *sysroot*) ;;
2436                 'undef'|*)
2437                 ccflags="$ccflags $_sysroot"
2438             esac
2439             case "$ldflags" in
2440                 *sysroot*) ;;
2441                 'undef'|*)
2442                 ldflags="$ldflags $_sysroot"
2443             esac
2444             case "$cppflags" in
2445                 *sysroot*) ;;
2446                 'undef'|*)
2447                 cppflags="$cppflags $_sysroot"
2448             esac
2449             # lddlflags updated below in lddlflags section;
2450             # same with cccdlflags
2451             ;;
2452     esac
2453
2454     # Adjust some defaults to also use $sysroot
2455     for var in xlibpth loclibpth locincpth glibpth; do
2456         eval xxx=\$$var
2457         eval $var=''
2458         for path in $xxx; do
2459             eval $var=\"\$$var $sysroot$path\"
2460         done
2461     done
2462
2463 fi
2464
2465 : find out where common programs are
2466 echo " "
2467 echo "Locating common programs..." >&4
2468 cat <<EOSC >loc
2469 $startsh
2470 case \$# in
2471 0) exit 1;;
2472 esac
2473 thing=\$1
2474 shift
2475 dflt=\$1
2476 shift
2477 for dir in \$*; do
2478         case "\$thing" in
2479         .)
2480         if test -d \$dir/\$thing; then
2481                 echo \$dir
2482                 exit 0
2483         fi
2484         ;;
2485         *)
2486         for thisthing in \$dir/\$thing; do
2487                 : just loop through to pick last item
2488         done
2489         if test -f \$thisthing; then
2490                 echo \$thisthing
2491                 exit 0
2492         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2493                 echo \$thisthing
2494                 exit 0
2495         elif test -f \$dir/\$thing.exe; then
2496                 if test -n "$DJGPP"; then
2497                         echo \$dir/\$thing.exe
2498                 elif test "$eunicefix" != ":"; then
2499                         : on Eunice apparently
2500                         echo \$dir/\$thing
2501                 fi
2502                 exit 0
2503         fi
2504         ;;
2505         esac
2506 done
2507 echo \$dflt
2508 exit 1
2509 EOSC
2510 chmod +x loc
2511 $eunicefix loc
2512 loclist="
2513 awk
2514 cat
2515 chmod
2516 comm
2517 cp
2518 echo
2519 expr
2520 grep
2521 ls
2522 mkdir
2523 rm
2524 sed
2525 sort
2526 touch
2527 tr
2528 uniq
2529 "
2530 trylist="
2531 ar
2532 bison
2533 byacc
2534 cpp
2535 csh
2536 date
2537 egrep
2538 gmake
2539 gzip
2540 less
2541 ln
2542 make
2543 more
2544 nm
2545 nroff
2546 perl
2547 pg
2548 test
2549 uname
2550 zip
2551 "
2552 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2553 pth="$pth $sysroot/lib $sysroot/usr/lib"
2554 for file in $loclist; do
2555         eval xxx=\$$file
2556         case "$xxx" in
2557         /*|?:[\\/]*)
2558                 if test -f "$xxx"; then
2559                         : ok
2560                 else
2561                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2562                         xxx=`./loc $file $file $pth`
2563                 fi
2564                 ;;
2565         '') xxx=`./loc $file $file $pth`;;
2566         *) xxx=`./loc $xxx $xxx $pth`;;
2567         esac
2568         eval $file=$xxx$_exe
2569         eval _$file=$xxx
2570         case "$xxx" in
2571         /*)
2572                 echo $file is in $xxx.
2573                 ;;
2574         ?:[\\/]*)
2575                 echo $file is in $xxx.
2576                 ;;
2577         *)
2578                 echo "I don't know where '$file' is, and my life depends on it." >&4
2579                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2580                 exit 1
2581                 ;;
2582         esac
2583 done
2584 echo " "
2585 echo "Don't worry if any of the following aren't found..."
2586 say=offhand
2587 for file in $trylist; do
2588         eval xxx=\$$file
2589         case "$xxx" in
2590         /*|?:[\\/]*)
2591                 if test -f "$xxx"; then
2592                         : ok
2593                 else
2594                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2595                         xxx=`./loc $file $file $pth`
2596                 fi
2597                 ;;
2598         '') xxx=`./loc $file $file $pth`;;
2599         *) xxx=`./loc $xxx $xxx $pth`;;
2600         esac
2601         eval $file=$xxx$_exe
2602         eval _$file=$xxx
2603         case "$xxx" in
2604         /*)
2605                 echo $file is in $xxx.
2606                 ;;
2607         ?:[\\/]*)
2608                 echo $file is in $xxx.
2609                 ;;
2610         *)
2611                 echo "I don't see $file out there, $say."
2612                 say=either
2613                 ;;
2614         esac
2615 done
2616 case "$egrep" in
2617 egrep)
2618         echo "Substituting grep for egrep."
2619         egrep=$grep
2620         _egrep=$grep
2621         ;;
2622 esac
2623 case "$less" in
2624 '')     ;;
2625 *)      if $less -R </dev/null >/dev/null 2>&1; then
2626                echo "Substituting less -R for less."
2627                less="$less -R"
2628                _less=$less
2629         fi
2630         ;;
2631 esac
2632 case "$ln" in
2633 ln)
2634         echo "Substituting cp for ln."
2635         ln=$cp
2636         _ln=$cp
2637         ;;
2638 esac
2639 case "$make" in
2640 make)
2641         case "$gmake" in
2642         gmake)
2643         echo "I can't find make or gmake, and my life depends on it." >&4
2644         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2645         exit 1
2646         ;;
2647         esac
2648         ;;
2649 esac
2650 case "$gmake" in
2651 gmake)  ;;
2652 *)      # We can't have osname yet.
2653         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2654                 # Assume that gmake, if found, is definitely GNU make
2655                 # and prefer it over the system make.
2656                 echo "Substituting gmake for make."
2657                 make=$gmake
2658                 _make=$gmake
2659         fi
2660         ;;
2661 esac
2662 case "$test" in
2663 test)
2664         echo "Hopefully test is built into your sh."
2665         ;;
2666 *)
2667         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2668                 echo "Using the test built into your sh."
2669                 test=test
2670                 _test=test
2671         fi
2672         ;;
2673 esac
2674 case "$echo" in
2675 echo)
2676         echo "Hopefully echo is built into your sh."
2677         ;;
2678 '') ;;
2679 *)
2680         echo " "
2681 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2682         $echo $n "hi there$c" >foo1
2683         echo $n "hi there$c" >foo2
2684         if cmp foo1 foo2 >/dev/null 2>&1; then
2685                 echo "They are compatible.  In fact, they may be identical."
2686         else
2687                 case "$n" in
2688                 '-n') n='' c='\c';;
2689                 *) n='-n' c='';;
2690                 esac
2691                 cat <<FOO
2692 They are not compatible!  You are probably running ksh on a non-USG system.
2693 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2694 have echo built in and we may have to run some Bourne shell scripts.  That
2695 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2696
2697 FOO
2698                 $echo $n "The star should be here-->$c"
2699                 $echo "*"
2700         fi
2701         $rm -f foo1 foo2
2702         ;;
2703 esac
2704
2705 # This question was auctioned at YAPC::Europe-2007 in Vienna
2706 # I never promised you could answer it. I only auctioned the question.
2707 cat <<FOO
2708 The following message is sponsored by
2709
2710   Dresden.pm<--The stars should be here.
2711
2712 Dear Perl user, system administrator or package
2713 maintainer, the Perl community sends greetings to
2714 you. Do you (emblematical) greet back [Y/n]? n
2715
2716 FOO
2717
2718 : Check what type of C compiler we use
2719 cat <<EOS >trygcc
2720 $startsh
2721 EOS
2722 cat <<'EOSC' >>trygcc
2723 case "$cc" in
2724 '') ;;
2725 *)  $rm -f try try.*
2726     $cat >try.c <<EOM
2727 int main(int argc, char *argv[]) {
2728   return 0;
2729 }
2730 EOM
2731     if $cc -o try $ccflags $ldflags try.c; then
2732        :
2733     else
2734         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2735         despair=yes
2736         trygcc=yes
2737         case "$cc" in
2738         *gcc*) trygcc=no ;;
2739         esac
2740         # Skip this test because it gives a false match on output like:
2741         #    ./trygcc: line 23: cc: command not found
2742         # case "`$cc -v -c try.c 2>&1`" in
2743         # *gcc*) trygcc=no ;;
2744         # esac
2745         if $test X"$trygcc" = Xyes; then
2746             if gcc -o try -c try.c; then
2747                 echo " "
2748                 echo "You seem to have a working gcc, though." >&4
2749                 # Switching compilers may undo the work of hints files.
2750                 # The most common problem is -D_REENTRANT for threads.
2751                 # This heuristic catches that case, but gets false positives
2752                 # if -Dusethreads was not actually specified.  Better to
2753                 # bail out here with a useful message than fail
2754                 # mysteriously later. Should we perhaps just try to
2755                 # re-invoke Configure -Dcc=gcc config_args ?
2756                 if $test -f usethreads.cbu; then
2757                         $cat >&4 <<EOM
2758
2759 *** However, any setting of the C compiler flags (e.g. for thread support)
2760 *** will be lost.  It may be necessary for you to restart Configure and
2761 *** add -Dcc=gcc to your Configure command line.
2762
2763 EOM
2764                         rp="Would you like to go ahead and try gcc anyway?"
2765                         dflt=n
2766                 else
2767                         rp="Would you like to use it?"
2768                         dflt=y
2769                 fi
2770                 if $test -f myread; then
2771                     . ./myread
2772                 else
2773                     if $test -f UU/myread; then
2774                         . ./UU/myread
2775                     else
2776                         echo "Cannot find myread, sorry.  Aborting." >&2
2777                         exit 1
2778                     fi
2779                 fi
2780                 case "$ans" in
2781                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2782                 esac
2783             fi
2784         fi
2785     fi
2786     $rm -f try try.*
2787     ;;
2788 esac
2789 EOSC
2790
2791 cat <<EOS >checkcc
2792 $startsh
2793 EOS
2794 cat <<'EOSC' >>checkcc
2795 case "$cc" in
2796 '') ;;
2797 *)  $rm -f try try.*
2798     $cat >try.c <<EOM
2799 int main(int argc, char *argv[]) {
2800   return 0;
2801 }
2802 EOM
2803     if $cc -o try $ccflags $ldflags try.c; then
2804        :
2805     else
2806         if $test X"$despair" = Xyes; then
2807            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2808         fi
2809         $cat >&4 <<EOM
2810 You need to find a working C compiler.
2811 Either (purchase and) install the C compiler supplied by your OS vendor,
2812 or for a free C compiler try http://gcc.gnu.org/
2813 I cannot continue any further, aborting.
2814 EOM
2815         exit 1
2816     fi
2817     $rm -f try try.*
2818     ;;
2819 esac
2820 EOSC
2821
2822 : determine whether symbolic links are supported
2823 echo " "
2824 $touch blurfl
2825 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2826         echo "Symbolic links are supported." >&4
2827         lns="$ln -s"
2828 else
2829         echo "Symbolic links are NOT supported." >&4
2830         lns="$ln"
2831 fi
2832 $rm -f blurfl sym
2833
2834 : determine whether symbolic links are supported
2835 echo " "
2836 case "$lns" in
2837 *"ln"*" -s")
2838         echo "Checking how to test for symbolic links..." >&4
2839         $lns blurfl sym
2840         if $test "X$issymlink" = X; then
2841                 case "$newsh" in
2842                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2843                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2844                 esac
2845                 if test $? = 0; then
2846                         issymlink="test -h"
2847                 else
2848                         echo "Your builtin 'test -h' may be broken." >&4
2849                         case "$test" in
2850                         /*)     ;;
2851                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2852                                 for p in $pth
2853                                 do
2854                                         if test -f "$p/$test"; then
2855                                                 test="$p/$test"
2856                                                 break
2857                                         fi
2858                                 done
2859                                 ;;
2860                         esac
2861                         case "$test" in
2862                         /*)
2863                                 echo "Trying external '$test -h'." >&4
2864                                 issymlink="$test -h"
2865                                 if $test ! -h sym >/dev/null 2>&1; then
2866                                         echo "External '$test -h' is broken, too." >&4
2867                                         issymlink=''
2868                                 fi
2869                                 ;;
2870                         *)      issymlink='' ;;
2871                         esac
2872                 fi
2873         fi
2874         if $test "X$issymlink" = X; then
2875                 if $test -L sym 2>/dev/null; then
2876                         issymlink="$test -L"
2877                         echo "The builtin '$test -L' worked." >&4
2878                 fi
2879         fi
2880         if $test "X$issymlink" != X; then
2881                 echo "You can test for symbolic links with '$issymlink'." >&4
2882         else
2883                 echo "I do not know how you can test for symbolic links." >&4
2884         fi
2885         $rm -f blurfl sym
2886         ;;
2887 *)      echo "No symbolic links, so not testing for their testing..." >&4
2888         ;;
2889 esac
2890
2891 : Make symlinks util
2892 case "$mksymlinks" in
2893 $define|true|[yY]*)
2894         case "$src" in
2895         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2896                 exit 1
2897                 ;;
2898         *)      case "$lns:$issymlink" in
2899                 *"ln"*" -s:"*"test -"?)
2900                         echo "Creating the symbolic links..." >&4
2901                         cd ..
2902                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2903                         awk 'NF == 1 {
2904                                 dir=".";
2905                                 file=$1 "";
2906                              }
2907                              NF == 2 {
2908                                 dir=$1 "";
2909                                 file=$2 "";
2910                              }
2911                              {
2912                                  print "# dir = ", dir, "file = ", file
2913                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2914                              } END {
2915                                  for (d in mf) {
2916                                      if (d != ".") { print("mkdir -p "d) }
2917                                      print("ln -sf "mf[d]" "d);
2918                                  }
2919                              }' source="$src" > UU/mksymlinks.$$
2920                         sh UU/mksymlinks.$$
2921                         rm UU/mksymlinks.$$
2922                         # Sanity check 1.
2923                         if test ! -d t/base; then
2924                                 echo "Failed to create the subdirectories.  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         # Sanity check 2.
2928                         if test ! -f t/base/lex.t; then
2929                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2930                                 exit 1
2931                         fi
2932                         if test ! -f win32/win32.c; then
2933                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2934                                 exit 1
2935                         fi
2936                         cd UU
2937                         ;;
2938                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2939                         ;;
2940                 esac
2941                 ;;
2942         esac
2943         ;;
2944 esac
2945
2946 : Check for Cross-Compilation
2947 if $test "X$targethost" = "X"; then
2948     targethost=""
2949 fi
2950 if $test "X$targetenv" = "X"; then
2951     targetenv=""
2952 fi
2953 case "$usecrosscompile" in
2954 $define|true|[yY]*)
2955         $echo "Cross-compiling..."
2956         croak=''
2957         case "$cc" in
2958         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2959             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2960             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2961             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2962             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2963             # leave out ld, choosing it is more complex
2964             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2965             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2966             # We are in a weird spot. Just before us, some values
2967             # were 'saved', to be restored after the hints are
2968             # run.  This means that the changes we made to ar,
2969             # nm and ranlib will get reverted.
2970             # To avoid that, we hijack the saving mechanism and
2971             # have it save our new values.
2972             for file in ar nm ranlib; do
2973                 eval xxx=\$$file
2974                 eval $file=$xxx$_exe
2975                 eval _$file=$xxx
2976             done
2977         ;;
2978         esac
2979         case "$targetarch" in
2980         '') echo "Targetarch not defined." >&4; croak=y ;;
2981         *)  echo "Using targetarch $targetarch." >&4 ;;
2982         esac
2983         case "$targethost" in
2984         '') echo "Targethost not defined." >&4; croak=n ;;
2985         *)  echo "Using targethost $targethost." >&4
2986         esac
2987         locincpth=' '
2988         loclibpth=' '
2989         case "$croak" in
2990         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2991         esac
2992     : compile a host miniperl and generate_uudmap, unless we got passed them
2993     if $test "X$hostperl" = X; then
2994       echo "Building host miniperl and generate_uudmap binaries" >&4
2995       before_host=`pwd`
2996       cd ..
2997       cd $src
2998       src=`pwd`
2999       rm -rf $src/host
3000       mkdir $src/host
3001       cd $src/host
3002       $src/Configure -des -Dusedevel -Dmksymlinks
3003       $make miniperl
3004       case "$hostgenerate" in
3005       '') $make generate_uudmap
3006           hostgenerate=$src/host/generate_uudmap
3007           ;;
3008        "$undef") hostgenerate=''
3009           ;;
3010       esac
3011       hostperl=$src/host/miniperl
3012       cd $before_host
3013     fi
3014     hostosname=`$hostperl -le 'print $^O'`
3015     ;;
3016 *)
3017     usecrosscompile="$undef"
3018     ;;
3019 esac
3020
3021 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3022 case "$targethost" in
3023     '') echo "Checking for cross-compile" >&4
3024     case "$usecrosscompile$multiarch" in
3025        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3026          if [ -f Makefile ]; then
3027            echo " "
3028            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3029          else
3030            echo "Configure done."
3031          fi
3032        exit 0
3033        ;;
3034      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3035         run=''
3036         to=:
3037         from=:
3038         ;;
3039     esac
3040     ;;
3041     *) echo "Using targethost $targethost." >&4
3042         case "$src" in
3043         /*) run=$src/Cross/run
3044             targetmkdir=$src/Cross/mkdir
3045             to=$src/Cross/to
3046             from=$src/Cross/from
3047             ;;
3048         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3049             run=$pwd/Cross/run
3050             targetmkdir=$pwd/Cross/mkdir
3051             to=$pwd/Cross/to
3052             from=$pwd/Cross/from
3053             ;;
3054         esac
3055         case "$targetrun" in
3056         '') targetrun=ssh ;;
3057         esac
3058         case "$targetto" in
3059         '') targetto=scp ;;
3060         esac
3061         case "$targetfrom" in
3062         '') targetfrom=scp ;;
3063         esac
3064         run=$run-$targetrun
3065         to=$to-$targetto
3066         from=$from-$targetfrom
3067         case "$targetdir" in
3068         '')  targetdir=/tmp
3069              echo "Guessing targetdir $targetdir." >&4
3070              ;;
3071         esac
3072         case "$targetuser" in
3073         '')  targetuser=root
3074              echo "Guessing targetuser $targetuser." >&4
3075              ;;
3076         esac
3077         case "$targetport" in
3078         '')  targetport=22
3079              echo "Guessing targetport $targetport." >&4
3080              ;;
3081         esac
3082         case "$targetfrom" in
3083         scp)    q=-q ;;
3084         *)      q='' ;;
3085         esac
3086         case "$targetrun" in
3087         ssh|rsh)
3088             cat >$run <<EOF
3089 #!/bin/sh
3090 env=''
3091 case "\$1" in
3092 -cwd)
3093   shift
3094   cwd=\$1
3095   shift
3096   ;;
3097 esac
3098 case "\$1" in
3099 -env)
3100   shift
3101   env=\$1
3102   shift
3103   ;;
3104 esac
3105 case "\$cwd" in
3106 '') cwd=$targetdir ;;
3107 esac
3108 exe=\$1
3109 shift
3110 $to \$exe
3111 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3112 EOF
3113             ;;
3114         adb)
3115             $touch $run
3116             ;;
3117         *)  echo "Unknown targetrun '$targetrun'" >&4
3118             exit 1
3119             ;;
3120         esac
3121         case "$targetmkdir" in
3122         */Cross/mkdir)
3123             cat >$targetmkdir <<EOF
3124 #!/bin/sh
3125 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3126 EOF
3127             $chmod a+rx $targetmkdir
3128             ;;
3129         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3130             exit 1
3131             ;;
3132         esac
3133         case "$targetto" in
3134         scp|rcp)
3135             cat >$to <<EOF
3136 #!/bin/sh
3137 for f in \$@
3138 do
3139   case "\$f" in
3140   /*)
3141     $targetmkdir \`dirname \$f\`
3142     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3143     ;;
3144   *)
3145     $targetmkdir $targetdir/\`dirname \$f\`
3146     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3147     ;;
3148   esac
3149 done
3150 exit 0
3151 EOF
3152             ;;
3153         cp) cat >$to <<EOF
3154 #!/bin/sh
3155 for f in \$@
3156 do
3157   case "\$f" in
3158   /*)
3159     $mkdir -p $targetdir/\`dirname \$f\`
3160     $cp \$f $targetdir/\$f || exit 1
3161     ;;
3162   *)
3163     $targetmkdir $targetdir/\`dirname \$f\`
3164     $cp \$f $targetdir/\$f || exit 1
3165     ;;
3166   esac
3167 done
3168 exit 0
3169 EOF
3170             ;;
3171         *)  echo "Unknown targetto '$targetto'" >&4
3172             exit 1
3173             ;;
3174         esac
3175         case "$targetfrom" in
3176         scp|rcp)
3177           cat >$from <<EOF
3178 #!/bin/sh
3179 for f in \$@
3180 do
3181   $rm -f \$f
3182   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3183 done
3184 exit 0
3185 EOF
3186             ;;
3187         cp) cat >$from <<EOF
3188 #!/bin/sh
3189 for f in \$@
3190 do
3191   $rm -f \$f
3192   cp $targetdir/\$f . || exit 1
3193 done
3194 exit 0
3195 EOF
3196             ;;
3197         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3198             exit 1
3199             ;;
3200         esac
3201         if $test ! -f $run; then
3202             echo "Target 'run' script '$run' not found." >&4
3203         else
3204             $chmod a+rx $run
3205         fi
3206         if $test ! -f $to; then
3207             echo "Target 'to' script '$to' not found." >&4
3208         else
3209             $chmod a+rx $to
3210         fi
3211         if $test ! -f $from; then
3212             echo "Target 'from' script '$from' not found." >&4
3213         else
3214             $chmod a+rx $from
3215         fi
3216         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3217             exit 1
3218         fi
3219         cat >&4 <<EOF
3220 Using '$run' for remote execution,
3221 and '$from' and '$to'
3222 for remote file transfer.
3223 EOF
3224         ;;
3225 *)      run=''
3226         to=:
3227         from=:
3228         usecrosscompile="$undef"
3229         targetarch=''
3230         ;;
3231 esac
3232
3233 : see whether [:lower:] and [:upper:] are supported character classes
3234 echo " "
3235 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3236 ABYZ-abyz)
3237         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3238         up='[:upper:]'
3239         low='[:lower:]'
3240         ;;
3241 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3242         # (0xd9 and 0xe2), therefore that is a nice testing point.
3243         if test "X$up" = X -o "X$low" = X; then
3244             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3245             rs) up='[A-Z]'
3246                 low='[a-z]'
3247                 ;;
3248             esac
3249         fi
3250         if test "X$up" = X -o "X$low" = X; then
3251             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3252             rs) up='A-Z'
3253                 low='a-z'
3254                 ;;
3255             esac
3256         fi
3257         if test "X$up" = X -o "X$low" = X; then
3258             case "`echo RS | od -x 2>/dev/null`" in
3259             *D9E2*|*d9e2*)
3260                 echo "Hey, this might be EBCDIC." >&4
3261                 if test "X$up" = X -o "X$low" = X; then
3262                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3263                     rs) up='[A-IJ-RS-Z]'
3264                         low='[a-ij-rs-z]'
3265                         ;;
3266                     esac
3267                 fi
3268                 if test "X$up" = X -o "X$low" = X; then
3269                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3270                     rs) up='A-IJ-RS-Z'
3271                         low='a-ij-rs-z'
3272                         ;;
3273                     esac
3274                 fi
3275                 ;;
3276             esac
3277         fi
3278 esac
3279 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3280 rs)
3281     echo "Using $up and $low to convert case." >&4
3282     ;;
3283 *)
3284     echo "I don't know how to translate letters from upper to lower case." >&4
3285     echo "Your tr is not acting any way I know of." >&4
3286     exit 1
3287     ;;
3288 esac
3289 : set up the translation script tr, must be called with ./tr of course
3290 cat >tr <<EOSC
3291 $startsh
3292 case "\$1\$2" in
3293 '[A-Z][a-z]') exec $tr '$up' '$low';;
3294 '[a-z][A-Z]') exec $tr '$low' '$up';;
3295 esac
3296 exec $tr "\$@"
3297 EOSC
3298 chmod +x tr
3299 $eunicefix tr
3300
3301 : Try to determine whether config.sh was made on this system
3302 case "$config_sh" in
3303 '')
3304 myuname=`$uname -a 2>/dev/null`
3305 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3306 # Downcase everything to avoid ambiguity.
3307 # Remove slashes and single quotes so we can use parts of this in
3308 # directory and file names.
3309 # Remove newlines so myuname is sane to use elsewhere.
3310 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3311 # because the A-Z/a-z are not consecutive.
3312 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3313         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3314 newmyuname="$myuname"
3315 dflt=n
3316 case "$knowitall" in
3317 '')
3318         if test -f ../config.sh; then
3319                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3320                         eval "`grep myuname= ../config.sh`"
3321                 fi
3322                 if test "X$myuname" = "X$newmyuname"; then
3323                         dflt=y
3324                 fi
3325         fi
3326         ;;
3327 *) dflt=y;;
3328 esac
3329
3330 : Get old answers from old config file if Configure was run on the
3331 : same system, otherwise use the hints.
3332 hint=default
3333 cd ..
3334 if test -f config.sh; then
3335         echo " "
3336         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3337         . UU/myread
3338         case "$ans" in
3339         n*|N*) echo "OK, I'll ignore it."
3340                 mv config.sh config.sh.old
3341                 myuname="$newmyuname"
3342                 ;;
3343         *)  echo "Fetching default answers from your old config.sh file..." >&4
3344                 tmp_n="$n"
3345                 tmp_c="$c"
3346                 tmp_sh="$sh"
3347                 . ./config.sh
3348                 cp config.sh UU
3349                 n="$tmp_n"
3350                 c="$tmp_c"
3351                 : Older versions did not always set $sh.  Catch re-use of such
3352                 : an old config.sh.
3353                 case "$sh" in
3354                 '') sh="$tmp_sh" ;;
3355                 esac
3356                 hint=previous
3357                 ;;
3358         esac
3359 fi
3360 . ./UU/checkcc
3361 if test ! -f config.sh; then
3362         $cat <<EOM
3363
3364 First time through, eh?  I have some defaults handy for some systems
3365 that need some extra help getting the Configure answers right:
3366
3367 EOM
3368         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3369         dflt=''
3370         : Half the following guesses are probably wrong... If you have better
3371         : tests or hints, please send them to perlbug@perl.org
3372         : The metaconfig authors would also appreciate a copy...
3373         $test -f /irix && osname=irix
3374         $test -f /xenix && osname=sco_xenix
3375         $test -f /dynix && osname=dynix
3376         $test -f /dnix && osname=dnix
3377         $test -f /lynx.os && osname=lynxos
3378         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3379         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3380         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3381         $test -f /bin/mips && /bin/mips && osname=mips
3382         $test -d /usr/apollo/bin && osname=apollo
3383         $test -f /etc/saf/_sactab && osname=svr4
3384         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3385         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3386         $test -f /sys/utilities/MultiView && osname=amigaos
3387         if $test -d /MachTen -o -d /MachTen_Folder; then
3388                 osname=machten
3389                 if $test -x /sbin/version; then
3390                         osvers=`/sbin/version | $awk '{print $2}' |
3391                         $sed -e 's/[A-Za-z]$//'`
3392                 elif $test -x /usr/etc/version; then
3393                         osvers=`/usr/etc/version | $awk '{print $2}' |
3394                         $sed -e 's/[A-Za-z]$//'`
3395                 else
3396                         osvers="$2.$3"
3397                 fi
3398         fi
3399
3400         $test -f /sys/posix.dll &&
3401                 $test -f /usr/bin/what &&
3402                 set X `/usr/bin/what /sys/posix.dll` &&
3403                 $test "$3" = UWIN &&
3404                 osname=uwin &&
3405                 osvers="$5"
3406
3407         if $test -f $uname; then
3408                 set X $myuname
3409                 shift
3410
3411                 case "$5" in
3412                 fps*) osname=fps ;;
3413                 mips*)
3414                         case "$4" in
3415                         umips) osname=umips ;;
3416                         *) osname=mips ;;
3417                         esac;;
3418                 [23]100) osname=mips ;;
3419                 i386*)
3420                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3421                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3422                                 osname='sco'
3423                                 osvers=$tmp
3424                         elif $test -f /etc/kconfig; then
3425                                 osname=isc
3426                                 if test "$lns" = "$ln -s"; then
3427                                         osvers=4
3428                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3429                                         osvers=3
3430                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3431                                         osvers=2
3432                                 fi
3433                         fi
3434                         tmp=''
3435                         ;;
3436                 pc*)
3437                         if test -n "$DJGPP"; then
3438                                 osname=dos
3439                                 osvers=djgpp
3440                         fi
3441                         ;;
3442                 esac
3443
3444                 case "$1" in
3445                 aix) osname=aix
3446                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3447                         case "$tmp" in
3448                         # oslevel can fail with:
3449                         # oslevel: Unable to acquire lock.
3450                         *not\ found) osvers="$4"."$3" ;;
3451                         '<3240'|'<>3240') osvers=3.2.0 ;;
3452                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3453                         '=3250'|'>3250') osvers=3.2.5 ;;
3454                         *) osvers=$tmp;;
3455                         esac
3456                         ;;
3457                 bitrig) osname=bitrig
3458                         osvers="$3"
3459                         ;;
3460                 bsd386) osname=bsd386
3461                         osvers=`$uname -r`
3462                         ;;
3463                 cygwin*) osname=cygwin
3464                         osvers="$3"
3465                         ;;
3466                 *dc.osx) osname=dcosx
3467                         osvers="$3"
3468                         ;;
3469                 dnix) osname=dnix
3470                         osvers="$3"
3471                         ;;
3472                 domainos) osname=apollo
3473                         osvers="$3"
3474                         ;;
3475                 dgux)   osname=dgux
3476                         osvers="$3"
3477                         ;;
3478                 dragonfly) osname=dragonfly
3479                         osvers="$3"
3480                         ;;
3481                 dynixptx*) osname=dynixptx
3482                         osvers=`echo "$4"|sed 's/^v//'`
3483                         ;;
3484                 freebsd) osname=freebsd
3485                         osvers="$3" ;;
3486                 genix)  osname=genix ;;
3487                 gnu)    osname=gnu
3488                         osvers="$3" ;;
3489                 hp*)    osname=hpux
3490                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3491                         ;;
3492                 irix*)  osname=irix
3493                         case "$3" in
3494                         4*) osvers=4 ;;
3495                         5*) osvers=5 ;;
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         ;;
3499                 linux)  osname=linux
3500                         case "$3" in
3501                         *)      osvers="$3" ;;
3502                         esac
3503                         $test -f /system/lib/libandroid.so && osname=linux-android
3504                         ;;
3505                 MiNT)   osname=mint
3506                         ;;
3507                 minix)  osname=minix
3508                         osvers=`$uname -r`
3509                         ;;
3510                 netbsd*) osname=netbsd
3511                         osvers="$3"
3512                         ;;
3513                 news-os) osvers="$3"
3514                         case "$3" in
3515                         4*) osname=newsos4 ;;
3516                         *) osname=newsos ;;
3517                         esac
3518                         ;;
3519                 nonstop-ux) osname=nonstopux ;;
3520                 openbsd) osname=openbsd
3521                         osvers="$3"
3522                         ;;
3523                 os2)    osname=os2
3524                         osvers="$4"
3525                         ;;
3526                 POSIX-BC | posix-bc ) osname=posix-bc
3527                         osvers="$3"
3528                         ;;
3529                 powerux | power_ux | powermax_os | powermaxos | \
3530                 powerunix | power_unix) osname=powerux
3531                         osvers="$3"
3532                         ;;
3533                 qnx) osname=qnx
3534                         osvers="$4"
3535                         ;;
3536                 solaris) osname=solaris
3537                         case "$3" in
3538                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3539                         *)      osvers="$3" ;;
3540                         esac
3541                         ;;
3542                 sunos) osname=sunos
3543                         case "$3" in
3544                         5*) osname=solaris
3545                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3546                         *)      osvers="$3" ;;
3547                         esac
3548                         ;;
3549                 titanos) osname=titanos
3550                         case "$3" in
3551                         1*) osvers=1 ;;
3552                         2*) osvers=2 ;;
3553                         3*) osvers=3 ;;
3554                         4*) osvers=4 ;;
3555                         *)      osvers="$3" ;;
3556                         esac
3557                         ;;
3558                 ultrix) osname=ultrix
3559                         osvers="$3"
3560                         ;;
3561                 osf1|mls+)      case "$5" in
3562                                 alpha)
3563                                         osname=dec_osf
3564                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3565                                         case "$osvers" in
3566                                         [1-9].[0-9]*) ;;
3567                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3568                                         esac
3569                                         ;;
3570                         hp*)    osname=hp_osf1  ;;
3571                         mips)   osname=mips_osf1 ;;
3572                         esac
3573                         ;;
3574                 # UnixWare 7.1.2 is known as Open UNIX 8
3575                 openunix|unixware) osname=svr5
3576                         osvers="$4"
3577                         ;;
3578                 uts)    osname=uts
3579                         osvers="$3"
3580                         ;;
3581                 vos) osvers="$3"
3582                         ;;
3583                 $2) case "$osname" in
3584                         *isc*) ;;
3585                         *freebsd*) ;;
3586                         svr*)
3587                                 : svr4.x or possibly later
3588                                 case "svr$3" in
3589                                 ${osname}*)
3590                                         osname=svr$3
3591                                         osvers=$4
3592                                         ;;
3593                                 esac
3594                                 case "$osname" in
3595                                 svr4.0)
3596                                         : Check for ESIX
3597                                         if test -f /stand/boot ; then
3598                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3599                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3600                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3601                                                         if test -n "$isesix"; then
3602                                                                 osname=esix4
3603                                                         fi
3604                                                 fi
3605                                         fi
3606                                         ;;
3607                                 esac
3608                                 ;;
3609                         *)      if test -f /etc/systemid; then
3610                                         osname=sco
3611                                         set `echo $3 | $sed 's/\./ /g'` $4
3612                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3613                                                 osvers=$1.$2.$3
3614                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3615                                                 osvers=$1.$2
3616                                         elif $test -f $src/hints/sco_$1.sh; then
3617                                                 osvers=$1
3618                                         fi
3619                                 else
3620                                         case "$osname" in
3621                                         '') : Still unknown.  Probably a generic Sys V.
3622                                                 osname="sysv"
3623                                                 osvers="$3"
3624                                                 ;;
3625                                         esac
3626                                 fi
3627                                 ;;
3628                         esac
3629                         ;;
3630                 *)      case "$osname" in
3631                         '') : Still unknown.  Probably a generic BSD.
3632                                 osname="$1"
3633                                 osvers="$3"
3634                                 ;;
3635                         esac
3636                         ;;
3637                 esac
3638         else
3639                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3640                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3641                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3642                                 osname=news_os
3643                         fi
3644                         $rm -f UU/kernel.what
3645                 elif test -d c:/. -o -n "$is_os2" ; then
3646                         set X $myuname
3647                         osname=os2
3648                         osvers="$5"
3649                 fi
3650         fi
3651
3652         case "$targetarch" in
3653         '') ;;
3654         *)  hostarch=$osname
3655             case "$targetarch" in
3656                 nto*|*-nto-*)
3657                     # Will load qnx.sh, which should change osname to nto
3658                     osname=qnx
3659                     osvers=''
3660                     ;;
3661                 *linux-android*)
3662                     # Catch arm-linux-androideabi, mipsel-linux-android,
3663                     # and i686-linux-android
3664                     osname=linux-android
3665                     osvers=''
3666                     ;;
3667                 *linux*)
3668                     # Something like arm-linux-gnueabihf is really just
3669                     # plain linux.
3670                     osname=linux
3671                     osvers=''
3672                     ;;
3673                 *solaris*|*sunos*)
3674                     osname=solaris
3675                     # XXX perhaps we should just assume
3676                     # osvers to be 2, or maybe take the value
3677                     # from targetarch. Using $run before the
3678                     # hints are run is somewhat icky.
3679                     set X `$run $uname -a 2>/dev/null`
3680                     shift
3681                     case "$3" in
3682                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3683                         *)  osvers="$3" ;;
3684                     esac
3685                     ;;
3686                 *)
3687                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3688                     osvers=''
3689                 ;;
3690             esac
3691             ;;
3692         esac
3693
3694         : Now look for a hint file osname_osvers, unless one has been
3695         : specified already.
3696         case "$hintfile" in
3697         ''|' ')
3698                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3699                 : Also try without trailing minor version numbers.
3700                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3701                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3702                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3703                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3704                 case "$file" in
3705                 '') dflt=none ;;
3706                 *)  case "$osvers" in
3707                         '') dflt=$file
3708                                 ;;
3709                         *)  if $test -f $src/hints/$file.sh ; then
3710                                         dflt=$file
3711                                 elif $test -f $src/hints/$xfile.sh ; then
3712                                         dflt=$xfile
3713                                 elif $test -f $src/hints/$xxfile.sh ; then
3714                                         dflt=$xxfile
3715                                 elif $test -f $src/hints/$xxxfile.sh ; then
3716                                         dflt=$xxxfile
3717                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3718                                         dflt=$xxxxfile
3719                                 elif $test -f "$src/hints/${osname}.sh" ; then
3720                                         dflt="${osname}"
3721                                 else
3722                                         dflt=none
3723                                 fi
3724                                 ;;
3725                         esac
3726                         ;;
3727                 esac
3728                 if $test -f Policy.sh ; then
3729                         case "$dflt" in
3730                         *Policy*) ;;
3731                         none) dflt="Policy" ;;
3732                         *) dflt="Policy $dflt" ;;
3733                         esac
3734                 fi
3735                 ;;
3736         *)
3737                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3738                 ;;
3739         esac
3740
3741         if $test -f Policy.sh ; then
3742                 $cat <<EOM
3743
3744 There's also a Policy hint file available, which should make the
3745 site-specific (policy) questions easier to answer.
3746 EOM
3747
3748         fi
3749
3750         $cat <<EOM
3751
3752 You may give one or more space-separated answers, or "none" if appropriate.
3753 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3754 previous run of Configure, you may specify it as well as or instead of
3755 OS-specific hints.  If hints are provided for your OS, you should use them:
3756 although Perl can probably be built without hints on many platforms, using
3757 hints often improve performance and may enable features that Configure can't
3758 set up on its own. If there are no hints that match your OS, specify "none";
3759 DO NOT give a wrong version or a wrong OS.
3760
3761 EOM
3762
3763         rp="Which of these apply, if any?"
3764         . UU/myread
3765         tans=$ans
3766         for file in $tans; do
3767                 if $test X$file = XPolicy -a -f Policy.sh; then
3768                         . Policy.sh
3769                         $cat Policy.sh >> UU/config.sh
3770                 elif $test -f $src/hints/$file.sh; then
3771                         . $src/hints/$file.sh
3772                         $cat $src/hints/$file.sh >> UU/config.sh
3773                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3774                         : nothing
3775                 else
3776                         : Give one chance to correct a possible typo.
3777                         echo "$file.sh does not exist"
3778                         dflt=$file
3779                         rp="hint to use instead?"
3780                         . UU/myread
3781                         for file in $ans; do
3782                                 if $test -f "$src/hints/$file.sh"; then
3783                                         . $src/hints/$file.sh
3784                                         $cat $src/hints/$file.sh >> UU/config.sh
3785                                 elif $test X$ans = X -o X$ans = Xnone ; then
3786                                         : nothing
3787                                 else
3788                                         echo "$file.sh does not exist -- ignored."
3789                                 fi
3790                         done
3791                 fi
3792         done
3793
3794         hint=recommended
3795         : Remember our hint file for later.
3796         if $test -f "$src/hints/$file.sh" ; then
3797                 hintfile="$file"
3798         else
3799                 hintfile=''
3800         fi
3801 fi
3802 cd UU
3803 ;;
3804 *)
3805         echo " "
3806         echo "Fetching default answers from $config_sh..." >&4
3807         tmp_n="$n"
3808         tmp_c="$c"
3809         cd ..
3810         cp $config_sh config.sh 2>/dev/null
3811         chmod +w config.sh
3812         . ./config.sh
3813         cd UU
3814         cp ../config.sh .
3815         n="$tmp_n"
3816         c="$tmp_c"
3817         hint=previous
3818         ;;
3819 esac
3820 . ./optdef.sh
3821
3822 : Restore computed paths
3823 for file in $loclist $trylist; do
3824         eval $file="\$_$file"
3825 done
3826
3827 cat << EOM
3828
3829 Configure uses the operating system name and version to set some defaults.
3830 The default value is probably right if the name rings a bell. Otherwise,
3831 since spelling matters for me, either accept the default or answer "none"
3832 to leave it blank.
3833
3834 EOM
3835 case "$osname" in
3836         ''|' ')
3837                 case "$hintfile" in
3838                 ''|' '|none) dflt=none ;;
3839                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3840                 esac
3841                 ;;
3842         *) dflt="$osname" ;;
3843 esac
3844 rp="Operating system name?"
3845 . ./myread
3846 case "$ans" in
3847 none)  osname='' ;;
3848 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3849 esac
3850 echo " "
3851 case "$osvers" in
3852         ''|' ')
3853                 case "$hintfile" in
3854                 ''|' '|none) dflt=none ;;
3855                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3856                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3857                         case "$dflt" in
3858                         ''|' ') dflt=none ;;
3859                         esac
3860                         ;;
3861                 esac
3862                 ;;
3863         *) dflt="$osvers" ;;
3864 esac
3865 rp="Operating system version?"
3866 . ./myread
3867 case "$ans" in
3868 none)  osvers='' ;;
3869 *) osvers="$ans" ;;
3870 esac
3871
3872
3873 . ./posthint.sh
3874
3875 : who configured the system
3876 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3877 case "$cf_by" in
3878 "")
3879         cf_by=`(logname) 2>/dev/null`
3880         case "$cf_by" in
3881         "")
3882                 cf_by=`(whoami) 2>/dev/null`
3883                 case "$cf_by" in
3884                 "") cf_by=unknown ;;
3885                 esac ;;
3886         esac ;;
3887 esac
3888
3889 : decide how portable to be.  Allow command line overrides.
3890 case "$d_portable" in
3891 "$undef") ;;
3892 *)      d_portable="$define" ;;
3893 esac
3894
3895 : set up shell script to do ~ expansion
3896 cat >filexp <<EOSS
3897 $startsh
3898 : expand filename
3899 case "\$1" in
3900  \~/*|\~)
3901         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3902         ;;
3903  \~*)
3904         if $test -f /bin/csh; then
3905                 /bin/csh -f -c "glob \$1"
3906                 failed=\$?
3907                 echo ""
3908                 exit \$failed
3909         else
3910                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3911                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3912                 if $test ! -d "\$dir"; then
3913                         me=\`basename \$0\`
3914                         echo "\$me: can't locate home directory for: \$name" >&2
3915                         exit 1
3916                 fi
3917                 case "\$1" in
3918                 */*)
3919                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3920                         ;;
3921                 *)
3922                         echo \$dir
3923                         ;;
3924                 esac
3925         fi
3926         ;;
3927 *)
3928         echo \$1
3929         ;;
3930 esac
3931 EOSS
3932 chmod +x filexp
3933 $eunicefix filexp
3934
3935 : now set up to get a file name
3936 cat <<EOS >getfile
3937 $startsh
3938 EOS
3939 cat <<'EOSC' >>getfile
3940 tilde=''
3941 fullpath=''
3942 already=''
3943 skip=''
3944 none_ok=''
3945 exp_file=''
3946 nopath_ok=''
3947 orig_rp="$rp"
3948 orig_dflt="$dflt"
3949 case "$gfpth" in
3950 '') gfpth='.' ;;
3951 esac
3952
3953 case "$fn" in
3954 *\(*)
3955         : getfile will accept an answer from the comma-separated list
3956         : enclosed in parentheses even if it does not meet other criteria.
3957         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3958         fn=`echo $fn | sed 's/(.*)//'`
3959         ;;
3960 esac
3961
3962 case "$fn" in
3963 *:*)
3964         loc_file=`expr $fn : '.*:\(.*\)'`
3965         fn=`expr $fn : '\(.*\):.*'`
3966         ;;
3967 esac
3968
3969 case "$fn" in
3970 *~*) tilde=true;;
3971 esac
3972 case "$fn" in
3973 */*) fullpath=true;;
3974 esac
3975 case "$fn" in
3976 *+*) skip=true;;
3977 esac
3978 case "$fn" in
3979 *n*) none_ok=true;;
3980 esac
3981 case "$fn" in
3982 *e*) exp_file=true;;
3983 esac
3984 case "$fn" in
3985 *p*) nopath_ok=true;;
3986 esac
3987
3988 case "$fn" in
3989 *f*) type='File';;
3990 *d*) type='Directory';;
3991 *l*) type='Locate';;
3992 esac
3993
3994 what="$type"
3995 case "$what" in
3996 Locate) what='File';;
3997 esac
3998
3999 case "$exp_file" in
4000 '')
4001         case "$d_portable" in
4002         "$define") ;;
4003         *) exp_file=true;;
4004         esac
4005         ;;
4006 esac
4007
4008 cd ..
4009 while test "$type"; do
4010         redo=''
4011         rp="$orig_rp"
4012         dflt="$orig_dflt"
4013         case "$tilde" in
4014         true) rp="$rp (~name ok)";;
4015         esac
4016         . UU/myread
4017         if test -f UU/getfile.ok && \
4018                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4019         then
4020                 value="$ans"
4021                 ansexp="$ans"
4022                 break
4023         fi
4024         case "$ans" in
4025         none)
4026                 value=''
4027                 ansexp=''
4028                 case "$none_ok" in
4029                 true) type='';;
4030                 esac
4031                 ;;
4032         *)
4033                 case "$tilde" in
4034                 '') value="$ans"
4035                         ansexp="$ans";;
4036                 *)
4037                         value=`UU/filexp $ans`
4038                         case $? in
4039                         0)
4040                                 if test "$ans" != "$value"; then
4041                                         echo "(That expands to $value on this system.)"
4042                                 fi
4043                                 ;;
4044                         *) value="$ans";;
4045                         esac
4046                         ansexp="$value"
4047                         case "$exp_file" in
4048                         '') value="$ans";;
4049                         esac
4050                         ;;
4051                 esac
4052                 case "$fullpath" in
4053                 true)
4054                         case "$ansexp" in
4055                         /*) value="$ansexp" ;;
4056                         [a-zA-Z]:/*) value="$ansexp" ;;
4057                         *)
4058                                 redo=true
4059                                 case "$already" in
4060                                 true)
4061                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4062                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4063                                         ;;
4064                                 *)
4065                                 echo "Please give a full path name, starting with slash." >&4
4066                                         case "$tilde" in
4067                                         true)
4068                                 echo "Note that using ~name is ok provided it expands well." >&4
4069                                                 already=true
4070                                                 ;;
4071                                         esac
4072                                 esac
4073                                 ;;
4074                         esac
4075                         ;;
4076                 esac
4077                 case "$redo" in
4078                 '')
4079                         case "$type" in
4080                         File)
4081                                 for fp in $gfpth; do
4082                                         if test "X$fp" = X.; then
4083                                             pf="$ansexp"
4084                                         else    
4085                                             pf="$fp/$ansexp"
4086                                         fi
4087                                         if test -f "$pf"; then
4088                                                 type=''
4089                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4090                                         then
4091                                                 echo "($value is not a plain file, but that's ok.)"
4092                                                 type=''
4093                                         fi
4094                                         if test X"$type" = X; then
4095                                             value="$pf"
4096                                             break
4097                                         fi
4098                                 done
4099                                 ;;
4100                         Directory)
4101                                 for fp in $gfpth; do
4102                                         if test "X$fp" = X.; then
4103                                             dir="$ans"
4104                                             direxp="$ansexp"
4105                                         else    
4106                                             dir="$fp/$ansexp"
4107                                             direxp="$fp/$ansexp"
4108                                         fi
4109                                         if test -d "$direxp"; then
4110                                                 type=''
4111                                                 value="$dir"
4112                                                 break
4113                                         fi
4114                                 done
4115                                 ;;
4116                         Locate)
4117                                 if test -d "$ansexp"; then
4118                                         echo "(Looking for $loc_file in directory $value.)"
4119                                         value="$value/$loc_file"
4120                                         ansexp="$ansexp/$loc_file"
4121                                 fi
4122                                 if test -f "$ansexp"; then
4123                                         type=''
4124                                 fi
4125                                 case "$nopath_ok" in
4126                                 true)   case "$value" in
4127                                         */*) ;;
4128                                         *)      echo "Assuming $value will be in people's path."
4129                                                 type=''
4130                                                 ;;
4131                                         esac
4132                                         ;;
4133                                 esac
4134                                 ;;
4135                         esac
4136
4137                         case "$skip" in
4138                         true) type='';
4139                         esac
4140
4141                         case "$type" in
4142                         '') ;;
4143                         *)
4144                                 if test "$fastread" = yes; then
4145                                         dflt=y
4146                                 else
4147                                         dflt=n
4148                                 fi
4149                                 rp="$what $value doesn't exist.  Use that name anyway?"
4150                                 . UU/myread
4151                                 dflt=''
4152                                 case "$ans" in
4153                                 y*) type='';;
4154                                 *) echo " ";;
4155                                 esac
4156                                 ;;
4157                         esac
4158                         ;;
4159                 esac
4160                 ;;
4161         esac
4162 done
4163 cd UU
4164 ans="$value"
4165 rp="$orig_rp"
4166 dflt="$orig_dflt"
4167 rm -f getfile.ok
4168 test "X$gfpthkeep" != Xy && gfpth=""
4169 EOSC
4170
4171 : determine root of directory hierarchy where package will be installed.
4172 case "$prefix" in
4173 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
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 *)      case "$ans" in
4196         "$prefix") ;;
4197         *) oldprefix="$prefix";;
4198         esac
4199         ;;
4200 esac
4201
4202 case "$ans" in
4203 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4204         ;;
4205 *)      prefix="$ans"
4206 esac
4207
4208 case "$ansexp" in
4209 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4210         ;;
4211 *)      prefixexp="$ansexp"
4212 esac
4213
4214 : allow them to override the AFS root
4215 case "$afsroot" in
4216 '')     afsroot=/afs ;;
4217 *)      afsroot=$afsroot ;;
4218 esac
4219
4220 : is AFS running?
4221 echo " "
4222 case "$afs" in
4223 $define|true)   afs=true ;;
4224 $undef|false)   afs=false ;;
4225 *)      if $test -d $afsroot; then
4226                 afs=true
4227         else
4228                 afs=false
4229         fi
4230         ;;
4231 esac
4232 if $afs; then
4233         echo "AFS may be running... I'll be extra cautious then..." >&4
4234 else
4235         echo "AFS does not seem to be running..." >&4
4236 fi
4237
4238 : determine installation prefix for where package is to be installed.
4239 if $afs; then
4240 $cat <<EOM
4241
4242 Since you are running AFS, I need to distinguish the directory in which
4243 files will reside from the directory in which they are installed (and from
4244 which they are presumably copied to the former directory by occult means).
4245
4246 EOM
4247         case "$installprefix" in
4248         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4249         *) dflt="$installprefix";;
4250         esac
4251 else
4252 $cat <<EOM
4253
4254 In some special cases, particularly when building $package for distribution,
4255 it is convenient to distinguish the directory in which files should be
4256 installed from the directory ($prefix) in which they will
4257 eventually reside.  For most users, these two directories are the same.
4258
4259 EOM
4260         case "$installprefix" in
4261         '') dflt=$prefix ;;
4262         *) dflt=$installprefix;;
4263         esac
4264 fi
4265 fn=d~
4266 rp='What installation prefix should I use for installing files?'
4267 . ./getfile
4268 installprefix="$ans"
4269 installprefixexp="$ansexp"
4270
4271 : Perform the prefixexp/installprefixexp correction if necessary
4272 cat <<EOS >installprefix
4273 $startsh
4274 EOS
4275 cat <<'EOSC' >>installprefix
4276 : Change installation prefix, if necessary.
4277 if $test X"$prefix" != X"$installprefix"; then
4278     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4279 else
4280     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4281 fi
4282 EOSC
4283 chmod +x installprefix
4284 $eunicefix installprefix
4285
4286 : Set variables such as privlib and privlibexp from the output of ./getfile
4287 : performing the prefixexp/installprefixexp correction if necessary.
4288 cat <<EOS >setprefixvar
4289 $startsh
4290 EOS
4291 cat <<'EOSC' >>setprefixvar
4292 eval "${prefixvar}=\"\$ans\""
4293 eval "${prefixvar}exp=\"\$ansexp\""
4294 . ./installprefix
4295 EOSC
4296 chmod +x setprefixvar
4297 $eunicefix setprefixvar
4298
4299 : set up the script used to warn in case of inconsistency
4300 cat <<EOS >whoa
4301 $startsh
4302 EOS
4303 cat <<'EOSC' >>whoa
4304 dflt=y
4305 case "$hint" in
4306     recommended)
4307         case "$hintfile" in
4308         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4309                 ;;
4310         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4311                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4312                 ;;
4313         esac
4314         ;;
4315     *)  echo " "
4316         echo "*** WHOA THERE!!! ***" >&4
4317         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4318         ;;
4319 esac
4320 rp="    Keep the $hint value?"
4321 . ./myread
4322 case "$ans" in
4323 y) td=$was; tu=$was;;
4324 esac
4325 EOSC
4326
4327 : function used to set '$1' to '$val'
4328 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4329 case "$val$was" in
4330 $define$undef) . ./whoa; eval "$var=\$td";;
4331 $undef$define) . ./whoa; eval "$var=\$tu";;
4332 *) eval "$var=$val";;
4333 esac'
4334
4335 : get the patchlevel
4336 echo " "
4337 echo "Getting the current patchlevel..." >&4
4338 if $test -r $rsrc/patchlevel.h;then
4339         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4340         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4341         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4342         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4343         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4344         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4345         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4346 else
4347         revision=0
4348         patchlevel=0
4349         subversion=0
4350         api_revision=0
4351         api_version=0
4352         api_subversion=0
4353         perl_patchlevel=0
4354         $echo "(You do not have patchlevel.h.  Eek.)"
4355 fi
4356 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4357 version_patchlevel_string="version $patchlevel subversion $subversion"
4358 case "$perl_patchlevel" in
4359 0|'') ;;
4360 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4361     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4362     ;;
4363 esac
4364
4365 $echo "(You have $package $version_patchlevel_string.)"
4366
4367 case "$osname" in
4368 dos|vms)
4369         : XXX Should be a Configure test for double-dots in filenames.
4370         version=`echo $revision $patchlevel $subversion | \
4371                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4372         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4373                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4374         ;;
4375 *)
4376         version=`echo $revision $patchlevel $subversion | \
4377                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4378         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4379                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4380         ;;
4381 esac
4382 : Special case the 5.005_xx maintenance series, which used 5.005
4383 : without any subversion label as a subdirectory in $sitelib
4384 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4385         api_versionstring='5.005'
4386 fi
4387
4388 : Do we want threads support and if so, what type
4389 case "$usethreads" in
4390 $define|true|[yY]*)     dflt='y';;
4391 *)     # Catch case where user specified ithreads or 5005threads but
4392        # forgot -Dusethreads (A.D. 4/2002)
4393        case "$useithreads$use5005threads" in
4394        *$define*)       dflt='y';;
4395        *)               dflt='n';;
4396        esac
4397        ;;
4398 esac
4399 cat <<EOM
4400
4401 Perl can be built to offer a form of threading support on some systems
4402 To do so, Configure can be run with -Dusethreads.
4403
4404 Note that Perl built with threading support runs slightly slower
4405 and uses slightly more memory than plain Perl.
4406
4407 If this doesn't make any sense to you, just accept the default '$dflt'.
4408 EOM
4409 rp='Build a threading Perl?'
4410 . ./myread
4411 case "$ans" in
4412 y|Y)    val="$define" ;;
4413 *)      val="$undef" ;;
4414 esac
4415 set usethreads
4416 eval $setvar
4417
4418 if $test $patchlevel -lt 9; then
4419     case "$usethreads" in
4420     $define)
4421         : Default to ithreads unless overridden on command line or with
4422         : old config.sh
4423         dflt='y'
4424         case "$use5005threads" in
4425                 $define|true|[yY]*)
4426                         echo "5.005 threads are no longer supported"
4427                         exit 1
4428                 ;;
4429         esac
4430         case "$useithreads" in
4431                 $undef|false|[nN]*) dflt='n';;
4432         esac
4433         rp='Use the newer interpreter-based ithreads?'
4434         . ./myread
4435         case "$ans" in
4436         y|Y)    val="$define" ;;
4437         *)      val="$undef" ;;
4438         esac
4439         set useithreads
4440         eval $setvar
4441         : Now set use5005threads to the opposite value.
4442         case "$useithreads" in
4443         $define) val="$undef" ;;
4444         *) val="$define" ;;
4445         esac
4446         set use5005threads
4447         eval $setvar
4448         ;;
4449     *)
4450         useithreads="$undef"
4451         use5005threads="$undef"
4452         ;;
4453     esac
4454
4455     case "$useithreads$use5005threads" in
4456     "$define$define")
4457         $cat >&4 <<EOM
4458
4459 You cannot have both the ithreads and the 5.005 threads enabled
4460 at the same time.  Disabling the 5.005 threads since they are
4461 much less stable than the ithreads.
4462
4463 EOM
4464         use5005threads="$undef"
4465         ;;
4466     esac
4467
4468 else
4469 : perl-5.9.x and later
4470
4471     if test X"$usethreads" = "X$define"; then
4472         case "$use5005threads" in
4473             $define|true|[yY]*)
4474                 $cat >&4 <<EOM
4475
4476 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4477
4478 EOM
4479             ;;
4480         esac
4481     fi
4482
4483     use5005threads="$undef"
4484     useithreads="$usethreads"
4485 fi
4486
4487 case "$d_oldpthreads" in
4488 '')     : Configure tests would be welcome here.  For now, assume undef.
4489         val="$undef" ;;
4490 *)      val="$d_oldpthreads" ;;
4491 esac
4492 set d_oldpthreads
4493 eval $setvar
4494
4495
4496 : Look for a hint-file generated 'call-back-unit'.  If the
4497 : user has specified that a threading perl is to be built,
4498 : we may need to set or change some other defaults.
4499 if $test -f usethreads.cbu; then
4500     echo "Your platform has some specific hints regarding threaded builds, using them..."
4501     . ./usethreads.cbu
4502 else
4503     case "$usethreads" in
4504         "$define"|true|[yY]*)
4505                 $cat <<EOM
4506 (Your platform does not have any specific hints for threaded builds.
4507  Assuming POSIX threads, then.)
4508 EOM
4509         ;;
4510     esac
4511 fi
4512
4513 : Check if multiplicity is required
4514 cat <<EOM
4515
4516 Perl can be built so that multiple Perl interpreters can coexist
4517 within the same Perl executable.
4518 EOM
4519
4520 case "$useithreads" in
4521 $define)
4522         cat <<EOM
4523 This multiple interpreter support is required for interpreter-based threads.
4524 EOM
4525         val="$define"
4526         ;;
4527 *)      case "$usemultiplicity" in
4528         $define|true|[yY]*)     dflt='y';;
4529         *) dflt='n';;
4530         esac
4531         echo " "
4532         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4533         rp='Build Perl for multiplicity?'
4534         . ./myread
4535         case "$ans" in
4536         y|Y)    val="$define" ;;
4537         *)      val="$undef" ;;
4538         esac
4539         ;;
4540 esac
4541 set usemultiplicity
4542 eval $setvar
4543
4544 : Check if morebits is requested
4545 case "$usemorebits" in
4546 "$define"|true|[yY]*)
4547         use64bitint="$define"
4548         uselongdouble="$define"
4549         usemorebits="$define"
4550         ;;
4551 *)      usemorebits="$undef"
4552         ;;
4553 esac
4554
4555 : Determine the C compiler to be used
4556 echo " "
4557 case "$cc" in
4558 '') dflt=cc;;
4559 *) dflt="$cc";;
4560 esac
4561 rp="Use which C compiler?"
4562 . ./myread
4563 cc="$ans"
4564
4565 : See whether they have no cc but they do have gcc
4566 . ./trygcc
4567 if $test -f cc.cbu; then
4568     . ./cc.cbu
4569 fi
4570 . ./checkcc
4571
4572 : make some quick guesses about what we are up against
4573 echo " "
4574 $echo $n "Hmm...  $c"
4575 echo exit 1 >bsd
4576 echo exit 1 >usg
4577 echo exit 1 >v7
4578 echo exit 1 >osf1
4579 echo exit 1 >eunice
4580 echo exit 1 >xenix
4581 echo exit 1 >venix
4582 echo exit 1 >os2
4583 d_bsd="$undef"
4584 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4585 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4586 then
4587         echo "Looks kind of like an OSF/1 system, but we'll see..."
4588         echo exit 0 >osf1
4589 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4590         xxx=`./loc addbib blurfl $pth`
4591         if $test -f $xxx; then
4592         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4593                 echo exit 0 >bsd
4594                 echo exit 0 >usg
4595         else
4596                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4597                         echo "Looks kind of like an extended USG system, but we'll see..."
4598                 else
4599                         echo "Looks kind of like a USG system, but we'll see..."
4600                 fi
4601                 echo exit 0 >usg
4602         fi
4603 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4604         echo "Looks kind of like a BSD system, but we'll see..."
4605         d_bsd="$define"
4606         echo exit 0 >bsd
4607 else
4608         echo "Looks kind of like a Version 7 system, but we'll see..."
4609         echo exit 0 >v7
4610 fi
4611 case "$eunicefix" in
4612 *unixtovms*)
4613         $cat <<'EOI'
4614 There is, however, a strange, musty smell in the air that reminds me of
4615 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4616 EOI
4617         echo exit 0 >eunice
4618         d_eunice="$define"
4619 : it so happens the Eunice I know will not run shell scripts in Unix format
4620         ;;
4621 *)
4622         echo " "
4623         echo "Congratulations.  You aren't running Eunice."
4624         d_eunice="$undef"
4625         ;;
4626 esac
4627 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4628 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4629 : semicolon as a patch separator
4630 case "$p_" in
4631 :) ;;
4632 *)
4633         $cat <<'EOI'
4634 I have the feeling something is not exactly right, however...don't tell me...
4635 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4636 (Or you may be running DOS with DJGPP.)
4637 EOI
4638         echo exit 0 >os2
4639         ;;
4640 esac
4641 if test -f /xenix; then
4642         echo "Actually, this looks more like a XENIX system..."
4643         echo exit 0 >xenix
4644         d_xenix="$define"
4645 else
4646         echo " "
4647         echo "It's not Xenix..."
4648         d_xenix="$undef"
4649 fi
4650 chmod +x xenix
4651 $eunicefix xenix
4652 if test -f /venix; then
4653         echo "Actually, this looks more like a VENIX system..."
4654         echo exit 0 >venix
4655 else
4656         echo " "
4657         if ./xenix; then
4658                 : null
4659         else
4660                 echo "Nor is it Venix..."
4661         fi
4662 fi
4663 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4664 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4665 $rm -f foo
4666
4667 : Check if we are using GNU gcc and what its version is
4668 echo " "
4669 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4670 $cat >try.c <<EOM
4671 #include <stdio.h>
4672 int main() {
4673 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4674 #ifdef __VERSION__
4675         printf("%s\n", __VERSION__);
4676 #else
4677         printf("%s\n", "1");
4678 #endif
4679 #endif
4680         return(0);
4681 }
4682 EOM
4683 if $cc -o try $ccflags $ldflags try.c; then
4684         gccversion=`$run ./try`
4685         case "$gccversion" in
4686         '') echo "You are not using GNU cc." ;;
4687         *)  echo "You are using GNU cc $gccversion."
4688             ccname=gcc
4689             ;;
4690         esac
4691 else
4692         echo " "
4693         echo "*** WHOA THERE!!! ***" >&4
4694         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4695         case "$knowitall" in
4696         '')
4697         echo "    You'd better start hunting for one and let me know about it." >&4
4698                 exit 1
4699                 ;;
4700         esac
4701 fi
4702 $rm -f try try.*
4703 case "$gccversion" in
4704 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4705 esac
4706 case "$gccversion" in
4707 '') gccosandvers='' ;;
4708 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4709    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4710    gccshortvers=''
4711    case "$gccosandvers" in
4712    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4713    $osname$osvers) ;; # looking good
4714    $osname*) cat <<EOM >&4
4715
4716 *** WHOA THERE!!! ***
4717
4718     Your gcc has not been compiled for the exact release of
4719     your operating system ($gccosandvers versus $osname$osvers).
4720
4721     In general it is a good idea to keep gcc synchronized with
4722     the operating system because otherwise serious problems
4723     may ensue when trying to compile software, like Perl.
4724
4725     I'm trying to be optimistic here, though, and will continue.
4726     If later during the configuration and build icky compilation
4727     problems appear (headerfile conflicts being the most common
4728     manifestation), I suggest reinstalling the gcc to match
4729     your operating system release.
4730
4731 EOM
4732       ;;
4733    *) gccosandvers='' ;; # failed to parse, better be silent
4734    esac
4735    ;;
4736 esac
4737 case "$ccname" in
4738 '') ccname="$cc" ;;
4739 esac
4740
4741 # gcc 3.* complain about adding -Idirectories that they already know about,
4742 # so we will take those off from locincpth.
4743 case "$gccversion" in
4744 3*)
4745     echo "main(){}">try.c
4746     for incdir in $locincpth; do
4747        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4748              grep '^c[cp]p*[01]: warning: changing search order '`
4749        if test "X$warn" != X; then
4750            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4751        fi
4752     done
4753     $rm -f try try.*
4754 esac
4755
4756 # gcc 4.9 by default does some optimizations that break perl.
4757 # see ticket 121505.
4758 #
4759 # The -fwrapv disables those optimizations (and probably others,) so
4760 # for gcc 4.9 (and later, since the optimizations probably won't go
4761 # away), add -fwrapv unless the user requests -fno-wrapv, which
4762 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4763 # which turns the overflows -fwrapv ignores into runtime errors.
4764 case "$gccversion" in
4765 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4766     case "$ccflags" in
4767     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4768     *) ccflags="$ccflags -fwrapv" ;;
4769     esac
4770 esac
4771
4772 : What should the include directory be ?
4773 : Use sysroot if set, so findhdr looks in the right place.
4774 echo " "
4775 $echo $n "Hmm...  $c"
4776 dflt="$sysroot/usr/include"
4777 incpath=''
4778 mips_type=''
4779 if $test -f /bin/mips && /bin/mips; then
4780         echo "Looks like a MIPS system..."
4781         $cat >usr.c <<'EOCP'
4782 #ifdef SYSTYPE_BSD43
4783 /bsd43
4784 #endif
4785 EOCP
4786         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4787                 dflt='/bsd43/usr/include'
4788                 incpath='/bsd43'
4789                 mips_type='BSD 4.3'
4790         else
4791                 mips_type='System V'
4792         fi
4793         $rm -f usr.c usr.out
4794         echo "and you're compiling with the $mips_type compiler and libraries."
4795         xxx_prompt=y
4796         echo "exit 0" >mips
4797 else
4798         echo "Doesn't look like a MIPS system."
4799         xxx_prompt=n
4800         echo "exit 1" >mips
4801 fi
4802 chmod +x mips
4803 $eunicefix mips
4804 case "$usrinc" in
4805 '') ;;
4806 *) dflt="$usrinc";;
4807 esac
4808 case "$xxx_prompt" in
4809 y)      fn=d/
4810         echo " "
4811         rp='Where are the include files you want to use?'
4812         . ./getfile
4813         usrinc="$ans"
4814         ;;
4815 *)      usrinc="$dflt"
4816         ;;
4817 esac
4818
4819 : see how we invoke the C preprocessor
4820 echo " "
4821 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4822 cat <<'EOT' >testcpp.c
4823 #define ABC abc
4824 #define XYZ xyz
4825 ABC.XYZ
4826 EOT
4827 cd ..
4828 if test ! -f cppstdin; then
4829         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4830                 # AIX cc -E doesn't show the absolute headerfile
4831                 # locations but we'll cheat by using the -M flag.
4832                 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
4833         else
4834                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4835         fi
4836 else
4837         echo "Keeping your $hint cppstdin wrapper."
4838 fi
4839 chmod 755 cppstdin
4840 wrapper=`pwd`/cppstdin
4841 ok='false'
4842 cd UU
4843
4844 if $test "X$cppstdin" != "X" && \
4845         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4846         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4847 then
4848         echo "You used to use $cppstdin $cppminus so we'll use that again."
4849         case "$cpprun" in
4850         '') echo "But let's see if we can live without a wrapper..." ;;
4851         *)
4852                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4853                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4854                 then
4855                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4856                         ok='true'
4857                 else
4858                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4859                 fi
4860                 ;;
4861         esac
4862 else
4863         case "$cppstdin" in
4864         '') ;;
4865         *)
4866                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4867                 ;;
4868         esac
4869 fi
4870
4871 if $ok; then
4872         : nothing
4873 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4874         $cc -E <testcpp.c >testcpp.out 2>&1; \
4875         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4876         echo "Yup, it does."
4877         x_cpp="$cc $cppflags -E"
4878         x_minus='';
4879 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4880         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4881         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4882         echo "Yup, it does."
4883         x_cpp="$cc $cppflags -E"
4884         x_minus='-';
4885 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4886         $cc -P <testcpp.c >testcpp.out 2>&1; \
4887         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4888         echo "Yipee, that works!"
4889         x_cpp="$cc $cppflags -P"
4890         x_minus='';
4891 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4892         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4893         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894         echo "At long last!"
4895         x_cpp="$cc $cppflags -P"
4896         x_minus='-';
4897 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4898         $cpp <testcpp.c >testcpp.out 2>&1; \
4899         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4900         echo "It works!"
4901         x_cpp="$cpp $cppflags"
4902         x_minus='';
4903 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4904         $cpp - <testcpp.c >testcpp.out 2>&1; \
4905         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4906         echo "Hooray, it works!  I was beginning to wonder."
4907         x_cpp="$cpp $cppflags"
4908         x_minus='-';
4909 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4910         $wrapper <testcpp.c >testcpp.out 2>&1; \
4911         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4912         x_cpp="$wrapper"
4913         x_minus=''
4914         echo "Eureka!"
4915 else
4916         dflt=''
4917         rp="No dice.  I can't find a C preprocessor.  Name one:"
4918         . ./myread
4919         x_cpp="$ans"
4920         x_minus=''
4921         $x_cpp <testcpp.c >testcpp.out 2>&1
4922         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4923                 echo "OK, that will do." >&4
4924         else
4925 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4926                 exit 1
4927         fi
4928 fi
4929
4930 case "$ok" in
4931 false)
4932         cppstdin="$x_cpp"
4933         cppminus="$x_minus"
4934         cpprun="$x_cpp"
4935         cpplast="$x_minus"
4936         set X $x_cpp
4937         shift
4938         case "$1" in
4939         "$cpp")
4940                 echo "Perhaps can we force $cc -E using a wrapper..."
4941                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4942                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4943                 then
4944                         echo "Yup, we can."
4945                         cppstdin="$wrapper"
4946                         cppminus='';
4947                 else
4948                         echo "Nope, we'll have to live without it..."
4949                 fi
4950                 ;;
4951         esac
4952         case "$cpprun" in
4953         "$wrapper")
4954                 cpprun=''
4955                 cpplast=''
4956                 ;;
4957         esac
4958         ;;
4959 esac
4960
4961 case "$cppstdin" in
4962 "$wrapper"|'cppstdin') ;;
4963 *) $rm -f $wrapper;;
4964 esac
4965 $rm -f testcpp.c testcpp.out
4966
4967 : Adjust cppfilter for path component separator
4968 case "$osname" in
4969 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4970 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4971 *)   cppfilter='' ;;
4972 esac
4973
4974 : Use gcc to determine libpth and incpth
4975 # If using gcc or clang, we can get better values for libpth, incpth
4976 # and usrinc directly from the compiler.
4977 # Note that ccname for clang is also gcc.
4978 case "$ccname" in
4979     gcc)
4980         $echo 'extern int foo;' > try.c
4981         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4982         shift
4983         if $test $# -gt 0; then
4984             incpth="$incpth $*"
4985             incpth="`$echo $incpth|$sed 's/^ //'`"
4986             for i in $*; do
4987                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4988                 if $test -d $j; then
4989                     libpth="$libpth $j"
4990                 fi
4991             done
4992             libpth="`$echo $libpth|$sed 's/^ //'`"
4993             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4994                 if $test -d $xxx; then
4995                     case " $libpth " in
4996                     *" $xxx "*) ;;
4997                     *) libpth="$libpth $xxx";;
4998                     esac
4999                 fi
5000             done
5001         fi
5002         $rm -f try.c
5003         case "$usrinc" in
5004         '') for i in $incpth; do
5005                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5006                     usrinc="$i"
5007                     break
5008                 fi
5009             done
5010             ;;
5011         esac
5012
5013         case "$usecrosscompile" in
5014         $define|true|[yY]*)
5015             case "$incpth" in
5016                 '') echo "Incpth not defined." >&4; croak=y ;;
5017                 *)  echo "Using incpth '$incpth'." >&4 ;;
5018             esac
5019             case "$libpth" in
5020                 '') echo "Libpth not defined." >&4; croak=y ;;
5021                 *)  echo "Using libpth '$libpth'." >&4 ;;
5022             esac
5023             case "$usrinc" in
5024                 '') echo "Usrinc not defined." >&4; croak=y ;;
5025                 *)  echo "Using usrinc $usrinc." >&4 ;;
5026             esac
5027             case "$croak" in
5028                 y)
5029                 if test "X$sysroot" = X; then
5030                     echo "Cannot continue, aborting." >&4; exit 1
5031                 else
5032                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5033                 fi
5034                 ;;
5035             esac
5036             ;;
5037         esac
5038     ;;
5039 esac
5040
5041 : Default value for incpth is just usrinc
5042 case "$incpth" in
5043 '') incpth="$usrinc";;
5044 esac
5045
5046 : Set private lib path
5047 case "$plibpth" in
5048 '') if ./mips; then
5049         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5050     fi;;
5051 esac
5052 case "$libpth" in
5053 ' ') dlist='';;
5054 '') dlist="$loclibpth $plibpth $glibpth";;
5055 *) dlist="$libpth";;
5056 esac
5057
5058 : Now check and see which directories actually exist, avoiding duplicates
5059 for xxx in $dlist
5060 do
5061     if $test -d $xxx; then
5062                 case " $libpth " in
5063                 *" $xxx "*) ;;
5064                 *) libpth="$libpth $xxx";;
5065                 esac
5066     fi
5067 done
5068 $cat <<'EOM'
5069
5070 Some systems have incompatible or broken versions of libraries.  Among
5071 the directories listed in the question below, please remove any you
5072 know not to be holding relevant libraries, and add any that are needed.
5073 Say "none" for none.
5074
5075 EOM
5076
5077 if test "X$sysroot" != X; then
5078     $cat <<EOM
5079 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5080
5081 EOM
5082 fi
5083
5084 case "$libpth" in
5085 '') dflt='none';;
5086 *)
5087         set X $libpth
5088         shift
5089         dflt=${1+"$@"}
5090         ;;
5091 esac
5092 rp="Directories to use for library searches?"
5093 . ./myread
5094 case "$ans" in
5095 none) libpth=' ';;
5096 *) libpth="$ans";;
5097 esac
5098
5099 : compute shared library extension
5100 case "$so" in
5101 '')
5102         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5103                 dflt='sl'
5104         else
5105                 dflt='so'
5106         fi
5107         ;;
5108 *) dflt="$so";;
5109 esac
5110 $cat <<EOM
5111
5112 On some systems, shared libraries may be available.  Answer 'none' if
5113 you want to suppress searching of shared libraries for the remainder
5114 of this configuration.
5115
5116 EOM
5117 rp='What is the file extension used for shared libraries?'
5118 . ./myread
5119 so="$ans"
5120
5121 : Does target system insist that shared library basenames are unique
5122 $cat << EOM
5123
5124 Some dynamic loaders assume that the *basename* of shared library filenames
5125 are globally unique.  We'll default this to undef as we assume your system
5126 is not this weird. Set to defined if you're on one of them.
5127
5128 EOM
5129
5130 dflt='n'
5131 rp='Make shared library basenames unique?'
5132 . ./myread
5133 case "$ans" in
5134 y|Y) val="$define" ;;
5135 *)   val="$undef"  ;;
5136 esac
5137 set d_libname_unique
5138 eval $setvar
5139
5140 : Define several unixisms.
5141 : Hints files or command line option can be used to override them.
5142 : The convoluted testing is in case hints files set either the old
5143 : or the new name.
5144 case "$_exe" in
5145 '')     case "$exe_ext" in
5146         '')     ;;
5147         *)      _exe="$exe_ext" ;;
5148         esac
5149         ;;
5150 esac
5151 case "$_a" in
5152 '')     case "$lib_ext" in
5153     '') _a='.a';;
5154         *)      _a="$lib_ext" ;;
5155         esac
5156         ;;
5157 esac
5158 case "$_o" in
5159 '') case "$obj_ext" in
5160         '')     _o='.o';;
5161         *)      _o="$obj_ext";;
5162         esac
5163         ;;
5164 esac
5165 case "$p_" in
5166 '') case "$path_sep" in
5167         '')     p_=':';;
5168         *)      p_="$path_sep";;
5169         esac
5170         ;;
5171 esac
5172 exe_ext=$_exe
5173 lib_ext=$_a
5174 obj_ext=$_o
5175 path_sep=$p_
5176
5177 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5178
5179 : Which makefile gets called first.  This is used by make depend.
5180 case "$firstmakefile" in
5181 '') firstmakefile='makefile';;
5182 esac
5183
5184 : Check is we will use socks
5185 case "$usesocks" in
5186 $define|true|[yY]*)     dflt='y';;
5187 *) dflt='n';;
5188 esac
5189 cat <<EOM
5190
5191 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5192 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5193 to use the PerlIO abstraction layer, this will be implicitly selected.
5194
5195 If this doesn't make any sense to you, just accept the default '$dflt'.
5196 EOM
5197 rp='Build Perl for SOCKS?'
5198 . ./myread
5199 case "$ans" in
5200 y|Y)    val="$define" ;;
5201 *)      val="$undef" ;;
5202 esac
5203 set usesocks
5204 eval $setvar
5205
5206 : Check for uselongdouble support
5207 case "$ccflags" in
5208 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5209 esac
5210
5211 case "$uselongdouble" in
5212 $define|true|[yY]*)     dflt='y';;
5213 *) dflt='n';;
5214 esac
5215 cat <<EOM
5216
5217 Perl can be built to take advantage of long doubles which
5218 (if available) may give more accuracy and range for floating point numbers.
5219
5220 If this doesn't make any sense to you, just accept the default '$dflt'.
5221 EOM
5222 rp='Try to use long doubles if available?'
5223 . ./myread
5224 case "$ans" in
5225 y|Y)    val="$define"   ;;
5226 *)      val="$undef"    ;;
5227 esac
5228 set uselongdouble
5229 eval $setvar
5230
5231 case "$uselongdouble" in
5232 true|[yY]*) uselongdouble="$define" ;;
5233 esac
5234
5235 : Look for a hint-file generated 'call-back-unit'.  If the
5236 : user has specified that long doubles should be used,
5237 : we may need to set or change some other defaults.
5238 if $test -f uselongdouble.cbu; then
5239     echo "Your platform has some specific hints regarding long doubles, using them..."
5240     . ./uselongdouble.cbu
5241 else
5242     case "$uselongdouble" in
5243         $define)
5244                 $cat <<EOM
5245 (Your platform does not have any specific hints for long doubles.)
5246 EOM
5247         ;;
5248     esac
5249 fi
5250
5251 : Check if quadmath is requested
5252 case "$usequadmath" in
5253 "$define"|true|[yY]*) usequadmath="$define" ;;
5254 *)                    usequadmath="$undef"  ;;
5255 esac
5256
5257 : Fail if both uselongdouble and usequadmath are requested
5258 case "$usequadmath:$uselongdouble" in
5259 define:define)
5260         $cat <<EOM >&4
5261
5262 *** You requested the use of the quadmath library and use
5263 *** of long doubles.
5264 ***
5265 *** Please select one or the other.
5266 EOM
5267         exit 1
5268         ;;
5269 esac
5270
5271 : Looking for optional libraries
5272 echo " "
5273 echo "Checking for optional libraries..." >&4
5274 case "$libs" in
5275 ' '|'') dflt='';;
5276 *) dflt="$libs";;
5277 esac
5278 case "$libswanted" in
5279 '') libswanted='c_s';;
5280 esac
5281 case "$usesocks" in
5282 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5283 esac
5284 case "$usecbacktrace" in
5285 "$define") libswanted="$libswanted bfd" ;;
5286 esac
5287 case "$usequadmath" in
5288 "$define") libswanted="$libswanted quadmath" ;;
5289 esac
5290 libsfound=''
5291 libsfiles=''
5292 libsdirs=''
5293 libspath=''
5294 for thisdir in $libpth $xlibpth; do
5295   test -d $thisdir && libspath="$libspath $thisdir"
5296 done
5297 for thislib in $libswanted; do
5298         for thisdir in $libspath; do
5299             xxx=''
5300             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5301                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5302                 $test -f "$xxx" && eval $libscheck
5303                 $test -f "$xxx" && libstyle=shared
5304                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=shared
5307             fi
5308             if test ! -f "$xxx"; then
5309                 xxx=$thisdir/lib$thislib.$so
5310                 $test -f "$xxx" && eval $libscheck
5311                 $test -f "$xxx" && libstyle=shared
5312             fi
5313             if test ! -f "$xxx"; then
5314                 xxx=$thisdir/lib$thislib$_a
5315                 $test -f "$xxx" && eval $libscheck
5316                 $test -f "$xxx" && libstyle=static
5317             fi
5318             if test ! -f "$xxx"; then
5319                 xxx=$thisdir/$thislib$_a
5320                 $test -f "$xxx" && eval $libscheck
5321                 $test -f "$xxx" && libstyle=static
5322             fi
5323             if test ! -f "$xxx"; then
5324                 xxx=$thisdir/lib${thislib}_s$_a
5325                 $test -f "$xxx" && eval $libscheck
5326                 $test -f "$xxx" && libstyle=static
5327                 $test -f "$xxx" && thislib=${thislib}_s
5328             fi
5329             if test ! -f "$xxx"; then
5330                 xxx=$thisdir/Slib$thislib$_a
5331                 $test -f "$xxx" && eval $libscheck
5332                 $test -f "$xxx" && libstyle=static
5333             fi
5334             if $test -f "$xxx"; then
5335                 case "$libstyle" in
5336                 shared) echo "Found -l$thislib (shared)." ;;
5337                 static) echo "Found -l$thislib." ;;
5338                 *)      echo "Found -l$thislib ($libstyle)." ;;
5339                 esac
5340                 case " $dflt " in
5341                 *"-l$thislib "*);;
5342                 *) dflt="$dflt -l$thislib"
5343                    libsfound="$libsfound $xxx"
5344                    yyy=`basename $xxx`
5345                    libsfiles="$libsfiles $yyy"
5346                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5347                    case " $libsdirs " in
5348                    *" $yyy "*) ;;
5349                    *) libsdirs="$libsdirs $yyy" ;;
5350                    esac
5351                    ;;
5352                 esac
5353                 break
5354             fi
5355         done
5356         if $test ! -f "$xxx"; then
5357             echo "No -l$thislib."
5358         fi
5359 done
5360 set X $dflt
5361 shift
5362 dflt="$*"
5363 case "$libs" in
5364 '') dflt="$dflt";;
5365 *) dflt="$libs";;
5366 esac
5367 case "$dflt" in
5368 ' '|'') dflt='none';;
5369 esac
5370
5371 $cat <<EOM
5372
5373 In order to compile $package on your machine, a number of libraries
5374 are usually needed.  Include any other special libraries here as well.
5375 Say "none" for none.  The default list is almost always right.
5376 EOM
5377
5378 echo " "
5379 rp="What libraries to use?"
5380 . ./myread
5381 case "$ans" in
5382 none) libs=' ';;
5383 *) libs="$ans";;
5384 esac
5385
5386 : determine optimization, if desired, or use for debug flag also
5387 case "$optimize" in
5388 ' '|$undef) dflt='none';;
5389 '') dflt='-O';;
5390 *) dflt="$optimize";;
5391 esac
5392 $cat <<EOH
5393
5394 By default, $package compiles with the -O flag to use the optimizer.
5395 Alternately, you might want to use the symbolic debugger, which uses
5396 the -g flag (on traditional Unix systems).  Either flag can be
5397 specified here.  To use neither flag, specify the word "none".
5398
5399 EOH
5400 rp="What optimizer/debugger flag should be used?"
5401 . ./myread
5402 optimize="$ans"
5403 case "$optimize" in
5404 'none') optimize=" ";;
5405 esac
5406
5407 : Check what DEBUGGING is required from the command line
5408 : -DEBUGGING      or -DDEBUGGING or
5409 : -DEBUGGING=both                       = -g + -DDEBUGGING
5410 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5411 : -DEBUGGING=none or -UDEBUGGING        =
5412 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5413 case "$EBUGGING" in
5414 '')     ;;
5415 *)      DEBUGGING=$EBUGGING ;;
5416 esac
5417
5418 case "$DEBUGGING" in
5419 -g|both|$define)
5420     case "$optimize" in
5421         *-g*) ;;
5422         *)    optimize="$optimize -g" ;;
5423     esac ;;
5424 none|$undef)
5425     case "$optimize" in
5426         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5427                 shift
5428                 optimize="$*"
5429                 ;;
5430     esac ;;
5431 esac
5432
5433 dflt=''
5434 case "$DEBUGGING" in
5435 both|$define) dflt='-DDEBUGGING'
5436 esac
5437
5438 : argument order is deliberate, as the flag will start with - which set could
5439 : think is an option
5440 checkccflag='check=$1; flag=$2; callback=$3;
5441 echo " ";
5442 echo "Checking if your compiler accepts $flag" 2>&1;
5443 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5444 echo "int main(void) { return 0; }" > gcctest.c;
5445 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5446     echo "Yes, it does." 2>&1;
5447     if $test -s gcctest.out ; then
5448         echo "But your platform does not like it:";
5449         cat gcctest.out;
5450     else
5451         case "$ccflags" in
5452         *$check*)
5453             echo "Leaving current flags $ccflags alone." 2>&1
5454             ;;
5455         *) dflt="$dflt $flag";
5456             eval $callback
5457             ;;
5458         esac
5459     fi
5460 else
5461     echo "Nope, it does not, but that is ok." 2>&1;
5462 fi
5463 '
5464
5465 : We will not override a previous value, but we might want to
5466 : augment a hint file
5467 case "$hint" in
5468 default|recommended)
5469         case "$gccversion" in
5470         1*) dflt="$dflt -fpcc-struct-return" ;;
5471         esac
5472         case "$optimize:$DEBUGGING" in
5473         *-g*:old) dflt="$dflt -DDEBUGGING";;
5474         esac
5475         case "$gccversion" in
5476         2*) if $test -d /etc/conf/kconfig.d &&
5477                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5478                 then
5479                         # Interactive Systems (ISC) POSIX mode.
5480                         dflt="$dflt -posix"
5481                 fi
5482                 ;;
5483         esac
5484         case "$gccversion" in
5485         1*) ;;
5486         2.[0-8]*) ;;
5487         ?*)     set strict-aliasing -fno-strict-aliasing
5488                 eval $checkccflag
5489                 ;;
5490         esac
5491         # For gcc, adding -pipe speeds up compilations for some, but apparently
5492         # some assemblers can't read from stdin.  (It also slows down compilations
5493         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5494         case "$gccversion" in
5495         ?*)     set pipe -pipe
5496                 eval $checkccflag
5497                 ;;
5498         esac
5499
5500         # on x86_64 (at least) we require an extra library (libssp) in the
5501         # link command line. This library is not named, so I infer that it is
5502         # an implementation detail that may change. Hence the safest approach
5503         # is to add the flag to the flags passed to the compiler at link time,
5504         # as that way the compiler can do the right implementation dependant
5505         # thing. (NWC)
5506         case "$osname" in
5507         amigaos) ;; # -fstack-protector builds but doesn't work
5508         *)      case "$gccversion" in
5509                 ?*)     set stack-protector-strong -fstack-protector-strong
5510                         eval $checkccflag
5511                         case "$dflt" in
5512                         *-fstack-protector-strong*) ;; # It got added.
5513                         *) # Try the plain/older -fstack-protector.
5514                            set stack-protector -fstack-protector
5515                            eval $checkccflag
5516                            ;;
5517                         esac
5518                         ;;
5519                 esac
5520                 ;;
5521         esac
5522         ;;
5523 esac
5524
5525 case "$mips_type" in
5526 *BSD*|'') inclwanted="$locincpth $usrinc";;
5527 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5528 esac
5529 for thisincl in $inclwanted; do
5530         if $test -d $thisincl; then
5531                 if $test x$thisincl != x$usrinc; then
5532                         case "$dflt" in
5533                         *" -I$thisincl "*);;
5534                         *) dflt="$dflt -I$thisincl ";;
5535                         esac
5536                 fi
5537         fi
5538 done
5539
5540 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5541         xxx=true;
5542 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5543         xxx=true;
5544 else
5545         xxx=false;
5546 fi;
5547 if $xxx; then
5548         case "$dflt" in
5549         *$2*);;
5550         *) dflt="$dflt -D$2";;
5551         esac;
5552 fi'
5553
5554 set signal.h LANGUAGE_C; eval $inctest
5555
5556 case "$usesocks" in
5557 $define)
5558         ccflags="$ccflags -DSOCKS"
5559         ;;
5560 esac
5561
5562 case "$hint" in
5563 default|recommended) dflt="$ccflags $dflt" ;;
5564 *) dflt="$ccflags";;
5565 esac
5566
5567 case "$dflt" in
5568 ''|' ') dflt=none;;
5569 esac
5570
5571 $cat <<EOH
5572
5573 Your C compiler may want other flags.  For this question you should include
5574 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5575 but you should NOT include libraries or ld flags like -lwhatever.  If you
5576 want $package to honor its debug switch, you should include -DDEBUGGING here.
5577 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5578
5579 To use no flags, specify the word "none".
5580
5581 EOH
5582 set X $dflt
5583 shift
5584 dflt=${1+"$@"}
5585 rp="Any additional cc flags?"
5586 . ./myread
5587 case "$ans" in
5588 none) ccflags='';;
5589 *) ccflags="$ans";;
5590 esac
5591
5592 : the following weeds options from ccflags that are of no interest to cpp
5593 case "$cppflags" in
5594 '') cppflags="$ccflags" ;;
5595 *)  set X $ccflags; shift
5596     case " $cppflags " in
5597     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5598     *) cppflags="$cppflags $ccflags" ;;
5599     esac
5600     ;;
5601 esac
5602 case "$gccversion" in
5603 1*) cppflags="$cppflags -D__GNUC__"
5604 esac
5605 case "$mips_type" in
5606 '');;
5607 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5608 esac
5609 case "$cppflags" in
5610 '');;
5611 *)
5612         echo " "
5613         echo "Let me guess what the preprocessor flags are..." >&4
5614         set X $cppflags
5615         shift
5616         cppflags=''
5617         $cat >cpp.c <<'EOM'
5618 #define BLURFL foo
5619
5620 BLURFL xx LFRULB
5621 EOM
5622         previous=''
5623         for flag in $*
5624         do
5625                 case "$flag" in
5626                 -*) ftry="$flag";;
5627                 *) ftry="$previous $flag";;
5628                 esac
5629                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5630                         >cpp1.out 2>/dev/null && \
5631                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5632                         >cpp2.out 2>/dev/null && \
5633                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5634                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5635                 then
5636                         cppflags="$cppflags $ftry"
5637                         previous=''
5638                 else
5639                         previous="$flag"
5640                 fi
5641         done
5642         set X $cppflags
5643         shift
5644         cppflags=${1+"$@"}
5645         case "$cppflags" in
5646         *-*)  echo "They appear to be: $cppflags";;
5647         esac
5648         $rm -f cpp.c cpp?.out
5649         ;;
5650 esac
5651
5652 : flags used in final linking phase
5653 case "$ldflags" in
5654 '') if ./venix; then
5655                 dflt='-i -z'
5656         else
5657                 dflt=''
5658         fi
5659         case "$ccflags" in
5660         *-posix*) dflt="$dflt -posix" ;;
5661         esac
5662         ;;
5663 *) dflt="$ldflags";;
5664 esac
5665 # See note above about -fstack-protector
5666 case "$ccflags" in
5667 *-fstack-protector-strong*)
5668         case "$dflt" in
5669         *-fstack-protector-strong*) ;; # Don't add it again
5670         *) dflt="$dflt -fstack-protector-strong" ;;
5671         esac
5672         ;;
5673 *-fstack-protector*)
5674         case "$dflt" in
5675         *-fstack-protector*) ;; # Don't add it again
5676         *) dflt="$dflt -fstack-protector" ;;
5677         esac
5678         ;;
5679 esac
5680
5681 : Try to guess additional flags to pick up local libraries.
5682 for thislibdir in $libpth; do
5683         case " $loclibpth " in
5684         *" $thislibdir "*)
5685                 case "$dflt " in
5686                 *"-L$thislibdir "*) ;;
5687                 *)  dflt="$dflt -L$thislibdir" ;;
5688                 esac
5689                 ;;
5690         esac
5691 done
5692
5693 case "$dflt" in
5694 '') dflt='none' ;;
5695 esac
5696
5697 $cat <<EOH
5698
5699 Your C linker may need flags.  For this question you should
5700 include -L/whatever and any other flags used by the C linker, but you
5701 should NOT include libraries like -lwhatever.
5702
5703 Make sure you include the appropriate -L/path flags if your C linker
5704 does not normally search all of the directories you specified above,
5705 namely
5706         $libpth
5707 To use no flags, specify the word "none".
5708
5709 EOH
5710
5711 rp="Any additional ld flags (NOT including libraries)?"
5712 . ./myread
5713 case "$ans" in
5714 none) ldflags='';;
5715 *) ldflags="$ans";;
5716 esac
5717 rmlist="$rmlist pdp11"
5718
5719 : coherency check
5720 echo " "
5721 echo "Checking your choice of C compiler and flags for coherency..." >&4
5722 $cat > try.c <<'EOF'
5723 #include <stdio.h>
5724 int main() { printf("Ok\n"); return(0); }
5725 EOF
5726 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5727 shift
5728 $cat >try.msg <<'EOM'
5729 I've tried to compile and run the following simple program:
5730
5731 EOM
5732 $cat try.c >> try.msg
5733
5734 $cat >> try.msg <<EOM
5735
5736 I used the command:
5737
5738         $*
5739         $run ./try
5740
5741 and I got the following output:
5742
5743 EOM
5744 dflt=y
5745 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5746         if $sh -c "$run ./try " >>try.msg 2>&1; then
5747                 xxx=`$run ./try`
5748                 case "$xxx" in
5749                 "Ok") dflt=n ;;
5750                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5751                 esac
5752         else
5753                 echo "The program compiled OK, but exited with status $?." >>try.msg
5754                 rp="You have a problem.  Shall I abort Configure"
5755                 dflt=y
5756         fi
5757 else
5758         echo "I can't compile the test program." >>try.msg
5759         rp="You have a BIG problem.  Shall I abort Configure"
5760         dflt=y
5761 fi
5762 case "$dflt" in
5763 y)
5764         $cat try.msg >&4
5765         case "$knowitall" in
5766         '')
5767                 echo "(The supplied flags or libraries might be incorrect.)"
5768                 ;;
5769         *) dflt=n;;
5770         esac
5771         echo " "
5772         . ./myread
5773         case "$ans" in
5774         n*|N*) ;;
5775         *)      echo "Ok.  Stopping Configure." >&4
5776                 exit 1
5777                 ;;
5778         esac
5779         ;;
5780 n) echo "OK, that should do.";;
5781 esac
5782 $rm_try gcctest gcctest.out
5783
5784 : define a shorthand compile call
5785 compile='
5786 mc_file=$1;
5787 shift;
5788 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5789 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5790 exit 1;
5791 fi;
5792 esac;
5793 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5794 : define a shorthand compile call for compilations that should be ok.
5795 compile_ok='
5796 mc_file=$1;
5797 shift;
5798 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5799
5800 : stub, used only to satisfy other units
5801 i_stdlib='define'
5802
5803 : check for lengths of integral types
5804 echo " "
5805 case "$intsize" in
5806 '')
5807         echo "Checking to see how big your integers are..." >&4
5808         $cat >try.c <<EOCP
5809 #include <stdio.h>
5810 #$i_stdlib I_STDLIB
5811 #ifdef I_STDLIB
5812 #include <stdlib.h>
5813 #endif
5814 int main()
5815 {
5816         printf("intsize=%d;\n", (int)sizeof(int));
5817         printf("longsize=%d;\n", (int)sizeof(long));
5818         printf("shortsize=%d;\n", (int)sizeof(short));
5819         exit(0);
5820 }
5821 EOCP
5822         set try
5823         if eval $compile_ok && $run ./try > /dev/null; then
5824                 eval `$run ./try`
5825                 echo "Your integers are $intsize bytes long."
5826                 echo "Your long integers are $longsize bytes long."
5827                 echo "Your short integers are $shortsize bytes long."
5828         else
5829                 $cat >&4 <<EOM
5830 !
5831 Help! I can't compile and run the intsize test program: please enlighten me!
5832 (This is probably a misconfiguration in your system or libraries, and
5833 you really ought to fix it.  Still, I'll try anyway.)
5834 !
5835 EOM
5836                 dflt=4
5837                 rp="What is the size of an integer (in bytes)?"
5838                 . ./myread
5839                 intsize="$ans"
5840                 dflt=$intsize
5841                 rp="What is the size of a long integer (in bytes)?"
5842                 . ./myread
5843                 longsize="$ans"
5844                 dflt=2
5845                 rp="What is the size of a short integer (in bytes)?"
5846                 . ./myread
5847                 shortsize="$ans"
5848         fi
5849         ;;
5850 esac
5851 $rm_try
5852
5853 : check for long long
5854 echo " "
5855 echo "Checking to see if you have long long..." >&4
5856 echo 'int main() { long long x = 7; return 0; }' > try.c
5857 set try
5858 if eval $compile; then
5859         val="$define"
5860         echo "You have long long."
5861 else
5862         val="$undef"
5863         echo "You do not have long long."
5864 fi
5865 $rm_try
5866 set d_longlong
5867 eval $setvar
5868
5869 : check for length of long long
5870 case "${d_longlong}${longlongsize}" in
5871 $define)
5872         echo " "
5873         echo "Checking to see how big your long longs are..." >&4
5874         $cat >try.c <<'EOCP'
5875 #include <stdio.h>
5876 int main()
5877 {
5878     printf("%d\n", (int)sizeof(long long));
5879     return(0);
5880 }
5881 EOCP
5882         set try
5883         if eval $compile_ok; then
5884                 longlongsize=`$run ./try`
5885                 echo "Your long longs are $longlongsize bytes long."
5886         else
5887                 dflt='8'
5888                 echo " "
5889                 echo "(I can't seem to compile the test program.  Guessing...)"
5890                 rp="What is the size of a long long (in bytes)?"
5891                 . ./myread
5892                 longlongsize="$ans"
5893         fi
5894         if $test "X$longsize" = "X$longlongsize"; then
5895                 echo "(That isn't any different from an ordinary long.)"
5896         fi
5897         ;;
5898 esac
5899 $rm_try
5900
5901 : determine filename position in cpp output
5902 echo " "
5903 echo "Computing filename position in cpp output for #include directives..." >&4
5904 case "$osname" in
5905 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5906 esac
5907 case "$fieldn" in
5908 '')
5909 case "$osname" in
5910 vos) testaccess=-e ;;
5911 *)   testaccess=-r ;;
5912 esac
5913 echo '#include <stdio.h>' > foo.c
5914 $cat >fieldn <<EOF
5915 $startsh
5916 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5917 $grep '^[       ]*#.*stdio\.h' | \
5918 while read cline; do
5919         pos=1
5920         set \$cline
5921         while $test \$# -gt 0; do
5922                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5923                         echo "\$pos"
5924                         exit 0
5925                 fi
5926                 shift
5927                 pos=\`expr \$pos + 1\`
5928         done
5929 done
5930 EOF
5931 chmod +x fieldn
5932 fieldn=`./fieldn`
5933 $rm -f foo.c fieldn
5934 ;;
5935 esac
5936 case $fieldn in
5937 '') pos='???';;
5938 1) pos=first;;
5939 2) pos=second;;
5940 3) pos=third;;
5941 *) pos="${fieldn}th";;
5942 esac
5943 echo "Your cpp writes the filename in the $pos field of the line."
5944
5945 : locate header file
5946 $cat >findhdr <<EOF
5947 $startsh
5948 wanted=\$1
5949 name=''
5950 for usrincdir in $incpth
5951 do
5952         if test -f \$usrincdir/\$wanted; then
5953                 echo "\$usrincdir/\$wanted"
5954                 exit 0
5955         fi
5956 done
5957 awkprg='{ print \$$fieldn }'
5958 echo "#include <\$wanted>" > foo\$\$.c
5959 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5960 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5961 while read cline; do
5962         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5963         case "\$name" in
5964         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5965         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5966         *) exit 2;;
5967         esac;
5968 done;
5969 #
5970 # status = 0: grep returned 0 lines, case statement not executed
5971 # status = 1: headerfile found
5972 # status = 2: while loop executed, no headerfile found
5973 #
5974 status=\$?
5975 $rm -f foo\$\$.c;
5976 if test \$status -eq 1; then
5977         exit 0;
5978 fi
5979 exit 1
5980 EOF
5981 chmod +x findhdr
5982
5983 : define an alternate in-header-list? function
5984 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5985 cont=true; xxf="echo \"<\$1> found.\" >&4";
5986 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5987 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5988 esac;
5989 case $# in 4) instead=instead;; *) instead="at last";; esac;
5990 while $test "$cont"; do
5991         xxx=`./findhdr $1`
5992         var=$2; eval "was=\$$2";
5993         if $test "$xxx" && $test -r "$xxx";
5994         then eval $xxf;
5995         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5996                 cont="";
5997         else eval $xxnf;
5998         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5999         set $yyy; shift; shift; yyy=$@;
6000         case $# in 0) cont="";;
6001         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6002                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6003         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6004                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6005         esac;
6006 done;
6007 while $test "$yyy";
6008 do set $yyy; var=$2; eval "was=\$$2";
6009         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6010         set $yyy; shift; shift; yyy=$@;
6011 done'
6012
6013 : see if inttypes.h is available
6014 : we want a real compile instead of Inhdr because some systems
6015 : have an inttypes.h which includes non-existent headers
6016 echo " "
6017 $cat >try.c <<EOCP
6018 #include <inttypes.h>
6019 int main() {
6020         static int32_t foo32 = 0x12345678;
6021 }
6022 EOCP
6023 set try
6024 if eval $compile; then
6025         echo "<inttypes.h> found." >&4
6026         val="$define"
6027 else
6028         echo "<inttypes.h> NOT found." >&4
6029         val="$undef"
6030 fi
6031 $rm_try
6032 set i_inttypes
6033 eval $setvar
6034
6035 : check for int64_t
6036 echo " "
6037 echo "Checking to see if you have int64_t..." >&4
6038 $cat >try.c <<EOCP
6039 #include <sys/types.h>
6040 #$i_inttypes I_INTTYPES
6041 #ifdef I_INTTYPES
6042 #include <inttypes.h>
6043 #endif
6044 int main() { int64_t x = 7; }
6045 EOCP
6046 set try
6047 if eval $compile; then
6048         val="$define"
6049         echo "You have int64_t."
6050 else
6051         val="$undef"
6052         echo "You do not have int64_t."
6053 fi
6054 $rm_try
6055 set d_int64_t
6056 eval $setvar
6057
6058 : Check if 64bit ints have a quad type
6059 echo " "
6060 echo "Checking which 64-bit integer type we could use..." >&4
6061
6062 case "$intsize" in
6063 8) val=int
6064    set quadtype
6065    eval $setvar
6066    val='"unsigned int"'
6067    set uquadtype
6068    eval $setvar
6069    quadkind=1
6070    ;;
6071 *) case "$longsize" in
6072    8) val=long
6073       set quadtype
6074       eval $setvar
6075       val='"unsigned long"'
6076       set uquadtype
6077       eval $setvar
6078       quadkind=2
6079       ;;
6080    *) case "$d_longlong:$longlongsize" in
6081       define:8)
6082         val='"long long"'
6083         set quadtype
6084         eval $setvar
6085         val='"unsigned long long"'
6086         set uquadtype
6087         eval $setvar
6088         quadkind=3
6089         ;;
6090       *) case "$d_int64_t" in
6091          define)
6092            val=int64_t
6093            set quadtype
6094            eval $setvar
6095            val=uint64_t
6096            set uquadtype
6097            eval $setvar
6098            quadkind=4
6099            ;;
6100          esac
6101          ;;
6102       esac
6103       ;;
6104    esac
6105    ;;
6106 esac
6107
6108 case "$quadtype" in
6109 '')     echo "Alas, no 64-bit integer types in sight." >&4
6110         d_quad="$undef"
6111         ;;
6112 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6113         d_quad="$define"
6114         ;;
6115 esac
6116
6117 : Do we want 64bit support
6118 case "$uselonglong" in
6119 "$define"|true|[yY]*)
6120         cat <<EOM >&4
6121
6122 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6123 EOM
6124         use64bitint="$define"
6125         ;;
6126 esac
6127 case "$use64bits" in
6128 "$define"|true|[yY]*)
6129         cat <<EOM >&4
6130
6131 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6132 EOM
6133         use64bitint="$define"
6134         ;;
6135 esac
6136 case "$use64bitints" in
6137 "$define"|true|[yY]*)
6138         cat <<EOM >&4
6139
6140 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6141 EOM
6142         use64bitint="$define"
6143         ;;
6144 esac
6145 case "$use64bitsint" in
6146 "$define"|true|[yY]*)
6147         cat <<EOM >&4
6148
6149 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6150 EOM
6151         use64bitint="$define"
6152         ;;
6153 esac
6154 case "$uselonglongs" in
6155 "$define"|true|[yY]*)
6156         cat <<EOM >&4
6157
6158 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6159 EOM
6160         use64bitint="$define"
6161         ;;
6162 esac
6163 case "$use64bitsall" in
6164 "$define"|true|[yY]*)
6165         cat <<EOM >&4
6166
6167 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6168 EOM
6169         use64bitall="$define"
6170         ;;
6171 esac
6172
6173 case "$ccflags" in
6174 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6175 esac
6176 case "$use64bitall" in
6177 "$define"|true|[yY]*) use64bitint="$define" ;;
6178 esac
6179
6180 case "$longsize" in
6181 8) cat <<EOM
6182
6183 You have natively 64-bit long integers.
6184 EOM
6185    val="$define"
6186    ;;
6187 *) case "$use64bitint" in
6188    "$define"|true|[yY]*) dflt='y';;
6189    *) dflt='n';;
6190    esac
6191    case "$d_quad" in
6192    "$define") ;;
6193    *) dflt='n' ;;
6194    esac
6195    cat <<EOM
6196
6197 Perl can be built to take advantage of 64-bit integer types
6198 on some systems.  To do so, Configure can be run with -Duse64bitint.
6199 Choosing this option will most probably introduce binary incompatibilities.
6200
6201 If this doesn't make any sense to you, just accept the default '$dflt'.
6202 (The default has been chosen based on your configuration.)
6203 EOM
6204    rp='Try to use 64-bit integers, if available?'
6205    . ./myread
6206    case "$ans" in
6207    [yY]*) val="$define" ;;
6208    *)     val="$undef"  ;;
6209    esac
6210    ;;
6211 esac
6212 set use64bitint
6213 eval $setvar
6214
6215 case "$use64bitall" in
6216 "$define"|true|[yY]*) dflt='y' ;;
6217 *) case "$longsize" in
6218    8) dflt='y' ;;
6219    *) dflt='n' ;;
6220    esac
6221    ;;
6222 esac
6223 cat <<EOM
6224
6225 You may also choose to try maximal 64-bitness.  It means using as much
6226 64-bitness as possible on the platform.  This in turn means even more
6227 binary incompatibilities.  On the other hand, your platform may not
6228 have any more 64-bitness available than what you already have chosen.
6229
6230 If this doesn't make any sense to you, just accept the default '$dflt'.
6231 (The default has been chosen based on your configuration.)
6232 EOM
6233 rp='Try to use maximal 64-bit support, if available?'
6234 . ./myread
6235 case "$ans" in
6236 [yY]*) val="$define" ;;
6237 *)     val="$undef"  ;;
6238 esac
6239 set use64bitall
6240 eval $setvar
6241 case "$use64bitall" in
6242 "$define")
6243         case "$use64bitint" in
6244         "$undef")
6245                 cat <<EOM
6246
6247 Since you have chosen a maximally 64-bit build, I'm also turning on
6248 the use of 64-bit integers.
6249 EOM
6250                 use64bitint="$define" ;;
6251         esac
6252         ;;
6253 esac
6254
6255 : Look for a hint-file generated 'call-back-unit'.  If the
6256 : user has specified that a 64-bit perl is to be built,
6257 : we may need to set or change some other defaults.
6258 if $test -f use64bitint.cbu; then
6259         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6260         . ./use64bitint.cbu
6261 fi
6262 case "$use64bitint" in
6263 "$define"|true|[yY]*)
6264         : This test was common to all the OpenBSD forks, and seems harmless for
6265         : other platforms:
6266         echo " "
6267         echo "Checking if your C library has broken 64-bit functions..." >&4
6268         cat >try.c <<EOCP
6269 #include <stdio.h>
6270 typedef $uquadtype myULL;
6271 int main (void)
6272 {
6273     struct {
6274         double d;
6275         myULL  u;
6276     } *p, test[] = {
6277         {4294967303.15, 4294967303ULL},
6278         {4294967294.2,  4294967294ULL},
6279         {4294967295.7,  4294967295ULL},
6280         {0.0, 0ULL}
6281     };
6282     for (p = test; p->u; p++) {
6283         myULL x = (myULL)p->d;
6284         if (x != p->u) {
6285             printf("buggy\n");
6286             return 0;
6287         }
6288     }
6289     printf("ok\n");
6290     return 0;
6291 }
6292 EOCP
6293         set try
6294         if eval $compile_ok; then
6295             libcquad=`$run ./try`
6296             echo "Your C library's 64-bit functions are $libcquad."
6297         else
6298             echo "(I can't seem to compile the test program.)"
6299             echo "Assuming that your C library's 64-bit functions are ok."
6300             libcquad="ok"
6301         fi
6302         $rm_try
6303
6304         case "$libcquad" in
6305             buggy*)
6306                 cat >&4 <<EOM
6307
6308 *** You have a C library with broken 64-bit functions.
6309 *** 64-bit support does not work reliably in this configuration.
6310 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6311 *** Cannot continue, aborting.
6312
6313 EOM
6314                 exit 1
6315                 ;;
6316         esac
6317         case "$longsize" in
6318         4) case "$archname64" in
6319            '') archname64=64int ;;
6320            esac
6321            ;;
6322         esac
6323         ;;
6324 esac
6325
6326 : Look for a hint-file generated 'call-back-unit'.  If the
6327 : user has specified that a maximally 64-bit perl is to be built,
6328 : we may need to set or change some other defaults.
6329 if $test -f use64bitall.cbu; then
6330         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6331         . ./use64bitall.cbu
6332 fi
6333 case "$use64bitall" in
6334 "$define"|true|[yY]*)
6335         case "$longsize" in
6336         4) case "$archname64" in
6337            ''|64int) archname64=64all ;;
6338            esac
6339            ;;
6340         esac
6341         ;;
6342 esac
6343
6344 case "$d_quad:$use64bitint" in
6345 $undef:$define)
6346         cat >&4 <<EOF
6347
6348 *** You have chosen to use 64-bit integers,
6349 *** but none can be found.
6350 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6351 *** Cannot continue, aborting.
6352
6353 EOF
6354         exit 1
6355         ;;
6356 esac
6357
6358 : Check if we are using the GNU C library
6359 echo " "
6360 echo "Checking for GNU C Library..." >&4
6361 cat >try.c <<'EOCP'
6362 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6363    alone are insufficient to distinguish different versions, such as
6364    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6365    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6366 */
6367 #include <stdio.h>
6368 int main(void)
6369 {
6370 #ifdef __GLIBC__
6371 #   ifdef __GLIBC_MINOR__
6372 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6373 #           include <gnu/libc-version.h>
6374             printf("%s\n",  gnu_get_libc_version());
6375 #       else
6376             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6377 #       endif
6378 #   else
6379         printf("%d\n",  __GLIBC__);
6380 #   endif
6381     return 0;
6382 #else
6383     return 1;
6384 #endif
6385 }
6386 EOCP
6387 set try
6388 if eval $compile_ok && $run ./try > glibc.ver; then
6389         val="$define"
6390         gnulibc_version=`$cat glibc.ver`
6391         echo "You are using the GNU C Library version $gnulibc_version"
6392 else
6393         val="$undef"
6394         gnulibc_version=''
6395         echo "You are not using the GNU C Library"
6396 fi
6397 $rm_try glibc.ver
6398 set d_gnulibc
6399 eval $setvar
6400
6401 : see if nm is to be used to determine whether a symbol is defined or not
6402 case "$usenm" in
6403 '')
6404         dflt=''
6405         case "$d_gnulibc" in
6406         "$define")
6407                 echo " "
6408                 echo "nm probably won't work on the GNU C Library." >&4
6409                 dflt=n
6410                 ;;
6411         esac
6412         case "$dflt" in
6413         '')
6414                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6415                         echo " "
6416                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6417                         echo "'nm' won't be sufficient on this system." >&4
6418                         dflt=n
6419                 fi
6420                 ;;
6421         esac
6422         case "$dflt" in
6423         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6424                 if $test $dflt -gt 20; then
6425                         dflt=y
6426                 else
6427                         dflt=n
6428                 fi
6429                 ;;
6430         esac
6431         ;;
6432 *)
6433         case "$usenm" in
6434         true|$define) dflt=y;;
6435         *) dflt=n;;
6436         esac
6437         ;;
6438 esac
6439 $cat <<EOM
6440
6441 I can use $nm to extract the symbols from your C libraries. This
6442 is a time consuming task which may generate huge output on the disk (up
6443 to 3 megabytes) but that should make the symbols extraction faster. The
6444 alternative is to skip the 'nm' extraction part and to compile a small
6445 test program instead to determine whether each symbol is present. If
6446 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6447 this may be the best solution.
6448
6449 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6450
6451 EOM
6452 rp="Shall I use $nm to extract C symbols from the libraries?"
6453 . ./myread
6454 case "$ans" in
6455 [Nn]*) usenm=false;;
6456 *) usenm=true;;
6457 esac
6458
6459 runnm=$usenm
6460 case "$reuseval" in
6461 true) runnm=false;;
6462 esac
6463
6464 : nm options which may be necessary
6465 case "$nm_opt" in
6466 '') if $test -f /mach_boot; then
6467                 nm_opt=''       # Mach
6468         elif $test -d /usr/ccs/lib; then
6469                 nm_opt='-p'     # Solaris (and SunOS?)
6470         elif $test -f /dgux; then
6471                 nm_opt='-p'     # DG-UX
6472         elif $test -f /lib64/rld; then
6473                 nm_opt='-p'     # 64-bit Irix
6474         else
6475                 nm_opt=''
6476         fi;;
6477 esac
6478
6479 : nm options which may be necessary for shared libraries but illegal
6480 : for archive libraries.  Thank you, Linux.
6481 case "$nm_so_opt" in
6482 '')     case "$myuname" in
6483         *linux*|gnu*)
6484                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6485                         nm_so_opt='--dynamic'
6486                 fi
6487                 ;;
6488         esac
6489         ;;
6490 esac
6491
6492 : Figure out where the libc is located
6493 case "$runnm" in
6494 true)
6495 : get list of predefined functions in a handy place
6496 echo " "
6497 case "$libc" in
6498 '') libc=unknown
6499         case "$libs" in
6500         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6501         esac
6502         ;;
6503 esac
6504 case "$libs" in
6505 '') ;;
6506 *)  for thislib in $libs; do
6507         case "$thislib" in
6508         -lc|-lc_s)
6509                 : Handle C library specially below.
6510                 ;;
6511         -l*)
6512                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6513                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6514                         :
6515                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6516                         :
6517                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6518                         :
6519                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6520                         :
6521                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6522                         :
6523                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6524                         :
6525                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6526                         :
6527                 else
6528                         try=''
6529                 fi
6530                 libnames="$libnames $try"
6531                 ;;
6532         *) libnames="$libnames $thislib" ;;
6533         esac
6534         done
6535         ;;
6536 esac
6537 xxx=normal
6538 case "$libc" in
6539 unknown)
6540         set /lib/libc.$so
6541         for xxx in $libpth; do
6542                 $test -r $1 || set $xxx/libc.$so
6543                 : The messy sed command sorts on library version numbers.
6544                 $test -r $1 || \
6545                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6546                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6547                                 h
6548                                 s/[0-9][0-9]*/0000&/g
6549                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6550                                 G
6551                                 s/\n/ /' | \
6552                          $sort | $sed -e 's/^.* //'`
6553                 eval set \$$#
6554         done
6555         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6556         $test -r $1 || set $sysroot/lib/libsys_s$_a
6557         ;;
6558 *)
6559         set blurfl
6560         ;;
6561 esac
6562 if $test -r "$1"; then
6563         echo "Your (shared) C library seems to be in $1."
6564         libc="$1"
6565 elif $test -r /lib/libc && $test -r /lib/clib; then
6566         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6567         xxx=apollo
6568         libc='/lib/clib /lib/libc'
6569         if $test -r /lib/syslib; then
6570                 echo "(Your math library is in /lib/syslib.)"
6571                 libc="$libc /lib/syslib"
6572         fi
6573 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6574         echo "Your C library seems to be in $libc, as you said before."
6575 elif $test -r $incpath/usr/lib/libc$_a; then
6576         libc=$incpath/usr/lib/libc$_a;
6577         echo "Your C library seems to be in $libc.  That's fine."
6578 elif $test -r /lib/libc$_a; then
6579         libc=/lib/libc$_a;
6580         echo "Your C library seems to be in $libc.  You're normal."
6581 else
6582         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6583                 :
6584         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6585                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6586         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6587                 :
6588         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6589                 :
6590         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6591                 :
6592         else
6593                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6594         fi
6595         if $test -r "$tans"; then
6596                 echo "Your C library seems to be in $tans, of all places."
6597                 libc=$tans
6598         else
6599                 libc='blurfl'
6600         fi
6601 fi
6602 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6603         dflt="$libc"
6604         cat <<EOM
6605
6606 If the guess above is wrong (which it might be if you're using a strange
6607 compiler, or your machine supports multiple models), you can override it here.
6608
6609 EOM
6610 else
6611         dflt=''
6612         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6613         cat >&4 <<EOM
6614 I can't seem to find your C library.  I've looked in the following places:
6615
6616 EOM
6617         $sed 's/^/      /' libpath
6618         cat <<EOM
6619
6620 None of these seems to contain your C library. I need to get its name...
6621
6622 EOM
6623 fi
6624 fn=f
6625 rp='Where is your C library?'
6626 . ./getfile
6627 libc="$ans"
6628
6629 echo " "
6630 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6631 set X `cat libnames`
6632 shift
6633 xxx=files
6634 case $# in 1) xxx=file; esac
6635 echo "Extracting names from the following $xxx for later perusal:" >&4
6636 echo " "
6637 $sed 's/^/      /' libnames >&4
6638 echo " "
6639 $echo $n "This may take a while...$c" >&4
6640
6641 for file in $*; do
6642         case $file in
6643         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6644         *) $nm $nm_opt $file 2>/dev/null;;
6645         esac
6646 done >libc.tmp
6647
6648 $echo $n ".$c"
6649 $grep fprintf libc.tmp > libc.ptf
6650 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6651 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6652 xxx='[ADTSIWi]'
6653 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\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'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6678                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6691         eval $xscan;\
6692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6693                 eval $xrun
6694 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6695         eval $xscan;\
6696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6697                 eval $xrun
6698 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6699         eval $xscan;\
6700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6701                 eval $xrun
6702 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6703         eval $xscan;\
6704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6705                 eval $xrun
6706 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6707         eval $xscan;\
6708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6709                 eval $xrun
6710 else
6711         $nm -p $* 2>/dev/null >libc.tmp
6712         $grep fprintf libc.tmp > libc.ptf
6713         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6714                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6715         then
6716                 nm_opt='-p'
6717                 eval $xrun
6718         else
6719                 echo " "
6720                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6721                 com=''
6722                 if $ar t $libc > libc.tmp && \
6723                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6724                 then
6725                         for thisname in $libnames $libc; do
6726                                 $ar t $thisname >>libc.tmp
6727                         done
6728                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6729                         echo "Ok." >&4
6730                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6731                         for thisname in $libnames $libc; do
6732                                 $ar tv $thisname >>libc.tmp
6733                                 emximp -o tmp.imp $thisname \
6734                                     2>/dev/null && \
6735                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6736                                     < tmp.imp >>libc.tmp
6737                                 $rm -f tmp.imp
6738                         done
6739                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6740                         echo "Ok." >&4
6741                 else
6742                         echo "$ar didn't seem to work right." >&4
6743                         echo "Maybe this is a Cray...trying bld instead..." >&4
6744                         if  bld t $libc | \
6745                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6746                                 $test -s libc.list
6747                         then
6748                                 for thisname in $libnames; do
6749                                         bld t $libnames | \
6750                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6751                                         $ar t $thisname >>libc.tmp
6752                                 done
6753                                 echo "Ok." >&4
6754                         else
6755                                 echo "That didn't work either.  Giving up." >&4
6756                                 exit 1
6757                         fi
6758                 fi
6759         fi
6760 fi
6761 nm_extract="$com"
6762 case "$PASE" in
6763 define)
6764     echo " "
6765     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6766     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6767     ;;
6768 *)  if $test -f /lib/syscalls.exp; then
6769         echo " "
6770         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6771         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6772                 /lib/syscalls.exp >>libc.list
6773     fi
6774     ;;
6775 esac
6776 ;;
6777 esac
6778 $rm -f libnames libpath
6779
6780 : Check if we are using C++
6781 echo " "
6782 echo "Checking for C++..." >&4
6783 $cat >try.c <<'EOCP'
6784 #include <stdio.h>
6785 int main(void)
6786 {
6787 #ifdef __cplusplus
6788     return 0;
6789 #else
6790     return 1;
6791 #endif
6792 }
6793 EOCP
6794 set try
6795 if eval $compile_ok && $run ./try; then
6796         val="$define"
6797         echo "You are using a C++ compiler."
6798 else
6799         val="$undef"
6800         echo "You are not using a C++ compiler."
6801 fi
6802 $rm_try cplusplus$$
6803 set d_cplusplus
6804 eval $setvar
6805
6806 : is a C symbol defined?
6807 csym='tlook=$1;
6808 case "$3" in
6809 -v) tf=libc.tmp; tdc="";;
6810 -a) tf=libc.tmp; tdc="[]";;
6811 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6812 esac;
6813 case "$d_cplusplus" in
6814     $define)    extern_C="extern \"C\"" ;;
6815     *)          extern_C="extern"       ;;
6816 esac;
6817 tx=yes;
6818 case "$reuseval-$4" in
6819 true-) ;;
6820 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6821 esac;
6822 case "$tx" in
6823 yes)
6824         tval=false;
6825         if $test "$runnm" = true; then
6826                 if $contains $tlook $tf >/dev/null 2>&1; then
6827                         tval=true;
6828                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6829                         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;
6830                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6831                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6832                         $rm_try;
6833                 fi;
6834         else
6835                 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;
6836                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6837                 $rm_try;
6838         fi;
6839         ;;
6840 *)
6841         case "$tval" in
6842         $define) tval=true;;
6843         *) tval=false;;
6844         esac;
6845         ;;
6846 esac;
6847 eval "$2=$tval"'
6848
6849 : define an is-in-libc? function
6850 inlibc='echo " "; td=$define; tu=$undef;
6851 sym=$1; var=$2; eval "was=\$$2";
6852 tx=yes;
6853 case "$reuseval$was" in
6854 true) ;;
6855 true*) tx=no;;
6856 esac;
6857 case "$tx" in
6858 yes)
6859         set $sym tres -f;
6860         eval $csym;
6861         case "$tres" in
6862         true)
6863                 echo "$sym() found." >&4;
6864                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6865         *)
6866                 echo "$sym() NOT found." >&4;
6867                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6868         esac;;
6869 *)
6870         case "$was" in
6871         $define) echo "$sym() found." >&4;;
6872         *) echo "$sym() NOT found." >&4;;
6873         esac;;
6874 esac'
6875
6876 : check for length of double
6877 echo " "
6878 case "$doublesize" in
6879 '')
6880         echo "Checking to see how big your double precision numbers are..." >&4
6881         $cat >try.c <<EOCP
6882 #include <stdio.h>
6883 #$i_stdlib I_STDLIB
6884 #ifdef I_STDLIB
6885 #include <stdlib.h>
6886 #endif
6887 int main()
6888 {
6889     printf("%d\n", (int)sizeof(double));
6890     exit(0);
6891 }
6892 EOCP
6893         set try
6894         if eval $compile_ok; then
6895                 doublesize=`$run ./try`
6896                 echo "Your double is $doublesize bytes long."
6897         else
6898                 dflt='8'
6899                 echo "(I can't seem to compile the test program.  Guessing...)"
6900                 rp="What is the size of a double precision number (in bytes)?"
6901                 . ./myread
6902                 doublesize="$ans"
6903         fi
6904         ;;
6905 esac
6906 $rm_try
6907
6908 : check for long doubles
6909 echo " "
6910 echo "Checking to see if you have long double..." >&4
6911 echo 'int main() { long double x = 7.0; }' > try.c
6912 set try
6913 if eval $compile; then
6914         val="$define"
6915         echo "You have long double."
6916 else
6917         val="$undef"
6918         echo "You do not have long double."
6919 fi
6920 $rm_try
6921 set d_longdbl
6922 eval $setvar
6923
6924 : see if ldexpl exists
6925 set ldexpl d_ldexpl
6926 eval $inlibc
6927
6928 : check for length of long double
6929 case "${d_longdbl}${longdblsize}" in
6930 $define)
6931         echo " "
6932         echo "Checking to see how big your long doubles are..." >&4
6933         $cat >try.c <<'EOCP'
6934 #include <stdio.h>
6935 int main()
6936 {
6937         printf("%d\n", sizeof(long double));
6938 }
6939 EOCP
6940         set try
6941         set try
6942         if eval $compile; then
6943                 longdblsize=`$run ./try`
6944                 echo "Your long doubles are $longdblsize bytes long."
6945         else
6946                 dflt='8'
6947                 echo " "
6948                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6949                 rp="What is the size of a long double (in bytes)?"
6950                 . ./myread
6951                 longdblsize="$ans"
6952         fi
6953         if $test "X$doublesize" = "X$longdblsize"; then
6954                 echo "That isn't any different from an ordinary double."
6955                 echo "I'll keep your setting anyway, but you may see some"
6956                 echo "harmless compilation warnings."
6957         fi
6958         ;;
6959 esac
6960 $rm_try
6961
6962 $echo "Checking the kind of long doubles you have..." >&4
6963 case "$d_longdbl" in
6964 define)
6965 $cat <<EOP >try.c
6966 #$i_stdlib I_STDLIB
6967 #define LONGDBLSIZE $longdblsize
6968 #define DOUBLESIZE $doublesize
6969 #include <float.h>
6970 #ifdef I_STDLIB
6971 #include <stdlib.h>
6972 #endif
6973 #include <stdio.h>
6974 static const long double d = -0.1L;
6975 int main() {
6976   unsigned const char* b = (unsigned const char*)(&d);
6977 #if DOUBLESIZE == LONGDBLSIZE
6978   printf("0\n"); /* if it floats like double */
6979   exit(0);
6980 #endif
6981 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6982   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6983     /* IEEE 754 128-bit little-endian */
6984     printf("1\n");
6985     exit(0);
6986   }
6987   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6988     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6989     printf("2\n");
6990     exit(0);
6991   }
6992 #endif
6993 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6994  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6995  * cannot be trusted. */
6996 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6997   if (b[0] == 0xCD && b[9] == 0xBF) {
6998     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6999      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7000      * Also known as "extended precision". */
7001     printf("3\n");
7002     exit(0);
7003   }
7004   if (b[0] == 0xBF && b[9] == 0xCD) {
7005     /* Is there ever big-endian 80-bit, really?
7006      *
7007      * The Motorola 68881 had another "extended precision" format:
7008      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7009      * for total of 96 bits of bytes.  The zero bits were unused.
7010      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7011      * If it ever becomes relevant, this format should be allocated
7012      * a new doublekind code since it's quite different from the Intel x87.
7013      */
7014     printf("4\n");
7015     exit(0);
7016   }
7017 #endif
7018 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7019   /* software "double double", the 106 is 53+53.
7020    * but irix thinks it is 107. */
7021   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7022     /* double double 128-bit fully little-endian,
7023      * little-endian doubles in little-endian order,
7024      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7025     printf("5\n");
7026     exit(0);
7027   }
7028   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7029     /* double double 128-bit fully big-endian,
7030      * big-endian doubles in big-endian order,
7031      * e.g. PPC/Power and MIPS:
7032      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7033     printf("6\n");
7034     exit(0);
7035   }
7036   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7037     /* double double 128-bit mixed endian.
7038      * little-endian doubles in big-endian order,
7039      * e.g. ppc64el,
7040      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7041     printf("7\n");
7042     exit(0);
7043   }
7044   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7045     /* double double 128-bit mixed endian,
7046      * big-endian doubles in little-endian order,
7047      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7048     printf("8\n");
7049     exit(0);
7050   }
7051 #endif
7052 /* We are largely making this up because it may well be
7053  * that the VAX format H was never made available to C,
7054  * only to Fortran. */
7055 #if LONGDBLSIZE == 16 && defined(__vax__)
7056   if (b[0] == 0xFD && b[15] == 0x99) {
7057     /* VAX format H, PDP-11 mixed endian. */
7058     printf("9\n");
7059     exit(0);
7060   }
7061 #endif
7062   printf("-1\n"); /* unknown */
7063   exit(0);
7064 }
7065 EOP
7066 set try
7067 if eval $compile; then
7068     longdblkind=`$run ./try`
7069 else
7070     longdblkind=-1
7071 fi
7072 ;;
7073 *) longdblkind=0 ;;
7074 esac
7075 case "$longdblkind" in
7076 0) echo "Your long doubles are doubles." >&4 ;;
7077 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7078 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7079 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7080 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7081 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7082 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7083 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7084 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7085 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7086 *) echo "Cannot figure out your long double." >&4 ;;
7087 esac
7088 d_long_double_style_ieee=$undef
7089 d_long_double_style_ieee_std=$undef
7090 d_long_double_style_ieee_extended=$undef
7091 d_long_double_style_ieee_doubledouble=$undef
7092 d_long_double_style_vax=$undef
7093 case "$longdblkind" in
7094 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7095 esac
7096 case "$longdblkind" in
7097 1|2) d_long_double_style_ieee_std=$define ;;
7098 esac
7099 case "$longdblkind" in
7100 3|4) d_long_double_style_ieee_extended=$define ;;
7101 esac
7102 case "$longdblkind" in
7103 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7104 esac
7105 case "$longdblkind" in
7106 9) d_long_double_style_vax=$define ;;
7107 esac
7108 $rm_try
7109
7110 : determine the architecture name
7111 echo " "
7112 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7113         tarch=`arch`"-$osname"
7114 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7115         if uname -m > tmparch 2>&1 ; then
7116                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7117                         -e 's/$/'"-$osname/" tmparch`
7118         else
7119                 tarch="$osname"
7120         fi
7121         $rm -f tmparch
7122 else
7123         tarch="$osname"
7124 fi
7125 case "$myarchname" in
7126 ''|"$tarch") ;;
7127 *)
7128         echo "(Your architecture name used to be $myarchname.)"
7129         archname=''
7130         ;;
7131 esac
7132 case "$targetarch" in
7133 '') ;;
7134 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7135 esac
7136 myarchname="$tarch"
7137 case "$archname" in
7138 '') dflt="$tarch";;
7139 *) dflt="$archname";;
7140 esac
7141 rp='What is your architecture name'
7142 . ./myread
7143 archname="$ans"
7144
7145 : optionally add API version to the architecture for versioned archlibs
7146 case "$useversionedarchname" in
7147 $define|true|[yY]*) dflt='y';;
7148 *)                  dflt='n';;
7149 esac
7150 rp='Add the Perl API version to your archname?'
7151 . ./myread
7152 case "$ans" in
7153 y|Y)    useversionedarchname="$define" ;;
7154 *)      useversionedarchname="$undef" ;;
7155 esac
7156 case "$useversionedarchname" in
7157 $define)
7158         case "$archname" in
7159         *-$api_versionstring)
7160                 echo "...and architecture name already has -$api_versionstring" >&4
7161                 ;;
7162         *)
7163                 archname="$archname-$api_versionstring"
7164                 echo "...setting architecture name to $archname." >&4
7165                 ;;
7166         esac
7167         ;;
7168 esac
7169
7170 case "$usethreads" in
7171 $define)
7172         echo "Threads selected." >&4
7173         case "$archname" in
7174         *-thread*) echo "...and architecture name already has -thread." >&4
7175                 ;;
7176         *)      archname="$archname-thread"
7177                 echo "...setting architecture name to $archname." >&4
7178                 ;;
7179         esac
7180         ;;
7181 esac
7182 case "$usemultiplicity" in
7183 $define)
7184         echo "Multiplicity selected." >&4
7185         case "$archname" in
7186         *-multi*) echo "...and architecture name already has -multi." >&4
7187                 ;;
7188         *)      archname="$archname-multi"
7189                 echo "...setting architecture name to $archname." >&4
7190                 ;;
7191         esac
7192         ;;
7193 esac
7194 case "$use64bitint$use64bitall" in
7195 *"$define"*)
7196         case "$archname64" in
7197         '')
7198                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7199                 ;;
7200         *)
7201                 case "$use64bitint" in
7202                 "$define") echo "64 bit integers selected." >&4 ;;
7203                 esac
7204                 case "$use64bitall" in
7205                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7206                 esac
7207                 case "$archname" in
7208                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7209                         ;;
7210                 *)      archname="$archname-$archname64"
7211                         echo "...setting architecture name to $archname." >&4
7212                         ;;
7213                 esac
7214                 ;;
7215         esac
7216 esac
7217 case "$uselongdouble" in
7218 $define)
7219         echo "Long doubles selected." >&4
7220         case "$longdblsize" in
7221         $doublesize)
7222                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7223                 ;;
7224         *)
7225                 case "$archname" in
7226                 *-ld*) echo "...and architecture name already has -ld." >&4
7227                         ;;
7228                 *)      archname="$archname-ld"
7229                         echo "...setting architecture name to $archname." >&4
7230                         ;;
7231                 esac
7232                 ;;
7233         esac
7234         ;;
7235 esac
7236 case "$usequadmath" in
7237 $define)
7238         echo "quadmath selected." >&4
7239         case "$archname" in
7240         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7241                 ;;
7242         *)      archname="$archname-quadmath"
7243                 echo "...setting architecture name to $archname." >&4
7244                 ;;
7245         esac
7246         ;;
7247 esac
7248 if $test -f archname.cbu; then
7249         echo "Your platform has some specific hints for architecture name, using them..."
7250         . ./archname.cbu
7251 fi
7252
7253 : set the prefixit variable, to compute a suitable default value
7254 prefixit='case "$3" in
7255 ""|none)
7256         case "$oldprefix" in
7257         "") eval "$1=\"\$$2\"";;
7258         *)
7259                 case "$3" in
7260                 "") eval "$1=";;
7261                 none)
7262                         eval "tp=\"\$$2\"";
7263                         case "$tp" in
7264                         ""|" "|none) eval "$1=\"\$$2\"";;
7265                         *) eval "$1=";;
7266                         esac;;
7267                 esac;;
7268         esac;;
7269 *)
7270         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7271         case "$tp" in
7272         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7273         /*-$oldprefix/*|\~*-$oldprefix/*)
7274                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7275         *) eval "$1=\"\$$2\"";;
7276         esac;;
7277 esac'
7278
7279 : determine installation style
7280 : For now, try to deduce it from prefix unless it is already set.
7281 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7282 case "$installstyle" in
7283 '')     case "$prefix" in
7284                 *perl*) dflt='lib';;
7285                 *) dflt='lib/perl5' ;;
7286         esac
7287         ;;
7288 *)      dflt="$installstyle" ;;
7289 esac
7290 : Probably not worth prompting for this since we prompt for all
7291 : the directories individually, and the prompt would be too long and
7292 : confusing anyway.
7293 installstyle=$dflt
7294
7295 : determine where public executables go
7296 echo " "
7297 set dflt bin bin
7298 eval $prefixit
7299 fn=d~
7300 rp='Pathname where the public executables will reside?'
7301 . ./getfile
7302 if $test "X$ansexp" != "X$binexp"; then
7303         installbin=''
7304 fi
7305 prefixvar=bin
7306 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7307 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7308 :     this via initialinstalllocation
7309 . ./setprefixvar
7310
7311 case "$userelocatableinc" in
7312 $define|true|[yY]*)     dflt='y' ;;
7313 *)                      dflt='n' ;;
7314 esac
7315 cat <<EOM
7316
7317 Would you like to build Perl so that the installation is relocatable, so that
7318 library paths in @INC are determined relative to the path of the perl binary?
7319 This is not advised for system Perl installs, or if you need to run setid
7320 scripts or scripts under taint mode.
7321
7322 If this doesn't make any sense to you, just accept the default '$dflt'.
7323 EOM
7324 rp='Use relocatable @INC?'
7325 . ./myread
7326 case "$ans" in
7327 y|Y)    val="$define" ;;
7328 *)      val="$undef"  ;;
7329 esac
7330 set userelocatableinc
7331 eval $setvar
7332
7333 initialinstalllocation="$binexp"
7334 : Default prefix is now "up one level from where the binaries are"
7335 case "$userelocatableinc" in
7336 $define|true|[yY]*)
7337     bin=".../"
7338     binexp=".../"
7339     prefix=".../.."
7340     prefixexp=".../.."
7341     installprefixexp=".../.."
7342     ;;
7343 esac
7344
7345 : determine where private library files go
7346 : Usual default is /usr/local/lib/perl5/$version.
7347 : Also allow things like /opt/perl/lib/$version, since
7348 : /opt/perl/lib/perl5... would be redundant.
7349 : The default "style" setting is made in installstyle.U
7350 case "$installstyle" in
7351 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7352 *)       set dflt privlib lib/$version ;;
7353 esac
7354 eval $prefixit
7355 $cat <<EOM
7356
7357 There are some auxiliary files for $package that need to be put into a
7358 private library directory that is accessible by everyone.
7359
7360 EOM
7361 fn=$binexp
7362 fn=d~+
7363 rp='Pathname where the private library files will reside?'
7364 . ./getfile
7365 prefixvar=privlib
7366 . ./setprefixvar
7367
7368 : set the prefixup variable, to restore leading tilda escape
7369 prefixup='case "$prefixexp" in
7370 "$prefix") ;;
7371 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7372 esac'
7373
7374 : determine where public architecture dependent libraries go
7375 set archlib archlib
7376 eval $prefixit
7377 : privlib default is /usr/local/lib/$package/$version
7378 : archlib default is /usr/local/lib/$package/$version/$archname
7379 : privlib may have an optional trailing /share.
7380 tdflt=`echo $privlib | $sed 's,/share$,,'`
7381 tdflt=$tdflt/$archname
7382 case "$archlib" in
7383 '')     dflt=$tdflt
7384         ;;
7385 *)      dflt="$archlib"
7386     ;;
7387 esac
7388 $cat <<EOM
7389
7390 $spackage contains architecture-dependent library files.  If you are
7391 sharing libraries in a heterogeneous environment, you might store
7392 these files in a separate location.  Otherwise, you can just include
7393 them with the rest of the public library files.
7394
7395 EOM
7396 fn=$binexp
7397 fn=d+~
7398 rp='Where do you want to put the public architecture-dependent libraries?'
7399 . ./getfile
7400 prefixvar=archlib
7401 . ./setprefixvar
7402 if $test X"$archlib" = X"$privlib"; then
7403         d_archlib="$undef"
7404 else
7405         d_archlib="$define"
7406 fi
7407
7408 : see if setuid scripts can be secure
7409 $cat <<EOM
7410
7411 Some kernels have a bug that prevents setuid #! scripts from being
7412 secure.  Some sites have disabled setuid #! scripts because of this.
7413
7414 First let's decide if your kernel supports secure setuid #! scripts.
7415 (If setuid #! scripts would be secure but have been disabled anyway,
7416 don't say that they are secure if asked.)
7417
7418 EOM
7419
7420 val="$undef"
7421 if $test -d /dev/fd; then
7422         echo "#!$ls" >reflect
7423         chmod +x,u+s reflect
7424         ./reflect >flect 2>&1
7425         if $contains "/dev/fd" flect >/dev/null; then
7426                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7427                 val="$define"
7428         else
7429                 $cat <<EOM
7430 If you are not sure if they are secure, I can check but I'll need a
7431 username and password different from the one you are using right now.
7432 If you don't have such a username or don't want me to test, simply
7433 enter 'none'.
7434
7435 EOM
7436                 rp='Other username to test security of setuid scripts with?'
7437                 dflt='none'
7438                 . ./myread
7439                 case "$ans" in
7440                 n|none)
7441                         case "$d_suidsafe" in
7442                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7443                                 dflt=n;;
7444                         "$undef")
7445                                 echo "Well, the $hint value is *not* secure." >&4
7446                                 dflt=n;;
7447                         *)      echo "Well, the $hint value *is* secure." >&4
7448                                 dflt=y;;
7449                         esac
7450                         ;;
7451                 *)
7452                         $rm -f reflect flect
7453                         echo "#!$ls" >reflect
7454                         chmod +x,u+s reflect
7455                         echo >flect
7456                         chmod a+w flect
7457                         echo '"su" will (probably) prompt you for '"$ans's password."
7458                         su $ans -c './reflect >flect'
7459                         if $contains "/dev/fd" flect >/dev/null; then
7460                                 echo "Okay, it looks like setuid scripts are secure." >&4
7461                                 dflt=y
7462                         else
7463                                 echo "I don't think setuid scripts are secure." >&4
7464                                 dflt=n
7465                         fi
7466                         ;;
7467                 esac
7468                 rp='Does your kernel have *secure* setuid scripts?'
7469                 . ./myread
7470                 case "$ans" in
7471                 [yY]*)  val="$define";;
7472                 *)      val="$undef";;
7473                 esac
7474         fi
7475 else
7476         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7477         echo "(That's for file descriptors, not floppy disks.)"
7478         val="$undef"
7479 fi
7480 set d_suidsafe
7481 eval $setvar
7482
7483 $rm -f reflect flect
7484
7485 : now see if they want to do setuid emulation
7486 if $test $patchlevel -lt 11; then
7487 echo " "
7488 val="$undef"
7489 case "$d_suidsafe" in
7490 "$define")
7491         val="$undef"
7492         echo "No need to emulate SUID scripts since they are secure here." >&4
7493         ;;
7494 *)
7495         $cat <<EOM
7496 Some systems have disabled setuid scripts, especially systems where
7497 setuid scripts cannot be secure.  On systems where setuid scripts have
7498 been disabled, the setuid/setgid bits on scripts are currently
7499 useless.  It is possible for $package to detect those bits and emulate
7500 setuid/setgid in a secure fashion.  This emulation will only work if
7501 setuid scripts have been disabled in your kernel.
7502
7503 EOM
7504         case "$d_dosuid" in
7505         "$define") dflt=y ;;
7506         *) dflt=n ;;
7507         esac
7508         rp="Do you want to do setuid/setgid emulation?"
7509         . ./myread
7510         case "$ans" in
7511         [yY]*)  val="$define";;
7512         *)      val="$undef";;
7513         esac
7514         ;;
7515 esac
7516 set d_dosuid
7517 eval $setvar
7518 else
7519     case "$d_dosuid" in
7520         "$define")
7521         cat >&4 <<EOH
7522
7523 SUID emulation has been removed for 5.12
7524 Please re-run Configure without -Dd_dosuid
7525
7526 EOH
7527         exit 1;
7528         ;;
7529     esac
7530     d_dosuid=undef
7531 fi
7532
7533 : Find perl5.005 or later.
7534 echo "Looking for a previously installed perl5.005 or later... "
7535 case "$perl5" in
7536 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7537                 : Check if this perl is recent and can load a simple module
7538                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7539                         perl5=$tdir/perl
7540                         break;
7541                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7542                         perl5=$tdir/perl5
7543                         break;
7544                 fi
7545         done
7546         ;;
7547 *)      perl5="$perl5"
7548         ;;
7549 esac
7550 case "$perl5" in
7551 '')     echo "None found.  That's ok.";;
7552 *)      echo "Using $perl5." ;;
7553 esac
7554
7555 : Set the siteprefix variables
7556 $cat <<EOM
7557
7558 After $package is installed, you may wish to install various
7559 add-on modules and utilities.  Typically, these add-ons will
7560 be installed under $prefix with the rest
7561 of this package.  However, you may wish to install such add-ons
7562 elsewhere under a different prefix.
7563
7564 If you do not wish to put everything under a single prefix, that's
7565 ok.  You will be prompted for the individual locations; this siteprefix
7566 is only used to suggest the defaults.
7567
7568 The default should be fine for most people.
7569
7570 EOM
7571 fn=d~+
7572 rp='Installation prefix to use for add-on modules and utilities?'
7573 : XXX Here might be another good place for an installstyle setting.
7574 case "$siteprefix" in
7575 '') dflt=$prefix ;;
7576 *)  dflt=$siteprefix ;;
7577 esac
7578 . ./getfile
7579 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7580 oldsiteprefix=''
7581 case "$siteprefix" in
7582 '') ;;
7583 *)      case "$ans" in
7584         "$prefix") ;;
7585         *) oldsiteprefix="$prefix";;
7586         esac
7587         ;;
7588 esac
7589 siteprefix="$ans"
7590 siteprefixexp="$ansexp"
7591
7592 : determine where site specific libraries go.
7593 : Usual default is /usr/local/lib/perl5/site_perl/$version
7594 : The default "style" setting is made in installstyle.U
7595 : XXX No longer works with Prefixit stuff.
7596 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7597 case "$sitelib" in
7598 '') case "$installstyle" in
7599         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7600         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7601         esac
7602         ;;
7603 *)      dflt="$sitelib"
7604         ;;
7605 esac
7606 $cat <<EOM
7607
7608 The installation process will create a directory for
7609 site-specific extensions and modules.  Most users find it convenient
7610 to place all site-specific files in this directory rather than in the
7611 main distribution directory.
7612
7613 EOM
7614 fn=d~+
7615 rp='Pathname for the site-specific library files?'
7616 . ./getfile
7617 prefixvar=sitelib
7618 . ./setprefixvar
7619 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7620
7621 : Determine list of previous versions to include in @INC
7622 $cat > getverlist <<EOPL
7623 #!$perl5 -w
7624 use File::Basename;
7625 \$api_versionstring = "$api_versionstring";
7626 \$version = "$version";
7627 \$stem = "$sitelib_stem";
7628 \$archname = "$archname";
7629 EOPL
7630         $cat >> getverlist <<'EOPL'
7631 # The list found is store twice for each entry: the original name, and
7632 # the binary broken down version as pack "sss", so sorting is easy and
7633 # unambiguous. This will work for all versions that have a maximum of
7634 # three digit groups, separate by '.'s or '_'s. Names are extended with
7635 # ".0.0" to ensure at least three elements for the pack.
7636 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7637
7638 # Can't have leading @ because metaconfig interprets it as a command!
7639 ;@inc_version_list=();
7640 # XXX Redo to do opendir/readdir?
7641 if (-d $stem) {
7642     chdir($stem);
7643     ;@candidates = map {
7644         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7645     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7646 }
7647 else {
7648     ;@candidates = ();
7649 }
7650
7651 ($pversion, $aversion, $vsn5005) = map {
7652     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7653 foreach $d (@candidates) {
7654     if ($d->[1] lt $pversion) {
7655         if ($d->[1] ge $aversion) {
7656             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7657         }
7658         elsif ($d->[1] ge $vsn5005) {
7659             unshift(@inc_version_list, grep { -d } $d->[0]);
7660         }
7661     }
7662     else {
7663         # Skip newer version.  I.e. don't look in
7664         # 5.7.0 if we're installing 5.6.1.
7665     }
7666 }
7667
7668 if (@inc_version_list) {
7669     print join(' ', @inc_version_list);
7670 }
7671 else {
7672     # Blank space to preserve value for next Configure run.
7673     print " ";
7674 }
7675 EOPL
7676 chmod +x getverlist
7677 case "$inc_version_list" in
7678 '')     if test -x "$perl5$exe_ext"; then
7679                 dflt=`$perl5 getverlist`
7680         else
7681                 dflt='none'
7682         fi
7683         ;;
7684 $undef) dflt='none' ;;
7685 *)  eval dflt=\"$inc_version_list\" ;;
7686 esac
7687 case "$dflt" in
7688 ''|' ') dflt=none ;;
7689 esac
7690 case "$dflt" in
7691 5.005) dflt=none ;;
7692 esac
7693 $cat <<EOM
7694
7695 In order to ease the process of upgrading, this version of perl
7696 can be configured to use modules built and installed with earlier
7697 versions of perl that were installed under $prefix.  Specify here
7698 the list of earlier versions that this version of perl should check.
7699 If Configure detected no earlier versions of perl installed under
7700 $prefix, then the list will be empty.  Answer 'none' to tell perl
7701 to not search earlier versions.
7702
7703 The default should almost always be sensible, so if you're not sure,
7704 just accept the default.
7705 EOM
7706
7707 rp='List of earlier versions to include in @INC?'
7708 . ./myread
7709 case "$ans" in
7710 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7711 *) inc_version_list="$ans" ;;
7712 esac
7713 case "$inc_version_list" in
7714 ''|' ')
7715         inc_version_list_init='0'
7716         d_inc_version_list="$undef"
7717         ;;
7718 *)      inc_version_list_init=`echo $inc_version_list |
7719                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7720         d_inc_version_list="$define"
7721         ;;
7722 esac
7723 $rm -f getverlist
7724
7725 : see if malloc/malloc.h has to be included
7726 set malloc/malloc.h i_mallocmalloc
7727 eval $inhdr
7728
7729 : see if this is a malloc.h system
7730 : we want a real compile instead of Inhdr because some systems have a
7731 : malloc.h that just gives a compile error saying to use stdlib.h instead
7732 echo " "
7733 $cat >try.c <<EOCP
7734 #include <stdlib.h>
7735 #include <malloc.h>
7736 #$i_mallocmalloc I_MALLOCMALLOC
7737 #ifdef I_MALLOCMALLOC
7738 # include <malloc/malloc.h>
7739 #endif
7740
7741 int main () { return 0; }
7742 EOCP
7743 set try
7744 if eval $compile; then
7745     echo "<malloc.h> found." >&4
7746     val="$define"
7747 else
7748     echo "<malloc.h> NOT found." >&4
7749     val="$undef"
7750 fi
7751 $rm_try
7752 set i_malloc
7753 eval $setvar
7754
7755 : check for length of pointer
7756 echo " "
7757 case "$ptrsize" in
7758 '')
7759         echo "Checking to see how big your pointers are..." >&4
7760         $cat >try.c <<EOCP
7761 #include <stdio.h>
7762 #$i_stdlib I_STDLIB
7763 #ifdef I_STDLIB
7764 #include <stdlib.h>
7765 #endif
7766 int main()
7767 {
7768     printf("%d\n", (int)sizeof(void *));
7769     exit(0);
7770 }
7771 EOCP
7772         set try
7773         if eval $compile_ok; then
7774                 ptrsize=`$run ./try`
7775                 echo "Your pointers are $ptrsize bytes long."
7776         else
7777                 dflt='4'
7778                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7779                 rp="What is the size of a pointer (in bytes)?"
7780                 . ./myread
7781                 ptrsize="$ans"
7782         fi
7783         ;;
7784 esac
7785 $rm_try
7786 case "$use64bitall" in
7787 "$define"|true|[yY]*)
7788         case "$ptrsize" in
7789         4)      cat <<EOM >&4
7790
7791 *** You have chosen a maximally 64-bit build,
7792 *** but your pointers are only 4 bytes wide.
7793 *** Please rerun Configure without -Duse64bitall.
7794 EOM
7795                 case "$d_quad" in
7796                 define)
7797                         cat <<EOM >&4
7798 *** Since you have quads, you could possibly try with -Duse64bitint.
7799 EOM
7800                         ;;
7801                 esac
7802                 cat <<EOM >&4
7803 *** Cannot continue, aborting.
7804
7805 EOM
7806
7807                 exit 1
7808                 ;;
7809         esac
7810         ;;
7811 esac
7812
7813 : determine whether to use malloc wrapping
7814 echo " "
7815 case "$usemallocwrap" in
7816 [yY]*|true|$define)     dflt='y' ;;
7817 [nN]*|false|$undef)     dflt='n' ;;
7818 *)      case "$usedevel" in
7819         [yY]*|true|$define)     dflt='y' ;;
7820         *) dflt='n' ;;
7821         esac
7822         ;;
7823 esac
7824 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7825 . ./myread
7826 usemallocwrap="$ans"
7827 case "$ans" in
7828 y*|true)
7829         usemallocwrap="$define" ;;
7830 *)
7831         usemallocwrap="$undef" ;;
7832 esac
7833
7834 : determine which malloc to compile in
7835 echo " "
7836 case "$usemymalloc" in
7837 [yY]*|true|$define)     dflt='y' ;;
7838 [nN]*|false|$undef)     dflt='n' ;;
7839 *)      case "$ptrsize" in
7840         4) dflt='y' ;;
7841         *) dflt='n' ;;
7842         esac
7843         if test "$useithreads" = "$define"; then dflt='n'; fi
7844         ;;
7845 esac
7846 rp="Do you wish to attempt to use the malloc that comes with $package?"
7847 . ./myread
7848 usemymalloc="$ans"
7849 case "$ans" in
7850 y*|true)
7851         usemymalloc='y'
7852         mallocsrc='malloc.c'
7853         mallocobj="malloc$_o"
7854         d_mymalloc="$define"
7855         case "$libs" in
7856         *-lmalloc*)
7857                 : Remove malloc from list of libraries to use
7858                 echo "Removing unneeded -lmalloc from library list" >&4
7859                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7860                 shift
7861                 libs="$*"
7862                 echo "libs = $libs" >&4
7863                 ;;
7864         esac
7865         ;;
7866 *)
7867         usemymalloc='n'
7868         mallocsrc=''
7869         mallocobj=''
7870         d_mymalloc="$undef"
7871         ;;
7872 esac
7873
7874 : compute the return types of malloc and free
7875 echo " "
7876 $cat >malloc.c <<END
7877 #$i_malloc I_MALLOC
7878 #$i_stdlib I_STDLIB
7879 #include <stdio.h>
7880 #include <sys/types.h>
7881 #ifdef I_MALLOC
7882 #include <malloc.h>
7883 #endif
7884 #ifdef I_STDLIB
7885 #include <stdlib.h>
7886 #endif
7887 #ifdef TRY_MALLOC
7888 void *malloc();
7889 #endif
7890 #ifdef TRY_FREE
7891 void free();
7892 #endif
7893 END
7894 case "$malloctype" in
7895 '')
7896         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7897                 malloctype='void *'
7898         else
7899                 malloctype='char *'
7900         fi
7901         ;;
7902 esac
7903 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7904
7905 case "$freetype" in
7906 '')
7907         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7908                 freetype='void'
7909         else
7910                 freetype='int'
7911         fi
7912         ;;
7913 esac
7914 echo "Your system uses $freetype free(), it would seem." >&4
7915 $rm -f malloc.[co]
7916 : determine where site specific architecture-dependent libraries go.
7917 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7918 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7919 : sitelib may have an optional trailing /share.
7920 case "$sitearch" in
7921 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7922         dflt="$dflt/$archname"
7923         ;;
7924 *)      dflt="$sitearch"
7925         ;;
7926 esac
7927 set sitearch sitearch none
7928 eval $prefixit
7929 $cat <<EOM
7930
7931 The installation process will also create a directory for
7932 architecture-dependent site-specific extensions and modules.
7933
7934 EOM
7935 fn=d~+
7936 rp='Pathname for the site-specific architecture-dependent library files?'
7937 . ./getfile
7938 prefixvar=sitearch
7939 . ./setprefixvar
7940 if $test X"$sitearch" = X"$sitelib"; then
7941         d_sitearch="$undef"
7942 else
7943         d_sitearch="$define"
7944 fi
7945
7946 : Set the vendorprefix variables
7947 $cat <<EOM
7948
7949 The installation process will also create a directory for
7950 vendor-supplied add-ons.  Vendors who supply perl with their system
7951 may find it convenient to place all vendor-supplied files in this
7952 directory rather than in the main distribution directory.  This will
7953 ease upgrades between binary-compatible maintenance versions of perl.
7954
7955 Of course you may also use these directories in whatever way you see
7956 fit.  For example, you might use them to access modules shared over a
7957 company-wide network.
7958
7959 The default answer should be fine for most people.
7960 This causes further questions about vendor add-ons to be skipped
7961 and no vendor-specific directories will be configured for perl.
7962
7963 EOM
7964 rp='Do you want to configure vendor-specific add-on directories?'
7965 case "$usevendorprefix" in
7966 define|true|[yY]*) dflt=y ;;
7967 *)      : User may have set vendorprefix directly on Configure command line.
7968         case "$vendorprefix" in
7969         ''|' ') dflt=n ;;
7970         *)      dflt=y ;;
7971         esac
7972         ;;
7973 esac
7974 . ./myread
7975 case "$ans" in
7976 [yY]*)  fn=d~+
7977         rp='Installation prefix to use for vendor-supplied add-ons?'
7978         case "$vendorprefix" in
7979         '') dflt="$prefix" ;;
7980         *)  dflt=$vendorprefix ;;
7981         esac
7982         . ./getfile
7983         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7984         oldvendorprefix=''
7985         case "$vendorprefix" in
7986         '') ;;
7987         *)      case "$ans" in
7988                 "$prefix") ;;
7989                 *) oldvendorprefix="$prefix";;
7990                 esac
7991                 ;;
7992         esac
7993         usevendorprefix="$define"
7994         vendorprefix="$ans"
7995         vendorprefixexp="$ansexp"
7996         ;;
7997 *)      usevendorprefix="$undef"
7998         vendorprefix=''
7999         vendorprefixexp=''
8000         ;;
8001 esac
8002
8003 : Set the vendorlib variables
8004 case "$vendorprefix" in
8005 '')     d_vendorlib="$undef"
8006         vendorlib=''
8007         vendorlibexp=''
8008         ;;
8009 *)      d_vendorlib="$define"
8010         : determine where vendor-supplied modules go.
8011         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8012         case "$vendorlib" in
8013         '')
8014                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8015                 case "$installstyle" in
8016                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8017                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8018                 esac
8019                 ;;
8020         *)      dflt="$vendorlib"
8021                 ;;
8022         esac
8023         fn=d~+
8024         rp='Pathname for the vendor-supplied library files?'
8025         . ./getfile
8026         vendorlib="$ans"
8027         vendorlibexp="$ansexp"
8028         ;;
8029 esac
8030 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8031 prefixvar=vendorlib
8032 . ./installprefix
8033
8034 : Set the vendorarch variables
8035 case "$vendorprefix" in
8036 '')     d_vendorarch="$undef"
8037         vendorarch=''
8038         vendorarchexp=''
8039         ;;
8040 *)      d_vendorarch="$define"
8041         : determine where vendor-supplied architecture-dependent libraries go.
8042         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8043         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8044         : vendorlib may have an optional trailing /share.
8045         case "$vendorarch" in
8046         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8047                 dflt="$dflt/$archname"
8048                 ;;
8049         *)      dflt="$vendorarch" ;;
8050         esac
8051         fn=d~+
8052         rp='Pathname for vendor-supplied architecture-dependent files?'
8053         . ./getfile
8054         vendorarch="$ans"
8055         vendorarchexp="$ansexp"
8056         ;;
8057 esac
8058 prefixvar=vendorarch
8059 . ./installprefix
8060 if $test X"$vendorarch" = X"$vendorlib"; then
8061         d_vendorarch="$undef"
8062 else
8063         d_vendorarch="$define"
8064 fi
8065
8066 : Final catch-all directories to search
8067 $cat <<EOM
8068
8069 Lastly, you can have perl look in other directories for extensions and
8070 modules in addition to those already specified.
8071 These directories will be searched after
8072         $sitearch
8073         $sitelib
8074 EOM
8075 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8076 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8077 echo ' '
8078 case "$otherlibdirs" in
8079 ''|' ') dflt='none' ;;
8080 *)      dflt="$otherlibdirs" ;;
8081 esac
8082 $cat <<EOM
8083 Enter a colon-separated set of extra paths to include in perl's @INC
8084 search path, or enter 'none' for no extra paths.
8085
8086 EOM
8087
8088 rp='Colon-separated list of additional directories for perl to search?'
8089 . ./myread
8090 case "$ans" in
8091 ' '|''|none)    otherlibdirs=' ' ;;
8092 *)      otherlibdirs="$ans" ;;
8093 esac
8094 case "$otherlibdirs" in
8095 ' ') val=$undef ;;
8096 *)      val=$define ;;
8097 esac
8098 set d_perl_otherlibdirs
8099 eval $setvar
8100
8101 : DTrace support
8102 dflt_dtrace='/usr/sbin/dtrace'
8103 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8104
8105 cat <<EOM
8106
8107 Perl can be built to support DTrace on platforms that support it.
8108 DTrace is a diagnosis and performance analysis tool from Sun.
8109
8110 If this doesn't make any sense to you, just accept the default.
8111 EOM
8112
8113 while $test 1 ; do
8114         case "$usedtrace" in
8115         $define|true|[yY]*)
8116                 dflt='y'
8117                 ;;
8118         $undef|false|[nN]*)
8119                 dflt='n'
8120                 dflt_dtrace=""
8121                 ;;
8122         ?*)
8123                 dflt='y'
8124                 dflt_dtrace=$usedtrace
8125                 ;;
8126         *)
8127                 dflt='n'
8128                 ;;
8129         esac
8130
8131         rp='Support DTrace if available?'
8132         . ./myread
8133         case "$ans" in
8134         y|Y)    val="$define" ;;
8135         *)      val="$undef" ;;
8136         esac
8137         set usedtrace
8138         eval $setvar
8139
8140         test "X$usedtrace" != "X$define" && break
8141
8142         echo " "
8143         rp='Where is the dtrace executable?'
8144         dflt=$dflt_dtrace
8145         . ./getfile
8146         val="$ans"
8147         set dtrace
8148         eval $setvar
8149
8150         if $test -f $dtrace
8151         then
8152                 if $dtrace -h -s ../perldtrace.d \
8153                         -o perldtrace.tmp >/dev/null 2>&1 \
8154                         && rm -f perldtrace.tmp
8155                 then
8156                         echo " "
8157                         echo "Good: your $dtrace knows about the -h flag."
8158                 else
8159                         cat >&2 <<EOM
8160
8161 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8162 ***
8163 *** Your installed dtrace doesn't support the -h switch to compile a D
8164 *** program into a C header. Can't continue.
8165
8166 EOM
8167                         exit 1
8168                 fi
8169                 break;
8170         fi
8171
8172         case "$fastread" in
8173         yes)
8174                 cat >&2 <<EOM
8175
8176 *** $me:  Fatal Error:  $dtrace not found.
8177 *** Can't continue.
8178
8179 EOM
8180                 exit 1
8181                 ;;
8182         *)
8183                 echo "*** $dtrace was not found."
8184                 echo " "
8185                 ;;
8186         esac
8187 done
8188
8189 : See if we want extra modules installed
8190 echo " "
8191 case "$extras" in
8192 '') dflt='n';;
8193 *) dflt='y';;
8194 esac
8195 cat <<EOM
8196 Perl can be built with extra modules or bundles of modules which
8197 will be fetched from the CPAN and installed alongside Perl.
8198
8199 Notice that you will need access to the CPAN; either via the Internet,
8200 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8201 be asked later to configure the CPAN.pm module which will in turn do
8202 the installation of the rest of the extra modules or bundles.)
8203
8204 Notice also that if the modules require any external software such as
8205 libraries and headers (the libz library and the zlib.h header for the
8206 Compress::Zlib module, for example) you MUST have any such software
8207 already installed, this configuration process will NOT install such
8208 things for you.
8209
8210 If this doesn't make any sense to you, just accept the default '$dflt'.
8211 EOM
8212 rp='Install any extra modules (y or n)?'
8213 . ./myread
8214 case "$ans" in
8215 y|Y)
8216         cat <<EOM
8217
8218 Please list any extra modules or bundles to be installed from CPAN,
8219 with spaces between the names.  The names can be in any format the
8220 'install' command of CPAN.pm will understand.  (Answer 'none',
8221 without the quotes, to install no extra modules or bundles.)
8222 EOM
8223         rp='Extras?'
8224         dflt="$extras"
8225         . ./myread
8226         extras="$ans"
8227 esac
8228 case "$extras" in
8229 ''|'none')
8230         val=''
8231         $rm -f ../extras.lst
8232         ;;
8233 *)      echo "(Saving the list of extras for later...)"
8234         echo "$extras" > ../extras.lst
8235         val="'$extras'"
8236         ;;
8237 esac
8238 set extras
8239 eval $setvar
8240 echo " "
8241
8242 : determine where html pages for programs go
8243 set html1dir html1dir none
8244 eval $prefixit
8245 $cat <<EOM
8246
8247 If you wish to install html files for programs in $spackage, indicate
8248 the appropriate directory here.  To skip installing html files,
8249 answer "none".
8250 EOM
8251 case "$html1dir" in
8252 ''|none|$undef|' ') dflt=none ;;
8253 *) dflt=$html1dir ;;
8254 esac
8255 fn=dn+~
8256 rp="Directory for the main $spackage html pages?"
8257 . ./getfile
8258 prefixvar=html1dir
8259 . ./setprefixvar
8260 : Use ' ' for none so value is preserved next time through Configure
8261 $test X"$html1dir" = "X" && html1dir=' '
8262
8263 : determine where html pages for libraries and modules go
8264 set html3dir html3dir none
8265 eval $prefixit
8266 $cat <<EOM
8267
8268 If you wish to install html files for modules associated with $spackage,
8269 indicate the appropriate directory here.  To skip installing html files,
8270 answer "none".
8271 EOM
8272 : There is no obvious default.  If they have specified html1dir, then
8273 : try to key off that, possibly changing .../html1 into .../html3.
8274 case "$html3dir" in
8275 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8276 *) dflt=$html3dir ;;
8277 esac
8278 fn=dn+~
8279 rp="Directory for the $spackage module html pages?"
8280 . ./getfile
8281 prefixvar=html3dir
8282 . ./setprefixvar
8283 : Use ' ' for none so value is preserved next time through Configure
8284 $test X"$html3dir" = "X" && html3dir=' '
8285
8286 : determine whether to install perl also as /usr/bin/perl
8287
8288 echo " "
8289 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8290         $cat <<EOM
8291 Many scripts expect perl to be installed as /usr/bin/perl.
8292
8293 If you want to, I can install the perl you are about to compile
8294 as /usr/bin/perl (in addition to $bin/perl).
8295 EOM
8296         if test -f /usr/bin/perl; then
8297             $cat <<EOM
8298
8299 However, please note that because you already have a /usr/bin/perl,
8300 overwriting that with a new Perl would very probably cause problems.
8301 Therefore I'm assuming you don't want to do that (unless you insist).
8302
8303 EOM
8304             case "$installusrbinperl" in
8305             "$define"|[yY]*)    dflt='y';;
8306             *)                  dflt='n';;
8307             esac
8308         else
8309             $cat <<EOM
8310
8311 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8312
8313 EOM
8314             case "$installusrbinperl" in
8315             "$undef"|[nN]*)     dflt='n';;
8316             *)                  dflt='y';;
8317             esac
8318         fi
8319         rp="Do you want to install perl as /usr/bin/perl?"
8320         . ./myread
8321         case "$ans" in
8322         [yY]*)  val="$define";;
8323         *)      val="$undef" ;;
8324         esac
8325 else
8326         val="$undef"
8327 fi
8328 set installusrbinperl
8329 eval $setvar
8330
8331 : see if dlopen exists
8332 xxx_runnm="$runnm"
8333 xxx_ccflags="$ccflags"
8334 runnm=false
8335 : with g++ one needs -shared to get is-in-libc to work for dlopen
8336 case "$gccversion" in
8337 '')     ;;
8338 *Clang*)        ;;
8339 *)      case "$d_cplusplus" in
8340         "$define") ccflags="$ccflags -shared" ;;
8341         esac
8342         ;;
8343 esac
8344 set dlopen d_dlopen
8345 eval $inlibc
8346 runnm="$xxx_runnm"
8347 ccflags="$xxx_ccflags"
8348
8349 : see if this is a unistd.h system
8350 set unistd.h i_unistd
8351 eval $inhdr
8352
8353 : determine which dynamic loading, if any, to compile in
8354 echo " "
8355 dldir="ext/DynaLoader"
8356 case "$usedl" in
8357     $define|y|true)
8358         dflt='y'
8359         usedl="$define"
8360         ;;
8361     $undef|n|false)
8362         dflt='n'
8363         usedl="$undef"
8364         ;;
8365     *)
8366         dflt='n'
8367         case "$d_dlopen" in
8368             $define) dflt='y' ;;
8369         esac
8370         : Does a dl_xxx.xs file exist for this operating system
8371         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8372         ;;
8373 esac
8374 rp="Do you wish to use dynamic loading?"
8375 . ./myread
8376 usedl="$ans"
8377 bin_ELF="$undef"
8378 case "$ans" in
8379     y*) usedl="$define"
8380         case "$dlsrc" in
8381             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8382                     dflt="$dldir/dl_${osname}.xs"
8383                 elif $test "$d_dlopen" = "$define" ; then
8384                     dflt="$dldir/dl_dlopen.xs"
8385                 else
8386                     dflt=''
8387                 fi
8388                 ;;
8389             *)  dflt="$dldir/$dlsrc"
8390                 ;;
8391         esac
8392         echo "The following dynamic loading files are available:"
8393         : Can not go over to $dldir because getfile has path hard-coded in.
8394         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8395         rp="Source file to use for dynamic loading"
8396         fn="fne"
8397         gfpth="$src"
8398         . ./getfile
8399         usedl="$define"
8400         : emulate basename
8401         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8402
8403         $cat << EOM
8404
8405 Some systems may require passing special flags to $cc -c to
8406 compile modules that will be used to create a shared library.
8407 To use no flags, say "none".
8408
8409 EOM
8410         case "$cccdlflags" in
8411             '') case "$gccversion" in
8412                 '') case "$osname" in
8413                         hpux)   dflt='+z' ;;
8414                         irix*)  dflt='-KPIC' ;;
8415                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8416                         sunos)  dflt='-pic' ;;
8417                         *)      dflt='none' ;;
8418                     esac
8419                     ;;
8420                 *)  case "$osname" in
8421                         darwin) dflt='none' ;;
8422                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8423                         *)      dflt='-fpic' ;;
8424                     esac ;;
8425                 esac ;;
8426             ' ') dflt='none' ;;
8427             *)   dflt="$cccdlflags" ;;
8428         esac
8429
8430         case "$dflt" in
8431             none) dflt='' ;;
8432         esac
8433
8434         # If -Dsysroot was specified, now's the time to add it
8435         # to cccdlflags
8436         if test "X$sysroot" != X; then
8437             case "$gccversion" in
8438                 '') ;;
8439                 *)  case "$dflt" in
8440                         *sysroot*) ;;
8441                         'undef'|*)
8442                             dflt="$dflt --sysroot=$sysroot" ;;
8443                     esac
8444                     ;;
8445             esac
8446         fi
8447
8448         case "$dflt" in
8449             '') dflt='none';;
8450         esac
8451
8452         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8453         . ./myread
8454         case "$ans" in
8455             none) cccdlflags=' ' ;;
8456             *)    cccdlflags="$ans" ;;
8457         esac
8458
8459         cat << EOM
8460
8461 Some systems use ld to create libraries that can be dynamically loaded,
8462 while other systems (such as those using ELF) use $cc.
8463
8464 EOM
8465
8466 : Determine if this is ELF
8467         $cat >try.c <<EOM
8468 /* Test for whether ELF binaries are produced */
8469 #include <fcntl.h>
8470 #$i_stdlib I_STDLIB
8471 #ifdef I_STDLIB
8472 #include <stdlib.h>
8473 #endif
8474 #$i_unistd I_UNISTD
8475 #ifdef I_UNISTD
8476 #include <unistd.h>
8477 #endif
8478 int main() {
8479     char b[4];
8480     int i = open("a.out",O_RDONLY);
8481     if(i == -1)
8482         exit(1); /* fail */
8483     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8484         exit(0); /* succeed (yes, it is ELF) */
8485     exit(1); /* fail */
8486 }
8487 EOM
8488         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8489             bin_ELF="$define"
8490         fi
8491         $rm_try
8492
8493         case "$ld" in
8494             '') if $test $bin_ELF = "$define"; then
8495                     cat <<EOM
8496 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8497 EOM
8498                     dflt="$cc"
8499                 else
8500                     echo "I'll use ld to build dynamic libraries."
8501                     dflt='ld'
8502                 fi
8503                 ;;
8504             *)  dflt="$ld"
8505                 ;;
8506         esac
8507
8508         rp="What command should be used to create dynamic libraries?"
8509         . ./myread
8510         ld="$ans"
8511
8512         cat << EOM
8513
8514 Some systems may require passing special flags to $ld to create a
8515 library that can be dynamically loaded.  If your ld flags include
8516 -L/other/path options to locate libraries outside your loader's normal
8517 search path, you may need to specify those -L options here as well.  To
8518 use no flags, say "none".
8519
8520 EOM
8521         case "$lddlflags" in
8522             '') case "$osname" in
8523                     haiku) dflt='-shared' ;;
8524                     hpux) dflt='-b';
8525                           case "$gccversion" in
8526                               '') dflt="$dflt +vnocompatwarnings" ;;
8527                           esac
8528                           ;;
8529                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8530                     solaris) # See [perl #66604].
8531                             # On Solaris 11, gcc -m64 on amd64
8532                             # appears not to understand -G.  gcc versions at
8533                             # least as old as 3.4.3 support -shared, so just
8534                             # use that with Solaris 11 and later, but keep
8535                             # the old behavior for older Solaris versions.
8536                             case "$gccversion" in
8537                                 '') dflt='-G' ;;
8538                                 *)  case "$osvers" in
8539                                         2.?|2.10) dflt='-G' ;;
8540                                         *) dflt='-shared' ;;
8541                                     esac
8542                                     ;;
8543                             esac
8544                             ;;
8545                     sunos) dflt='-assert nodefinitions' ;;
8546                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8547                     *)     dflt='none' ;;
8548                 esac
8549                 ;;
8550             *) dflt="$lddlflags" ;;
8551         esac
8552
8553         : Only do this for gcc, since, for example, qcc has no concept
8554         : of --sysroot.
8555         if $test "X$sysroot" != X; then
8556             case "$gccversion" in
8557                 '') ;;
8558                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8559             esac
8560         fi
8561
8562         : Try to guess additional flags to pick up local libraries.
8563         : Be careful not to append to a plain 'none'
8564         case "$dflt" in
8565             none) dflt='' ;;
8566         esac
8567         for thisflag in $ldflags; do
8568             case "$thisflag" in
8569                 -L*|-R*|-Wl,-R*)
8570                     case " $dflt " in
8571                         *" $thisflag "*) ;;
8572                         *) dflt="$dflt $thisflag" ;;
8573                     esac
8574                     ;;
8575             esac
8576         done
8577
8578         case "$dflt" in
8579             ''|' ') dflt='none' ;;
8580         esac
8581
8582         case "$ldflags" in
8583             *-fstack-protector-strong*)
8584                 case "$dflt" in
8585                     *-fstack-protector-strong*) ;; # Don't add it again
8586                     *) dflt="$dflt -fstack-protector-strong" ;;
8587                 esac
8588                 ;;
8589             *-fstack-protector*)
8590                 case "$dflt" in
8591                     *-fstack-protector*) ;; # Don't add it again
8592                     *) dflt="$dflt -fstack-protector" ;;
8593                 esac
8594                 ;;
8595         esac
8596
8597         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8598         . ./myread
8599         case "$ans" in
8600             none) lddlflags=' ' ;;
8601             *) lddlflags="$ans" ;;
8602         esac
8603
8604         cat <<EOM
8605
8606 Some systems may require passing special flags to $cc to indicate that
8607 the resulting executable will use dynamic linking.  To use no flags,
8608 say "none".
8609
8610 EOM
8611         case "$ccdlflags" in
8612             '') case "$osname" in
8613                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8614                     sunos)             dflt='none'   ;;
8615                     *)                 dflt='none'   ;;
8616                 esac ;;
8617             ' ') dflt='none' ;;
8618             *)   dflt="$ccdlflags" ;;
8619         esac
8620         rp="Any special flags to pass to $cc to use dynamic linking?"
8621         . ./myread
8622         case "$ans" in
8623             none) ccdlflags=' ' ;;
8624             *)    ccdlflags="$ans" ;;
8625         esac
8626         ;;
8627
8628     *)  usedl="$undef"
8629         ld='ld'
8630         dlsrc='dl_none.xs'
8631         lddlflags=''
8632         ccdlflags=''
8633         ;;
8634 esac
8635
8636 ld_can_script="$undef"
8637 case "$bin_ELF$usedl" in
8638     $define$define)
8639         # Abuse try.h and a.out names for neat cleanup
8640         $cat >try.c <<EOM
8641 void foo() {}
8642 void bar() {}
8643 EOM
8644         $cat >try.h <<EOM
8645 LIBTEST_42 {
8646  global:
8647   foo;
8648  local: *;
8649  };
8650 EOM
8651         if $cc $cccdlflags $ccdlflags $ccflags \
8652                $ldflags $lddlflags -o a.out try.c \
8653                -Wl,--version-script=try.h >/dev/null 2>&1 \
8654            &&  $test -s a.out ; then
8655             echo "ld supports scripting" >&4
8656             ld_can_script="$define"
8657         else
8658             echo "ld does not support scripting" >&4
8659         fi
8660         $rm_try
8661         ;;
8662 esac
8663
8664 : Do we want a shared libperl?
8665 also=''
8666 case "$usedl" in
8667 $undef)
8668         # No dynamic loading being used, so don't bother even to prompt.
8669         useshrplib='false'
8670         ;;
8671 *)      case "$useshrplib" in
8672         '')     case "$osname" in
8673                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8674                         dflt=y
8675                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8676                         ;;
8677                 *)      dflt=n
8678                         ;;
8679                 esac
8680                 ;;
8681         $define|true|[Yy]*)
8682                 dflt=y
8683                 ;;
8684         *)      dflt=n
8685                 ;;
8686         esac
8687         $cat << EOM
8688
8689 The perl executable is normally obtained by linking perlmain.c with
8690 libperl${_a}, any static extensions (usually just DynaLoader), and
8691 any other libraries needed on this system (such as -lm, etc.).  Since
8692 your system supports dynamic loading, it is probably possible to build
8693 a shared libperl.$so.  If you will have more than one executable linked
8694 to libperl.$so, this will significantly reduce the size of each
8695 executable, but it may have a noticeable effect on performance.  The
8696 default is probably sensible for your system.
8697 $also
8698
8699 EOM
8700         rp="Build a shared libperl.$so (y/n)"
8701         . ./myread
8702         case "$ans" in
8703         true|$define|[Yy]*)
8704                 useshrplib='true'  ;;
8705         *)      useshrplib='false' ;;
8706         esac
8707         ;;
8708 esac
8709
8710 case "$useshrplib" in
8711 true)
8712         case "$userelocatableinc" in
8713         true|define)
8714                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8715                 echo "See INSTALL for an explanation why that won't work." >&4
8716                 exit 4
8717                 ;;
8718         esac
8719         case "$libperl" in
8720         '')
8721                 # Figure out a good name for libperl.so.  Since it gets stored in
8722                 # a version-specific architecture-dependent library, the version
8723                 # number isn't really that important, except for making cc/ld happy.
8724                 #
8725                 # A name such as libperl.so.10.1
8726                 majmin="libperl.$so.$patchlevel.$subversion"
8727                 # A name such as libperl.so.100
8728                 majonly=`echo $patchlevel $subversion |
8729                         $awk '{printf "%d%02d", $1, $2}'`
8730                 majonly=libperl.$so.$majonly
8731                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8732                 # rely on figuring it out from the naming of libc.
8733                 case "${osname}${osvers}" in
8734                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8735                         dflt=libperl.$so
8736                         ;;
8737                 cygwin*) # ld links now against the dll directly
8738                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8739                         majonly=`echo $patchlevel $subversion |
8740                                 $awk '{printf "%03d%03d", $1, $2}'`
8741                         majonly=cygperl5.$majonly.$so
8742                         dflt=$majmin
8743                         ;;
8744                 *)      # Try to guess based on whether libc has major.minor.
8745                         case "$libc" in
8746                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8747                         *libc.$so.[0-9]*) dflt=$majonly ;;
8748                         *)      dflt=libperl.$so ;;
8749                         esac
8750                         ;;
8751                 esac
8752                 ;;
8753         *)      dflt=$libperl
8754                 ;;
8755         esac
8756         cat << EOM
8757
8758 I need to select a good name for the shared libperl.  If your system uses
8759 library names with major and minor numbers, then you might want something
8760 like $majmin.  Alternatively, if your system uses a single version
8761 number for shared libraries, then you might want to use $majonly.
8762 Or, your system might be quite happy with a simple libperl.$so.
8763
8764 Since the shared libperl will get installed into a version-specific
8765 architecture-dependent directory, the version number of the shared perl
8766 library probably isn't important, so the default should be o.k.
8767
8768 EOM
8769         rp='What name do you want to give to the shared libperl?'
8770         . ./myread
8771         libperl=$ans
8772         echo "Ok, I'll use $libperl"
8773         ;;
8774 *)
8775         libperl="libperl${_a}"
8776         ;;
8777 esac
8778
8779 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8780 case "$shrpdir" in
8781 '') ;;
8782 *)      $cat >&4 <<EOM
8783 WARNING:  Use of the shrpdir variable for the installation location of
8784 the shared $libperl is not supported.  It was never documented and
8785 will not work in this version.  Let me (perlbug@perl.org)
8786 know of any problems this may cause.
8787
8788 EOM
8789         case "$shrpdir" in
8790         "$archlibexp/CORE")
8791                 $cat >&4 <<EOM
8792 But your current setting of $shrpdir is
8793 the default anyway, so it's harmless.
8794 EOM
8795                 ;;
8796         *)
8797                 $cat >&4 <<EOM
8798 Further, your current attempted setting of $shrpdir
8799 conflicts with the value of $archlibexp/CORE
8800 that installperl will use.
8801 EOM
8802                 ;;
8803         esac
8804         ;;
8805 esac
8806
8807 # How will the perl executable find the installed shared $libperl?
8808 # Add $xxx to ccdlflags.
8809 # If we can't figure out a command-line option, use $shrpenv to
8810 # set env LD_RUN_PATH.  The main perl makefile uses this.
8811 shrpdir=$archlibexp/CORE
8812 xxx=''
8813 tmp_shrpenv=''
8814 if "$useshrplib"; then
8815     case "$osname" in
8816         aix)
8817                 # We'll set it in Makefile.SH...
8818                 ;;
8819         solaris)
8820                 xxx="-R $shrpdir"
8821                 ;;
8822         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8823                 xxx="-Wl,-R$shrpdir"
8824                 ;;
8825         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8826                 xxx="-Wl,-rpath,$shrpdir"
8827                 ;;
8828         hpux*)
8829                 # hpux doesn't like the default, either.
8830                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8831                 ;;
8832         cygwin)
8833                 # cygwin needs only ldlibpth
8834                 ;;
8835         *)
8836                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8837                 ;;
8838         esac
8839         case "$xxx" in
8840         '') ;;
8841         *)
8842                 # Only add $xxx if it isn't already in ccdlflags.
8843                 case " $ccdlflags " in
8844                 *" $xxx "*)     ;;
8845                 *)      ccdlflags="$ccdlflags $xxx"
8846                         cat <<EOM >&4
8847
8848 Adding $xxx to the flags
8849 passed to $ld so that the perl executable will find the
8850 installed shared $libperl.
8851
8852 EOM
8853                         ;;
8854                 esac
8855                 ;;
8856         esac
8857 fi
8858 # Fix ccdlflags in AIX for building external extensions.
8859 # (For building Perl itself bare -bE:perl.exp is needed,
8860 #  Makefile.SH takes care of this.)
8861 case "$osname" in
8862 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8863 esac
8864 # Respect a hint or command-line value.
8865 case "$shrpenv" in
8866 '') shrpenv="$tmp_shrpenv" ;;
8867 esac
8868 case "$ldlibpthname" in
8869 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8870 none)   ldlibpthname='' ;;
8871 esac
8872
8873 : determine where manual pages are on this system
8874 echo " "
8875 case "$sysman" in
8876 '')
8877         syspath='/usr/share/man/man1 /usr/man/man1'
8878         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8879         syspath="$syspath /usr/man/u_man/man1"
8880         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8881         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8882         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8883         sysman=`./loc . /usr/man/man1 $syspath`
8884         ;;
8885 esac
8886 if $test -d "$sysman"; then
8887         echo "System manual is in $sysman." >&4
8888 else
8889         echo "Could not find manual pages in source form." >&4
8890 fi
8891
8892 : determine where manual pages go
8893 set man1dir man1dir none
8894 eval $prefixit
8895 $cat <<EOM
8896
8897 $spackage has manual pages available in source form.
8898 EOM
8899 case "$nroff" in
8900 nroff)
8901         echo "However, you don't have nroff, so they're probably useless to you."
8902         case "$man1dir" in
8903         '') man1dir="none";;
8904         esac;;
8905 esac
8906 echo "If you don't want the manual sources installed, answer 'none'."
8907 case "$man1dir" in
8908 ' ') dflt=none
8909         ;;
8910 '')
8911         lookpath="$prefixexp/share/man/man1"
8912         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8913         lookpath="$lookpath $prefixexp/man/p_man/man1"
8914         lookpath="$lookpath $prefixexp/man/u_man/man1"
8915         lookpath="$lookpath $prefixexp/man/man.1"
8916         case "$sysman" in
8917         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8918         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8919         esac
8920         set dflt
8921         eval $prefixup
8922         ;;
8923 *)  dflt="$man1dir"
8924         ;;
8925 esac
8926 echo " "
8927 fn=dn+~
8928 rp="Where do the main $spackage manual pages (source) go?"
8929 . ./getfile
8930 if $test "X$man1direxp" != "X$ansexp"; then
8931         installman1dir=''
8932 fi
8933 prefixvar=man1dir
8934 . ./setprefixvar
8935
8936 case "$man1dir" in
8937 '')     man1dir=' '
8938         installman1dir='';;
8939 esac
8940
8941 : What suffix to use on installed man pages
8942
8943 case "$man1dir" in
8944 ' ')
8945         man1ext='0'
8946         ;;
8947 *)
8948         rp="What suffix should be used for the main $spackage man pages?"
8949         case "$man1ext" in
8950         '')     case "$man1dir" in
8951                 *1)  dflt=1 ;;
8952                 *1p) dflt=1p ;;
8953                 *1pm) dflt=1pm ;;
8954                 *l) dflt=l;;
8955                 *n) dflt=n;;
8956                 *o) dflt=o;;
8957                 *p) dflt=p;;
8958                 *C) dflt=C;;
8959                 *L) dflt=L;;
8960                 *L1) dflt=L1;;
8961                 *) dflt=1;;
8962                 esac
8963                 ;;
8964         *)      dflt="$man1ext";;
8965         esac
8966         . ./myread
8967         man1ext="$ans"
8968         ;;
8969 esac
8970
8971 : see if we can have long filenames
8972 echo " "
8973 first=123456789abcdef
8974 $rm -f $first
8975 if (echo hi >$first) 2>/dev/null; then
8976         if $test -f 123456789abcde; then
8977                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8978                 val="$undef"
8979         else
8980                 echo 'You can have filenames longer than 14 characters.'>&4
8981                 val="$define"
8982         fi
8983 else
8984         $cat <<'EOM'
8985 You can't have filenames longer than 14 chars.
8986 You can't even think about them!
8987 EOM
8988         val="$undef"
8989 fi
8990 set d_flexfnam
8991 eval $setvar
8992 $rm -rf 123456789abcde*
8993
8994 : determine where library module manual pages go
8995 set man3dir man3dir none
8996 eval $prefixit
8997 $cat <<EOM
8998
8999 $spackage has manual pages for many of the library modules.
9000 EOM
9001
9002 case "$nroff" in
9003 nroff)
9004         $cat <<'EOM'
9005 However, you don't have nroff, so they're probably useless to you.
9006 EOM
9007         case "$man3dir" in
9008         '') man3dir="none";;
9009         esac;;
9010 esac
9011
9012 case "$d_flexfnam" in
9013 undef)
9014         $cat <<'EOM'
9015 However, your system can't handle the long file names like File::Basename.3.
9016 EOM
9017         case "$man3dir" in
9018         '') man3dir="none";;
9019         esac;;
9020 esac
9021
9022 echo "If you don't want the manual sources installed, answer 'none'."
9023 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9024 case "$man3dir" in
9025 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9026         if $test -d "$privlib/man/man3"; then
9027                 cat <<EOM >&4
9028
9029 WARNING:  Previous versions of perl installed man3 pages into
9030 $privlib/man/man3.  This version will suggest a
9031 new default of $dflt.
9032 EOM
9033                 tdflt=$dflt
9034                 dflt='n'
9035                 rp='Do you wish to preserve the old behavior?(y/n)'
9036                 . ./myread
9037                 case "$ans" in
9038                 y*) dflt="$privlib/man/man3" ;;
9039                 *)  dflt=$tdflt ;;
9040                 esac
9041     fi
9042         ;;
9043 *)      dflt="$man3dir" ;;
9044 esac
9045 case "$dflt" in
9046 ' ') dflt=none ;;
9047 esac
9048 echo " "
9049 fn=dn+~
9050 rp="Where do the $package library man pages (source) go?"
9051 . ./getfile
9052 prefixvar=man3dir
9053 . ./setprefixvar
9054
9055 case "$man3dir" in
9056 '')     man3dir=' '
9057         installman3dir='';;
9058 esac
9059
9060 : What suffix to use on installed man pages
9061 case "$man3dir" in
9062 ' ')
9063         man3ext='0'
9064         ;;
9065 *)
9066         rp="What suffix should be used for the $package library man pages?"
9067         case "$man3ext" in
9068         '')     case "$man3dir" in
9069                 *3)  dflt=3 ;;
9070                 *3p) dflt=3p ;;
9071                 *3pm) dflt=3pm ;;
9072                 *l) dflt=l;;
9073                 *n) dflt=n;;
9074                 *o) dflt=o;;
9075                 *p) dflt=p;;
9076                 *C) dflt=C;;
9077                 *L) dflt=L;;
9078                 *L3) dflt=L3;;
9079                 *) dflt=3;;
9080                 esac
9081                 ;;
9082         *)      dflt="$man3ext";;
9083         esac
9084         . ./myread
9085         man3ext="$ans"
9086         ;;
9087 esac
9088
9089 : see if we have to deal with yellow pages, now NIS.
9090 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9091         case "$hostcat" in
9092         nidump*) ;;
9093         *)
9094                 case "$hostcat" in
9095                 *ypcat*) dflt=y;;
9096                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9097                                 dflt=y
9098                         else
9099                                 dflt=n
9100                         fi;;
9101                 *) dflt=n;;
9102                 esac
9103                 echo " "
9104                 rp='Are you getting the hosts file via yellow pages?'
9105                 . ./myread
9106                 case "$ans" in
9107                 y*) hostcat='ypcat hosts';;
9108                 *) hostcat='cat /etc/hosts';;
9109                 esac
9110                 ;;
9111         esac
9112 fi
9113 case "$hostcat" in
9114 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9115 esac
9116 case "$groupcat" in
9117 '') test -f /etc/group && groupcat='cat /etc/group';;
9118 esac
9119 case "$passcat" in
9120 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9121 esac
9122
9123 : now get the host name
9124 echo " "
9125 echo "Figuring out host name..." >&4
9126 case "$myhostname" in
9127 '') cont=true
9128         echo 'Maybe "hostname" will work...'
9129         if tans=`sh -c hostname 2>&1` ; then
9130                 myhostname=$tans
9131                 phostname=hostname
9132                 cont=''
9133         fi
9134         ;;
9135 *) cont='';;
9136 esac
9137 if $test "$cont"; then
9138         if ./xenix; then
9139                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9140                 if tans=`cat /etc/systemid 2>&1` ; then
9141                         myhostname=$tans
9142                         phostname='cat /etc/systemid'
9143                         echo "Whadyaknow.  Xenix always was a bit strange..."
9144                         cont=''
9145                 fi
9146         elif $test -r /etc/systemid; then
9147                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9148         fi
9149 fi
9150 if $test "$cont"; then
9151         echo 'No, maybe "uuname -l" will work...'
9152         if tans=`sh -c 'uuname -l' 2>&1` ; then
9153                 myhostname=$tans
9154                 phostname='uuname -l'
9155         else
9156                 echo 'Strange.  Maybe "uname -n" will work...'
9157                 if tans=`sh -c 'uname -n' 2>&1` ; then
9158                         myhostname=$tans
9159                         phostname='uname -n'
9160                 else
9161                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9162                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9163                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9164                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9165                         else
9166                                 case "$myhostname" in
9167                                 '') echo "Does this machine have an identity crisis or something?"
9168                                         phostname='';;
9169                                 *)
9170                                         echo "Well, you said $myhostname before..."
9171                                         phostname='echo $myhostname';;
9172                                 esac
9173                         fi
9174                 fi
9175         fi
9176 fi
9177 case "$myhostname" in
9178 '') myhostname=noname ;;
9179 esac
9180 : you do not want to know about this
9181 set $myhostname
9182 myhostname=$1
9183
9184 : verify guess
9185 if $test "$myhostname" ; then
9186         dflt=y
9187         rp='Your host name appears to be "'$myhostname'".'" Right?"
9188         . ./myread
9189         case "$ans" in
9190         y*) ;;
9191         *) myhostname='';;
9192         esac
9193 fi
9194
9195 : bad guess or no guess
9196 while $test "X$myhostname" = X ; do
9197         dflt=''
9198         rp="Please type the (one word) name of your host:"
9199         . ./myread
9200         myhostname="$ans"
9201 done
9202
9203 : translate upper to lower if necessary
9204 case "$myhostname" in
9205 *[A-Z]*)
9206         echo "(Normalizing case in your host name)"
9207         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9208         ;;
9209 esac
9210
9211 case "$myhostname" in
9212 *.*)
9213         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9214         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9215         echo "(Trimming domain name from host name--host name is now $myhostname)"
9216         ;;
9217 *) case "$mydomain" in
9218         '')
9219                 {
9220                         test "X$hostcat" = "Xypcat hosts" &&
9221                         ypmatch "$myhostname" hosts 2>/dev/null |\
9222                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9223                         $test -s hosts
9224                 } || {
9225                         test "X$hostcat" != "X" &&
9226                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9227                                         /[       ]$myhostname[  . ]/p" > hosts
9228                 }
9229                 tmp_re="[       . ]"
9230                 if $test -f hosts; then
9231                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9232                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9233                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9234                                 hosts | $sort | $uniq | \
9235                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9236                         case `$echo X$dflt` in
9237                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9238                                 dflt=.
9239                                 ;;
9240                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9241                                 ;;
9242                         esac
9243                 else
9244                         echo "(I cannot locate a hosts database anywhere)"
9245                         dflt=.
9246                 fi
9247                 case "$dflt" in
9248                 .)
9249                         tans=`./loc resolv.conf X /etc /usr/etc`
9250                         if $test -f "$tans"; then
9251                                 echo "(Attempting domain name extraction from $tans)"
9252                                 dflt=.`$sed -n -e 's/   / /g' \
9253                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9254                                   -e 1q 2>/dev/null`
9255                                 case "$dflt" in
9256                                 .) dflt=.`$sed -n -e 's/        / /g' \
9257                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9258                                      -e 1q 2>/dev/null`
9259                                         ;;
9260                                 esac
9261                         fi
9262                         ;;
9263                 esac
9264                 case "$dflt" in
9265                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9266                         dflt=.`sh -c domainname 2>/dev/null`
9267                         case "$dflt" in
9268                         '') dflt='.';;
9269                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9270                         esac
9271                         ;;
9272                 esac
9273                 case "$dflt$osname" in
9274                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9275                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9276                         ;;
9277                 esac
9278                 case "$dflt" in
9279                 .) echo "(Lost all hope -- silly guess then)"
9280                         dflt='.nonet'
9281                         ;;
9282                 esac
9283                 $rm -f hosts
9284                 ;;
9285         *) dflt="$mydomain";;
9286         esac;;
9287 esac
9288 echo " "
9289 rp="What is your domain name?"
9290 . ./myread
9291 tans="$ans"
9292 case "$ans" in
9293 '') ;;
9294 .*) ;;
9295 *) tans=".$tans";;
9296 esac
9297 mydomain="$tans"
9298
9299 : translate upper to lower if necessary
9300 case "$mydomain" in
9301 *[A-Z]*)
9302         echo "(Normalizing case in your domain name)"
9303         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9304         ;;
9305 esac
9306
9307 : a little sanity check here
9308 case "$phostname" in
9309 '') ;;
9310 *)
9311         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9312         $myhostname$mydomain|$myhostname) ;;
9313         *)
9314                 case "$phostname" in
9315                 sed*)
9316                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9317                         ;;
9318                 *)
9319                         echo "(That doesn't agree with your $phostname command, by the way.)"
9320                         ;;
9321                 esac
9322         ;;
9323         esac
9324         ;;
9325 esac
9326
9327 : determine the e-mail address of the user who is running us
9328 $cat <<EOM
9329
9330 I need to get your e-mail address in Internet format if possible, i.e.
9331 something like user@host.domain. Please answer accurately since I have
9332 no easy means to double check it. The default value provided below
9333 is most probably close to reality but may not be valid from outside
9334 your organization...
9335
9336 EOM
9337 cont=x
9338 while test "$cont"; do
9339         case "$MAILDOMAIN" in
9340         '')
9341                 if $test -s /etc/mailname; then
9342                         maildomain=`$cat /etc/mailname`
9343                 else
9344                         maildomain="$myhostname$mydomain"
9345                 fi
9346                 ;;
9347         *)  maildomain="$MAILDOMAIN";;
9348         esac
9349         case "$cf_email" in
9350         '') dflt="$cf_by@$maildomain";;
9351         *)  dflt="$cf_email";;
9352         esac
9353         rp='What is your e-mail address?'
9354         . ./myread
9355         cf_email="$ans"
9356         case "$cf_email" in
9357         *@*.*) cont='' ;;
9358         *)
9359                 rp='Address does not look like an Internet one.  Use it anyway?'
9360                 case "$fastread" in
9361                 yes) dflt=y ;;
9362                 *) dflt=n ;;
9363                 esac
9364                 . ./myread
9365                 case "$ans" in
9366                 y*) cont='' ;;
9367                 *) echo " " ;;
9368                 esac
9369                 ;;
9370         esac
9371 done
9372
9373 : Ask e-mail of administrator
9374 $cat <<EOM
9375
9376 If you or somebody else will be maintaining perl at your site, please
9377 fill in the correct e-mail address here so that they may be contacted
9378 if necessary. Currently, the "perlbug" program included with perl
9379 will send mail to this address in addition to perlbug@perl.org. You may
9380 enter "none" for no administrator.
9381
9382 EOM
9383 case "$perladmin" in
9384 '') dflt="$cf_email";;
9385 *) dflt="$perladmin";;
9386 esac
9387 rp='Perl administrator e-mail address'
9388 . ./myread
9389 perladmin="$ans"
9390
9391 : determine whether to use a version number suffix for installed binaries
9392 echo " "
9393 $cat <<EOM
9394 Do you want to use a version number suffix for installed binaries? This
9395 will install 'perl$version' instead of 'perl', and likewise for other
9396 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9397 to be installed side-by-side. Unless you are a developer, you probably
9398 do *not* want to do this.
9399 EOM
9400 case "$versiononly" in
9401 "$define"|[Yy]*|true) dflt='y' ;;
9402 *) dflt='n';
9403 esac
9404 rp="Do you want to use a version number suffix for installed binaries?"
9405 . ./myread
9406 case "$ans" in
9407 [yY]*)  val="$define";;
9408 *)      val="$undef" ;;
9409 esac
9410 set versiononly
9411 eval $setvar
9412
9413 case "$versiononly" in
9414 "$define") inc_version_list=''
9415            inc_version_list_init=0
9416            ;;
9417 esac
9418
9419 : figure out how to guarantee perl startup
9420 : XXX Note that this currently takes advantage of the bug that binexp ignores
9421 :     the Configure -Dinstallprefix setting, which in turn means that under
9422 :     relocatable @INC, initialinstalllocation is what binexp started as.
9423 case "$startperl" in
9424 '')
9425         case "$sharpbang" in
9426         *!)
9427                 $cat <<EOH
9428
9429 I can use the #! construct to start perl on your system. This will
9430 make startup of perl scripts faster, but may cause problems if you
9431 want to share those scripts and perl is not in a standard place
9432 ($initialinstalllocation/perl) on all your platforms. The alternative
9433 is to force a shell by starting the script with a single ':' character.
9434
9435 EOH
9436                 case "$versiononly" in
9437                 "$define")      dflt="$initialinstalllocation/perl$version";;
9438                 *)              dflt="$initialinstalllocation/perl";;
9439                 esac
9440                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9441                 . ./myread
9442                 case "$ans" in
9443                 none)   startperl=": # use perl";;
9444                 *)      startperl="#!$ans"
9445                         if $test 30 -lt `echo "$ans" | wc -c`; then
9446                                 $cat >&4 <<EOM
9447
9448 WARNING:  Some systems limit the #! command to 32 characters.
9449 If you experience difficulty running Perl scripts with #!, try
9450 installing Perl in a directory with a shorter pathname.
9451
9452 EOM
9453                         fi ;;
9454                 esac
9455                 ;;
9456         *) startperl=": # use perl"
9457                 ;;
9458         esac
9459         ;;
9460 esac
9461 echo "I'll use $startperl to start perl scripts."
9462
9463 : figure best path for perl in scripts
9464 case "$perlpath" in
9465 '')
9466         case "$versiononly" in
9467         "$define")      perlpath="$initialinstalllocation/perl$version";;
9468         *)              perlpath="$initialinstalllocation/perl";;
9469         esac
9470         case "$startperl" in
9471         *!*) ;;
9472         *)
9473                 $cat <<EOH
9474
9475 I will use the "eval 'exec'" idiom to start Perl on your system.
9476 I can use the full path of your Perl binary for this purpose, but
9477 doing so may cause problems if you want to share those scripts and
9478 Perl is not always in a standard place ($initialinstalllocation/perl).
9479
9480 EOH
9481                 dflt="$initialinstalllocation/perl"
9482                 rp="What path shall I use in \"eval 'exec'\"?"
9483                 . ./myread
9484                 perlpath="$ans"
9485                 ;;
9486         esac
9487         ;;
9488 esac
9489 case "$startperl" in
9490 *!*)    ;;
9491 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9492 esac
9493
9494 : determine where public executable scripts go
9495 set scriptdir scriptdir
9496 eval $prefixit
9497 case "$scriptdir" in
9498 '')
9499         dflt="$bin"
9500         : guess some guesses
9501         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9502         $test -d /usr/share/bin     && dflt=/usr/share/bin
9503         $test -d /usr/local/script  && dflt=/usr/local/script
9504         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9505         $test -d $prefixexp/script  && dflt=$prefixexp/script
9506         set dflt
9507         eval $prefixup
9508         ;;
9509 *)  dflt="$scriptdir"
9510         ;;
9511 esac
9512 $cat <<EOM
9513
9514 Some installations have a separate directory just for executable scripts so
9515 that they can mount it across multiple architectures but keep the scripts in
9516 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9517 Or you might just lump your scripts in with all your other executables.
9518
9519 EOM
9520 fn=d~
9521 rp='Where do you keep publicly executable scripts?'
9522 . ./getfile
9523 if $test "X$ansexp" != "X$scriptdirexp"; then
9524         installscript=''
9525 fi
9526 installscriptdir=''
9527 prefixvar=scriptdir
9528 . ./setprefixvar
9529 : A little fix up for an irregularly named variable.
9530 installscript="$installscriptdir"
9531
9532 : determine where add-on public executables go
9533 case "$sitebin" in
9534 '')     dflt=$siteprefix/bin ;;
9535 *)      dflt=$sitebin ;;
9536 esac
9537 fn=d~
9538 rp='Pathname where the add-on public executables should be installed?'
9539 . ./getfile
9540 prefixvar=sitebin
9541 . ./setprefixvar
9542
9543 : determine where add-on html pages go
9544 : There is no standard location, so try to copy the previously-selected
9545 : directory structure for the core html pages.
9546 case "$sitehtml1dir" in
9547 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9548 *)     dflt=$sitehtml1dir ;;
9549 esac
9550 case "$dflt" in
9551 ''|' ') dflt=none ;;
9552 esac
9553 fn=dn+~
9554 rp='Pathname where the site-specific html pages should be installed?'
9555 . ./getfile
9556 prefixvar=sitehtml1dir
9557 . ./setprefixvar
9558
9559 : determine where add-on library html pages go
9560 : There is no standard location, so try to copy the previously-selected
9561 : directory structure for the core html pages.
9562 case "$sitehtml3dir" in
9563 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9564 *)     dflt=$sitehtml3dir ;;
9565 esac
9566 case "$dflt" in
9567 ''|' ') dflt=none ;;
9568 esac
9569 fn=dn+~
9570 rp='Pathname where the site-specific library html pages should be installed?'
9571 . ./getfile
9572 prefixvar=sitehtml3dir
9573 . ./setprefixvar
9574
9575 : determine where add-on manual pages go
9576 case "$siteman1dir" in
9577 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9578 *)      dflt=$siteman1dir ;;
9579 esac
9580 case "$dflt" in
9581 ''|' ') dflt=none ;;
9582 esac
9583 fn=dn+~
9584 rp='Pathname where the site-specific manual pages should be installed?'
9585 . ./getfile
9586 prefixvar=siteman1dir
9587 . ./setprefixvar
9588
9589 : determine where add-on library man pages go
9590 case "$siteman3dir" in
9591 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9592 *)      dflt=$siteman3dir ;;
9593 esac
9594 case "$dflt" in
9595 ''|' ') dflt=none ;;
9596 esac
9597 fn=dn+~
9598 rp='Pathname where the site-specific library manual pages should be installed?'
9599 . ./getfile
9600 prefixvar=siteman3dir
9601 . ./setprefixvar
9602
9603 : determine where add-on public executable scripts go
9604 case "$sitescript" in
9605 '')     dflt=$siteprefix/script
9606         $test -d $dflt || dflt=$sitebin ;;
9607 *)  dflt="$sitescript" ;;
9608 esac
9609 fn=d~+
9610 rp='Pathname where add-on public executable scripts should be installed?'
9611 . ./getfile
9612 prefixvar=sitescript
9613 . ./setprefixvar
9614
9615 : see if backtrace exists
9616 set backtrace d_backtrace
9617 eval $inlibc
9618
9619 : add flags if using c backtrace
9620 case "$usecbacktrace" in
9621   "") usecbacktrace=$undef ;;
9622   [yY]*|true|$define)
9623     case "$d_backtrace" in
9624       [yY]*|true|$define)
9625         case " $ccflags " in
9626           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9627           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9628           esac
9629         ;;
9630       *)
9631         echo "This system does not support backtrace" >&4
9632         usecbacktrace=$undef
9633         ;;
9634       esac
9635     ;;
9636   esac
9637
9638 : Check if faststdio is requested and available
9639 case "$usefaststdio" in
9640 $define|true|[yY]*|'')
9641         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9642         case "$xversion" in
9643         [68])   dflt='y' ;;
9644         *)      dflt='n' ;;
9645         esac
9646         ;;
9647 *) dflt='n';;
9648 esac
9649 cat <<EOM
9650
9651 Perl can be built to use 'fast stdio', which means using the stdio
9652 library but also directly manipulating the stdio buffers to enable
9653 faster I/O.  Using stdio is better for backward compatibility (especially
9654 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9655 interface has been preferred instead of stdio.
9656
9657 If this doesn't make any sense to you, just accept the default '$dflt'.
9658 EOM
9659 rp='Use the "fast stdio" if available?'
9660 . ./myread
9661 case "$ans" in
9662 y|Y)    val="$define" ;;
9663 *)      val="$undef" ;;
9664 esac
9665 set usefaststdio
9666 eval $setvar
9667
9668 : define an is-a-typedef? function
9669 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9670 case "$inclist" in
9671 "") inclist="sys/types.h";;
9672 esac;
9673 eval "varval=\$$var";
9674 case "$varval" in
9675 "")
9676         $rm -f temp.c;
9677         for inc in $inclist; do
9678                 echo "#include <$inc>" >>temp.c;
9679         done;
9680         echo "#ifdef $type" >> temp.c;
9681         echo "printf(\"We have $type\");" >> temp.c;
9682         echo "#endif" >> temp.c;
9683         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9684         if $contains $type temp.E >/dev/null 2>&1; then
9685                 eval "$var=\$type";
9686         else
9687                 eval "$var=\$def";
9688         fi;
9689         $rm -f temp.?;;
9690 *) eval "$var=\$varval";;
9691 esac'
9692
9693 : define an is-a-typedef? function that prompts if the type is not available.
9694 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9695 case "$inclist" in
9696 "") inclist="sys/types.h";;
9697 esac;
9698 eval "varval=\$$var";
9699 case "$varval" in
9700 "")
9701         $rm -f temp.c;
9702         for inc in $inclist; do
9703                 echo "#include <$inc>" >>temp.c;
9704         done;
9705         echo "#ifdef $type" >> temp.c;
9706         echo "printf(\"We have $type\");" >> temp.c;
9707         echo "#endif" >> temp.c;
9708         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9709         echo " " ;
9710         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9711         if $contains $type temp.E >/dev/null 2>&1; then
9712                 echo "$type found." >&4;
9713                 eval "$var=\$type";
9714         else
9715                 echo "$type NOT found." >&4;
9716                 dflt="$def";
9717                 . ./myread ;
9718                 eval "$var=\$ans";
9719         fi;
9720         $rm -f temp.?;;
9721 *) eval "$var=\$varval";;
9722 esac'
9723
9724 : see what type lseek is declared as in the kernel
9725 rp="What is the type used for lseek's offset on this system?"
9726 set off_t lseektype long stdio.h sys/types.h
9727 eval $typedef_ask
9728
9729 echo " "
9730 echo "Checking to see how big your file offsets are..." >&4
9731 $cat >try.c <<EOCP
9732 #include <sys/types.h>
9733 #include <stdio.h>
9734 int main()
9735 {
9736     printf("%d\n", (int)sizeof($lseektype));
9737     return(0);
9738 }
9739 EOCP
9740 set try
9741 if eval $compile_ok; then
9742         lseeksize=`$run ./try`
9743         echo "Your file offsets are $lseeksize bytes long."
9744 else
9745         dflt=$longsize
9746         echo " "
9747         echo "(I can't seem to compile the test program.  Guessing...)"
9748         rp="What is the size of your file offsets (in bytes)?"
9749         . ./myread
9750         lseeksize="$ans"
9751 fi
9752 $rm_try
9753
9754 : see what type file positions are declared as in the library
9755 rp="What is the type for file position used by fsetpos()?"
9756 set fpos_t fpostype long stdio.h sys/types.h
9757 eval $typedef_ask
9758
9759 : Check size for Fpos_t
9760 echo " "
9761 case "$fpostype" in
9762 *_t) zzz="$fpostype"    ;;
9763 *)   zzz="fpos_t"       ;;
9764 esac
9765 echo "Checking the size of $zzz..." >&4
9766 cat > try.c <<EOCP
9767 #include <sys/types.h>
9768 #include <stdio.h>
9769 #$i_stdlib I_STDLIB
9770 #ifdef I_STDLIB
9771 #include <stdlib.h>
9772 #endif
9773 int main() {
9774     printf("%d\n", (int)sizeof($fpostype));
9775     exit(0);
9776 }
9777 EOCP
9778 set try
9779 if eval $compile_ok; then
9780         yyy=`$run ./try`
9781         case "$yyy" in
9782         '')     fpossize=4
9783                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9784                 ;;
9785         *)      fpossize=$yyy
9786                 echo "Your $zzz is $fpossize bytes long."
9787                 ;;
9788         esac
9789 else
9790         dflt="$longsize"
9791         echo " " >&4
9792         echo "(I can't compile the test program.  Guessing...)" >&4
9793         rp="What is the size of your file positions (in bytes)?"
9794         . ./myread
9795         fpossize="$ans"
9796 fi
9797
9798 : Check for large file support
9799 # Backward compatibility (uselfs is deprecated).
9800 case "$uselfs" in
9801 "$define"|true|[yY]*)
9802         cat <<EOM >&4
9803
9804 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9805 EOM
9806         uselargefiles="$define"
9807         ;;
9808 esac
9809
9810 case "$lseeksize:$fpossize" in
9811 8:8) cat <<EOM
9812
9813 You can have files larger than 2 gigabytes.
9814 EOM
9815    val="$define" ;;
9816 *)    case "$uselargefiles" in
9817    "$undef"|false|[nN]*) dflt='n' ;;
9818    *)   dflt='y' ;;
9819    esac
9820    cat <<EOM
9821
9822 Perl can be built to understand large files (files larger than 2 gigabytes)
9823 on some systems.  To do so, Configure can be run with -Duselargefiles.
9824
9825 If this doesn't make any sense to you, just accept the default '$dflt'.
9826 EOM
9827    rp='Try to understand large files, if available?'
9828    . ./myread
9829    case "$ans" in
9830    y|Y) val="$define" ;;
9831    *)   val="$undef"  ;;
9832    esac
9833    ;;
9834 esac
9835 set uselargefiles
9836 eval $setvar
9837 : Look for a hint-file generated 'call-back-unit'.  If the
9838 : user has specified that a large files perl is to be built,
9839 : we may need to set or change some other defaults.
9840 if $test -f uselargefiles.cbu; then
9841         echo "Your platform has some specific hints regarding large file builds, using them..."
9842         . ./uselargefiles.cbu
9843 fi
9844 case "$uselargefiles" in
9845 "$define")
9846         if $test -f uselargefiles.cbu; then
9847                 echo " "
9848                 echo "Rechecking to see how big your file offsets are..." >&4
9849                 $cat >try.c <<EOCP
9850 #include <sys/types.h>
9851 #include <stdio.h>
9852 int main()
9853 {
9854     printf("%d\n", (int)sizeof($lseektype));
9855     return(0);
9856 }
9857 EOCP
9858                 set try
9859                 if eval $compile_ok; then
9860                         lseeksize=`$run ./try`
9861                         $echo "Your file offsets are now $lseeksize bytes long."
9862                 else
9863                         dflt="$lseeksize"
9864                         echo " "
9865                         echo "(I can't seem to compile the test program.  Guessing...)"
9866                         rp="What is the size of your file offsets (in bytes)?"
9867                         . ./myread
9868                         lseeksize="$ans"
9869                 fi
9870                 case "$fpostype" in
9871                 *_t) zzz="$fpostype"    ;;
9872                 *)   zzz="fpos_t"       ;;
9873                 esac
9874                 $echo $n "Rechecking the size of $zzz...$c" >&4
9875                 $cat > try.c <<EOCP
9876 #include <sys/types.h>
9877 #include <stdio.h>
9878 #$i_stdlib I_STDLIB
9879 #ifdef I_STDLIB
9880 #include <stdlib.h>
9881 #endif
9882 int main() {
9883     printf("%d\n", (int)sizeof($fpostype));
9884     return(0);
9885 }
9886 EOCP
9887                 set try
9888                 if eval $compile_ok; then
9889                         yyy=`$run ./try`
9890                         dflt="$lseeksize"
9891                         case "$yyy" in
9892                         '')     echo " "
9893                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9894                                 ;;
9895                         *)      fpossize=$yyy
9896                                 echo " $fpossize bytes." >&4
9897                                 ;;
9898                         esac
9899                 else
9900                         dflt="$fpossize"
9901                         echo " "
9902                         echo "(I can't compile the test program.  Guessing...)" >&4
9903                         rp="What is the size of your file positions (in bytes)?"
9904                         . ./myread
9905                         fpossize="$ans"
9906                 fi
9907                 $rm_try
9908         fi
9909         ;;
9910 esac
9911
9912 : Check if we want perlio
9913 useperlio="$define"
9914
9915 : Set the vendorbin variables
9916 case "$vendorprefix" in
9917 '')     d_vendorbin="$undef"
9918         vendorbin=''
9919         vendorbinexp=''
9920         ;;
9921 *)      d_vendorbin="$define"
9922         : determine where vendor-supplied executables go.
9923         case "$vendorbin" in
9924         '') dflt=$vendorprefix/bin ;;
9925         *)      dflt="$vendorbin" ;;
9926         esac
9927         fn=d~+
9928         rp='Pathname for the vendor-supplied executables directory?'
9929         . ./getfile
9930         vendorbin="$ans"
9931         vendorbinexp="$ansexp"
9932         ;;
9933 esac
9934 prefixvar=vendorbin
9935 . ./installprefix
9936
9937 : Set the vendorhtml1dir variables
9938 case "$vendorprefix" in
9939 '')     vendorhtml1dir=''
9940         vendorhtml1direxp=''
9941         ;;
9942 *)      : determine where vendor-supplied html pages go.
9943         : There is no standard location, so try to copy the previously-selected
9944         : directory structure for the core html pages.
9945         : XXX Better default suggestions would be welcome.
9946         case "$vendorhtml1dir" in
9947         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9948         *)      dflt=$vendorhtml1dir ;;
9949         esac
9950         case "$dflt" in
9951         ''|' ') dflt=none ;;
9952         esac
9953         fn=dn+~
9954         rp='Pathname for the vendor-supplied html pages?'
9955         . ./getfile
9956         vendorhtml1dir="$ans"
9957         vendorhtml1direxp="$ansexp"
9958         ;;
9959 esac
9960 : Use ' ' for none so value is preserved next time through Configure
9961 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9962 prefixvar=vendorhtml1dir
9963 . ./installprefix
9964
9965 : Set the vendorhtml3dir variables
9966 case "$vendorprefix" in
9967 '')     vendorhtml3dir=''
9968         vendorhtml3direxp=''
9969         ;;
9970 *)      : determine where vendor-supplied module html pages go.
9971         : There is no standard location, so try to copy the previously-selected
9972         : directory structure for the core html pages.
9973         : XXX Better default suggestions would be welcome.
9974         case "$vendorhtml3dir" in
9975         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9976         *)      dflt=$vendorhtml3dir ;;
9977         esac
9978         case "$dflt" in
9979         ''|' ') dflt=none ;;
9980         esac
9981         fn=dn+~
9982         rp='Pathname for the vendor-supplied html pages?'
9983         . ./getfile
9984         vendorhtml3dir="$ans"
9985         vendorhtml3direxp="$ansexp"
9986         ;;
9987 esac
9988 : Use ' ' for none so value is preserved next time through Configure
9989 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9990 prefixvar=vendorhtml3dir
9991 . ./installprefix
9992
9993 : Set the vendorman1dir variables
9994 case "$vendorprefix" in
9995 '')     vendorman1dir=''
9996         vendorman1direxp=''
9997         ;;
9998 *)      : determine where vendor-supplied manual pages go.
9999         case "$vendorman1dir" in
10000         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10001         *)      dflt=$vendorman1dir ;;
10002         esac
10003         case "$dflt" in
10004         ''|' ') dflt=none ;;
10005         esac
10006         fn=nd~+
10007         rp='Pathname for the vendor-supplied manual section 1 pages?'
10008         . ./getfile
10009         vendorman1dir="$ans"
10010         vendorman1direxp="$ansexp"
10011         ;;
10012 esac
10013 : Use ' ' for none so value is preserved next time through Configure
10014 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10015 prefixvar=vendorman1dir
10016 . ./installprefix
10017
10018 : Set the vendorman3dir variables
10019 case "$vendorprefix" in
10020 '')     vendorman3dir=''
10021         vendorman3direxp=''
10022         ;;
10023 *)      : determine where vendor-supplied module manual pages go.
10024         case "$vendorman3dir" in
10025         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10026         *)      dflt=$vendorman3dir ;;
10027         esac
10028         case "$dflt" in
10029         ''|' ') dflt=none ;;
10030         esac
10031         fn=nd~+
10032         rp='Pathname for the vendor-supplied manual section 3 pages?'
10033         . ./getfile
10034         vendorman3dir="$ans"
10035         vendorman3direxp="$ansexp"
10036         ;;
10037 esac
10038 : Use ' ' for none so value is preserved next time through Configure
10039 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10040 prefixvar=vendorman3dir
10041 . ./installprefix
10042
10043 : Set the vendorscript variables
10044 case "$vendorprefix" in
10045 '')     d_vendorscript="$undef"
10046         vendorscript=''
10047         vendorscriptexp=''
10048         ;;
10049 *)      d_vendorscript="$define"
10050         : determine where vendor-supplied scripts go.
10051         case "$vendorscript" in
10052         '')     dflt=$vendorprefix/script
10053                 $test -d $dflt || dflt=$vendorbin ;;
10054         *)  dflt="$vendorscript" ;;
10055         esac
10056         $cat <<EOM
10057
10058 The installation process will create a directory for
10059 vendor-supplied scripts.
10060
10061 EOM
10062         fn=d~+
10063         rp='Pathname for the vendor-supplied scripts directory?'
10064         . ./getfile
10065         vendorscript="$ans"
10066         vendorscriptexp="$ansexp"
10067         ;;
10068 esac
10069 prefixvar=vendorscript
10070 . ./installprefix
10071
10072 : see if qgcvt exists
10073 set qgcvt d_qgcvt
10074 eval $inlibc
10075
10076 : Check what kind of doubles your system has
10077 $echo "Checking the kind of doubles you have..." >&4
10078 $cat >try.c <<EOP
10079 #$i_stdlib I_STDLIB
10080 #define DOUBLESIZE $doublesize
10081 #ifdef I_STDLIB
10082 #include <stdlib.h>
10083 #endif
10084 #include <stdio.h>
10085 static const double d = -0.1;
10086 int main() {
10087   unsigned const char* b = (unsigned const char*)(&d);
10088 #if DOUBLESIZE == 4
10089   if (b[0] == 0xCD && b[3] == 0xBD) {
10090     /* IEEE 754 32-bit little-endian */
10091     printf("1\n");
10092     exit(0);
10093   }
10094   if (b[0] == 0xBD && b[3] == 0xCD) {
10095     /* IEEE 754 32-bit big-endian */
10096     printf("2\n");
10097     exit(0);
10098   }
10099   if (b[0] == 0xCC && b[3] == 0xCC) {
10100     /* VAX format F, 32-bit PDP-style mixed endian. */
10101     printf("9\n");
10102     exit(0);
10103   }
10104   if (b[0] == 0xC0 && b[3] == 0x9A) {
10105     /* IBM single 32-bit */
10106     printf("12\n");
10107     exit(0);
10108   }
10109 #endif
10110 #if DOUBLESIZE == 8
10111   if (b[0] == 0x9A && b[7] == 0xBF) {
10112     /* IEEE 754 64-bit little-endian */
10113     printf("3\n");
10114     exit(0);
10115   }
10116   if (b[0] == 0xBF && b[7] == 0x9A) {
10117     /* IEEE 754 64-bit big-endian */
10118     printf("4\n");
10119     exit(0);
10120   }
10121   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10122    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10123     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10124     * 99 99 b9 bf 9a 99 99 99 */
10125     printf("7\n");
10126     exit(0);
10127   }
10128   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10129    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10130     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10131     * 99 99 99 9a bf b9 99 99 */
10132     printf("8\n");
10133     exit(0);
10134   }
10135   if (b[0] == 0xCC && b[7] == 0xCC) {
10136    /* VAX format D, 64-bit PDP-style mixed endian. */
10137     printf("10\n");
10138     exit(0);
10139   }
10140   if (b[0] == 0xD9 && b[7] == 0x99) {
10141    /* VAX format G, 64-bit PDP-style mixed endian. */
10142     printf("11\n");
10143     exit(0);
10144   }
10145   if (b[0] == 0xC0 && b[7] == 0x9A) {
10146     /* IBM double 64-bit */
10147     printf("13\n");
10148     exit(0);
10149   }
10150   if (b[0] == 0xBF && b[7] == 0xCD) {
10151     /* CRAY single 64-bit */
10152     printf("14\n");
10153     exit(0);
10154   }
10155 #endif
10156 #if DOUBLESIZE == 16
10157   if (b[0] == 0x9A && b[15] == 0xBF) {
10158     /* IEEE 754 128-bit little-endian */
10159     printf("5\n");
10160     exit(0);
10161   }
10162   if (b[0] == 0xBF && b[15] == 0x9A) {
10163     /* IEEE 754 128-bit big-endian */
10164     printf("6\n");
10165     exit(0);
10166   }
10167 #endif
10168   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10169    * Whether those environments can still build Perl is debatable. */
10170   printf("-1\n"); /* unknown */
10171   exit(0);
10172 }
10173 EOP
10174 set try
10175 if eval $compile; then
10176     doublekind=`$run ./try`
10177 else
10178     doublekind=-1
10179 fi
10180 case "$doublekind" in
10181 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10182 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10183 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10184 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10185 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10186 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10187 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10188 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10189 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10190 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10191 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10192 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10193 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10194 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10195 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10196 esac
10197 d_double_style_ieee=$undef
10198 d_double_style_vax=$undef
10199 d_double_style_ibm=$undef
10200 d_double_style_cray=$undef
10201 case "$doublekind" in
10202 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10203 9|10|11) d_double_style_vax=$define ;;
10204 12|13) d_double_style_ibm=$define ;;
10205 14) d_double_style_cray=$define ;;
10206 esac
10207 case "$d_double_style_ieee" in
10208 $define)
10209     d_double_has_inf=$define
10210     d_double_has_nan=$define
10211     d_double_has_negative_zero=$define
10212     d_double_has_subnormals=$define
10213     ;;
10214 *)
10215     d_double_has_inf=$undef
10216     d_double_has_nan=$undef
10217     d_double_has_negative_zero=$undef
10218     d_double_has_subnormals=$undef
10219     ;;
10220 esac
10221 $rm_try
10222
10223 : Check print/scan long double stuff
10224 echo " "
10225
10226 if $test X"$d_longdbl" = X"$define"; then
10227
10228 echo "Checking how to print long doubles..." >&4
10229
10230 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10231         $cat >try.c <<'EOCP'
10232 #include <sys/types.h>
10233 #include <stdio.h>
10234 int main() {
10235   double d = 123.456;
10236   printf("%.3f\n", d);
10237 }
10238 EOCP
10239         set try
10240         if eval $compile; then
10241                 yyy=`$run ./try`
10242                 case "$yyy" in
10243                 123.456)
10244                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10245                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10246                         echo "We will use %f."
10247                         ;;
10248                 esac
10249         fi
10250 fi
10251
10252 if $test X"$sPRIfldbl" = X; then
10253         $cat >try.c <<'EOCP'
10254 #include <sys/types.h>
10255 #include <stdio.h>
10256 int main() {
10257   long double d = 123.456;
10258   printf("%.3Lf\n", d);
10259 }
10260 EOCP
10261         set try
10262         if eval $compile; then
10263                 yyy=`$run ./try`
10264                 case "$yyy" in
10265                 123.456)
10266                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10267                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10268                         echo "We will use %Lf."
10269                         ;;
10270                 esac
10271         fi
10272 fi
10273
10274 if $test X"$sPRIfldbl" = X; then
10275         $cat >try.c <<'EOCP'
10276 #include <sys/types.h>
10277 #include <stdio.h>
10278 int main() {
10279   long double d = 123.456;
10280   printf("%.3llf\n", d);
10281 }
10282 EOCP
10283         set try
10284         if eval $compile; then
10285                 yyy=`$run ./try`
10286                 case "$yyy" in
10287                 123.456)
10288                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10289                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10290                         echo "We will use %llf."
10291                         ;;
10292                 esac
10293         fi
10294 fi
10295
10296 if $test X"$sPRIfldbl" = X; then
10297         $cat >try.c <<'EOCP'
10298 #include <sys/types.h>
10299 #include <stdio.h>
10300 int main() {
10301   long double d = 123.456;
10302   printf("%.3lf\n", d);
10303 }
10304 EOCP
10305         set try
10306         if eval $compile; then
10307                 yyy=`$run ./try`
10308                 case "$yyy" in
10309                 123.456)
10310                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10311                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10312                         echo "We will use %lf."
10313                         ;;
10314                 esac
10315         fi
10316 fi
10317
10318 if $test X"$sPRIfldbl" = X; then
10319         echo "Cannot figure out how to print long doubles." >&4
10320 else
10321         sSCNfldbl=$sPRIfldbl    # expect consistency
10322 fi
10323
10324 $rm_try
10325
10326 fi # d_longdbl
10327
10328 case "$sPRIfldbl" in
10329 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10330         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10331         d_SCNfldbl="$undef";
10332         ;;
10333 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10334         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10335         d_SCNfldbl="$define";
10336         ;;
10337 esac
10338
10339 : Before committing on uselongdouble, see whether that looks sane.
10340 if $test "$uselongdouble" = "$define"; then
10341     message=""
10342     echo " "
10343     echo "Checking if your long double math functions work right..." >&4
10344     $cat > try.c <<EOF
10345 #include <math.h>
10346 #include <stdio.h>
10347 int main() {
10348   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10349 }
10350 EOF
10351     case "$osname:$gccversion" in
10352     aix:)       saveccflags="$ccflags"
10353                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10354     esac
10355     set try
10356     if eval $compile_ok; then
10357       yyy=`$run ./try`
10358     fi
10359     case "$yyy" in
10360     3) echo "Your long double math functions are working correctly." >&4 ;;
10361     *) echo "Your long double math functions are broken, not using long doubles." >&4
10362        uselongdouble=$undef
10363        ;;
10364     esac
10365     $rm_try
10366     case "$osname:$gccversion" in
10367     aix:)       ccflags="$saveccflags" ;; # restore
10368     esac
10369 fi
10370
10371 : Check how to convert floats to strings.
10372
10373 if test "X$d_Gconvert" = X; then
10374
10375 echo " "
10376 echo "Checking for an efficient way to convert floats to strings."
10377 echo " " > try.c
10378 case "$uselongdouble" in
10379 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10380 esac
10381 case "$d_longdbl" in
10382 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10383 esac
10384 case "$d_PRIgldbl" in
10385 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10386 esac
10387 $cat >>try.c <<EOP
10388 #ifdef TRY_gconvert
10389 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10390 const char *myname = "gconvert";
10391 #endif
10392 #ifdef TRY_gcvt
10393 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10394 const char *myname = "gcvt";
10395 #endif
10396 #ifdef TRY_qgcvt
10397 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10398 const char *myname = "qgcvt";
10399 #define DOUBLETYPE long double
10400 #endif
10401 #ifdef TRY_sprintf
10402 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10403 #ifdef HAS_PRIgldbl
10404 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10405 #else
10406 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10407 #endif
10408 #else
10409 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10410 #endif
10411 const char *myname = "sprintf";
10412 #endif
10413
10414 #ifndef DOUBLETYPE
10415 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10416 #define DOUBLETYPE long double
10417 #else
10418 #define DOUBLETYPE double
10419 #endif
10420 #endif
10421
10422 #include <stdio.h>
10423
10424 #$i_stdlib I_STDLIB
10425 #ifdef I_STDLIB
10426 #include <stdlib.h>
10427 #endif
10428 #include <string.h>
10429
10430 void checkit(const char *expect, char *got)
10431 {
10432     if (strcmp(expect, got)) {
10433                 printf("%s oddity:  Expected %s, got %s\n",
10434                         myname, expect, got);
10435                 exit(1);
10436         }
10437 }
10438
10439 int main()
10440 {
10441         char buf[64];
10442         buf[63] = '\0';
10443
10444         /* This must be 1st test on (which?) platform */
10445         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10446         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10447         checkit("0.1", buf);
10448
10449         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10450         checkit("0.01", buf);
10451
10452         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10453         checkit("0.001", buf);
10454
10455         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10456         checkit("0.0001", buf);
10457
10458         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10459         if (strlen(buf) > 5)
10460             checkit("9e-005", buf); /* for Microsoft ?? */
10461         else
10462             checkit("9e-05", buf);
10463
10464         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10465         checkit("1", buf);
10466
10467         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10468         checkit("1.1", buf);
10469
10470         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10471         checkit("1.01", buf);
10472
10473         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10474         checkit("1.001", buf);
10475
10476         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10477         checkit("1.0001", buf);
10478
10479         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10480         checkit("1.00001", buf);
10481
10482         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10483         checkit("1.000001", buf);
10484
10485         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10486         checkit("0", buf);
10487
10488         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10489         checkit("-1", buf);
10490
10491         /* Some Linux gcvt's give 1.e+5 here. */
10492         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10493         checkit("100000", buf);
10494
10495         /* Some Linux gcvt's give -1.e+5 here. */
10496         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10497         checkit("-100000", buf);
10498
10499         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10500         checkit("123.456", buf);
10501
10502         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10503         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10504         /* 34 should be enough to scare even long double
10505          * places into using the e notation. */
10506         if (strlen(buf) > 5)
10507             checkit("1e+034", buf); /* for Microsoft */
10508         else
10509             checkit("1e+34", buf);
10510
10511         /* For Perl, if you add additional tests here, also add them to
10512          * t/base/num.t for benefit of platforms not using Configure or
10513          * overriding d_Gconvert */
10514
10515         exit(0);
10516 }
10517 EOP
10518 : first add preferred functions to our list
10519 xxx_list=""
10520 for xxx_convert in $gconvert_preference; do
10521     case $xxx_convert in
10522     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10523     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10524     esac
10525 done
10526 : then add any others
10527 for xxx_convert in gconvert gcvt sprintf; do
10528     case "$xxx_list" in
10529     *$xxx_convert*) ;;
10530     *) xxx_list="$xxx_list $xxx_convert" ;;
10531     esac
10532 done
10533
10534 case "$d_longdbl$uselongdouble" in
10535 "$define$define")
10536     : again, add preferred functions to our list first
10537     xxx_ld_list=""
10538     for xxx_convert in $gconvert_ld_preference; do
10539         case $xxx_convert in
10540         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10541         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10542         esac
10543     done
10544     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10545     for xxx_convert in qgcvt sprintf $xxx_list; do
10546         case "$xxx_ld_list" in
10547         $xxx_convert*|*" $xxx_convert"*) ;;
10548         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10549         esac
10550     done
10551     : if sprintf cannot do long doubles, move it to the end
10552     if test "$d_PRIgldbl" != "$define"; then
10553         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10554     fi
10555     : if no qgcvt, remove it
10556     if test "$d_qgcvt" != "$define"; then
10557         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10558     fi
10559     : use the ld_list
10560     xxx_list="$xxx_ld_list"
10561     ;;
10562 esac
10563
10564 for xxx_convert in $xxx_list; do
10565         echo "Trying $xxx_convert..."
10566         $rm -f try try$_o core
10567         set try -DTRY_$xxx_convert
10568         if eval $compile; then
10569                 echo "$xxx_convert() found." >&4
10570                 if $run ./try; then
10571                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10572                         break;
10573                 else
10574                         echo "...But $xxx_convert didn't work as I expected."
10575                         xxx_convert=''
10576                 fi
10577         else
10578                 echo "$xxx_convert NOT found." >&4
10579                 xxx_convert=''
10580         fi
10581 done
10582
10583 if test X$xxx_convert = X; then
10584     echo "*** WHOA THERE!!! ***" >&4
10585     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10586     xxx_convert=sprintf
10587 fi
10588
10589 case "$xxx_convert" in
10590 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10591 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10592 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10593 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10594    "$define$define$define")
10595       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10596    "$define$define$undef")
10597       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10598    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10599    esac
10600    ;;
10601 esac
10602
10603 fi
10604 $rm_try
10605
10606 : see if _fwalk exists
10607 set fwalk d__fwalk
10608 eval $inlibc
10609
10610 : see if accept4 exists
10611 set accept4 d_accept4
10612 eval $inlibc
10613
10614 : Initialize h_fcntl
10615 h_fcntl=false
10616
10617 : Initialize h_sysfile
10618 h_sysfile=false
10619
10620 : access call always available on UNIX
10621 set access d_access
10622 eval $inlibc
10623
10624 : locate the flags for 'access()'
10625 case "$d_access" in
10626 "$define")
10627         echo " "
10628         $cat >access.c <<EOCP
10629 #include <sys/types.h>
10630 #ifdef I_FCNTL
10631 #include <fcntl.h>
10632 #endif
10633 #ifdef I_SYS_FILE
10634 #include <sys/file.h>
10635 #endif
10636 #ifdef I_UNISTD
10637 #include <unistd.h>
10638 #endif
10639 #$i_stdlib I_STDLIB
10640 #ifdef I_STDLIB
10641 #include <stdlib.h>
10642 #endif
10643 int main() {
10644         exit(R_OK);
10645 }
10646 EOCP
10647         : check sys/file.h first, no particular reason here
10648         if $test `./findhdr sys/file.h` && \
10649                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10650                 h_sysfile=true;
10651                 echo "<sys/file.h> defines the *_OK access constants." >&4
10652         elif $test `./findhdr fcntl.h` && \
10653                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10654                 h_fcntl=true;
10655                 echo "<fcntl.h> defines the *_OK access constants." >&4
10656         elif $test `./findhdr unistd.h` && \
10657                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10658                 echo "<unistd.h> defines the *_OK access constants." >&4
10659         else
10660                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10661         fi
10662         ;;
10663 esac
10664 $rm -f access*
10665
10666 : see if accessx exists
10667 set accessx d_accessx
10668 eval $inlibc
10669
10670 : see if acosh exists
10671 set acosh d_acosh
10672 eval $inlibc
10673
10674 : see if aintl exists
10675 set aintl d_aintl
10676 eval $inlibc
10677
10678 : see if alarm exists
10679 set alarm d_alarm
10680 eval $inlibc
10681
10682 : see if 64bit time functions exists
10683
10684 set ctime64 d_ctime64
10685 eval $inlibc
10686
10687 set localtime64 d_localtime64
10688 eval $inlibc
10689
10690 set gmtime64 d_gmtime64
10691 eval $inlibc
10692
10693 set mktime64 d_mktime64
10694 eval $inlibc
10695
10696 set difftime64 d_difftime64
10697 eval $inlibc
10698
10699 set asctime64 d_asctime64
10700 eval $inlibc
10701
10702 : see if POSIX threads are available
10703 set pthread.h i_pthread
10704 eval $inhdr
10705
10706 : define a function to check prototypes
10707 $cat > protochk <<EOSH
10708 $startsh
10709 cc="$cc"
10710 optimize="$optimize"
10711 ccflags="$ccflags"
10712 define="$define"
10713 rm_try="$rm_try"
10714 usethreads=$usethreads
10715 i_pthread=$i_pthread
10716 pthread_h_first=$pthread_h_first
10717 EOSH
10718
10719 $cat >> protochk <<'EOSH'
10720
10721 $rm_try
10722 foo="$1"
10723 shift
10724 while test $# -ge 2; do
10725         case "$1" in
10726                 $define) echo "#include <$2>" >> try.c ;;
10727                 literal) echo "$2" >> try.c ;;
10728         esac
10729     # Extra magic for the benefit of systems that need pthread.h
10730     # to be included early to correctly detect threadsafe functions.
10731     # Such functions must guarantee themselves, though, that the usethreads
10732     # and i_pthread have been defined, before calling protochk.
10733     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10734         echo "#include <pthread.h>" >> try.c
10735         pthread_h_done=yes
10736     fi
10737     shift 2
10738 done
10739 cat >> try.c <<'EOCP'
10740 #define _(args) args
10741 EOCP
10742 echo "$foo" >> try.c
10743 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10744 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10745 status=$?
10746 $rm_try
10747 exit $status
10748 EOSH
10749 chmod +x protochk
10750 $eunicefix protochk
10751
10752 : Define hasproto macro for Configure internal use
10753 hasproto='varname=$1; func=$2; shift; shift;
10754 while $test $# -ge 2; do
10755         case "$1" in
10756         $define) echo "#include <$2>";;
10757         literal) echo "$2" ;;
10758         esac ;
10759     shift 2;
10760 done > try.c;
10761 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10762 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10763         echo "$func() prototype found.";
10764         val="$define";
10765 else
10766         echo "$func() prototype NOT found.";
10767         val="$undef";
10768 fi;
10769 set $varname;
10770 eval $setvar;
10771 $rm_try tryout.c'
10772
10773 : see if sys/types.h has to be included
10774 set sys/types.h i_systypes
10775 eval $inhdr
10776
10777 : see if sys/select.h has to be included
10778 set sys/select.h i_sysselct
10779 eval $inhdr
10780
10781 : Define hasfield macro for Configure internal use
10782 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10783 while $test $# -ge 2; do
10784         case "$1" in
10785         $define) echo "#include <$2>";;
10786         esac ;
10787     shift 2;
10788 done > try.c;
10789 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10790 set try;
10791 if eval $compile; then
10792         val="$define";
10793 else
10794         val="$undef";
10795 fi;
10796 set $varname;
10797 eval $setvar;
10798 $rm_try'
10799
10800 : see if we should include sys/time.h
10801 echo " "
10802 i_time='define'
10803 if test "X$timeincl" = X; then
10804         echo "Testing to see if we should include <sys/time.h>." >&4
10805         $echo $n "I'm now running the test program...$c"
10806         $cat >try.c <<EOCP
10807 #include <sys/types.h>
10808 #include <time.h>
10809 #ifdef I_SYSTIME
10810 #ifdef SYSTIMEKERNEL
10811 #define KERNEL
10812 #endif
10813 #include <sys/time.h>
10814 #endif
10815 #ifdef I_SYSSELECT
10816 #include <sys/select.h>
10817 #endif
10818 #$i_stdlib I_STDLIB
10819 #ifdef I_STDLIB
10820 #include <stdlib.h>
10821 #endif
10822 int main()
10823 {
10824         struct tm foo;
10825 #ifdef S_TIMEVAL
10826         struct timeval bar;
10827 #endif
10828 #ifdef S_TIMEZONE
10829         struct timezone tzp;
10830 #endif
10831         if (foo.tm_sec == foo.tm_sec)
10832                 exit(0);
10833 #ifdef S_TIMEVAL
10834         if (bar.tv_sec == bar.tv_sec)
10835                 exit(0);
10836 #endif
10837         exit(1);
10838 }
10839 EOCP
10840         flags=''
10841         for s_timezone in '-DS_TIMEZONE' ''; do
10842         sysselect=''
10843         for s_timeval in '-DS_TIMEVAL' ''; do
10844         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10845         for i_systime in '-DI_SYSTIME' ''; do
10846                 case "$flags" in
10847                 '') $echo $n ".$c"
10848                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10849                         if eval $compile; then
10850                                 set X $i_systime $i_systimek $sysselect $s_timeval
10851                                 shift
10852                                 flags="$*"
10853                                 echo " "
10854                                 $echo $n "Succeeded with $flags$c"
10855                         fi
10856                         ;;
10857                 esac
10858         done
10859         done
10860         done
10861         done
10862         timeincl=''
10863         echo " "
10864         case "$flags" in
10865         *SYSTIMEKERNEL*) i_systimek="$define"
10866                 timeincl=`./findhdr sys/time.h`
10867                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10868         *) i_systimek="$undef";;
10869         esac
10870         case "$flags" in
10871         *I_SYSTIME*) i_systime="$define"
10872                 timeincl=`./findhdr sys/time.h`" $timeincl"
10873                 echo "We'll include <sys/time.h>." >&4;;
10874         *) i_systime="$undef";;
10875         esac
10876         $rm_try
10877 fi
10878 : see if struct tm knows about tm_zone
10879 case "$i_systime$i_time" in
10880 *$define*)
10881         echo " "
10882         echo "Checking to see if your struct tm has tm_zone field..." >&4
10883         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10884         eval $hasfield
10885         ;;
10886 *)      val="$undef"
10887         set d_tm_tm_zone
10888         eval $setvar
10889         ;;
10890 esac
10891 case "$d_tm_tm_zone" in
10892 "$define")      echo "Yes, it does."   ;;
10893 *)              echo "No, it doesn't." ;;
10894 esac
10895 : see if struct tm knows about tm_gmtoff
10896 case "$i_systime$i_time" in
10897 *$define*)
10898         echo " "
10899         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10900         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10901         eval $hasfield
10902         ;;
10903 *)      val="$undef"
10904         set d_tm_tm_gmtoff
10905         eval $setvar
10906         ;;
10907 esac
10908 case "$d_tm_tm_gmtoff" in
10909 "$define")      echo "Yes, it does."   ;;
10910 *)              echo "No, it doesn't." ;;
10911 esac
10912
10913 : see if asctime_r exists
10914 set asctime_r d_asctime_r
10915 eval $inlibc
10916 case "$d_asctime_r" in
10917 "$define")
10918         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10919         case "$d_asctime_r_proto:$usethreads" in
10920         ":define")      d_asctime_r_proto=define
10921                 set d_asctime_r_proto asctime_r $hdrs
10922                 eval $hasproto ;;
10923         *)      ;;
10924         esac
10925         case "$d_asctime_r_proto" in
10926         define)
10927         case "$asctime_r_proto" in
10928         ''|0) try='char* asctime_r(const struct tm*, char*);'
10929         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10930         esac
10931         case "$asctime_r_proto" in
10932         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10933         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10934         esac
10935         case "$asctime_r_proto" in
10936         ''|0) try='int asctime_r(const struct tm*, char*);'
10937         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10938         esac
10939         case "$asctime_r_proto" in
10940         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10941         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10942         esac
10943         case "$asctime_r_proto" in
10944         ''|0)   d_asctime_r=undef
10945                 asctime_r_proto=0
10946                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10947         * )     case "$asctime_r_proto" in
10948                 REENTRANT_PROTO*) ;;
10949                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10950                 esac
10951                 echo "Prototype: $try" ;;
10952         esac
10953         ;;
10954         *)      case "$usethreads" in
10955                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10956                 esac
10957                 d_asctime_r=undef
10958                 asctime_r_proto=0
10959                 ;;
10960         esac
10961         ;;
10962 *)      asctime_r_proto=0
10963         ;;
10964 esac
10965
10966 : see if asinh exists
10967 set asinh d_asinh
10968 eval $inlibc
10969
10970 : see if atanh exists
10971 set atanh d_atanh
10972 eval $inlibc
10973
10974 : see if atolf exists
10975 set atolf d_atolf
10976 eval $inlibc
10977
10978 : see if atoll exists
10979 set atoll d_atoll
10980 eval $inlibc
10981
10982 : Look for GCC-style attribute format
10983 case "$d_attribute_format" in
10984 '')
10985 echo " "
10986 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10987 $cat >attrib.c <<'EOCP'
10988 #include <stdio.h>
10989 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10990 EOCP
10991 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10992         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10993                 echo "Your C compiler doesn't support __attribute__((format))."
10994                 val="$undef"
10995         else
10996                 echo "Your C compiler supports __attribute__((format))."
10997                 val="$define"
10998         fi
10999 else
11000         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11001         val="$undef"
11002 fi
11003 ;;
11004 *) val="$d_attribute_format" ;;
11005 esac
11006 set d_attribute_format
11007 eval $setvar
11008 $rm -f attrib*
11009
11010 : Look for GCC-style attribute format with null format allowed
11011 case "$d_printf_format_null" in
11012 '') case "$d_attribute_format" in
11013     $define)
11014         echo " "
11015         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11016 $cat >attrib.c <<EOCP
11017 #include <stdio.h>
11018 #$i_stdlib I_STDLIB
11019 #ifdef I_STDLIB
11020 #include <stdlib.h>
11021 #endif
11022 #$i_inttypes I_INTTYPES
11023 #ifdef I_INTTYPES
11024 #include <inttypes.h>
11025 #endif
11026 #ifndef INTPTR_MAX
11027 #define intptr_t int
11028 #endif
11029 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11030 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11031 int main () { exit(null_printf(NULL)); }
11032 EOCP
11033         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11034             : run the executable in case it produces a run-time warning
11035             if $run ./attrib >>attrib.out 2>&1; then
11036                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11037                     echo "Your C compiler doesn't allow __printf__ format to be null."
11038                     val="$undef"
11039                 else
11040                     echo "Your C compiler allows __printf__ format to be null."
11041                     val="$define"
11042                 fi
11043             else
11044             echo "Your C compiler executable failed with __printf__ format null."
11045             val="$undef"
11046         fi
11047     else
11048         echo "Your C compiler fails with __printf__ format null."
11049         val="$undef"
11050     fi
11051     ;;
11052     *)  val="$undef" ;;
11053     esac
11054 ;;
11055 *)  val="$d_printf_format_null" ;;
11056 esac
11057 set d_printf_format_null
11058 eval $setvar
11059 $rm -f attrib*
11060
11061 : Look for GCC-style attribute malloc
11062 case "$d_attribute_malloc" in
11063 '')
11064 echo " "
11065 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11066 $cat >attrib.c <<'EOCP'
11067 #include <stdio.h>
11068 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11069 EOCP
11070 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11071         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11072                 echo "Your C compiler doesn't support __attribute__((malloc))."
11073                 val="$undef"
11074         else
11075                 echo "Your C compiler supports __attribute__((malloc))."
11076                 val="$define"
11077         fi
11078 else
11079         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11080         val="$undef"
11081 fi
11082 ;;
11083 *) val="$d_attribute_malloc" ;;
11084 esac
11085 set d_attribute_malloc
11086 eval $setvar
11087 $rm -f attrib*
11088
11089 : Look for GCC-style attribute nonnull
11090 case "$d_attribute_nonnull" in
11091 '')
11092 echo " "
11093 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11094 $cat >attrib.c <<'EOCP'
11095 #include <stdio.h>
11096 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11097 EOCP
11098 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11099         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11100                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11101                 val="$undef"
11102         else
11103                 echo "Your C compiler supports __attribute__((nonnull))."
11104                 val="$define"
11105         fi
11106 else
11107         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11108         val="$undef"
11109 fi
11110 ;;
11111 *) val="$d_attribute_nonnull" ;;
11112 esac
11113 set d_attribute_nonnull
11114 eval $setvar
11115 $rm -f attrib*
11116
11117 : Look for GCC-style attribute noreturn
11118 case "$d_attribute_noreturn" in
11119 '')
11120 echo " "
11121 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11122 $cat >attrib.c <<'EOCP'
11123 #include <stdio.h>
11124 void fall_over_dead( void ) __attribute__((noreturn));
11125 EOCP
11126 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11127         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11128                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11129                 val="$undef"
11130         else
11131                 echo "Your C compiler supports __attribute__((noreturn))."
11132                 val="$define"
11133         fi
11134 else
11135         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11136         val="$undef"
11137 fi
11138 ;;
11139 *) val="$d_attribute_noreturn" ;;
11140 esac
11141 set d_attribute_noreturn
11142 eval $setvar
11143 $rm -f attrib*
11144
11145 : Look for GCC-style attribute pure
11146 case "$d_attribute_pure" in
11147 '')
11148 echo " "
11149 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11150 $cat >attrib.c <<'EOCP'
11151 #include <stdio.h>
11152 int square( int n ) __attribute__((pure));
11153 EOCP
11154 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11155         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11156                 echo "Your C compiler doesn't support __attribute__((pure))."
11157                 val="$undef"
11158         else
11159                 echo "Your C compiler supports __attribute__((pure))."
11160                 val="$define"
11161         fi
11162 else
11163         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11164         val="$undef"
11165 fi
11166 ;;
11167 *) val="$d_attribute_pure" ;;
11168 esac
11169 set d_attribute_pure
11170 eval $setvar
11171 $rm -f attrib*
11172
11173 : Look for GCC-style attribute unused
11174 case "$d_attribute_unused" in
11175 '')
11176 echo " "
11177 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11178 $cat >attrib.c <<'EOCP'
11179 #include <stdio.h>
11180 int do_something( int dummy __attribute__((unused)), int n );
11181 EOCP
11182 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11183         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11184                 echo "Your C compiler doesn't support __attribute__((unused))."
11185                 val="$undef"
11186         else
11187                 echo "Your C compiler supports __attribute__((unused))."
11188                 val="$define"
11189         fi
11190 else
11191         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11192         val="$undef"
11193 fi
11194 ;;
11195 *) val="$d_attribute_unused" ;;
11196 esac
11197 set d_attribute_unused
11198 eval $setvar
11199 $rm -f attrib*
11200
11201 : Look for GCC-style attribute deprecated
11202 case "$d_attribute_deprecated" in
11203 '')
11204 echo " "
11205 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11206 $cat >attrib.c <<'EOCP'
11207 #include <stdio.h>
11208 int I_am_deprecated(void) __attribute__((deprecated));
11209 EOCP
11210 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11211         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11212                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11213                 val="$undef"
11214         else
11215                 echo "Your C compiler supports __attribute__((deprecated))."
11216                 val="$define"
11217         fi
11218 else
11219         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11220         val="$undef"
11221 fi
11222 ;;
11223 *) val="$d_attribute_deprecated" ;;
11224 esac
11225 set d_attribute_deprecated
11226 eval $setvar
11227 $rm -f attrib*
11228
11229 : Look for GCC-style attribute warn_unused_result
11230 case "$d_attribute_warn_unused_result" in
11231 '')
11232 echo " "
11233 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11234 $cat >attrib.c <<'EOCP'
11235 #include <stdio.h>
11236 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11237 EOCP
11238 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11239         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11240                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11241                 val="$undef"
11242         else
11243                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11244                 val="$define"
11245         fi
11246 else
11247         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11248         val="$undef"
11249 fi
11250 ;;
11251 *) val="$d_attribute_warn_unused_result" ;;
11252 esac
11253 set d_attribute_warn_unused_result
11254 eval $setvar
11255 $rm -f attrib*
11256
11257 : see if getpgrp exists
11258 set getpgrp d_getpgrp
11259 eval $inlibc
11260
11261 case "$d_getpgrp" in
11262 "$define")
11263         echo " "
11264         echo "Checking to see which flavor of getpgrp is in use..."
11265         $cat >try.c <<EOP
11266 #$i_unistd I_UNISTD
11267 #include <sys/types.h>
11268 #ifdef I_UNISTD
11269 #  include <unistd.h>
11270 #endif
11271 #$i_stdlib I_STDLIB
11272 #ifdef I_STDLIB
11273 #include <stdlib.h>
11274 #endif
11275 int main()
11276 {
11277         if (getuid() == 0) {
11278                 printf("(I see you are running Configure as super-user...)\n");
11279                 setuid(1);
11280         }
11281 #ifdef TRY_BSD_PGRP
11282         if (getpgrp(1) == 0)
11283                 exit(0);
11284 #else
11285         if (getpgrp() > 0)
11286                 exit(0);
11287 #endif
11288         exit(1);
11289 }
11290 EOP
11291         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11292                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11293                 val="$define"
11294         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11295                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11296                 val="$undef"
11297         else
11298                 echo "I can't seem to compile and run the test program."
11299                 if ./usg; then
11300                         xxx="a USG one, i.e. you use getpgrp()."
11301                 else
11302                         # SVR4 systems can appear rather BSD-ish.
11303                         case "$i_unistd" in
11304                         $undef)
11305                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11306                                 val="$define"
11307                                 ;;
11308                         $define)
11309                                 xxx="probably a USG one, i.e. you use getpgrp()."
11310                                 val="$undef"
11311                                 ;;
11312                         esac
11313                 fi
11314                 echo "Assuming your getpgrp is $xxx" >&4
11315         fi
11316         ;;
11317 *) val="$undef";;
11318 esac
11319 set d_bsdgetpgrp
11320 eval $setvar
11321 $rm_try
11322
11323 : see if setpgrp exists
11324 set setpgrp d_setpgrp
11325 eval $inlibc
11326
11327 case "$d_setpgrp" in
11328 "$define")
11329         echo " "
11330         echo "Checking to see which flavor of setpgrp is in use..."
11331         $cat >try.c <<EOP
11332 #$i_unistd I_UNISTD
11333 #include <sys/types.h>
11334 #ifdef I_UNISTD
11335 #  include <unistd.h>
11336 #endif
11337 #$i_stdlib I_STDLIB
11338 #ifdef I_STDLIB
11339 #include <stdlib.h>
11340 #endif
11341 int main()
11342 {
11343         if (getuid() == 0) {
11344                 printf("(I see you are running Configure as super-user...)\n");
11345                 setuid(1);
11346         }
11347 #ifdef TRY_BSD_PGRP
11348         if (-1 == setpgrp(1, 1))
11349                 exit(0);
11350 #else
11351         if (setpgrp() != -1)
11352                 exit(0);
11353 #endif
11354         exit(1);
11355 }
11356 EOP
11357         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11358                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11359                 val="$define"
11360         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11361                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11362                 val="$undef"
11363         else
11364                 echo "(I can't seem to compile and run the test program.)"
11365                 if ./usg; then
11366                         xxx="a USG one, i.e. you use setpgrp()."
11367                 else
11368                         # SVR4 systems can appear rather BSD-ish.
11369                         case "$i_unistd" in
11370                         $undef)
11371                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11372                                 val="$define"
11373                                 ;;
11374                         $define)
11375                                 xxx="probably a USG one, i.e. you use setpgrp()."
11376                                 val="$undef"
11377                                 ;;
11378                         esac
11379                 fi
11380                 echo "Assuming your setpgrp is $xxx" >&4
11381         fi
11382         ;;
11383 *) val="$undef";;
11384 esac
11385 set d_bsdsetpgrp
11386 eval $setvar
11387 $rm_try
11388
11389 : Look for GCC-style __builtin_add_overflow
11390 case "$d_builtin_add_overflow" in
11391 '')
11392     echo " "
11393     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11394     $cat >try.c <<'EOCP'
11395 int main(void) {
11396     const unsigned int uint_max = ~0u;
11397     int target_int = 0;
11398     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11399         return 1;
11400     }
11401     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11402         return 1;
11403     }
11404     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11405         return 1;
11406     }
11407     return 0;
11408 }
11409 EOCP
11410     set try
11411     if eval $compile && $run ./try; then
11412         echo "Your C compiler supports __builtin_add_overflow."
11413         val="$define"
11414     else
11415         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11416         val="$undef"
11417     fi
11418     ;;
11419 *) val="$d_builtin_add_overflow" ;;
11420 esac
11421
11422 set d_builtin_add_overflow
11423 eval $setvar
11424 $rm_try
11425
11426 : Look for GCC-style __builtin_sub_overflow
11427 case "$d_builtin_sub_overflow" in
11428 '')
11429     echo " "
11430     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11431     $cat >try.c <<'EOCP'
11432 int main(void) {
11433     const unsigned int uint_max = ~0u;
11434     int target_int = 0;
11435     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11436         return 1;
11437     }
11438     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11439         return 1;
11440     }
11441     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11442         return 1;
11443     }
11444     return 0;
11445 }
11446 EOCP
11447     set try
11448     if eval $compile && $run ./try; then
11449         echo "Your C compiler supports __builtin_sub_overflow."
11450         val="$define"
11451     else
11452         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11453         val="$undef"
11454     fi
11455     ;;
11456 *) val="$d_builtin_sub_overflow" ;;
11457 esac
11458
11459 set d_builtin_sub_overflow
11460 eval $setvar
11461 $rm_try
11462
11463 : Look for GCC-style __builtin_mul_overflow
11464 case "$d_builtin_mul_overflow" in
11465 '')
11466     echo " "
11467     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11468     $cat >try.c <<'EOCP'
11469 int main(void) {
11470     const unsigned int uint_max = ~0u;
11471     int target_int = 0;
11472     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11473         return 1;
11474     }
11475     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11476         return 1;
11477     }
11478     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11479         return 1;
11480     }
11481     return 0;
11482 }
11483 EOCP
11484     set try
11485     if eval $compile && $run ./try; then
11486         echo "Your C compiler supports __builtin_mul_overflow."
11487         val="$define"
11488     else
11489         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11490         val="$undef"
11491     fi
11492     ;;
11493 *) val="$d_builtin_mul_overflow" ;;
11494 esac
11495
11496 set d_builtin_mul_overflow
11497 eval $setvar
11498 $rm_try
11499
11500 : Look for GCC-style __builtin_choose_expr
11501 case "$d_builtin_choose_expr" in
11502 '')
11503     echo " "
11504     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11505     $cat >try.c <<'EOCP'
11506 #include <assert.h>
11507 #include <stdlib.h>
11508 #include <stdio.h>
11509
11510 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11511
11512 int main(void) {
11513     assert( SYRINX(1) == 2112 );
11514     assert( SYRINX(1) != 5150 );
11515     assert( SYRINX(0) == 5150 );
11516     assert( SYRINX(0) != 2112 );
11517     puts( "All good!" );
11518     exit(0);
11519 }
11520
11521 EOCP
11522     set try
11523     if eval $compile && $run ./try; then
11524         echo "Your C compiler supports __builtin_choose_expr."
11525         val="$define"
11526     else
11527         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11528         val="$undef"
11529     fi
11530 ;;
11531 *) val="$d_builtin_choose_expr" ;;
11532 esac
11533
11534 set d_builtin_choose_expr
11535 eval $setvar
11536 $rm_try
11537
11538 : Look for GCC-style __builtin_expect
11539 case "$d_builtin_expect" in
11540 '')
11541     echo " "
11542     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11543     $cat >try.c <<'EOCP'
11544 int main(void) {
11545     int n = 50;
11546     if ( __builtin_expect(n, 0) ) n = 1;
11547     /* Remember shell exit code truth is 0, C truth is non-zero */
11548     return !(n == 1);
11549 }
11550 EOCP
11551     set try
11552     if eval $compile && $run ./try; then
11553         echo "Your C compiler supports __builtin_expect."
11554         val="$define"
11555     else
11556         echo "Your C compiler doesn't seem to understand __builtin_expect."
11557         val="$undef"
11558     fi
11559     ;;
11560 *) val="$d_builtin_expect" ;;
11561 esac
11562
11563 set d_builtin_expect
11564 eval $setvar
11565 $rm_try
11566
11567 : see if the Compiler supports C99 variadic macros
11568 echo "Checking for C99 variadic macros." >&4
11569 $cat >try.c <<EOCP
11570 #include <stdio.h>
11571 #include <stdarg.h>
11572
11573 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11574
11575 int main() {
11576   char buf[20];
11577   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11578   puts(buf);
11579   return 0;
11580 }
11581 EOCP
11582 set try
11583 if eval $compile && $run ./try 2>&1 >/dev/null; then
11584     case "`$run ./try`" in
11585         "123 456 789")
11586         echo "You have C99 variadic macros." >&4
11587         d_c99_variadic_macros="$define"
11588         ;;
11589         *)
11590         echo "You don't have functional C99 variadic macros." >&4
11591         d_c99_variadic_macros="$undef"
11592         ;;
11593     esac
11594 else
11595     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11596     d_c99_variadic_macros="$undef"
11597 fi
11598 $rm_try
11599
11600 : see if signal is declared as pointer to function returning int or void
11601 echo " "
11602 xxx=`./findhdr signal.h`
11603 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11604 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11605         echo "You have int (*signal())() instead of void." >&4
11606         val="$undef"
11607 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11608         echo "You have void (*signal())()." >&4
11609         val="$define"
11610 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11611         echo "You have int (*signal())() instead of void." >&4
11612         val="$undef"
11613 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11614         echo "You have void (*signal())()." >&4
11615         val="$define"
11616 else
11617         case "$d_voidsig" in
11618         '')
11619         echo "I can't determine whether signal handler returns void or int..." >&4
11620                 dflt=void
11621                 rp="What type does your signal handler return?"
11622                 . ./myread
11623                 case "$ans" in
11624                 v*) val="$define";;
11625                 *) val="$undef";;
11626                 esac;;
11627         "$define")
11628                 echo "As you already told me, signal handler returns void." >&4
11629                 val="$define"
11630                 ;;
11631         *)      echo "As you already told me, signal handler returns int." >&4
11632                 val="$undef"
11633                 ;;
11634         esac
11635 fi
11636 set d_voidsig
11637 eval $setvar
11638 case "$d_voidsig" in
11639 "$define") signal_t="void";;
11640 *) signal_t="int";;
11641 esac
11642 $rm -f $$.tmp
11643
11644 : check for ability to cast large floats to 32-bit ints.
11645 echo " "
11646 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11647 if $test "$intsize" -ge 4; then
11648         xxx=int
11649 else
11650         xxx=long
11651 fi
11652 $cat >try.c <<EOCP
11653 #include <stdio.h>
11654 #$i_stdlib I_STDLIB
11655 #ifdef I_STDLIB
11656 #include <stdlib.h>
11657 #endif
11658 #include <sys/types.h>
11659 #include <signal.h>
11660 $signal_t blech(int s) { exit(3); }
11661 int main()
11662 {
11663         $xxx i32;
11664         double f, g;
11665         int result = 0;
11666         char str[16];
11667         signal(SIGFPE, blech);
11668
11669         /* Don't let compiler optimize the test away.  Store the number
11670            in a writable string for gcc to pass to sscanf under HP-UX.
11671         */
11672         sprintf(str, "2147483647");
11673         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11674         g = 10 * f;
11675         i32  = ($xxx) g;
11676
11677         /* x86 processors will probably give 0x8000 0000, which is a
11678            sign change.  We don't want that.  We want to mimic SPARC
11679            behavior here, which is to preserve the sign and give
11680            back 0x7fff ffff.
11681         */
11682         if (i32 != ($xxx) f)
11683                 result |= 1;
11684         exit(result);
11685 }
11686 EOCP
11687 set try
11688 if eval $compile_ok; then
11689         $run ./try 2>/dev/null
11690         yyy=$?
11691 else
11692         echo "(I can't seem to compile the test program--assuming it can't)"
11693         yyy=1
11694 fi
11695 case "$yyy" in
11696 0)      val="$define"
11697         echo "Yup, it can."
11698         ;;
11699 *)      val="$undef"
11700         echo "Nope, it can't."
11701         ;;
11702 esac
11703 set d_casti32
11704 eval $setvar
11705 $rm_try
11706
11707 : check for ability to cast negative floats to unsigned
11708 echo " "
11709 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11710 $cat >try.c <<EOCP
11711 #include <stdio.h>
11712 #$i_stdlib I_STDLIB
11713 #ifdef I_STDLIB
11714 #include <stdlib.h>
11715 #endif
11716 #include <sys/types.h>
11717 #include <signal.h>
11718 $signal_t blech(int s) { exit(7); }
11719 $signal_t blech_in_list(int s) { exit(4); }
11720 unsigned long dummy_long(unsigned long p) { return p; }
11721 unsigned int dummy_int(unsigned int p) { return p; }
11722 unsigned short dummy_short(unsigned short p) { return p; }
11723 int main()
11724 {
11725         double f;
11726         unsigned long along;
11727         unsigned int aint;
11728         unsigned short ashort;
11729         int result = 0;
11730         char str[16];
11731
11732         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11733            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11734            optimized the whole file away
11735         */
11736         /* Store the number in a writable string for gcc to pass to
11737            sscanf under HP-UX.
11738         */
11739         sprintf(str, "-123");
11740         sscanf(str, "%lf", &f);  /* f = -123.; */
11741
11742         signal(SIGFPE, blech);
11743         along = (unsigned long)f;
11744         aint = (unsigned int)f;
11745         ashort = (unsigned short)f;
11746         if (along != (unsigned long)-123)
11747                 result |= 1;
11748         if (aint != (unsigned int)-123)
11749                 result |= 1;
11750         if (ashort != (unsigned short)-123)
11751                 result |= 1;
11752         sprintf(str, "1073741824.");
11753         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11754         f = f + f;
11755         along = 0;
11756         along = (unsigned long)f;
11757         if (along != 0x80000000)
11758                 result |= 2;
11759         f -= 1.;
11760         along = 0;
11761         along = (unsigned long)f;
11762         if (along != 0x7fffffff)
11763                 result |= 1;
11764         f += 2.;
11765         along = 0;
11766         along = (unsigned long)f;
11767         if (along != 0x80000001)
11768                 result |= 2;
11769         if (result)
11770                 exit(result);
11771         signal(SIGFPE, blech_in_list);
11772         sprintf(str, "123.");
11773         sscanf(str, "%lf", &f);  /* f = 123.; */
11774         along = dummy_long((unsigned long)f);
11775         aint = dummy_int((unsigned int)f);
11776         ashort = dummy_short((unsigned short)f);
11777         if (along != (unsigned long)123)
11778                 result |= 4;
11779         if (aint != (unsigned int)123)
11780                 result |= 4;
11781         if (ashort != (unsigned short)123)
11782                 result |= 4;
11783         exit(result);
11784
11785 }
11786 EOCP
11787 set try
11788 if eval $compile_ok; then
11789         $run ./try 2>/dev/null
11790         castflags=$?
11791 else
11792         echo "(I can't seem to compile the test program--assuming it can't)"
11793         castflags=7
11794 fi
11795 case "$castflags" in
11796 0)      val="$define"
11797         echo "Yup, it can."
11798         ;;
11799 *)      val="$undef"
11800         echo "Nope, it can't."
11801         ;;
11802 esac
11803 set d_castneg
11804 eval $setvar
11805 $rm_try
11806
11807 : see if cbrt exists
11808 set cbrt d_cbrt
11809 eval $inlibc
11810
11811 : see if chown exists
11812 set chown d_chown
11813 eval $inlibc
11814
11815 : see if chroot exists
11816 set chroot d_chroot
11817 eval $inlibc
11818
11819 : see if chsize exists
11820 set chsize d_chsize
11821 eval $inlibc
11822
11823 : see if class exists
11824 set class d_class
11825 eval $inlibc
11826
11827 : see if clearenv exists
11828 set clearenv d_clearenv
11829 eval $inlibc
11830
11831 : Define hasstruct macro for Configure internal use
11832 hasstruct='varname=$1; struct=$2; shift; shift;
11833 while $test $# -ge 2; do
11834         case "$1" in
11835         $define) echo "#include <$2>";;
11836         esac ;
11837     shift 2;
11838 done > try.c;
11839 echo "int main () { struct $struct foo; }" >> try.c;
11840 set try;
11841 if eval $compile; then
11842         val="$define";
11843 else
11844         val="$undef";
11845 fi;
11846 set $varname;
11847 eval $setvar;
11848 $rm_try'
11849
11850 : see whether socket exists
11851 socketlib=''
11852 sockethdr=''
11853 echo " "
11854 $echo $n "Hmm... $c" >&4
11855 if set socket val -f d_socket; eval $csym; $val; then
11856     echo "Looks like you have Berkeley networking support." >&4
11857     d_socket="$define"
11858     if set setsockopt val -f; eval $csym; $val; then
11859         d_oldsock="$undef"
11860     else
11861         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11862         d_oldsock="$define"
11863     fi
11864 else
11865     if $contains socklib libc.list >/dev/null 2>&1; then
11866         echo "Looks like you have Berkeley networking support." >&4
11867         d_socket="$define"
11868         : we will have to assume that it supports the 4.2 BSD interface
11869         d_oldsock="$undef"
11870     else
11871         echo "You don't have Berkeley networking in libc$_a..." >&4
11872         if test "X$d_socket" = "X$define"; then
11873             echo "...but you seem to believe that you have sockets." >&4
11874         else
11875             for net in net socket
11876             do
11877                 if test -f $sysroot/usr/lib/lib$net$_a; then
11878                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11879                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11880                     if $contains socket libc.list >/dev/null 2>&1; then
11881                         d_socket="$define"
11882                         socketlib="-l$net"
11883                         case "$net" in
11884                         net)
11885                             echo "...but the Wollongong group seems to have hacked it in." >&4
11886                             sockethdr="-I$sysroot/usr/netinclude"
11887                             ;;
11888                         esac
11889                         echo "Found Berkeley sockets interface in lib$net." >&4
11890                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11891                             d_oldsock="$undef"
11892                         else
11893                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11894                             d_oldsock="$define"
11895                         fi
11896                         break
11897                     fi
11898                 fi
11899             done
11900             if test "X$d_socket" != "X$define"; then
11901                echo "or anywhere else I see." >&4
11902                d_socket="$undef"
11903                d_oldsock="$undef"
11904             fi
11905         fi
11906     fi
11907 fi
11908
11909 : see if socketpair exists
11910 set socketpair d_sockpair
11911 eval $inlibc
11912
11913
11914 echo " "
11915 echo "Checking the availability sa_len in the sock struct ..." >&4
11916 $cat >try.c <<EOF
11917 #include <sys/types.h>
11918 #include <sys/socket.h>
11919 int main() {
11920 struct sockaddr sa;
11921 return (sa.sa_len);
11922 }
11923 EOF
11924 val="$undef"
11925 set try; if eval $compile; then
11926     val="$define"
11927 fi
11928 set d_sockaddr_sa_len; eval $setvar
11929 $rm_try
11930
11931 echo " "
11932 echo "Checking the availability struct sockaddr_in6 ..." >&4
11933 $cat >try.c <<EOF
11934 #include <sys/types.h>
11935 #include <sys/socket.h>
11936 #include <netinet/in.h>
11937 int main() {
11938 struct sockaddr_in6 sin6;
11939 return (sin6.sin6_family);
11940 }
11941 EOF
11942 val="$undef"
11943 set try; if eval $compile; then
11944     val="$define"
11945 fi
11946 set d_sockaddr_in6; eval $setvar
11947 $rm_try
11948
11949 echo " "
11950 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11951 $cat >try.c <<EOF
11952 #include <sys/types.h>
11953 #include <sys/socket.h>
11954 #include <netinet/in.h>
11955 int main() {
11956 struct sockaddr_in6 sin6;
11957 return (sin6.sin6_scope_id);
11958 }
11959 EOF
11960 val="$undef"
11961 set try; if eval $compile; then
11962     val="$define"
11963 fi
11964 set d_sin6_scope_id; eval $setvar
11965 $rm_try
11966
11967 echo " "
11968 echo "Checking the availability struct ip_mreq ..." >&4
11969 $cat >try.c <<EOF
11970 #include <sys/types.h>
11971 #include <sys/socket.h>
11972 #include <netinet/in.h>
11973 int main() {
11974 struct ip_mreq mreq;
11975 return (mreq.imr_multiaddr.s_addr);
11976 }
11977 EOF
11978 val="$undef"
11979 set try; if eval $compile; then
11980        val="$define"
11981 fi
11982 set d_ip_mreq; eval $setvar
11983 $rm_try
11984
11985 echo " "
11986 echo "Checking the availability struct ip_mreq_source ..." >&4
11987 $cat >try.c <<EOF
11988 #include <sys/types.h>
11989 #include <sys/socket.h>
11990 #include <netinet/in.h>
11991 int main() {
11992 struct ip_mreq_source mreq;
11993 return (mreq.imr_multiaddr.s_addr);
11994 }
11995 EOF
11996 val="$undef"
11997 set try; if eval $compile; then
11998        val="$define"
11999 fi
12000 set d_ip_mreq_source; eval $setvar
12001 $rm_try
12002
12003 echo " "
12004 echo "Checking the availability struct ipv6_mreq ..." >&4
12005 $cat >try.c <<EOF
12006 #include <sys/types.h>
12007 #include <sys/socket.h>
12008 #include <netinet/in.h>
12009 int main() {
12010 struct ipv6_mreq mreq;
12011 return (mreq.ipv6mr_interface);
12012 }
12013 EOF
12014 val="$undef"
12015 set try; if eval $compile; then
12016     val="$define"
12017 fi
12018 set d_ipv6_mreq; eval $setvar
12019 $rm_try
12020
12021 echo " "
12022 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12023 $cat >try.c <<EOF
12024 #include <sys/types.h>
12025 #include <sys/socket.h>
12026 #include <netinet/in.h>
12027 int main() {
12028 struct ipv6_mreq_source mreq;
12029 return (mreq.imr_multiaddr.s_addr);
12030 }
12031 EOF
12032 val="$undef"
12033 set try; if eval $compile; then
12034        val="$define"
12035 fi
12036 set d_ipv6_mreq_source; eval $setvar
12037 $rm_try
12038
12039 echo " "
12040 echo "Checking the availability of certain socket constants..." >&4
12041 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12042     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12043     $cat >try.c <<EOF
12044 #include <sys/types.h>
12045 #include <sys/socket.h>
12046 int main() {
12047     int i = $ENUM;
12048 }
12049 EOF
12050     val="$undef"
12051     set try; if eval $compile; then
12052         val="$define"
12053     fi
12054     set d_${enum}; eval $setvar
12055     $rm_try
12056 done
12057
12058 : see if this is a sys/uio.h system
12059 set sys/uio.h i_sysuio
12060 eval $inhdr
12061
12062 : Check for cmsghdr support
12063 echo " "
12064 echo "Checking to see if your system supports struct cmsghdr..." >&4
12065 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12066 eval $hasstruct
12067 case "$d_cmsghdr_s" in
12068 "$define")      echo "Yes, it does."   ;;
12069 *)              echo "No, it doesn't." ;;
12070 esac
12071
12072 : see if copysign exists
12073 set copysign d_copysign
12074 eval $inlibc
12075
12076 : see if copysignl exists
12077 set copysignl d_copysignl
12078 eval $inlibc
12079
12080 : see if crypt exists
12081 echo " "
12082 set crypt d_crypt
12083 eval $inlibc
12084 case "$d_crypt" in
12085 $define) cryptlib='' ;;
12086 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12087                 echo 'crypt() found.' >&4
12088                 val="$define"
12089                 cryptlib=''
12090         else
12091                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12092                 if $test -z "$cryptlib"; then
12093                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12094                 else
12095                         cryptlib=-lcrypt
12096                 fi
12097                 if $test -z "$cryptlib"; then
12098                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12099                 else
12100                         cryptlib=-lcrypt
12101                 fi
12102                 if $test -z "$cryptlib"; then
12103                         cryptlib=`./loc libcrypt$_a "" $libpth`
12104                 else
12105                         cryptlib=-lcrypt
12106                 fi
12107                 if $test -z "$cryptlib"; then
12108                         echo 'crypt() NOT found.' >&4
12109                         val="$undef"
12110                 else
12111                         val="$define"
12112                 fi
12113         fi
12114         set d_crypt
12115         eval $setvar
12116         ;;
12117 esac
12118
12119 : see if this is a crypt.h system
12120 set crypt.h i_crypt
12121 eval $inhdr
12122
12123 : see if crypt_r exists
12124 set crypt_r d_crypt_r
12125 eval $inlibc
12126 case "$d_crypt_r" in
12127 "$define")
12128         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12129         case "$d_crypt_r_proto:$usethreads" in
12130         ":define")      d_crypt_r_proto=define
12131                 set d_crypt_r_proto crypt_r $hdrs
12132                 eval $hasproto ;;
12133         *)      ;;
12134         esac
12135         case "$d_crypt_r_proto" in
12136         define)
12137         case "$crypt_r_proto" in
12138         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12139         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12140         esac
12141         case "$crypt_r_proto" in
12142         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12143         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12144         esac
12145         case "$crypt_r_proto" in
12146         ''|0)   d_crypt_r=undef
12147                 crypt_r_proto=0
12148                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12149         * )     case "$crypt_r_proto" in
12150                 REENTRANT_PROTO*) ;;
12151                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12152                 esac
12153                 echo "Prototype: $try" ;;
12154         esac
12155         ;;
12156         *)      case "$usethreads" in
12157                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12158                 esac
12159                 d_crypt_r=undef
12160                 crypt_r_proto=0
12161                 ;;
12162         esac
12163         ;;
12164 *)      crypt_r_proto=0
12165         ;;
12166 esac
12167
12168 : get csh whereabouts
12169 case "$csh" in
12170 'csh') val="$undef" ;;
12171 *) val="$define" ;;
12172 esac
12173 set d_csh
12174 eval $setvar
12175 : Respect a hint or command line value for full_csh.
12176 case "$full_csh" in
12177 '') full_csh=$csh ;;
12178 esac
12179
12180 : see if ctermid exists
12181 set ctermid d_ctermid
12182 eval $inlibc
12183
12184 : see if ctermid_r exists
12185 set ctermid_r d_ctermid_r
12186 eval $inlibc
12187 case "$d_ctermid_r" in
12188 "$define")
12189         hdrs="$i_systypes sys/types.h define stdio.h "
12190         case "$d_ctermid_r_proto:$usethreads" in
12191         ":define")      d_ctermid_r_proto=define
12192                 set d_ctermid_r_proto ctermid_r $hdrs
12193                 eval $hasproto ;;
12194         *)      ;;
12195         esac
12196         case "$d_ctermid_r_proto" in
12197         define)
12198         case "$ctermid_r_proto" in
12199         ''|0) try='char* ctermid_r(char*);'
12200         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12201         esac
12202         case "$ctermid_r_proto" in
12203         ''|0)   d_ctermid_r=undef
12204                 ctermid_r_proto=0
12205                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12206         * )     case "$ctermid_r_proto" in
12207                 REENTRANT_PROTO*) ;;
12208                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12209                 esac
12210                 echo "Prototype: $try" ;;
12211         esac
12212         ;;
12213         *)      case "$usethreads" in
12214                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12215                 esac
12216                 d_ctermid_r=undef
12217                 ctermid_r_proto=0
12218                 ;;
12219         esac
12220         ;;
12221 *)      ctermid_r_proto=0
12222         ;;
12223 esac
12224
12225 : see if ctime_r exists
12226 set ctime_r d_ctime_r
12227 eval $inlibc
12228 case "$d_ctime_r" in
12229 "$define")
12230         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12231         case "$d_ctime_r_proto:$usethreads" in
12232         ":define")      d_ctime_r_proto=define
12233                 set d_ctime_r_proto ctime_r $hdrs
12234                 eval $hasproto ;;
12235         *)      ;;
12236         esac
12237         case "$d_ctime_r_proto" in
12238         define)
12239         case "$ctime_r_proto" in
12240         ''|0) try='char* ctime_r(const time_t*, char*);'
12241         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12242         esac
12243         case "$ctime_r_proto" in
12244         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12245         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12246         esac
12247         case "$ctime_r_proto" in
12248         ''|0) try='int ctime_r(const time_t*, char*);'
12249         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12250         esac
12251         case "$ctime_r_proto" in
12252         ''|0) try='int ctime_r(const time_t*, char*, int);'
12253         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12254         esac
12255         case "$ctime_r_proto" in
12256         ''|0)   d_ctime_r=undef
12257                 ctime_r_proto=0
12258                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12259         * )     case "$ctime_r_proto" in
12260                 REENTRANT_PROTO*) ;;
12261                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12262                 esac
12263                 echo "Prototype: $try" ;;
12264         esac
12265         ;;
12266         *)      case "$usethreads" in
12267                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12268                 esac
12269                 d_ctime_r=undef
12270                 ctime_r_proto=0
12271                 ;;
12272         esac
12273         ;;
12274 *)      ctime_r_proto=0
12275         ;;
12276 esac
12277
12278 : see if cuserid exists
12279 set cuserid d_cuserid
12280 eval $inlibc
12281
12282 : see if dbm.h is available
12283 : see if dbmclose exists
12284 set dbmclose d_dbmclose
12285 eval $inlibc
12286
12287 case "$d_dbmclose" in
12288 $define)
12289         set dbm.h i_dbm
12290         eval $inhdr
12291         case "$i_dbm" in
12292         $define)
12293                 val="$undef"
12294                 set i_rpcsvcdbm
12295                 eval $setvar
12296                 ;;
12297         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12298                 eval $inhdr
12299                 ;;
12300         esac
12301         ;;
12302 *)      echo "We won't be including <dbm.h>"
12303         val="$undef"
12304         set i_dbm
12305         eval $setvar
12306         val="$undef"
12307         set i_rpcsvcdbm
12308         eval $setvar
12309         ;;
12310 esac
12311
12312 : see if prototype for dbminit is available
12313 echo " "
12314 set d_dbminitproto dbminit $i_dbm dbm.h
12315 eval $hasproto
12316
12317 : see if difftime exists
12318 set difftime d_difftime
12319 eval $inlibc
12320
12321 : see if this is a dirent system
12322 echo " "
12323 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12324         val="$define"
12325         echo "<dirent.h> found." >&4
12326 else
12327         val="$undef"
12328         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12329                 echo "<sys/dir.h> found." >&4
12330                 echo " "
12331         else
12332                 xinc=`./findhdr sys/ndir.h`
12333         fi
12334         echo "<dirent.h> NOT found." >&4
12335 fi
12336 set i_dirent
12337 eval $setvar
12338
12339 : Look for type of directory structure.
12340 echo " "
12341 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12342
12343 case "$direntrytype" in
12344 ''|' ')
12345         case "$i_dirent" in
12346         $define) guess1='struct dirent' ;;
12347         *) guess1='struct direct'  ;;
12348         esac
12349         ;;
12350 *)      guess1="$direntrytype"
12351         ;;
12352 esac
12353
12354 case "$guess1" in
12355 'struct dirent') guess2='struct direct' ;;
12356 *) guess2='struct dirent' ;;
12357 esac
12358
12359 if $contains "$guess1" try.c >/dev/null 2>&1; then
12360         direntrytype="$guess1"
12361         echo "Your directory entries are $direntrytype." >&4
12362 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12363         direntrytype="$guess2"
12364         echo "Your directory entries seem to be $direntrytype." >&4
12365 else
12366         echo "I don't recognize your system's directory entries." >&4
12367         rp="What type is used for directory entries on this system?"
12368         dflt="$guess1"
12369         . ./myread
12370         direntrytype="$ans"
12371 fi
12372 $rm_try
12373
12374 : see if the directory entry stores field length
12375 echo " "
12376 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12377 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12378         echo "Good, your directory entry keeps length information in d_namlen." >&4
12379         val="$define"
12380 else
12381         echo "Your directory entry does not know about the d_namlen field." >&4
12382         val="$undef"
12383 fi
12384 set d_dirnamlen
12385 eval $setvar
12386 $rm_try
12387
12388 : Look for DIR.dd_fd
12389 case "$i_dirent" in
12390 "$define")
12391     echo "Checking to see if DIR has a dd_fd member variable" >&4
12392     $cat >try.c <<EOCP
12393 #$i_stdlib I_STDLIB
12394 #ifdef I_STDLIB
12395 #include <stdlib.h>
12396 #endif
12397 #include <dirent.h>
12398
12399 int main() {
12400     DIR dir;
12401     dir.dd_fd = 1;
12402     return 0;
12403 }
12404 EOCP
12405     val=$undef
12406     set try
12407     if eval $compile; then
12408         echo "Yes, it does."
12409         val="$define"
12410     else
12411         echo "No, it does not."
12412         val="$undef"
12413     fi
12414     ;;
12415 *)
12416     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12417     val="$undef"
12418     ;;
12419 esac
12420 set d_dir_dd_fd
12421 eval $setvar
12422 $rm_try
12423
12424 : see if this is an sysdir system
12425 set sys/dir.h i_sysdir
12426 eval $inhdr
12427
12428 : see if this is an sysndir system
12429 set sys/ndir.h i_sysndir
12430 eval $inhdr
12431
12432 : Look for dirfd
12433 echo " "
12434 $cat >dirfd.c <<EOM
12435 #include <stdio.h>
12436 #$i_stdlib I_STDLIB
12437 #ifdef I_STDLIB
12438 #include <stdlib.h>
12439 #endif
12440 #$i_dirent I_DIRENT             /**/
12441 #$i_sysdir I_SYS_DIR            /**/
12442 #$i_sysndir I_SYS_NDIR          /**/
12443 #$i_systypes I_SYS_TYPES        /**/
12444 #if defined(I_SYS_TYPES)
12445 #include <sys/types.h>
12446 #endif
12447 #if defined(I_DIRENT)
12448 #include <dirent.h>
12449 #else
12450 #ifdef I_SYS_NDIR
12451 #include <sys/ndir.h>
12452 #else
12453 #ifdef I_SYS_DIR
12454 #include <sys/dir.h>
12455 #endif
12456 #endif
12457 #endif
12458 int main() {
12459         DIR *dirp = opendir(".");
12460         if (dirfd(dirp) >= 0)
12461                 exit(0);
12462         else
12463                 exit(1);
12464 }
12465 EOM
12466 val=$undef
12467 set dirfd
12468 if eval $compile; then
12469         val="$define"
12470 fi
12471 case "$val" in
12472 $define)        echo "dirfd() found." >&4       ;;
12473 *)              echo "dirfd() NOT found." >&4   ;;
12474 esac
12475 set d_dirfd
12476 eval $setvar
12477 $rm -f dirfd*
12478
12479 : see if dladdr exists
12480 set dladdr d_dladdr
12481 eval $inlibc
12482
12483 : see if dlerror exists
12484 xxx_runnm="$runnm"
12485 runnm=false
12486 set dlerror d_dlerror
12487 eval $inlibc
12488 runnm="$xxx_runnm"
12489
12490 : see if dlfcn is available
12491 set dlfcn.h i_dlfcn
12492 eval $inhdr
12493
12494 : Check what extension to use for shared libs
12495 case "$usedl" in
12496 $define|y|true)
12497         $cat << EOM
12498
12499 On a few systems, the dynamically loaded modules that perl generates and uses
12500 will need a different extension than shared libs. The default will probably
12501 be appropriate.
12502
12503 EOM
12504         case "$dlext" in
12505         '')     dflt="$so" ;;
12506         *)      dflt="$dlext" ;;
12507         esac
12508         rp='What is the extension of dynamically loaded modules'
12509         . ./myread
12510         dlext="$ans"
12511         ;;
12512 *)
12513         dlext="none"
12514         ;;
12515 esac
12516
12517 : Check if dlsym need a leading underscore
12518 echo " "
12519 val="$undef"
12520
12521 case "$dlsrc" in
12522 dl_dlopen.xs)
12523         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12524         $cat >dyna.c <<'EOM'
12525 fred () { }
12526 EOM
12527
12528 $cat >fred.c<<EOM
12529
12530 #include <stdio.h>
12531 #$i_stdlib I_STDLIB
12532 #ifdef I_STDLIB
12533 #include <stdlib.h>
12534 #endif
12535 #$i_dlfcn I_DLFCN
12536 #ifdef I_DLFCN
12537 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12538 #else
12539 #include <sys/types.h>
12540 #include <nlist.h>
12541 #include <link.h>
12542 #endif
12543
12544 extern int fred() ;
12545
12546 int main()
12547 {
12548     void * handle ;
12549     void * symbol ;
12550 #ifndef RTLD_LAZY
12551     int mode = 1 ;
12552 #else
12553     int mode = RTLD_LAZY ;
12554 #endif
12555     handle = dlopen("./dyna.$dlext", mode) ;
12556     if (handle == NULL) {
12557         printf ("1\n") ;
12558         fflush (stdout) ;
12559         exit(0);
12560     }
12561     symbol = dlsym(handle, "fred") ;
12562     if (symbol == NULL) {
12563         /* try putting a leading underscore */
12564         symbol = dlsym(handle, "_fred") ;
12565         if (symbol == NULL) {
12566             printf ("2\n") ;
12567             fflush (stdout) ;
12568             exit(0);
12569         }
12570         printf ("3\n") ;
12571     }
12572     else
12573         printf ("4\n") ;
12574     fflush (stdout) ;
12575     exit(0);
12576 }
12577 EOM
12578         : Call the object file tmp-dyna.o in case dlext=o.
12579         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12580                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12581                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12582                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12583                 xxx=`$run ./fred`
12584                 case $xxx in
12585                 1)      echo "Test program failed using dlopen." >&4
12586                         echo "Perhaps you should not use dynamic loading." >&4;;
12587                 2)      echo "Test program failed using dlsym." >&4
12588                         echo "Perhaps you should not use dynamic loading." >&4;;
12589                 3)      echo "dlsym needs a leading underscore" >&4
12590                         val="$define" ;;
12591                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12592                 esac
12593         else
12594                 echo "I can't compile and run the test program." >&4
12595                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12596         fi
12597         ;;
12598 esac
12599
12600 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12601
12602 set d_dlsymun
12603 eval $setvar
12604
12605 : see if drand48_r exists
12606 set drand48_r d_drand48_r
12607 eval $inlibc
12608 case "$d_drand48_r" in
12609 "$define")
12610         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12611         case "$d_drand48_r_proto:$usethreads" in
12612         ":define")      d_drand48_r_proto=define
12613                 set d_drand48_r_proto drand48_r $hdrs
12614                 eval $hasproto ;;
12615         *)      ;;
12616         esac
12617         case "$d_drand48_r_proto" in
12618         define)
12619         case "$drand48_r_proto" in
12620         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12621         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12622         esac
12623         case "$drand48_r_proto" in
12624         ''|0)   d_drand48_r=undef
12625                 drand48_r_proto=0
12626                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12627         * )     case "$drand48_r_proto" in
12628                 REENTRANT_PROTO*) ;;
12629                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12630                 esac
12631                 echo "Prototype: $try" ;;
12632         esac
12633         ;;
12634         *)      case "$usethreads" in
12635                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12636                 esac
12637                 d_drand48_r=undef
12638                 drand48_r_proto=0
12639                 ;;
12640         esac
12641         ;;
12642 *)      drand48_r_proto=0
12643         ;;
12644 esac
12645
12646 : see if prototype for drand48 is available
12647 echo " "
12648 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12649 eval $hasproto
12650
12651 : see if dup2 exists
12652 set dup2 d_dup2
12653 eval $inlibc
12654
12655 : see if dup3 exists
12656 set dup3 d_dup3
12657 eval $inlibc
12658
12659 : see if this is an xlocale.h system
12660 set xlocale.h i_xlocale
12661 eval $inhdr
12662
12663 : see if newlocale exists
12664 set newlocale d_newlocale
12665 eval $inlibc
12666
12667 : see if freelocale exists
12668 set freelocale d_freelocale
12669 eval $inlibc
12670
12671 : see if uselocale exists
12672 set uselocale d_uselocale
12673 eval $inlibc
12674
12675 : see if duplocale exists
12676 set duplocale d_duplocale
12677 eval $inlibc
12678
12679 : see if querylocale exists
12680 set querylocale d_querylocale
12681 eval $inlibc
12682
12683 : see if eaccess exists
12684 set eaccess d_eaccess
12685 eval $inlibc
12686
12687 : see if endgrent exists
12688 set endgrent d_endgrent
12689 eval $inlibc
12690
12691 : see if this is an grp system
12692 set grp.h i_grp
12693 eval $inhdr
12694
12695 case "$i_grp" in
12696 $define)
12697         xxx=`./findhdr grp.h`
12698         $cppstdin $cppflags $cppminus < $xxx >$$.h
12699
12700         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12701                 val="$define"
12702         else
12703                 val="$undef"
12704         fi
12705         set d_grpasswd
12706         eval $setvar
12707
12708         $rm -f $$.h
12709         ;;
12710 *)
12711         val="$undef";
12712         set d_grpasswd; eval $setvar
12713         ;;
12714 esac
12715
12716 : see if endgrent_r exists
12717 set endgrent_r d_endgrent_r
12718 eval $inlibc
12719 case "$d_endgrent_r" in
12720 "$define")
12721         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12722         case "$d_endgrent_r_proto:$usethreads" in
12723         ":define")      d_endgrent_r_proto=define
12724                 set d_endgrent_r_proto endgrent_r $hdrs
12725                 eval $hasproto ;;
12726         *)      ;;
12727         esac
12728         case "$d_endgrent_r_proto" in
12729         define)
12730         case "$endgrent_r_proto" in
12731         ''|0) try='int endgrent_r(FILE**);'
12732         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12733         esac
12734         case "$endgrent_r_proto" in
12735         ''|0) try='void endgrent_r(FILE**);'
12736         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12737         esac
12738         case "$endgrent_r_proto" in
12739         ''|0)   d_endgrent_r=undef
12740                 endgrent_r_proto=0
12741                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12742         * )     case "$endgrent_r_proto" in
12743                 REENTRANT_PROTO*) ;;
12744                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12745                 esac
12746                 echo "Prototype: $try" ;;
12747         esac
12748         ;;
12749         *)      case "$usethreads" in
12750                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12751                 esac
12752                 d_endgrent_r=undef
12753                 endgrent_r_proto=0
12754                 ;;
12755         esac
12756         ;;
12757 *)      endgrent_r_proto=0
12758         ;;
12759 esac
12760
12761 : see if endhostent exists
12762 set endhostent d_endhent
12763 eval $inlibc
12764
12765 : see if this is a netdb.h system
12766 set netdb.h i_netdb
12767 eval $inhdr
12768
12769 : see if endhostent_r exists
12770 set endhostent_r d_endhostent_r
12771 eval $inlibc
12772 case "$d_endhostent_r" in
12773 "$define")
12774         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12775         case "$d_endhostent_r_proto:$usethreads" in
12776         ":define")      d_endhostent_r_proto=define
12777                 set d_endhostent_r_proto endhostent_r $hdrs
12778                 eval $hasproto ;;
12779         *)      ;;
12780         esac
12781         case "$d_endhostent_r_proto" in
12782         define)
12783         case "$endhostent_r_proto" in
12784         ''|0) try='int endhostent_r(struct hostent_data*);'
12785         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12786         esac
12787         case "$endhostent_r_proto" in
12788         ''|0) try='void endhostent_r(struct hostent_data*);'
12789         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12790         esac
12791         case "$endhostent_r_proto" in
12792         ''|0)   d_endhostent_r=undef
12793                 endhostent_r_proto=0
12794                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12795         * )     case "$endhostent_r_proto" in
12796                 REENTRANT_PROTO*) ;;
12797                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12798                 esac
12799                 echo "Prototype: $try" ;;
12800         esac
12801         ;;
12802         *)      case "$usethreads" in
12803                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12804                 esac
12805                 d_endhostent_r=undef
12806                 endhostent_r_proto=0
12807                 ;;
12808         esac
12809         ;;
12810 *)      endhostent_r_proto=0
12811         ;;
12812 esac
12813
12814 : see if endnetent exists
12815 set endnetent d_endnent
12816 eval $inlibc
12817
12818 : see if endnetent_r exists
12819 set endnetent_r d_endnetent_r
12820 eval $inlibc
12821 case "$d_endnetent_r" in
12822 "$define")
12823         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12824         case "$d_endnetent_r_proto:$usethreads" in
12825         ":define")      d_endnetent_r_proto=define
12826                 set d_endnetent_r_proto endnetent_r $hdrs
12827                 eval $hasproto ;;
12828         *)      ;;
12829         esac
12830         case "$d_endnetent_r_proto" in
12831         define)
12832         case "$endnetent_r_proto" in
12833         ''|0) try='int endnetent_r(struct netent_data*);'
12834         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12835         esac
12836         case "$endnetent_r_proto" in
12837         ''|0) try='void endnetent_r(struct netent_data*);'
12838         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12839         esac
12840         case "$endnetent_r_proto" in
12841         ''|0)   d_endnetent_r=undef
12842                 endnetent_r_proto=0
12843                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12844         * )     case "$endnetent_r_proto" in
12845                 REENTRANT_PROTO*) ;;
12846                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12847                 esac
12848                 echo "Prototype: $try" ;;
12849         esac
12850         ;;
12851         *)      case "$usethreads" in
12852                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12853                 esac
12854                 d_endnetent_r=undef
12855                 endnetent_r_proto=0
12856                 ;;
12857         esac
12858         ;;
12859 *)      endnetent_r_proto=0
12860         ;;
12861 esac
12862
12863 : see if endprotoent exists
12864 set endprotoent d_endpent
12865 eval $inlibc
12866
12867 : see if endprotoent_r exists
12868 set endprotoent_r d_endprotoent_r
12869 eval $inlibc
12870 case "$d_endprotoent_r" in
12871 "$define")
12872         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12873         case "$d_endprotoent_r_proto:$usethreads" in
12874         ":define")      d_endprotoent_r_proto=define
12875                 set d_endprotoent_r_proto endprotoent_r $hdrs
12876                 eval $hasproto ;;
12877         *)      ;;
12878         esac
12879         case "$d_endprotoent_r_proto" in
12880         define)
12881         case "$endprotoent_r_proto" in
12882         ''|0) try='int endprotoent_r(struct protoent_data*);'
12883         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12884         esac
12885         case "$endprotoent_r_proto" in
12886         ''|0) try='void endprotoent_r(struct protoent_data*);'
12887         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12888         esac
12889         case "$endprotoent_r_proto" in
12890         ''|0)   d_endprotoent_r=undef
12891                 endprotoent_r_proto=0
12892                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12893         * )     case "$endprotoent_r_proto" in
12894                 REENTRANT_PROTO*) ;;
12895                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12896                 esac
12897                 echo "Prototype: $try" ;;
12898         esac
12899         ;;
12900         *)      case "$usethreads" in
12901                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12902                 esac
12903                 d_endprotoent_r=undef
12904                 endprotoent_r_proto=0
12905                 ;;
12906         esac
12907         ;;
12908 *)      endprotoent_r_proto=0
12909         ;;
12910 esac
12911
12912 : see if endpwent exists
12913 set endpwent d_endpwent
12914 eval $inlibc
12915
12916 : see if this is a pwd.h system
12917 set pwd.h i_pwd
12918 eval $inhdr
12919
12920 case "$i_pwd" in
12921 $define)
12922         xxx=`./findhdr pwd.h`
12923         $cppstdin $cppflags $cppminus < $xxx >$$.h
12924
12925         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12926                 val="$define"
12927         else
12928                 val="$undef"
12929         fi
12930         set d_pwquota
12931         eval $setvar
12932
12933         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12934                 val="$define"
12935         else
12936                 val="$undef"
12937         fi
12938         set d_pwage
12939         eval $setvar
12940
12941         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12942                 val="$define"
12943         else
12944                 val="$undef"
12945         fi
12946         set d_pwchange
12947         eval $setvar
12948
12949         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12950                 val="$define"
12951         else
12952                 val="$undef"
12953         fi
12954         set d_pwclass
12955         eval $setvar
12956
12957         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12958                 val="$define"
12959         else
12960                 val="$undef"
12961         fi
12962         set d_pwexpire
12963         eval $setvar
12964
12965         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12966                 val="$define"
12967         else
12968                 val="$undef"
12969         fi
12970         set d_pwcomment
12971         eval $setvar
12972
12973         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12974                 val="$define"
12975         else
12976                 val="$undef"
12977         fi
12978         set d_pwgecos
12979         eval $setvar
12980
12981         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12982                 val="$define"
12983         else
12984                 val="$undef"
12985         fi
12986         set d_pwpasswd
12987         eval $setvar
12988
12989         $rm -f $$.h
12990         ;;
12991 *)
12992         val="$undef";
12993         set d_pwquota; eval $setvar
12994         set d_pwage; eval $setvar
12995         set d_pwchange; eval $setvar
12996         set d_pwclass; eval $setvar
12997         set d_pwexpire; eval $setvar
12998         set d_pwcomment; eval $setvar
12999         set d_pwgecos; eval $setvar
13000         set d_pwpasswd; eval $setvar
13001         ;;
13002 esac
13003
13004 : see if endpwent_r exists
13005 set endpwent_r d_endpwent_r
13006 eval $inlibc
13007 case "$d_endpwent_r" in
13008 "$define")
13009         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13010         case "$d_endpwent_r_proto:$usethreads" in
13011         ":define")      d_endpwent_r_proto=define
13012                 set d_endpwent_r_proto endpwent_r $hdrs
13013                 eval $hasproto ;;
13014         *)      ;;
13015         esac
13016         case "$d_endpwent_r_proto" in
13017         define)
13018         case "$endpwent_r_proto" in
13019         ''|0) try='int endpwent_r(FILE**);'
13020         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13021         esac
13022         case "$endpwent_r_proto" in
13023         ''|0) try='void endpwent_r(FILE**);'
13024         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13025         esac
13026         case "$endpwent_r_proto" in
13027         ''|0)   d_endpwent_r=undef
13028                 endpwent_r_proto=0
13029                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13030         * )     case "$endpwent_r_proto" in
13031                 REENTRANT_PROTO*) ;;
13032                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13033                 esac
13034                 echo "Prototype: $try" ;;
13035         esac
13036         ;;
13037         *)      case "$usethreads" in
13038                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13039                 esac
13040                 d_endpwent_r=undef
13041                 endpwent_r_proto=0
13042                 ;;
13043         esac
13044         ;;
13045 *)      endpwent_r_proto=0
13046         ;;
13047 esac
13048
13049 : see if endservent exists
13050 set endservent d_endsent
13051 eval $inlibc
13052
13053 : see if endservent_r exists
13054 set endservent_r d_endservent_r
13055 eval $inlibc
13056 case "$d_endservent_r" in
13057 "$define")
13058         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13059         case "$d_endservent_r_proto:$usethreads" in
13060         ":define")      d_endservent_r_proto=define
13061                 set d_endservent_r_proto endservent_r $hdrs
13062                 eval $hasproto ;;
13063         *)      ;;
13064         esac
13065         case "$d_endservent_r_proto" in
13066         define)
13067         case "$endservent_r_proto" in
13068         ''|0) try='int endservent_r(struct servent_data*);'
13069         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13070         esac
13071         case "$endservent_r_proto" in
13072         ''|0) try='void endservent_r(struct servent_data*);'
13073         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13074         esac
13075         case "$endservent_r_proto" in
13076         ''|0)   d_endservent_r=undef
13077                 endservent_r_proto=0
13078                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13079         * )     case "$endservent_r_proto" in
13080                 REENTRANT_PROTO*) ;;
13081                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13082                 esac
13083                 echo "Prototype: $try" ;;
13084         esac
13085         ;;
13086         *)      case "$usethreads" in
13087                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13088                 esac
13089                 d_endservent_r=undef
13090                 endservent_r_proto=0
13091                 ;;
13092         esac
13093         ;;
13094 *)      endservent_r_proto=0
13095         ;;
13096 esac
13097
13098 : Locate the flags for 'open()'
13099 echo " "
13100 $cat >try.c <<EOCP
13101 #include <sys/types.h>
13102 #ifdef I_FCNTL
13103 #include <fcntl.h>
13104 #endif
13105 #ifdef I_SYS_FILE
13106 #include <sys/file.h>
13107 #endif
13108 #$i_stdlib I_STDLIB
13109 #ifdef I_STDLIB
13110 #include <stdlib.h>
13111 #endif
13112 int main() {
13113         if(O_RDONLY);
13114 #ifdef O_TRUNC
13115         exit(0);
13116 #else
13117         exit(1);
13118 #endif
13119 }
13120 EOCP
13121 : check sys/file.h first to get FREAD on Sun
13122 if $test `./findhdr sys/file.h` && \
13123                 set try -DI_SYS_FILE && eval $compile; then
13124         h_sysfile=true;
13125         echo "<sys/file.h> defines the O_* constants..." >&4
13126         if $run ./try; then
13127                 echo "and you have the 3 argument form of open()." >&4
13128                 val="$define"
13129         else
13130                 echo "but not the 3 argument form of open().  Oh, well." >&4
13131                 val="$undef"
13132         fi
13133 elif $test `./findhdr fcntl.h` && \
13134                 set try -DI_FCNTL && eval $compile; then
13135         h_fcntl=true;
13136         echo "<fcntl.h> defines the O_* constants..." >&4
13137         if $run ./try; then
13138                 echo "and you have the 3 argument form of open()." >&4
13139                 val="$define"
13140         else
13141                 echo "but not the 3 argument form of open().  Oh, well." >&4
13142                 val="$undef"
13143         fi
13144 else
13145         val="$undef"
13146         echo "I can't find the O_* constant definitions!  You got problems." >&4
13147 fi
13148 set d_open3
13149 eval $setvar
13150 $rm_try
13151
13152 : see if this is a sys/file.h system
13153 val=''
13154 set sys/file.h val
13155 eval $inhdr
13156
13157 : do we need to include sys/file.h ?
13158 case "$val" in
13159 "$define")
13160         echo " "
13161         if $h_sysfile; then
13162                 val="$define"
13163                 echo "We'll be including <sys/file.h>." >&4
13164         else
13165                 val="$undef"
13166                 echo "We won't be including <sys/file.h>." >&4
13167         fi
13168         ;;
13169 *)
13170         h_sysfile=false
13171         ;;
13172 esac
13173 set i_sysfile
13174 eval $setvar
13175
13176 : see if fcntl.h is there
13177 val=''
13178 set fcntl.h val
13179 eval $inhdr
13180
13181 : see if we can include fcntl.h
13182 case "$val" in
13183 "$define")
13184         echo " "
13185         if $h_fcntl; then
13186                 val="$define"
13187                 echo "We'll be including <fcntl.h>." >&4
13188         else
13189                 val="$undef"
13190                 if $h_sysfile; then
13191         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13192                 else
13193                         echo "We won't be including <fcntl.h>." >&4
13194                 fi
13195         fi
13196         ;;
13197 *)
13198         h_fcntl=false
13199         val="$undef"
13200         ;;
13201 esac
13202 set i_fcntl
13203 eval $setvar
13204
13205 : see if fork exists
13206 set fork d_fork
13207 eval $inlibc
13208
13209 : see if pipe exists
13210 set pipe d_pipe
13211 eval $inlibc
13212
13213 : check for non-blocking I/O stuff
13214 case "$h_sysfile" in
13215 true) echo "#include <sys/file.h>" > head.c;;
13216 *)
13217        case "$h_fcntl" in
13218        true) echo "#include <fcntl.h>" > head.c;;
13219        *) echo "#include <sys/fcntl.h>" > head.c;;
13220        esac
13221        ;;
13222 esac
13223 echo " "
13224 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13225 case "$o_nonblock" in
13226 '')
13227         $cat head.c > try.c
13228         $cat >>try.c <<EOCP
13229 #include <stdio.h>
13230 #$i_stdlib I_STDLIB
13231 #ifdef I_STDLIB
13232 #include <stdlib.h>
13233 #endif
13234 #$i_fcntl I_FCNTL
13235 #ifdef I_FCNTL
13236 #include <fcntl.h>
13237 #endif
13238 int main() {
13239 #ifdef O_NONBLOCK
13240         printf("O_NONBLOCK\n");
13241         exit(0);
13242 #endif
13243 #ifdef O_NDELAY
13244         printf("O_NDELAY\n");
13245         exit(0);
13246 #endif
13247 #ifdef FNDELAY
13248         printf("FNDELAY\n");
13249         exit(0);
13250 #endif
13251         exit(0);
13252 }
13253 EOCP
13254         set try
13255         if eval $compile_ok; then
13256                 o_nonblock=`$run ./try`
13257                 case "$o_nonblock" in
13258                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13259                 *) echo "Seems like we can use $o_nonblock.";;
13260                 esac
13261         else
13262                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13263         fi
13264         ;;
13265 *) echo "Using $hint value $o_nonblock.";;
13266 esac
13267 $rm_try
13268
13269 echo " "
13270 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13271 case "$eagain" in
13272 '')
13273         case "$d_fork:$d_pipe:$d_alarm" in
13274         define:define:define)
13275         $cat head.c > try.c
13276         $cat >>try.c <<EOCP
13277 #include <errno.h>
13278 #include <sys/types.h>
13279 #include <signal.h>
13280 #include <stdio.h>
13281 #$i_stdlib I_STDLIB
13282 #ifdef I_STDLIB
13283 #include <stdlib.h>
13284 #endif
13285 #$i_fcntl I_FCNTL
13286 #ifdef I_FCNTL
13287 #include <fcntl.h>
13288 #endif
13289 #define MY_O_NONBLOCK $o_nonblock
13290 #ifndef errno  /* XXX need better Configure test */
13291 extern int errno;
13292 #endif
13293 #$i_unistd I_UNISTD
13294 #ifdef I_UNISTD
13295 #include <unistd.h>
13296 #endif
13297 #include <string.h>
13298 $signal_t blech(int x) { exit(3); }
13299 EOCP
13300         $cat >> try.c <<'EOCP'
13301 int main()
13302 {
13303         int pd[2];
13304         int pu[2];
13305         char buf[1];
13306         char string[100];
13307         int ret;
13308
13309         ret = pipe(pd); /* Down: child -> parent */
13310         if (ret != 0)
13311                 exit(3);
13312         ret = pipe(pu); /* Up: parent -> child */
13313         if (ret != 0)
13314                 exit(3);
13315         if (0 != fork()) {
13316                 close(pd[1]);   /* Parent reads from pd[0] */
13317                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13318 #ifdef F_SETFL
13319                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13320                         exit(1);
13321 #else
13322                 exit(4);
13323 #endif
13324                 signal(SIGALRM, blech);
13325                 alarm(5);
13326                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13327                         exit(2);
13328                 sprintf(string, "%d\n", ret);
13329                 ret = write(2, string, strlen(string));
13330                 if (ret != strlen(string))
13331                         exit(3);
13332                 alarm(0);
13333 #ifdef EAGAIN
13334                 if (errno == EAGAIN) {
13335                         printf("EAGAIN\n");
13336                         goto ok;
13337                 }
13338 #endif
13339 #ifdef EWOULDBLOCK
13340                 if (errno == EWOULDBLOCK)
13341                         printf("EWOULDBLOCK\n");
13342 #endif
13343         ok:
13344                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13345                 if (ret != 1)
13346                         exit(3);
13347                 sleep(2);                               /* Give it time to close our pipe */
13348                 alarm(5);
13349                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13350                 alarm(0);
13351                 sprintf(string, "%d\n", ret);
13352                 ret = write(4, string, strlen(string));
13353                 if (ret != strlen(string))
13354                         exit(3);
13355                 exit(0);
13356         }
13357
13358         close(pd[0]);                   /* We write to pd[1] */
13359         close(pu[1]);                   /* We read from pu[0] */
13360         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13361         if (ret != 1)
13362                 exit(3);
13363         close(pd[1]);                   /* Pipe pd is now fully closed! */
13364         exit(0);                                /* Bye bye, thank you for playing! */
13365 }
13366 EOCP
13367         set try
13368         if eval $compile_ok; then
13369                 echo "$startsh" >mtry
13370                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13371                 chmod +x mtry
13372                 $run ./mtry >/dev/null 2>&1
13373                 case $? in
13374                 0) eagain=`$cat try.out`;;
13375                 1) echo "Could not perform non-blocking setting!";;
13376                 2) echo "I did a successful read() for something that was not there!";;
13377                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13378                 4) echo "Could not find F_SETFL!";;
13379                 *) echo "Something terribly wrong happened during testing.";;
13380                 esac
13381                 rd_nodata=`$cat try.ret`
13382                 echo "A read() system call with no data present returns $rd_nodata."
13383                 case "$rd_nodata" in
13384                 0|-1) ;;
13385                 *)
13386                         echo "(That's peculiar, fixing that to be -1.)"
13387                         rd_nodata=-1
13388                         ;;
13389                 esac
13390                 case "$eagain" in
13391                 '')
13392                         echo "Forcing errno EAGAIN on read() with no data available."
13393                         eagain=EAGAIN
13394                         ;;
13395                 *)
13396                         echo "Your read() sets errno to $eagain when no data is available."
13397                         ;;
13398                 esac
13399                 status=`$cat try.err`
13400                 case "$status" in
13401                 0) echo "And it correctly returns 0 to signal EOF.";;
13402                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13403                 *) echo "However, your read() returns '$status' on EOF??";;
13404                 esac
13405                 val="$define"
13406                 if test "$status" = "$rd_nodata"; then
13407                         echo "WARNING: you can't distinguish between EOF and no data!"
13408                         val="$undef"
13409                 fi
13410         else
13411                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13412                 eagain=EAGAIN
13413         fi
13414         ;;
13415         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13416                 eagain=EAGAIN
13417                 val="$define"
13418                 ;;
13419         esac
13420         set d_eofnblk
13421         eval $setvar
13422         ;;
13423 *)
13424         echo "Using $hint value $eagain."
13425         echo "Your read() returns $rd_nodata when no data is present."
13426         case "$d_eofnblk" in
13427         "$define") echo "And you can see EOF because read() returns 0.";;
13428         "$undef") echo "But you can't see EOF status from read() returned value.";;
13429         *)
13430                 echo "(Assuming you can't see EOF status from read anyway.)"
13431                 d_eofnblk=$undef
13432                 ;;
13433         esac
13434         ;;
13435 esac
13436 $rm_try head.c mtry
13437
13438 : see if erf exists
13439 set erf d_erf
13440 eval $inlibc
13441
13442 : see if erfc exists
13443 set erfc d_erfc
13444 eval $inlibc
13445
13446 : see if exp2 exists
13447 set exp2 d_exp2
13448 eval $inlibc
13449
13450 : see if expm1 exists
13451 set expm1 d_expm1
13452 eval $inlibc
13453
13454 : see if _ptr and _cnt from stdio act std
13455 echo " "
13456
13457 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13458         echo "(Looks like you have stdio.h from BSD.)"
13459         case "$stdio_ptr" in
13460         '') stdio_ptr='((fp)->_p)'
13461                 ptr_lval=$define
13462                 ;;
13463         *)      ptr_lval=$d_stdio_ptr_lval;;
13464         esac
13465         case "$stdio_cnt" in
13466         '') stdio_cnt='((fp)->_r)'
13467                 cnt_lval=$define
13468                 ;;
13469         *)      cnt_lval=$d_stdio_cnt_lval;;
13470         esac
13471         case "$stdio_base" in
13472         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13473         esac
13474         case "$stdio_bufsiz" in
13475         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13476         esac
13477 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13478         echo "(Looks like you have stdio.h from Linux.)"
13479         case "$stdio_ptr" in
13480         '') stdio_ptr='((fp)->_IO_read_ptr)'
13481                 ptr_lval=$define
13482                 ;;
13483         *)      ptr_lval=$d_stdio_ptr_lval;;
13484         esac
13485         case "$stdio_cnt" in
13486         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13487                 cnt_lval=$undef
13488                 ;;
13489         *)      cnt_lval=$d_stdio_cnt_lval;;
13490         esac
13491         case "$stdio_base" in
13492         '') stdio_base='((fp)->_IO_read_base)';;
13493         esac
13494         case "$stdio_bufsiz" in
13495         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13496         esac
13497 else
13498         case "$stdio_ptr" in
13499         '') stdio_ptr='((fp)->_ptr)'
13500                 ptr_lval=$define
13501                 ;;
13502         *)      ptr_lval=$d_stdio_ptr_lval;;
13503         esac
13504         case "$stdio_cnt" in
13505         '') stdio_cnt='((fp)->_cnt)'
13506                 cnt_lval=$define
13507                 ;;
13508         *)      cnt_lval=$d_stdio_cnt_lval;;
13509         esac
13510         case "$stdio_base" in
13511         '') stdio_base='((fp)->_base)';;
13512         esac
13513         case "$stdio_bufsiz" in
13514         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13515         esac
13516 fi
13517
13518 : test whether _ptr and _cnt really work
13519 echo "Checking how std your stdio is..." >&4
13520 $cat >try.c <<EOP
13521 #include <stdio.h>
13522 #$i_stdlib I_STDLIB
13523 #ifdef I_STDLIB
13524 #include <stdlib.h>
13525 #endif
13526 #define FILE_ptr(fp)    $stdio_ptr
13527 #define FILE_cnt(fp)    $stdio_cnt
13528 int main() {
13529         FILE *fp = fopen("try.c", "r");
13530         char c = getc(fp);
13531         if (
13532                 18 <= FILE_cnt(fp) &&
13533                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13534         )
13535                 exit(0);
13536         exit(1);
13537 }
13538 EOP
13539 val="$undef"
13540 set try
13541 if eval $compile && $to try.c; then
13542         if $run ./try; then
13543                 echo "Your stdio acts pretty std."
13544                 val="$define"
13545         else
13546                 echo "Your stdio isn't very std."
13547         fi
13548 else
13549         echo "Your stdio doesn't appear very std."
13550 fi
13551 $rm_try
13552
13553 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13554 # direct buffer manipulation no longer works.  The Configure tests
13555 # should be changed to correctly detect this, but until then,
13556 # the following check should at least let perl compile and run.
13557 # (This quick fix should be updated before 5.8.1.)
13558 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13559 # A. Dougherty, June 3, 2002.
13560 case "$d_gnulibc" in
13561 $define)
13562         case "$gnulibc_version" in
13563         2.[01]*)  ;;
13564         2.2) ;;
13565         2.2.[0-9]) ;;
13566         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13567                 val="$undef"
13568                 ;;
13569         esac
13570         ;;
13571 esac
13572 set d_stdstdio
13573 eval $setvar
13574
13575 : Can _ptr be used as an lvalue?
13576 case "$d_stdstdio$ptr_lval" in
13577 $define$define) val=$define ;;
13578 *) val=$undef ;;
13579 esac
13580 set d_stdio_ptr_lval
13581 eval $setvar
13582
13583 : Can _cnt be used as an lvalue?
13584 case "$d_stdstdio$cnt_lval" in
13585 $define$define) val=$define ;;
13586 *) val=$undef ;;
13587 esac
13588 set d_stdio_cnt_lval
13589 eval $setvar
13590
13591
13592 : test whether setting _ptr sets _cnt as a side effect
13593 d_stdio_ptr_lval_sets_cnt="$undef"
13594 d_stdio_ptr_lval_nochange_cnt="$undef"
13595 case "$d_stdio_ptr_lval$d_stdstdio" in
13596 $define$define)
13597         echo "Checking to see what happens if we set the stdio ptr..." >&4
13598 $cat >try.c <<EOP
13599 #include <stdio.h>
13600 /* Can we scream? */
13601 /* Eat dust sed :-) */
13602 /* In the buffer space, no one can hear you scream. */
13603 #$i_stdlib I_STDLIB
13604 #ifdef I_STDLIB
13605 #include <stdlib.h>
13606 #endif
13607 #define FILE_ptr(fp)    $stdio_ptr
13608 #define FILE_cnt(fp)    $stdio_cnt
13609 #include <sys/types.h>
13610 int main() {
13611         FILE *fp = fopen("try.c", "r");
13612         int c;
13613         char *ptr;
13614         size_t cnt;
13615         if (!fp) {
13616             puts("Fail even to read");
13617             exit(1);
13618         }
13619         c = getc(fp); /* Read away the first # */
13620         if (c == EOF) {
13621             puts("Fail even to read");
13622             exit(1);
13623         }
13624         if (!(
13625                 18 <= FILE_cnt(fp) &&
13626                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13627         )) {
13628                 puts("Fail even to read");
13629                 exit (1);
13630         }
13631         ptr = (char*) FILE_ptr(fp);
13632         cnt = (size_t)FILE_cnt(fp);
13633
13634         FILE_ptr(fp) += 42;
13635
13636         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13637                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13638                 exit (1);
13639         }
13640         if (FILE_cnt(fp) <= 20) {
13641                 printf ("Fail (<20 chars to test)");
13642                 exit (1);
13643         }
13644         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13645                 puts("Fail compare");
13646                 exit (1);
13647         }
13648         if (cnt == FILE_cnt(fp)) {
13649                 puts("Pass_unchanged");
13650                 exit (0);
13651         }
13652         if (FILE_cnt(fp) == (cnt - 42)) {
13653                 puts("Pass_changed");
13654                 exit (0);
13655         }
13656         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13657         return 1;
13658
13659 }
13660 EOP
13661         set try
13662         if eval $compile && $to try.c; then
13663                 case `$run ./try` in
13664                 Pass_changed)
13665                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13666                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13667                 Pass_unchanged)
13668                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13669                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13670                 Fail*)
13671                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13672                 *)
13673                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13674         esac
13675         else
13676                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13677         fi
13678         $rm_try
13679         ;;
13680 esac
13681
13682 : see if _base is also standard
13683 val="$undef"
13684 case "$d_stdstdio" in
13685 $define)
13686         $cat >try.c <<EOP
13687 #include <stdio.h>
13688 #$i_stdlib I_STDLIB
13689 #ifdef I_STDLIB
13690 #include <stdlib.h>
13691 #endif
13692 #define FILE_base(fp)   $stdio_base
13693 #define FILE_bufsiz(fp) $stdio_bufsiz
13694 int main() {
13695         FILE *fp = fopen("try.c", "r");
13696         char c = getc(fp);
13697         if (
13698                 19 <= FILE_bufsiz(fp) &&
13699                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13700         )
13701                 exit(0);
13702         exit(1);
13703 }
13704 EOP
13705         set try
13706         if eval $compile && $to try.c; then
13707                 if $run ./try; then
13708                         echo "And its _base field acts std."
13709                         val="$define"
13710                 else
13711                         echo "But its _base field isn't std."
13712                 fi
13713         else
13714                 echo "However, it seems to be lacking the _base field."
13715         fi
13716         $rm_try
13717         ;;
13718 esac
13719 set d_stdiobase
13720 eval $setvar
13721
13722 : see if fast_stdio exists
13723 val="$undef"
13724 case "$d_stdstdio:$d_stdio_ptr_lval" in
13725 "$define:$define")
13726         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13727         *$define*)
13728                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13729                 val="$define"
13730                 ;;
13731         esac
13732         ;;
13733 esac
13734 set d_faststdio
13735 eval $setvar
13736
13737 : see if fchdir exists
13738 set fchdir d_fchdir
13739 eval $inlibc
13740
13741 : see if fchmod exists
13742 set fchmod d_fchmod
13743 eval $inlibc
13744
13745 : check for openat, unlinkat, renameat, linkat, fchmodat
13746 set openat d_openat
13747 eval $inlibc
13748
13749 set unlinkat d_unlinkat
13750 eval $inlibc
13751
13752 set renameat d_renameat
13753 eval $inlibc
13754
13755 set linkat d_linkat
13756 eval $inlibc
13757
13758 set fchmodat d_fchmodat
13759 eval $inlibc
13760
13761 : see if fchown exists
13762 set fchown d_fchown
13763 eval $inlibc
13764
13765 : see if this is an fcntl system
13766 set fcntl d_fcntl
13767 eval $inlibc
13768
13769 : See if fcntl-based locking works.
13770 echo " "
13771 $cat >try.c <<EOCP
13772 #$i_stdlib I_STDLIB
13773 #ifdef I_STDLIB
13774 #include <stdlib.h>
13775 #endif
13776 #include <unistd.h>
13777 #include <fcntl.h>
13778 #include <signal.h>
13779 $signal_t blech(int x) { exit(3); }
13780 int main() {
13781 #if defined(F_SETLK) && defined(F_SETLKW)
13782      struct flock flock;
13783      int retval, fd;
13784      fd = open("try.c", O_RDONLY);
13785      flock.l_type = F_RDLCK;
13786      flock.l_whence = SEEK_SET;
13787      flock.l_start = flock.l_len = 0;
13788      signal(SIGALRM, blech);
13789      alarm(10);
13790      retval = fcntl(fd, F_SETLK, &flock);
13791      close(fd);
13792      (retval < 0 ? exit(2) : exit(0));
13793 #else
13794      exit(2);
13795 #endif
13796 }
13797 EOCP
13798 echo "Checking if fcntl-based file locking works... "
13799 case "$d_fcntl" in
13800 "$define")
13801         set try
13802         if eval $compile_ok; then
13803                 if $run ./try; then
13804                         echo "Yes, it seems to work."
13805                         val="$define"
13806                 else
13807                         echo "Nope, it didn't work."
13808                         val="$undef"
13809                         case "$?" in
13810                         3) $cat >&4 <<EOM
13811 ***
13812 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13813 *** This is (almost) impossible.
13814 *** If your NFS lock daemons are not feeling well, something like
13815 *** this may happen, please investigate.  Cannot continue, aborting.
13816 ***
13817 EOM
13818                                 exit 1
13819                                 ;;
13820                         esac
13821                 fi
13822         else
13823                 echo "I'm unable to compile the test program, so I'll assume not."
13824                 val="$undef"
13825         fi
13826         ;;
13827 *) val="$undef";
13828         echo "Nope, since you don't even have fcntl()."
13829         ;;
13830 esac
13831 set d_fcntl_can_lock
13832 eval $setvar
13833 $rm_try
13834
13835 : check for fd_set items
13836 $cat <<EOM
13837
13838 Checking to see how well your C compiler handles fd_set and friends ...
13839 EOM
13840 $cat >try.c <<EOCP
13841 #$i_stdlib I_STDLIB
13842 #ifdef I_STDLIB
13843 #include <stdlib.h>
13844 #endif
13845 #$i_systime I_SYS_TIME
13846 #$i_sysselct I_SYS_SELECT
13847 #$d_socket HAS_SOCKET
13848 #include <sys/types.h>
13849 #ifdef HAS_SOCKET
13850 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13851 #endif
13852 #ifdef I_SYS_TIME
13853 #include <sys/time.h>
13854 #endif
13855 #ifdef I_SYS_SELECT
13856 #include <sys/select.h>
13857 #endif
13858 int main() {
13859         fd_set fds;
13860
13861 #ifdef TRYBITS
13862         if(fds.fds_bits);
13863 #endif
13864
13865 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13866         exit(0);
13867 #else
13868         exit(1);
13869 #endif
13870 }
13871 EOCP
13872 set try -DTRYBITS
13873 if eval $compile; then
13874         d_fds_bits="$define"
13875         d_fd_set="$define"
13876         echo "Well, your system knows about the normal fd_set typedef..." >&4
13877         if $run ./try; then
13878                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13879                 d_fd_macros="$define"
13880         else
13881                 $cat >&4 <<'EOM'
13882 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13883 EOM
13884                 d_fd_macros="$undef"
13885         fi
13886 else
13887         $cat <<'EOM'
13888 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13889 EOM
13890         set try
13891         if eval $compile; then
13892                 d_fds_bits="$undef"
13893                 d_fd_set="$define"
13894                 echo "Well, your system has some sort of fd_set available..." >&4
13895                 if $run ./try; then
13896                         echo "and you have the normal fd_set macros." >&4
13897                         d_fd_macros="$define"
13898                 else
13899                         $cat <<'EOM'
13900 but not the normal fd_set macros!  Gross!  More work for me...
13901 EOM
13902                         d_fd_macros="$undef"
13903                 fi
13904         else
13905         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13906                 d_fd_set="$undef"
13907                 d_fds_bits="$undef"
13908                 d_fd_macros="$undef"
13909         fi
13910 fi
13911 $rm_try
13912
13913 : see if fdclose exists
13914 set fdclose d_fdclose
13915 eval $inlibc
13916
13917 : see if fdim exists
13918 set fdim d_fdim
13919 eval $inlibc
13920
13921 : see if fegetround exists
13922 set fegetround d_fegetround
13923 eval $inlibc
13924
13925 : see if fgetpos exists
13926 set fgetpos d_fgetpos
13927 eval $inlibc
13928
13929 : see if finite exists
13930 set finite d_finite
13931 eval $inlibc
13932
13933 : see if finitel exists
13934 set finitel d_finitel
13935 eval $inlibc
13936
13937 : see if flock exists
13938 set flock d_flock
13939 eval $inlibc
13940
13941 : see if prototype for flock is available
13942 echo " "
13943 set d_flockproto flock $i_sysfile sys/file.h
13944 eval $hasproto
13945
13946 : see if fma exists
13947 set fma d_fma
13948 eval $inlibc
13949
13950 : see if fmax exists
13951 set fmax d_fmax
13952 eval $inlibc
13953
13954 : see if fmin exists
13955 set fmin d_fmin
13956 eval $inlibc
13957
13958 : see if fp_class exists
13959 set fp_class d_fp_class
13960 eval $inlibc
13961
13962 : check for fpclassify
13963 echo "Checking to see if you have fpclassify..." >&4
13964 $cat >try.c <<EOCP
13965 #include <math.h>
13966 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13967 EOCP
13968 set try
13969 if eval $compile; then
13970         val="$define"
13971         echo "You have fpclassify."
13972 else
13973         val="$undef"
13974         echo "You do not have fpclassify."
13975 fi
13976 $rm_try
13977 set d_fpclassify
13978 eval $setvar
13979
13980 : see if fp_classify exists
13981 set fp_classify d_fp_classify
13982 eval $inlibc
13983
13984 : see if fp_classl exists
13985 set fp_classl d_fp_classl
13986 eval $inlibc
13987
13988 : see if pathconf exists
13989 set pathconf d_pathconf
13990 eval $inlibc
13991
13992 : see if fpathconf exists
13993 set fpathconf d_fpathconf
13994 eval $inlibc
13995
13996 : see if fpclass exists
13997 set fpclass d_fpclass
13998 eval $inlibc
13999
14000 : see if fpclassl exists
14001 set fpclassl d_fpclassl
14002 eval $inlibc
14003
14004 : see if fpgetround exists
14005 set fpgetround d_fpgetround
14006 eval $inlibc
14007
14008 : check for fpos64_t
14009 echo " "
14010 echo "Checking to see if you have fpos64_t..." >&4
14011 $cat >try.c <<EOCP
14012 #include <stdio.h>
14013 int main() { fpos64_t x = 7; }
14014 EOCP
14015 set try
14016 if eval $compile; then
14017         val="$define"
14018         echo "You have fpos64_t."
14019 else
14020         val="$undef"
14021         echo "You do not have fpos64_t."
14022         case "$fpossize" in
14023         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14024         esac
14025 fi
14026 $rm_try
14027 set d_fpos64_t
14028 eval $setvar
14029
14030 : see if frexpl exists
14031 set frexpl d_frexpl
14032 eval $inlibc
14033
14034 : see if this is a sys/param system
14035 set sys/param.h i_sysparam
14036 eval $inhdr
14037
14038 : see if this is a sys/mount.h system
14039 set sys/mount.h i_sysmount
14040 eval $inhdr
14041
14042 : Check for fs_data_s
14043 echo " "
14044 echo "Checking to see if your system supports struct fs_data..." >&4
14045 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14046 eval $hasstruct
14047 case "$d_fs_data_s" in
14048 "$define")      echo "Yes, it does."   ;;
14049 *)              echo "No, it doesn't." ;;
14050 esac
14051
14052 : see if fseeko exists
14053 set fseeko d_fseeko
14054 eval $inlibc
14055 case "$longsize" in
14056 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14057 esac
14058
14059 : see if fsetpos exists
14060 set fsetpos d_fsetpos
14061 eval $inlibc
14062
14063 : see if fstatfs exists
14064 set fstatfs d_fstatfs
14065 eval $inlibc
14066
14067 : see if statvfs exists
14068 set statvfs d_statvfs
14069 eval $inlibc
14070
14071 : see if fstatvfs exists
14072 set fstatvfs d_fstatvfs
14073 eval $inlibc
14074
14075 : see if fsync exists
14076 set fsync d_fsync
14077 eval $inlibc
14078
14079 : see if ftello exists
14080 set ftello d_ftello
14081 eval $inlibc
14082 case "$longsize" in
14083 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14084 esac
14085
14086 : check for a working futimes
14087 d_futimes="$undef"
14088 echo " "
14089 echo "Checking if you have a working futimes()" >&4
14090 $cat >try.c <<EOCP
14091 #include <stdio.h>
14092 #include <sys/time.h>
14093 #include <errno.h>
14094 #include <fcntl.h>
14095 #include <stdlib.h>
14096
14097 int main ()
14098 {
14099     int fd, rv;
14100     fd = open ("try.c", O_RDWR);
14101     if (-1 == fd) exit (1);
14102     rv = futimes (fd, NULL);
14103     exit (rv == -1 ? errno : 0);
14104 }
14105 EOCP
14106 set try
14107 if eval $compile; then
14108     `$run ./try`
14109     rc=$?
14110     case "$rc" in
14111         0)  echo "Yes, you have" >&4
14112             d_futimes="$define"
14113             ;;
14114         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14115             ;;
14116     esac
14117 else
14118     echo "No, it does not (probably harmless)" >&4
14119 fi
14120 $rm_try
14121
14122 : look for gai_strerror
14123 echo " "
14124 $cat >try.c <<'EOCP'
14125 #include <sys/types.h>
14126 #include <sys/socket.h>
14127 #include <netdb.h>
14128 int main ()
14129 {
14130     return (gai_strerror (0) ? 0 : 1);
14131     }
14132 EOCP
14133 set try
14134 val="$undef"
14135 if eval $compile; then
14136     `$run ./try`
14137     case "$?" in
14138         0)  echo "A working gai_strerror() found." >&4
14139             val="$define" ;;
14140         *)  echo "gai_strerror() found, but it doesn't work" >&4
14141             ;;
14142         esac
14143 else
14144     echo "gai_strerror() NOT found." >&4
14145     fi
14146 set d_gai_strerror
14147 eval $setvar
14148 $rm_try
14149
14150 : see if ndbm.h is available
14151 set ndbm.h i_ndbm
14152 eval $inhdr
14153 : Compatibility location for RedHat 7.1
14154 set gdbm/ndbm.h i_gdbmndbm
14155 eval $inhdr
14156 : Compatibility location for Debian 4.0
14157 set gdbm-ndbm.h i_gdbm_ndbm
14158 eval $inhdr
14159
14160 val="$undef"
14161 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14162         : see if dbm_open exists
14163         set dbm_open d_dbm_open
14164         eval $inlibc
14165         case "$d_dbm_open" in
14166         $undef)
14167                 i_ndbm="$undef"
14168                 i_gdbmndbm="$undef"
14169                 i_gdbm_ndbm="$undef"
14170                 echo "We won't be including <ndbm.h>"
14171                 val="$undef"
14172                 ;;
14173         *) val="$define"
14174            ;;
14175         esac
14176 fi
14177 set d_ndbm
14178 eval $setvar
14179
14180 ndbm_hdr_protochk='name=$1; hdr=$2;
14181 eval "ihdr=\$""i_$name";
14182 val="$undef";
14183 if $test "$ihdr" = "$define"; then
14184         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14185         case "$d_cplusplus" in
14186         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14187         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14188         esac;
14189         case "$val" in
14190         $define) $echo "Your <$hdr> seems to have prototypes";;
14191         *) $echo "Your <$hdr> does not seem to have prototypes";;
14192         esac;
14193 fi;
14194 set "d_${name}_h_uses_prototypes";
14195 eval $setvar'
14196
14197 set ndbm ndbm.h
14198 eval $ndbm_hdr_protochk
14199 set gdbmndbm gdbm/ndbm.h
14200 eval $ndbm_hdr_protochk
14201 set gdbm_ndbm gdbm-ndbm.h
14202 eval $ndbm_hdr_protochk
14203
14204 : see if getaddrinfo exists
14205 set getaddrinfo d_getaddrinfo
14206 eval $inlibc
14207
14208 : see if getcwd exists
14209 set getcwd d_getcwd
14210 eval $inlibc
14211
14212 : see if getespwnam exists
14213 set getespwnam d_getespwnam
14214 eval $inlibc
14215
14216 : see if getfsstat exists
14217 set getfsstat d_getfsstat
14218 eval $inlibc
14219
14220 : see if getgrent exists
14221 set getgrent d_getgrent
14222 eval $inlibc
14223
14224 : see if getgrent_r exists
14225 set getgrent_r d_getgrent_r
14226 eval $inlibc
14227 case "$d_getgrent_r" in
14228 "$define")
14229         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14230         case "$d_getgrent_r_proto:$usethreads" in
14231         ":define")      d_getgrent_r_proto=define
14232                 set d_getgrent_r_proto getgrent_r $hdrs
14233                 eval $hasproto ;;
14234         *)      ;;
14235         esac
14236         case "$d_getgrent_r_proto" in
14237         define)
14238         case "$getgrent_r_proto" in
14239         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14240         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14241         esac
14242         case "$getgrent_r_proto" in
14243         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14244         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14245         esac
14246         case "$getgrent_r_proto" in
14247         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14248         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14249         esac
14250         case "$getgrent_r_proto" in
14251         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14252         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14253         esac
14254         case "$getgrent_r_proto" in
14255         ''|0) try='int getgrent_r(struct group*, char*, int);'
14256         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14257         esac
14258         case "$getgrent_r_proto" in
14259         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14260         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14261         esac
14262         case "$getgrent_r_proto" in
14263         ''|0)   d_getgrent_r=undef
14264                 getgrent_r_proto=0
14265                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14266         * )     case "$getgrent_r_proto" in
14267                 REENTRANT_PROTO*) ;;
14268                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14269                 esac
14270                 echo "Prototype: $try" ;;
14271         esac
14272         ;;
14273         *)      case "$usethreads" in
14274                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14275                 esac
14276                 d_getgrent_r=undef
14277                 getgrent_r_proto=0
14278                 ;;
14279         esac
14280         ;;
14281 *)      getgrent_r_proto=0
14282         ;;
14283 esac
14284
14285 : see if getgrgid_r exists
14286 set getgrgid_r d_getgrgid_r
14287 eval $inlibc
14288 case "$d_getgrgid_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14291         case "$d_getgrgid_r_proto:$usethreads" in
14292         ":define")      d_getgrgid_r_proto=define
14293                 set d_getgrgid_r_proto getgrgid_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_getgrgid_r_proto" in
14298         define)
14299         case "$getgrgid_r_proto" in
14300         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14301         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14302         esac
14303         case "$getgrgid_r_proto" in
14304         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14305         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14306         esac
14307         case "$getgrgid_r_proto" in
14308         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14310         esac
14311         case "$getgrgid_r_proto" in
14312         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14313         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14314         esac
14315         case "$getgrgid_r_proto" in
14316         ''|0)   d_getgrgid_r=undef
14317                 getgrgid_r_proto=0
14318                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14319         * )     case "$getgrgid_r_proto" in
14320                 REENTRANT_PROTO*) ;;
14321                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14322                 esac
14323                 echo "Prototype: $try" ;;
14324         esac
14325         ;;
14326         *)      case "$usethreads" in
14327                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14328                 esac
14329                 d_getgrgid_r=undef
14330                 getgrgid_r_proto=0
14331                 ;;
14332         esac
14333         ;;
14334 *)      getgrgid_r_proto=0
14335         ;;
14336 esac
14337
14338 : see if getgrnam_r exists
14339 set getgrnam_r d_getgrnam_r
14340 eval $inlibc
14341 case "$d_getgrnam_r" in
14342 "$define")
14343         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14344         case "$d_getgrnam_r_proto:$usethreads" in
14345         ":define")      d_getgrnam_r_proto=define
14346                 set d_getgrnam_r_proto getgrnam_r $hdrs
14347                 eval $hasproto ;;
14348         *)      ;;
14349         esac
14350         case "$d_getgrnam_r_proto" in
14351         define)
14352         case "$getgrnam_r_proto" in
14353         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14354         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14355         esac
14356         case "$getgrnam_r_proto" in
14357         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14358         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14359         esac
14360         case "$getgrnam_r_proto" in
14361         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14363         esac
14364         case "$getgrnam_r_proto" in
14365         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14366         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14367         esac
14368         case "$getgrnam_r_proto" in
14369         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14370         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14371         esac
14372         case "$getgrnam_r_proto" in
14373         ''|0)   d_getgrnam_r=undef
14374                 getgrnam_r_proto=0
14375                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14376         * )     case "$getgrnam_r_proto" in
14377                 REENTRANT_PROTO*) ;;
14378                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14379                 esac
14380                 echo "Prototype: $try" ;;
14381         esac
14382         ;;
14383         *)      case "$usethreads" in
14384                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14385                 esac
14386                 d_getgrnam_r=undef
14387                 getgrnam_r_proto=0
14388                 ;;
14389         esac
14390         ;;
14391 *)      getgrnam_r_proto=0
14392         ;;
14393 esac
14394
14395 : see if gethostbyaddr exists
14396 set gethostbyaddr d_gethbyaddr
14397 eval $inlibc
14398
14399 : see if gethostbyname exists
14400 set gethostbyname d_gethbyname
14401 eval $inlibc
14402
14403 : see if gethostent exists
14404 set gethostent d_gethent
14405 eval $inlibc
14406
14407 : see how we will look up host name
14408 echo " "
14409 call=''
14410 if set gethostname val -f d_gethname; eval $csym; $val; then
14411         echo 'gethostname() found.' >&4
14412         d_gethname="$define"
14413         call=gethostname
14414 fi
14415 if set uname val -f d_uname; eval $csym; $val; then
14416         if ./xenix; then
14417                 $cat <<'EOM'
14418 uname() was found, but you're running xenix, and older versions of xenix
14419 have a broken uname(). If you don't really know whether your xenix is old
14420 enough to have a broken system call, use the default answer.
14421
14422 EOM
14423                 dflt=y
14424                 case "$d_uname" in
14425                 "$define") dflt=n;;
14426                 esac
14427                 rp='Is your uname() broken?'
14428                 . ./myread
14429                 case "$ans" in
14430                 n*) d_uname="$define"; call=uname;;
14431                 esac
14432         else
14433                 echo 'uname() found.' >&4
14434                 d_uname="$define"
14435                 case "$call" in
14436                 '') call=uname ;;
14437                 esac
14438         fi
14439 fi
14440 case "$d_gethname" in
14441 '') d_gethname="$undef";;
14442 esac
14443 case "$d_uname" in
14444 '') d_uname="$undef";;
14445 esac
14446 case "$d_uname$d_gethname" in
14447 *define*)
14448         dflt=n
14449         cat <<EOM
14450
14451 Every now and then someone has a $call() that lies about the hostname
14452 but can't be fixed for political or economic reasons.  If you wish, I can
14453 pretend $call() isn't there and maybe compute hostname at run-time
14454 thanks to the '$phostname' command.
14455
14456 EOM
14457         rp="Shall I ignore $call() from now on?"
14458         . ./myread
14459         case "$ans" in
14460         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14461         esac;;
14462 esac
14463 case "$phostname" in
14464 '') aphostname='';;
14465 *) case "$aphostname" in
14466         /*) ;;
14467         *) set X $phostname
14468                 shift
14469                 file=$1
14470                 shift
14471                 file=`./loc $file $file $pth`
14472                 aphostname=`echo $file $*`
14473                 ;;
14474         esac
14475         ;;
14476 esac
14477 case "$d_uname$d_gethname" in
14478 *define*) ;;
14479 *)
14480         case "$phostname" in
14481         '')
14482                 echo "There will be no way for $package to get your hostname." >&4;;
14483         *)
14484         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14485                 ;;
14486         esac;;
14487 esac
14488 case "$d_phostname" in
14489 '') d_phostname="$undef";;
14490 esac
14491
14492 : see if gethostbyaddr_r exists
14493 set gethostbyaddr_r d_gethostbyaddr_r
14494 eval $inlibc
14495 case "$d_gethostbyaddr_r" in
14496 "$define")
14497         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14498         case "$d_gethostbyaddr_r_proto:$usethreads" in
14499         ":define")      d_gethostbyaddr_r_proto=define
14500                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14501                 eval $hasproto ;;
14502         *)      ;;
14503         esac
14504         case "$d_gethostbyaddr_r_proto" in
14505         define)
14506         case "$gethostbyaddr_r_proto" in
14507         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14508         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14509         esac
14510         case "$gethostbyaddr_r_proto" in
14511         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14512         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14513         esac
14514         case "$gethostbyaddr_r_proto" in
14515         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14516         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14517         esac
14518         case "$gethostbyaddr_r_proto" in
14519         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14520         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14521         esac
14522         case "$gethostbyaddr_r_proto" in
14523         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14524         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14525         esac
14526         case "$gethostbyaddr_r_proto" in
14527         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14528         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14529         esac
14530         case "$gethostbyaddr_r_proto" in
14531         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14532         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14533         esac
14534         case "$gethostbyaddr_r_proto" in
14535         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14536         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14537         esac
14538         case "$gethostbyaddr_r_proto" in
14539         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14540         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14541         esac
14542         case "$gethostbyaddr_r_proto" in
14543         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14544         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14545         esac
14546         case "$gethostbyaddr_r_proto" in
14547         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14548         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14549         esac
14550         case "$gethostbyaddr_r_proto" in
14551         ''|0)   d_gethostbyaddr_r=undef
14552                 gethostbyaddr_r_proto=0
14553                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14554         * )     case "$gethostbyaddr_r_proto" in
14555                 REENTRANT_PROTO*) ;;
14556                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14557                 esac
14558                 echo "Prototype: $try" ;;
14559         esac
14560         ;;
14561         *)      case "$usethreads" in
14562                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14563                 esac
14564                 d_gethostbyaddr_r=undef
14565                 gethostbyaddr_r_proto=0
14566                 ;;
14567         esac
14568         ;;
14569 *)      gethostbyaddr_r_proto=0
14570         ;;
14571 esac
14572
14573 : see if gethostbyname_r exists
14574 set gethostbyname_r d_gethostbyname_r
14575 eval $inlibc
14576 case "$d_gethostbyname_r" in
14577 "$define")
14578         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14579         case "$d_gethostbyname_r_proto:$usethreads" in
14580         ":define")      d_gethostbyname_r_proto=define
14581                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14582                 eval $hasproto ;;
14583         *)      ;;
14584         esac
14585         case "$d_gethostbyname_r_proto" in
14586         define)
14587         case "$gethostbyname_r_proto" in
14588         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14589         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14590         esac
14591         case "$gethostbyname_r_proto" in
14592         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14593         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14594         esac
14595         case "$gethostbyname_r_proto" in
14596         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14597         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14598         esac
14599         case "$gethostbyname_r_proto" in
14600         ''|0)   d_gethostbyname_r=undef
14601                 gethostbyname_r_proto=0
14602                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14603         * )     case "$gethostbyname_r_proto" in
14604                 REENTRANT_PROTO*) ;;
14605                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14606                 esac
14607                 echo "Prototype: $try" ;;
14608         esac
14609         ;;
14610         *)      case "$usethreads" in
14611                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14612                 esac
14613                 d_gethostbyname_r=undef
14614                 gethostbyname_r_proto=0
14615                 ;;
14616         esac
14617         ;;
14618 *)      gethostbyname_r_proto=0
14619         ;;
14620 esac
14621
14622 : see if gethostent_r exists
14623 set gethostent_r d_gethostent_r
14624 eval $inlibc
14625 case "$d_gethostent_r" in
14626 "$define")
14627         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14628         case "$d_gethostent_r_proto:$usethreads" in
14629         ":define")      d_gethostent_r_proto=define
14630                 set d_gethostent_r_proto gethostent_r $hdrs
14631                 eval $hasproto ;;
14632         *)      ;;
14633         esac
14634         case "$d_gethostent_r_proto" in
14635         define)
14636         case "$gethostent_r_proto" in
14637         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14638         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14639         esac
14640         case "$gethostent_r_proto" in
14641         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14642         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14643         esac
14644         case "$gethostent_r_proto" in
14645         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14646         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14647         esac
14648         case "$gethostent_r_proto" in
14649         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14651         esac
14652         case "$gethostent_r_proto" in
14653         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14654         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14655         esac
14656         case "$gethostent_r_proto" in
14657         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14658         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14659         esac
14660         case "$gethostent_r_proto" in
14661         ''|0)   d_gethostent_r=undef
14662                 gethostent_r_proto=0
14663                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14664         * )     case "$gethostent_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_gethostent_r=undef
14675                 gethostent_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      gethostent_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if prototypes for various gethostxxx netdb.h functions are available
14684 echo " "
14685 set d_gethostprotos gethostent $i_netdb netdb.h
14686 eval $hasproto
14687
14688 : see if getitimer exists
14689 set getitimer d_getitimer
14690 eval $inlibc
14691
14692 : see if getlogin exists
14693 set getlogin d_getlogin
14694 eval $inlibc
14695
14696 : see if getlogin_r exists
14697 set getlogin_r d_getlogin_r
14698 eval $inlibc
14699 case "$d_getlogin_r" in
14700 "$define")
14701         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14702         case "$d_getlogin_r_proto:$usethreads" in
14703         ":define")      d_getlogin_r_proto=define
14704                 set d_getlogin_r_proto getlogin_r $hdrs
14705                 eval $hasproto ;;
14706         *)      ;;
14707         esac
14708         case "$d_getlogin_r_proto" in
14709         define)
14710         case "$getlogin_r_proto" in
14711         ''|0) try='int getlogin_r(char*, size_t);'
14712         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14713         esac
14714         case "$getlogin_r_proto" in
14715         ''|0) try='int getlogin_r(char*, int);'
14716         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14717         esac
14718         case "$getlogin_r_proto" in
14719         ''|0) try='char* getlogin_r(char*, size_t);'
14720         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14721         esac
14722         case "$getlogin_r_proto" in
14723         ''|0) try='char* getlogin_r(char*, int);'
14724         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14725         esac
14726         case "$getlogin_r_proto" in
14727         ''|0)   d_getlogin_r=undef
14728                 getlogin_r_proto=0
14729                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14730         * )     case "$getlogin_r_proto" in
14731                 REENTRANT_PROTO*) ;;
14732                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14733                 esac
14734                 echo "Prototype: $try" ;;
14735         esac
14736         ;;
14737         *)      case "$usethreads" in
14738                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14739                 esac
14740                 d_getlogin_r=undef
14741                 getlogin_r_proto=0
14742                 ;;
14743         esac
14744         ;;
14745 *)      getlogin_r_proto=0
14746         ;;
14747 esac
14748
14749 : see if getmnt exists
14750 set getmnt d_getmnt
14751 eval $inlibc
14752
14753 : see if getmntent exists
14754 set getmntent d_getmntent
14755 eval $inlibc
14756
14757 : see if getnameinfo exists
14758 set getnameinfo d_getnameinfo
14759 eval $inlibc
14760
14761 : see if getnetbyaddr exists
14762 set getnetbyaddr d_getnbyaddr
14763 eval $inlibc
14764
14765 : see if getnetbyname exists
14766 set getnetbyname d_getnbyname
14767 eval $inlibc
14768
14769 : see if getnetent exists
14770 set getnetent d_getnent
14771 eval $inlibc
14772
14773 : see if getnetbyaddr_r exists
14774 set getnetbyaddr_r d_getnetbyaddr_r
14775 eval $inlibc
14776 case "$d_getnetbyaddr_r" in
14777 "$define")
14778         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14779         case "$d_getnetbyaddr_r_proto:$usethreads" in
14780         ":define")      d_getnetbyaddr_r_proto=define
14781                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14782                 eval $hasproto ;;
14783         *)      ;;
14784         esac
14785         case "$d_getnetbyaddr_r_proto" in
14786         define)
14787         case "$getnetbyaddr_r_proto" in
14788         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14789         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14790         esac
14791         case "$getnetbyaddr_r_proto" in
14792         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14793         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14794         esac
14795         case "$getnetbyaddr_r_proto" in
14796         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14797         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14798         esac
14799         case "$getnetbyaddr_r_proto" in
14800         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14801         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14802         esac
14803         case "$getnetbyaddr_r_proto" in
14804         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14805         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14806         esac
14807         case "$getnetbyaddr_r_proto" in
14808         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14809         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14810         esac
14811         case "$getnetbyaddr_r_proto" in
14812         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14813         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14814         esac
14815         case "$getnetbyaddr_r_proto" in
14816         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14817         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14818         esac
14819         case "$getnetbyaddr_r_proto" in
14820         ''|0)   d_getnetbyaddr_r=undef
14821                 getnetbyaddr_r_proto=0
14822                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14823         * )     case "$getnetbyaddr_r_proto" in
14824                 REENTRANT_PROTO*) ;;
14825                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14826                 esac
14827                 echo "Prototype: $try" ;;
14828         esac
14829         ;;
14830         *)      case "$usethreads" in
14831                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14832                 esac
14833                 d_getnetbyaddr_r=undef
14834                 getnetbyaddr_r_proto=0
14835                 ;;
14836         esac
14837         ;;
14838 *)      getnetbyaddr_r_proto=0
14839         ;;
14840 esac
14841
14842 : see if getnetbyname_r exists
14843 set getnetbyname_r d_getnetbyname_r
14844 eval $inlibc
14845 case "$d_getnetbyname_r" in
14846 "$define")
14847         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14848         case "$d_getnetbyname_r_proto:$usethreads" in
14849         ":define")      d_getnetbyname_r_proto=define
14850                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14851                 eval $hasproto ;;
14852         *)      ;;
14853         esac
14854         case "$d_getnetbyname_r_proto" in
14855         define)
14856         case "$getnetbyname_r_proto" in
14857         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14858         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14859         esac
14860         case "$getnetbyname_r_proto" in
14861         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14862         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14863         esac
14864         case "$getnetbyname_r_proto" in
14865         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14866         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14867         esac
14868         case "$getnetbyname_r_proto" in
14869         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14870         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14871         esac
14872         case "$getnetbyname_r_proto" in
14873         ''|0)   d_getnetbyname_r=undef
14874                 getnetbyname_r_proto=0
14875                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14876         * )     case "$getnetbyname_r_proto" in
14877                 REENTRANT_PROTO*) ;;
14878                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14879                 esac
14880                 echo "Prototype: $try" ;;
14881         esac
14882         ;;
14883         *)      case "$usethreads" in
14884                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14885                 esac
14886                 d_getnetbyname_r=undef
14887                 getnetbyname_r_proto=0
14888                 ;;
14889         esac
14890         ;;
14891 *)      getnetbyname_r_proto=0
14892         ;;
14893 esac
14894
14895 : see if getnetent_r exists
14896 set getnetent_r d_getnetent_r
14897 eval $inlibc
14898 case "$d_getnetent_r" in
14899 "$define")
14900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14901         case "$d_getnetent_r_proto:$usethreads" in
14902         ":define")      d_getnetent_r_proto=define
14903                 set d_getnetent_r_proto getnetent_r $hdrs
14904                 eval $hasproto ;;
14905         *)      ;;
14906         esac
14907         case "$d_getnetent_r_proto" in
14908         define)
14909         case "$getnetent_r_proto" in
14910         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14911         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14912         esac
14913         case "$getnetent_r_proto" in
14914         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14915         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14916         esac
14917         case "$getnetent_r_proto" in
14918         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14919         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14920         esac
14921         case "$getnetent_r_proto" in
14922         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14923         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14924         esac
14925         case "$getnetent_r_proto" in
14926         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14927         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14928         esac
14929         case "$getnetent_r_proto" in
14930         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14931         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14932         esac
14933         case "$getnetent_r_proto" in
14934         ''|0)   d_getnetent_r=undef
14935                 getnetent_r_proto=0
14936                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14937         * )     case "$getnetent_r_proto" in
14938                 REENTRANT_PROTO*) ;;
14939                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14940                 esac
14941                 echo "Prototype: $try" ;;
14942         esac
14943         ;;
14944         *)      case "$usethreads" in
14945                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14946                 esac
14947                 d_getnetent_r=undef
14948                 getnetent_r_proto=0
14949                 ;;
14950         esac
14951         ;;
14952 *)      getnetent_r_proto=0
14953         ;;
14954 esac
14955
14956 : see if prototypes for various getnetxxx netdb.h functions are available
14957 echo " "
14958 set d_getnetprotos getnetent $i_netdb netdb.h
14959 eval $hasproto
14960
14961 : see if getpagesize exists
14962 set getpagesize d_getpagsz
14963 eval $inlibc
14964
14965 : Optional checks for getprotobyname and getprotobynumber
14966
14967 : see if getprotobyname exists
14968 set getprotobyname d_getpbyname
14969 eval $inlibc
14970
14971 : see if getprotobynumber exists
14972 set getprotobynumber d_getpbynumber
14973 eval $inlibc
14974
14975 : see if getprotoent exists
14976 set getprotoent d_getpent
14977 eval $inlibc
14978
14979 : see if getpgid exists
14980 set getpgid d_getpgid
14981 eval $inlibc
14982
14983 : see if getpgrp2 exists
14984 set getpgrp2 d_getpgrp2
14985 eval $inlibc
14986
14987 : see if getppid exists
14988 set getppid d_getppid
14989 eval $inlibc
14990
14991 : see if getpriority exists
14992 set getpriority d_getprior
14993 eval $inlibc
14994
14995 : see if getprotobyname_r exists
14996 set getprotobyname_r d_getprotobyname_r
14997 eval $inlibc
14998 case "$d_getprotobyname_r" in
14999 "$define")
15000         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15001         case "$d_getprotobyname_r_proto:$usethreads" in
15002         ":define")      d_getprotobyname_r_proto=define
15003                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15004                 eval $hasproto ;;
15005         *)      ;;
15006         esac
15007         case "$d_getprotobyname_r_proto" in
15008         define)
15009         case "$getprotobyname_r_proto" in
15010         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15011         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15012         esac
15013         case "$getprotobyname_r_proto" in
15014         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15015         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15016         esac
15017         case "$getprotobyname_r_proto" in
15018         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15019         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15020         esac
15021         case "$getprotobyname_r_proto" in
15022         ''|0)   d_getprotobyname_r=undef
15023                 getprotobyname_r_proto=0
15024                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15025         * )     case "$getprotobyname_r_proto" in
15026                 REENTRANT_PROTO*) ;;
15027                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15028                 esac
15029                 echo "Prototype: $try" ;;
15030         esac
15031         ;;
15032         *)      case "$usethreads" in
15033                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15034                 esac
15035                 d_getprotobyname_r=undef
15036                 getprotobyname_r_proto=0
15037                 ;;
15038         esac
15039         ;;
15040 *)      getprotobyname_r_proto=0
15041         ;;
15042 esac
15043
15044 : see if getprotobynumber_r exists
15045 set getprotobynumber_r d_getprotobynumber_r
15046 eval $inlibc
15047 case "$d_getprotobynumber_r" in
15048 "$define")
15049         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15050         case "$d_getprotobynumber_r_proto:$usethreads" in
15051         ":define")      d_getprotobynumber_r_proto=define
15052                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15053                 eval $hasproto ;;
15054         *)      ;;
15055         esac
15056         case "$d_getprotobynumber_r_proto" in
15057         define)
15058         case "$getprotobynumber_r_proto" in
15059         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15060         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15061         esac
15062         case "$getprotobynumber_r_proto" in
15063         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15064         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15065         esac
15066         case "$getprotobynumber_r_proto" in
15067         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15068         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15069         esac
15070         case "$getprotobynumber_r_proto" in
15071         ''|0)   d_getprotobynumber_r=undef
15072                 getprotobynumber_r_proto=0
15073                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15074         * )     case "$getprotobynumber_r_proto" in
15075                 REENTRANT_PROTO*) ;;
15076                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15077                 esac
15078                 echo "Prototype: $try" ;;
15079         esac
15080         ;;
15081         *)      case "$usethreads" in
15082                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15083                 esac
15084                 d_getprotobynumber_r=undef
15085                 getprotobynumber_r_proto=0
15086                 ;;
15087         esac
15088         ;;
15089 *)      getprotobynumber_r_proto=0
15090         ;;
15091 esac
15092
15093 : see if getprotoent_r exists
15094 set getprotoent_r d_getprotoent_r
15095 eval $inlibc
15096 case "$d_getprotoent_r" in
15097 "$define")
15098         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15099         case "$d_getprotoent_r_proto:$usethreads" in
15100         ":define")      d_getprotoent_r_proto=define
15101                 set d_getprotoent_r_proto getprotoent_r $hdrs
15102                 eval $hasproto ;;
15103         *)      ;;
15104         esac
15105         case "$d_getprotoent_r_proto" in
15106         define)
15107         case "$getprotoent_r_proto" in
15108         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15109         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15110         esac
15111         case "$getprotoent_r_proto" in
15112         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15113         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15114         esac
15115         case "$getprotoent_r_proto" in
15116         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15117         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15118         esac
15119         case "$getprotoent_r_proto" in
15120         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15121         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15122         esac
15123         case "$getprotoent_r_proto" in
15124         ''|0)   d_getprotoent_r=undef
15125                 getprotoent_r_proto=0
15126                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15127         * )     case "$getprotoent_r_proto" in
15128                 REENTRANT_PROTO*) ;;
15129                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15130                 esac
15131                 echo "Prototype: $try" ;;
15132         esac
15133         ;;
15134         *)      case "$usethreads" in
15135                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15136                 esac
15137                 d_getprotoent_r=undef
15138                 getprotoent_r_proto=0
15139                 ;;
15140         esac
15141         ;;
15142 *)      getprotoent_r_proto=0
15143         ;;
15144 esac
15145
15146 : see if prototypes for various getprotoxxx netdb.h functions are available
15147 echo " "
15148 set d_getprotoprotos getprotoent $i_netdb netdb.h
15149 eval $hasproto
15150
15151 : see if getprpwnam exists
15152 set getprpwnam d_getprpwnam
15153 eval $inlibc
15154
15155 : see if getpwent exists
15156 set getpwent d_getpwent
15157 eval $inlibc
15158
15159 : see if getpwent_r exists
15160 set getpwent_r d_getpwent_r
15161 eval $inlibc
15162 case "$d_getpwent_r" in
15163 "$define")
15164         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15165         case "$d_getpwent_r_proto:$usethreads" in
15166         ":define")      d_getpwent_r_proto=define
15167                 set d_getpwent_r_proto getpwent_r $hdrs
15168                 eval $hasproto ;;
15169         *)      ;;
15170         esac
15171         case "$d_getpwent_r_proto" in
15172         define)
15173         case "$getpwent_r_proto" in
15174         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15175         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15176         esac
15177         case "$getpwent_r_proto" in
15178         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15179         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15180         esac
15181         case "$getpwent_r_proto" in
15182         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15183         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15184         esac
15185         case "$getpwent_r_proto" in
15186         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15187         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15188         esac
15189         case "$getpwent_r_proto" in
15190         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15191         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15192         esac
15193         case "$getpwent_r_proto" in
15194         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15195         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15196         esac
15197         case "$getpwent_r_proto" in
15198         ''|0)   d_getpwent_r=undef
15199                 getpwent_r_proto=0
15200                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15201         * )     case "$getpwent_r_proto" in
15202                 REENTRANT_PROTO*) ;;
15203                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15204                 esac
15205                 echo "Prototype: $try" ;;
15206         esac
15207         ;;
15208         *)      case "$usethreads" in
15209                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15210                 esac
15211                 d_getpwent_r=undef
15212                 getpwent_r_proto=0
15213                 ;;
15214         esac
15215         ;;
15216 *)      getpwent_r_proto=0
15217         ;;
15218 esac
15219
15220 : see if getpwnam_r exists
15221 set getpwnam_r d_getpwnam_r
15222 eval $inlibc
15223 case "$d_getpwnam_r" in
15224 "$define")
15225         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15226         case "$d_getpwnam_r_proto:$usethreads" in
15227         ":define")      d_getpwnam_r_proto=define
15228                 set d_getpwnam_r_proto getpwnam_r $hdrs
15229                 eval $hasproto ;;
15230         *)      ;;
15231         esac
15232         case "$d_getpwnam_r_proto" in
15233         define)
15234         case "$getpwnam_r_proto" in
15235         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15236         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15237         esac
15238         case "$getpwnam_r_proto" in
15239         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15240         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15241         esac
15242         case "$getpwnam_r_proto" in
15243         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15244         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15245         esac
15246         case "$getpwnam_r_proto" in
15247         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15248         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15249         esac
15250         case "$getpwnam_r_proto" in
15251         ''|0)   d_getpwnam_r=undef
15252                 getpwnam_r_proto=0
15253                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15254         * )     case "$getpwnam_r_proto" in
15255                 REENTRANT_PROTO*) ;;
15256                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15257                 esac
15258                 echo "Prototype: $try" ;;
15259         esac
15260         ;;
15261         *)      case "$usethreads" in
15262                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15263                 esac
15264                 d_getpwnam_r=undef
15265                 getpwnam_r_proto=0
15266                 ;;
15267         esac
15268         ;;
15269 *)      getpwnam_r_proto=0
15270         ;;
15271 esac
15272
15273 : see if getpwuid_r exists
15274 set getpwuid_r d_getpwuid_r
15275 eval $inlibc
15276 case "$d_getpwuid_r" in
15277 "$define")
15278         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15279         case "$d_getpwuid_r_proto:$usethreads" in
15280         ":define")      d_getpwuid_r_proto=define
15281                 set d_getpwuid_r_proto getpwuid_r $hdrs
15282                 eval $hasproto ;;
15283         *)      ;;
15284         esac
15285         case "$d_getpwuid_r_proto" in
15286         define)
15287         case "$getpwuid_r_proto" in
15288         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15289         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15290         esac
15291         case "$getpwuid_r_proto" in
15292         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15293         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15294         esac
15295         case "$getpwuid_r_proto" in
15296         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15297         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15298         esac
15299         case "$getpwuid_r_proto" in
15300         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15301         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15302         esac
15303         case "$getpwuid_r_proto" in
15304         ''|0)   d_getpwuid_r=undef
15305                 getpwuid_r_proto=0
15306                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15307         * )     case "$getpwuid_r_proto" in
15308                 REENTRANT_PROTO*) ;;
15309                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15310                 esac
15311                 echo "Prototype: $try" ;;
15312         esac
15313         ;;
15314         *)      case "$usethreads" in
15315                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15316                 esac
15317                 d_getpwuid_r=undef
15318                 getpwuid_r_proto=0
15319                 ;;
15320         esac
15321         ;;
15322 *)      getpwuid_r_proto=0
15323         ;;
15324 esac
15325
15326 : Optional checks for getsbyname and getsbyport
15327
15328 : see if getservbyname exists
15329 set getservbyname d_getsbyname
15330 eval $inlibc
15331
15332 : see if getservbyport exists
15333 set getservbyport d_getsbyport
15334 eval $inlibc
15335
15336 : see if getservent exists
15337 set getservent d_getsent
15338 eval $inlibc
15339
15340 : see if getservbyname_r exists
15341 set getservbyname_r d_getservbyname_r
15342 eval $inlibc
15343 case "$d_getservbyname_r" in
15344 "$define")
15345         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15346         case "$d_getservbyname_r_proto:$usethreads" in
15347         ":define")      d_getservbyname_r_proto=define
15348                 set d_getservbyname_r_proto getservbyname_r $hdrs
15349                 eval $hasproto ;;
15350         *)      ;;
15351         esac
15352         case "$d_getservbyname_r_proto" in
15353         define)
15354         case "$getservbyname_r_proto" in
15355         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15356         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15357         esac
15358         case "$getservbyname_r_proto" in
15359         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15360         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15361         esac
15362         case "$getservbyname_r_proto" in
15363         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15364         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15365         esac
15366         case "$getservbyname_r_proto" in
15367         ''|0)   d_getservbyname_r=undef
15368                 getservbyname_r_proto=0
15369                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15370         * )     case "$getservbyname_r_proto" in
15371                 REENTRANT_PROTO*) ;;
15372                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15373                 esac
15374                 echo "Prototype: $try" ;;
15375         esac
15376         ;;
15377         *)      case "$usethreads" in
15378                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15379                 esac
15380                 d_getservbyname_r=undef
15381                 getservbyname_r_proto=0
15382                 ;;
15383         esac
15384         ;;
15385 *)      getservbyname_r_proto=0
15386         ;;
15387 esac
15388
15389 : see if getservbyport_r exists
15390 set getservbyport_r d_getservbyport_r
15391 eval $inlibc
15392 case "$d_getservbyport_r" in
15393 "$define")
15394         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15395         case "$d_getservbyport_r_proto:$usethreads" in
15396         ":define")      d_getservbyport_r_proto=define
15397                 set d_getservbyport_r_proto getservbyport_r $hdrs
15398                 eval $hasproto ;;
15399         *)      ;;
15400         esac
15401         case "$d_getservbyport_r_proto" in
15402         define)
15403         case "$getservbyport_r_proto" in
15404         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15405         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15406         esac
15407         case "$getservbyport_r_proto" in
15408         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15409         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15410         esac
15411         case "$getservbyport_r_proto" in
15412         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15413         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15414         esac
15415         case "$getservbyport_r_proto" in
15416         ''|0)   d_getservbyport_r=undef
15417                 getservbyport_r_proto=0
15418                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15419         * )     case "$getservbyport_r_proto" in
15420                 REENTRANT_PROTO*) ;;
15421                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15422                 esac
15423                 echo "Prototype: $try" ;;
15424         esac
15425         ;;
15426         *)      case "$usethreads" in
15427                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15428                 esac
15429                 d_getservbyport_r=undef
15430                 getservbyport_r_proto=0
15431                 ;;
15432         esac
15433         ;;
15434 *)      getservbyport_r_proto=0
15435         ;;
15436 esac
15437
15438 : see if getservent_r exists
15439 set getservent_r d_getservent_r
15440 eval $inlibc
15441 case "$d_getservent_r" in
15442 "$define")
15443         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15444         case "$d_getservent_r_proto:$usethreads" in
15445         ":define")      d_getservent_r_proto=define
15446                 set d_getservent_r_proto getservent_r $hdrs
15447                 eval $hasproto ;;
15448         *)      ;;
15449         esac
15450         case "$d_getservent_r_proto" in
15451         define)
15452         case "$getservent_r_proto" in
15453         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15454         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15455         esac
15456         case "$getservent_r_proto" in
15457         ''|0) try='int getservent_r(struct servent*, char*, int);'
15458         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15459         esac
15460         case "$getservent_r_proto" in
15461         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15462         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15463         esac
15464         case "$getservent_r_proto" in
15465         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15466         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15467         esac
15468         case "$getservent_r_proto" in
15469         ''|0)   d_getservent_r=undef
15470                 getservent_r_proto=0
15471                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15472         * )     case "$getservent_r_proto" in
15473                 REENTRANT_PROTO*) ;;
15474                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15475                 esac
15476                 echo "Prototype: $try" ;;
15477         esac
15478         ;;
15479         *)      case "$usethreads" in
15480                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15481                 esac
15482                 d_getservent_r=undef
15483                 getservent_r_proto=0
15484                 ;;
15485         esac
15486         ;;
15487 *)      getservent_r_proto=0
15488         ;;
15489 esac
15490
15491 : see if prototypes for various getservxxx netdb.h functions are available
15492 echo " "
15493 set d_getservprotos getservent $i_netdb netdb.h
15494 eval $hasproto
15495
15496 : see if getspnam exists
15497 set getspnam d_getspnam
15498 eval $inlibc
15499
15500 : see if this is a shadow.h system
15501 set shadow.h i_shadow
15502 eval $inhdr
15503
15504 : see if getspnam_r exists
15505 set getspnam_r d_getspnam_r
15506 eval $inlibc
15507 case "$d_getspnam_r" in
15508 "$define")
15509         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15510         case "$d_getspnam_r_proto:$usethreads" in
15511         ":define")      d_getspnam_r_proto=define
15512                 set d_getspnam_r_proto getspnam_r $hdrs
15513                 eval $hasproto ;;
15514         *)      ;;
15515         esac
15516         case "$d_getspnam_r_proto" in
15517         define)
15518         case "$getspnam_r_proto" in
15519         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15520         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15521         esac
15522         case "$getspnam_r_proto" in
15523         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15524         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15525         esac
15526         case "$getspnam_r_proto" in
15527         ''|0)   d_getspnam_r=undef
15528                 getspnam_r_proto=0
15529                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15530         * )     case "$getspnam_r_proto" in
15531                 REENTRANT_PROTO*) ;;
15532                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15533                 esac
15534                 echo "Prototype: $try" ;;
15535         esac
15536         ;;
15537         *)      case "$usethreads" in
15538                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15539                 esac
15540                 d_getspnam_r=undef
15541                 getspnam_r_proto=0
15542                 ;;
15543         esac
15544         ;;
15545 *)      getspnam_r_proto=0
15546         ;;
15547 esac
15548
15549 : see if gettimeofday or ftime exists
15550 set gettimeofday d_gettimeod
15551 eval $inlibc
15552 case "$d_gettimeod" in
15553 "$undef")
15554         set ftime d_ftime 
15555         eval $inlibc
15556         ;;
15557 *)
15558         val="$undef"; set d_ftime; eval $setvar
15559         ;;
15560 esac
15561 case "$d_gettimeod$d_ftime" in
15562 "$undef$undef")
15563         echo " "
15564         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15565         ;;
15566 esac
15567
15568 : see if gmtime_r exists
15569 set gmtime_r d_gmtime_r
15570 eval $inlibc
15571 case "$d_gmtime_r" in
15572 "$define")
15573         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15574         case "$d_gmtime_r_proto:$usethreads" in
15575         ":define")      d_gmtime_r_proto=define
15576                 set d_gmtime_r_proto gmtime_r $hdrs
15577                 eval $hasproto ;;
15578         *)      ;;
15579         esac
15580         case "$d_gmtime_r_proto" in
15581         define)
15582         case "$gmtime_r_proto" in
15583         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15584         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15585         esac
15586         case "$gmtime_r_proto" in
15587         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15588         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15589         esac
15590         case "$gmtime_r_proto" in
15591         ''|0)   d_gmtime_r=undef
15592                 gmtime_r_proto=0
15593                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15594         * )     case "$gmtime_r_proto" in
15595                 REENTRANT_PROTO*) ;;
15596                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15597                 esac
15598                 echo "Prototype: $try" ;;
15599         esac
15600         ;;
15601         *)      case "$usethreads" in
15602                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15603                 esac
15604                 d_gmtime_r=undef
15605                 gmtime_r_proto=0
15606                 ;;
15607         esac
15608         ;;
15609 *)      gmtime_r_proto=0
15610         ;;
15611 esac
15612
15613 : see if hasmntopt exists
15614 set hasmntopt d_hasmntopt
15615 eval $inlibc
15616
15617 : see if this is a netinet/in.h or sys/in.h system
15618 set netinet/in.h i_niin sys/in.h i_sysin
15619 eval $inhdr
15620
15621 : see if arpa/inet.h has to be included
15622 set arpa/inet.h i_arpainet
15623 eval $inhdr
15624
15625 : see if htonl --and friends-- exists
15626 val=''
15627 set htonl val
15628 eval $inlibc
15629
15630 : Maybe they are macros.
15631 case "$val" in
15632 $undef)
15633         $cat >htonl.c <<EOM
15634 #include <stdio.h>
15635 #include <sys/types.h>
15636 #$i_niin I_NETINET_IN
15637 #$i_sysin I_SYS_IN
15638 #$i_arpainet I_ARPA_INET
15639 #ifdef I_NETINET_IN
15640 #include <netinet/in.h>
15641 #endif
15642 #ifdef I_SYS_IN
15643 #include <sys/in.h>
15644 #endif
15645 #ifdef I_ARPA_INET
15646 #include <arpa/inet.h>
15647 #endif
15648 #ifdef htonl
15649 printf("Defined as a macro.");
15650 #endif
15651 EOM
15652         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15653         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15654                 val="$define"
15655                 echo "But it seems to be defined as a macro." >&4
15656         fi
15657         $rm -f htonl.?
15658         ;;
15659 esac
15660 set d_htonl
15661 eval $setvar
15662
15663 : see if hypot exists
15664 set hypot d_hypot
15665 eval $inlibc
15666
15667 : see if ilogb exists
15668 set ilogb d_ilogb
15669 eval $inlibc
15670
15671 : see if ilogbl exists
15672 set ilogbl d_ilogbl
15673 eval $inlibc
15674
15675 : check whether inet_aton exists
15676 set inet_aton d_inetaton
15677 eval $inlibc
15678
15679 : see if inet_ntop exists
15680 set inet_ntop d_inetntop
15681 eval $inlibc
15682
15683 : see if inet_pton exists
15684 set inet_pton d_inetpton
15685 eval $inlibc
15686
15687 : Look for isascii
15688 echo " "
15689 $cat >isascii.c <<EOCP
15690 #include <stdio.h>
15691 #include <ctype.h>
15692 #$i_stdlib I_STDLIB
15693 #ifdef I_STDLIB
15694 #include <stdlib.h>
15695 #endif
15696 int main() {
15697         int c = 'A';
15698         if (isascii(c))
15699                 exit(0);
15700         else
15701                 exit(1);
15702 }
15703 EOCP
15704 set isascii
15705 if eval $compile; then
15706         echo "isascii() found." >&4
15707         val="$define"
15708 else
15709         echo "isascii() NOT found." >&4
15710         val="$undef"
15711 fi
15712 set d_isascii
15713 eval $setvar
15714 $rm -f isascii*
15715
15716 : Look for isblank
15717 echo " "
15718 $cat >isblank.c <<'EOCP'
15719 #include <stdio.h>
15720 #include <ctype.h>
15721 int main() {
15722         int c = ' ';
15723         if (isblank(c))
15724                 return 0 ;
15725         else
15726                 return 1 ;
15727 }
15728 EOCP
15729 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15730         echo "isblank() found." >&4
15731         val="$define"
15732 else
15733         echo "isblank() NOT found." >&4
15734         val="$undef"
15735 fi
15736 set d_isblank
15737 eval $setvar
15738 $rm -f isblank*
15739
15740 : check for isfinite
15741 echo "Checking to see if you have isfinite..." >&4
15742 $cat >try.c <<EOCP
15743 #include <math.h>
15744 int main() { return isfinite(0.0); }
15745 EOCP
15746 set try
15747 if eval $compile; then
15748         val="$define"
15749         echo "You have isfinite."
15750 else
15751         val="$undef"
15752         echo "You do not have isfinite."
15753 fi
15754 $rm_try
15755 set d_isfinite
15756 eval $setvar
15757
15758 : see if isfinitel exists
15759 set isfinitel d_isfinitel
15760 eval $inlibc
15761
15762 : check for isinf
15763 echo "Checking to see if you have isinf..." >&4
15764 $cat >try.c <<EOCP
15765 #include <math.h>
15766 int main() { return isinf(0.0); }
15767 EOCP
15768 set try
15769 if eval $compile; then
15770         val="$define"
15771         echo "You have isinf."
15772 else
15773         val="$undef"
15774         echo "You do not have isinf."
15775 fi
15776 $rm_try
15777 set d_isinf
15778 eval $setvar
15779
15780 : see if isinfl exists
15781 set isinfl d_isinfl
15782 eval $inlibc
15783
15784 : check for isless
15785 echo "Checking to see if you have isless..." >&4
15786 $cat >try.c <<EOCP
15787 #include <math.h>
15788 int main() { return isless(0.0); }
15789 EOCP
15790 set try
15791 if eval $compile; then
15792         val="$define"
15793         echo "You have isless."
15794 else
15795         val="$undef"
15796         echo "You do not have isless."
15797 fi
15798 $rm_try
15799 set d_isless
15800 eval $setvar
15801
15802 : check for isnan
15803 echo "Checking to see if you have isnan..." >&4
15804 $cat >try.c <<EOCP
15805 #include <math.h>
15806 int main() { return isnan(0.0); }
15807 EOCP
15808 set try
15809 if eval $compile; then
15810         val="$define"
15811         echo "You have isnan."
15812 else
15813         val="$undef"
15814         echo "You do not have isnan."
15815 fi
15816 $rm_try
15817 set d_isnan
15818 eval $setvar
15819
15820 : see if isnanl exists
15821 set isnanl d_isnanl
15822 eval $inlibc
15823
15824 : check for isnormal
15825 echo "Checking to see if you have isnormal..." >&4
15826 $cat >try.c <<EOCP
15827 #include <math.h>
15828 int main() { return isnormal(0.0); }
15829 EOCP
15830 set try
15831 if eval $compile; then
15832         val="$define"
15833         echo "You have isnormal."
15834 else
15835         val="$undef"
15836         echo "You do not have isnormal."
15837 fi
15838 $rm_try
15839 set d_isnormal
15840 eval $setvar
15841
15842 : see if j0 exists
15843 set j0 d_j0
15844 eval $inlibc
15845
15846 : see if j0l exists
15847 set j0l d_j0l
15848 eval $inlibc
15849
15850 : see if killpg exists
15851 set killpg d_killpg
15852 eval $inlibc
15853
15854 : see if localeconv exists
15855 set localeconv d_locconv
15856 eval $inlibc
15857
15858 : see if libc has the POSIX.1-2008 currency locale rules
15859 case "$d_locconv:$d_lc_monetary_2008" in
15860 $define:)
15861         $cat >try.c <<EOCP
15862 #include <locale.h>
15863 int main() {
15864         struct lconv *lc = localeconv();
15865         char int_p_cs_precedes = lc->int_p_cs_precedes;
15866         return 0;
15867 }
15868 EOCP
15869         set try
15870         if eval $compile; then
15871                 d_lc_monetary_2008="$define"
15872         else
15873                 d_lc_monetary_2008="$undef"
15874         fi;
15875         $rm_try
15876         ;;
15877 esac
15878
15879 : see if lchown exists
15880 echo " "
15881 $cat > try.c <<'EOCP'
15882 /* System header to define __stub macros and hopefully few prototypes,
15883     which can conflict with char lchown(); below.  */
15884 #include <assert.h>
15885 /* Override any gcc2 internal prototype to avoid an error.  */
15886 /* We use char because int might match the return type of a gcc2
15887    builtin and then its argument prototype would still apply.  */
15888 char lchown();
15889 int main() {
15890     /*  The GNU C library defines this for functions which it implements
15891         to always fail with ENOSYS.  Some functions are actually named
15892         something starting with __ and the normal name is an alias.  */
15893 #if defined (__stub_lchown) || defined (__stub___lchown)
15894 choke me
15895 #else
15896 lchown();
15897 #endif
15898 ; return 0; }
15899 EOCP
15900 set try
15901 if eval $compile; then
15902     $echo "lchown() found." >&4
15903     val="$define"
15904 else
15905     $echo "lchown() NOT found." >&4
15906     val="$undef"
15907 fi
15908 set d_lchown
15909 eval $setvar
15910
15911 : See if number of significant digits in a double precision number is known
15912 echo " "
15913 $cat >ldbl_dig.c <<EOM
15914 #include <limits.h>
15915 #include <float.h>
15916 #ifdef LDBL_DIG
15917 printf("Contains LDBL_DIG");
15918 #endif
15919 EOM
15920 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15921 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15922         echo "LDBL_DIG found." >&4
15923         val="$define"
15924 else
15925         echo "LDBL_DIG NOT found." >&4
15926         val="$undef"
15927 fi
15928 $rm -f ldbl_dig.?
15929 set d_ldbl_dig
15930 eval $setvar
15931
15932 : see if lgamma exists
15933 set lgamma d_lgamma
15934 eval $inlibc
15935
15936 : see if lgamma_r exists
15937 set lgamma_r d_lgamma_r
15938 eval $inlibc
15939
15940 : check to see if math.h defines _LIB_VERSION
15941 d_libm_lib_version="$undef"
15942 echo " "
15943 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15944 $cat >try.c <<EOCP
15945 #include <unistd.h>
15946 #include <math.h>
15947 int main (int argc, char *argv[])
15948 {
15949     printf ("%d\n", _LIB_VERSION);
15950     return (0);
15951     } /* main */
15952 EOCP
15953 set try
15954 if eval $compile; then
15955     foo=`$run ./try`
15956     echo "Yes, it does ($foo)" >&4
15957     d_libm_lib_version="$define"
15958 else
15959     echo "No, it does not (probably harmless)" >&4
15960     fi
15961 $rm_try
15962
15963 : see if link exists
15964 set link d_link
15965 eval $inlibc
15966
15967 : see if llrint exists
15968 set llrint d_llrint
15969 eval $inlibc
15970
15971 : see if llrintl exists
15972 set llrintl d_llrintl
15973 eval $inlibc
15974
15975 : see if llround exists
15976 set llround d_llround
15977 eval $inlibc
15978
15979 : see if llroundl exists
15980 set llroundl d_llroundl
15981 eval $inlibc
15982
15983 : see if localeconv_l exists
15984 set localeconv_l d_localeconv_l
15985 eval $inlibc
15986
15987 : see if localtime_r exists
15988 set localtime_r d_localtime_r
15989 eval $inlibc
15990 case "$d_localtime_r" in
15991 "$define")
15992         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15993         case "$d_localtime_r_proto:$usethreads" in
15994         ":define")      d_localtime_r_proto=define
15995                 set d_localtime_r_proto localtime_r $hdrs
15996                 eval $hasproto ;;
15997         *)      ;;
15998         esac
15999         case "$d_localtime_r_proto" in
16000         define)
16001         case "$localtime_r_proto" in
16002         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16003         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16004         esac
16005         case "$localtime_r_proto" in
16006         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16007         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16008         esac
16009         case "$localtime_r_proto" in
16010         ''|0)   d_localtime_r=undef
16011                 localtime_r_proto=0
16012                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16013         * )     case "$localtime_r_proto" in
16014                 REENTRANT_PROTO*) ;;
16015                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16016                 esac
16017                 echo "Prototype: $try" ;;
16018         esac
16019         ;;
16020         *)      case "$usethreads" in
16021                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16022                 esac
16023                 d_localtime_r=undef
16024                 localtime_r_proto=0
16025                 ;;
16026         esac
16027         ;;
16028 *)      localtime_r_proto=0
16029         ;;
16030 esac
16031
16032 : see if localtime_r calls tzset
16033 case "$localtime_r_proto" in
16034 REENTRANT_PROTO*)
16035         $cat >try.c <<EOCP
16036 /*  Does our libc's localtime_r call tzset ?
16037  *  return 0 if so, 1 otherwise.
16038  */
16039 #$i_systypes    I_SYS_TYPES
16040 #$i_unistd      I_UNISTD
16041 #$i_time        I_TIME
16042 #$i_stdlib      I_STDLIB
16043 #$i_malloc      I_MALLOC
16044 #ifdef I_SYS_TYPES
16045 #  include <sys/types.h>
16046 #endif
16047 #ifdef I_UNISTD
16048 #  include <unistd.h>
16049 #endif
16050 #ifdef I_TIME
16051 #  include <time.h>
16052 #endif
16053 #ifdef I_STDLIB
16054 #include <stdlib.h>
16055 #endif
16056 #include <string.h>
16057 #ifdef I_MALLOC
16058 #  include <malloc.h>
16059 #endif
16060 int main()
16061 {
16062     time_t t = time(0L);
16063     char w_tz[]="TZ" "=GMT+5",
16064          e_tz[]="TZ" "=GMT-5",
16065         *tz_e = (char*)malloc(16),
16066         *tz_w = (char*)malloc(16);
16067     struct tm tm_e, tm_w;
16068     memset(&tm_e,'\0',sizeof(struct tm));
16069     memset(&tm_w,'\0',sizeof(struct tm));
16070     strcpy(tz_e,e_tz);
16071     strcpy(tz_w,w_tz);
16072
16073     putenv(tz_e);
16074     localtime_r(&t, &tm_e);
16075
16076     putenv(tz_w);
16077     localtime_r(&t, &tm_w);
16078
16079     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16080         return 1;
16081     return 0;
16082 }
16083 EOCP
16084         set try
16085         if eval $compile; then
16086             if $run ./try; then
16087                 d_localtime_r_needs_tzset=undef;
16088             else
16089                 d_localtime_r_needs_tzset=define;
16090             fi;
16091         else
16092             d_localtime_r_needs_tzset=undef;
16093         fi;
16094      ;;
16095   *)
16096      d_localtime_r_needs_tzset=undef;
16097      ;;
16098 esac
16099 $rm_try
16100
16101 : see if lockf exists
16102 set lockf d_lockf
16103 eval $inlibc
16104
16105 : see if log1p exists
16106 set log1p d_log1p
16107 eval $inlibc
16108
16109 : see if log2 exists
16110 set log2 d_log2
16111 eval $inlibc
16112
16113 : see if logb exists
16114 set logb d_logb
16115 eval $inlibc
16116
16117 : see if lrint exists
16118 set lrint d_lrint
16119 eval $inlibc
16120
16121 : see if lrintl exists
16122 set lrintl d_lrintl
16123 eval $inlibc
16124
16125 : see if lround exists
16126 set lround d_lround
16127 eval $inlibc
16128
16129 : see if lroundl exists
16130 set lroundl d_lroundl
16131 eval $inlibc
16132
16133 : see if prototype for lseek is available
16134 echo " "
16135 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16136 eval $hasproto
16137
16138 : see if lstat exists
16139 set lstat d_lstat
16140 eval $inlibc
16141
16142 : see if madvise exists
16143 set madvise d_madvise
16144 eval $inlibc
16145
16146 : see if malloc_size exists
16147 set malloc_size d_malloc_size
16148 eval $inlibc
16149
16150 : see if malloc_size_good exists
16151 set malloc_good_size d_malloc_good_size
16152 eval $inlibc
16153
16154 : see if malloc_usable_size exists
16155 set malloc_usable_size d_malloc_usable_size
16156 eval $inlibc
16157
16158 : see if mblen exists
16159 set mblen d_mblen
16160 eval $inlibc
16161
16162 : see if mbrlen exists
16163 set mbrlen d_mbrlen
16164 eval $inlibc
16165
16166 : see if mbrtowc exists
16167 set mbrtowc d_mbrtowc
16168 eval $inlibc
16169
16170 : see if mbstowcs exists
16171 set mbstowcs d_mbstowcs
16172 eval $inlibc
16173
16174 : see if mbtowc exists
16175 set mbtowc d_mbtowc
16176 eval $inlibc
16177
16178 : see if memmem exists
16179 : We need both a prototype in string.h and the symbol in libc.
16180 echo " "
16181 d_memmem_proto=''
16182 xx1="#$d_gnulibc HAS_GNULIBC"
16183 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16184 xx3='#   define _GNU_SOURCE'
16185 xx4='#endif'
16186 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16187 eval $hasproto
16188 case "$d_memmem_proto" in
16189     define) # see if memmem exists
16190         set memmem d_memmem
16191         eval $inlibc
16192         ;;
16193     *)  val=$undef
16194         set d_memmem
16195         eval $setvar
16196         ;;
16197 esac
16198
16199 : see if memrchr exists
16200 : We need both a prototype in string.h and the symbol in libc.
16201 echo " "
16202 d_memrchr_proto=''
16203 xx1="#$d_gnulibc HAS_GNULIBC"
16204 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16205 xx3='#   define _GNU_SOURCE'
16206 xx4='#endif'
16207 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16208 eval $hasproto
16209 case "$d_memrchr_proto" in
16210     define) # see if memrchr exists
16211         set memrchr d_memrchr
16212         eval $inlibc
16213         ;;
16214     *)  val=$undef
16215         set d_memrchr
16216         eval $setvar
16217         ;;
16218 esac
16219
16220 : see if mkdir exists
16221 set mkdir d_mkdir
16222 eval $inlibc
16223
16224 : see if mkdtemp exists
16225 set mkdtemp d_mkdtemp
16226 eval $inlibc
16227
16228 : see if mkfifo exists
16229 set mkfifo d_mkfifo
16230 eval $inlibc
16231
16232 : see if mkostemp exists
16233 set mkostemp d_mkostemp
16234 eval $inlibc
16235
16236 : see if mkstemp exists
16237 set mkstemp d_mkstemp
16238 eval $inlibc
16239
16240 : see if mkstemps exists
16241 set mkstemps d_mkstemps
16242 eval $inlibc
16243
16244 : see if mktime exists
16245 set mktime d_mktime
16246 eval $inlibc
16247
16248 : see if sys/mman.h has to be included
16249 set sys/mman.h i_sysmman
16250 eval $inhdr
16251
16252 : see if mmap exists
16253 set mmap d_mmap
16254 eval $inlibc
16255 : see what shmat returns
16256 : default to something harmless
16257 mmaptype='void *'
16258 case "$i_sysmman$d_mmap" in
16259 "$define$define")
16260         $cat >mmap.c <<'END'
16261 #include <sys/mman.h>
16262 void *mmap();
16263 END
16264         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16265                 mmaptype='void *'
16266         else
16267                 mmaptype='caddr_t'
16268         fi
16269         echo "and it returns ($mmaptype)." >&4
16270         ;;
16271 esac
16272
16273 : see if sqrtl exists
16274 set sqrtl d_sqrtl
16275 eval $inlibc
16276
16277 : see if scalbnl exists
16278 set scalbnl d_scalbnl
16279 eval $inlibc
16280
16281 : see if truncl exists
16282 set truncl d_truncl
16283 eval $inlibc
16284
16285 : see if modfl exists
16286 set modfl d_modfl
16287 eval $inlibc
16288
16289 : see if prototype for modfl is available
16290 echo " "
16291 set d_modflproto modfl define math.h
16292 eval $hasproto
16293
16294 if $test "$uselongdouble" = "$define"; then
16295     message=""
16296     if $test "$d_sqrtl" != "$define"; then
16297         message="$message sqrtl"
16298     fi
16299     if $test "$d_modfl" != "$define"; then
16300         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16301             echo "You have both truncl and copysignl, so I can emulate modfl."
16302         else
16303             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16304                 echo "You have both aintl and copysignl, so I can emulate modfl."
16305             else
16306                 message="$message modfl"
16307             fi
16308         fi
16309     fi
16310     if $test "$d_frexpl" != "$define"; then
16311         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16312             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16313         else
16314             message="$message frexpl"
16315         fi
16316     fi
16317     if $test "$d_ldexpl" != "$define"; then
16318         message="$message ldexpl"
16319     fi
16320
16321     if $test "$message" != ""; then
16322         $cat <<EOM >&4
16323
16324 *** You requested the use of long doubles but you do not seem to have
16325 *** the following mathematical functions needed for long double support:
16326 ***    $message
16327 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16328 *** Cannot continue, aborting.
16329
16330 EOM
16331
16332         exit 1
16333     fi
16334 fi
16335
16336 : see if mprotect exists
16337 set mprotect d_mprotect
16338 eval $inlibc
16339
16340 : see if msgctl exists
16341 set msgctl d_msgctl
16342 eval $inlibc
16343
16344 : see if msgget exists
16345 set msgget d_msgget
16346 eval $inlibc
16347
16348 : see if msgsnd exists
16349 set msgsnd d_msgsnd
16350 eval $inlibc
16351
16352 : see if msgrcv exists
16353 set msgrcv d_msgrcv
16354 eval $inlibc
16355
16356 : see how much of the 'msg*(2)' library is present.
16357 h_msg=true
16358 echo " "
16359 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16360 *"$undef"*) h_msg=false;;
16361 esac
16362 case "$osname" in
16363 freebsd)
16364     case "`ipcs 2>&1`" in
16365     "SVID messages"*"not configured"*)
16366         echo "Your $osname does not have the msg*(2) configured." >&4
16367         h_msg=false
16368         val="$undef"
16369         set msgctl d_msgctl
16370         eval $setvar
16371         set msgget d_msgget
16372         eval $setvar
16373         set msgsnd d_msgsnd
16374         eval $setvar
16375         set msgrcv d_msgrcv
16376         eval $setvar
16377         ;;
16378     esac
16379     ;;
16380 esac
16381 : we could also check for sys/ipc.h ...
16382 if $h_msg && $test `./findhdr sys/msg.h`; then
16383         echo "You have the full msg*(2) library." >&4
16384         val="$define"
16385 else
16386         echo "You don't have the full msg*(2) library." >&4
16387         val="$undef"
16388 fi
16389 set d_msg
16390 eval $setvar
16391
16392 : Check for msghdr_s
16393 echo " "
16394 echo "Checking to see if your system supports struct msghdr..." >&4
16395 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16396 eval $hasstruct
16397 case "$d_msghdr_s" in
16398 "$define")      echo "Yes, it does."   ;;
16399 *)              echo "No, it doesn't." ;;
16400 esac
16401
16402 : see if msync exists
16403 set msync d_msync
16404 eval $inlibc
16405
16406 : see if munmap exists
16407 set munmap d_munmap
16408 eval $inlibc
16409
16410 : see if nan exists
16411 set nan d_nan
16412 eval $inlibc
16413
16414 : see if nanosleep exists
16415 set nanosleep d_nanosleep
16416 eval $inlibc
16417
16418 : see if nearbyint exists
16419 set nearbyint d_nearbyint
16420 eval $inlibc
16421
16422 : see if nextafter exists
16423 set nextafter d_nextafter
16424 eval $inlibc
16425
16426 : see if nexttoward exists
16427 set nexttoward d_nexttoward
16428 eval $inlibc
16429
16430 : see if nice exists
16431 set nice d_nice
16432 eval $inlibc
16433
16434 : see if this is a langinfo.h system
16435 set langinfo.h i_langinfo
16436 eval $inhdr
16437
16438 : see if nl_langinfo exists
16439 set nl_langinfo d_nl_langinfo
16440 eval $inlibc
16441
16442 : see if this is a quadmath.h system
16443 set quadmath.h i_quadmath
16444 eval $inhdr
16445
16446 : Check basic sizes
16447 echo " "
16448 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16449
16450 case "$use64bitint:$d_quad:$quadtype" in
16451 define:define:?*)
16452         ivtype="$quadtype"
16453         uvtype="$uquadtype"
16454         ivsize=8
16455         uvsize=8
16456         ;;
16457 *)      ivtype="long"
16458         uvtype="unsigned long"
16459         ivsize=$longsize
16460         uvsize=$longsize
16461         ;;
16462 esac
16463
16464 case "$uselongdouble:$d_longdbl" in
16465 define:define)
16466         nvtype="long double"
16467         nvsize=$longdblsize
16468         ;;
16469 *)      nvtype=double
16470         nvsize=$doublesize
16471         ;;
16472 esac
16473
16474 case "$usequadmath:$i_quadmath" in
16475 define:define)
16476   nvtype="__float128"
16477   nvsize=16
16478   case "$libs" in
16479   *quadmath*) ;;
16480   *) $cat <<EOM >&4
16481
16482 *** You requested the use of the quadmath library, but you
16483 *** do not seem to have the quadmath library installed.
16484 *** Cannot continue, aborting.
16485 EOM
16486     exit 1
16487     ;;
16488   esac
16489   ;;
16490 define:*) $cat <<EOM >&4
16491
16492 *** You requested the use of the quadmath library, but you
16493 *** do not seem to have the required header, <quadmath.h>.
16494 EOM
16495   case "$gccversion" in
16496   [23].*|4.[0-5]*)
16497    $cat <<EOM >&4
16498 *** Your gcc looks a bit old:
16499 *** $gccversion
16500 EOM
16501     ;;
16502   '')
16503    $cat <<EOM >&4
16504 *** You are not running a gcc.
16505 EOM
16506     ;;
16507   esac
16508   $cat <<EOM >&4
16509 *** For the quadmath library you need at least gcc 4.6.
16510 *** Cannot continue, aborting.
16511 EOM
16512   exit 1
16513   ;;
16514 esac
16515
16516 $echo "(IV will be "$ivtype", $ivsize bytes)"
16517 $echo "(UV will be "$uvtype", $uvsize bytes)"
16518 $echo "(NV will be "$nvtype", $nvsize bytes)"
16519
16520 $cat >try.c <<EOCP
16521 #$i_inttypes I_INTTYPES
16522 #ifdef I_INTTYPES
16523 #include <inttypes.h>
16524 #endif
16525 #include <stdio.h>
16526 int main() {
16527 #ifdef INT8
16528    int8_t i =  INT8_MAX;
16529   uint8_t u = UINT8_MAX;
16530   printf("int8_t\n");
16531 #endif
16532 #ifdef INT16
16533    int16_t i =  INT16_MAX;
16534   uint16_t u = UINT16_MAX;
16535   printf("int16_t\n");
16536 #endif
16537 #ifdef INT32
16538    int32_t i =  INT32_MAX;
16539   uint32_t u = UINT32_MAX;
16540   printf("int32_t\n");
16541 #endif
16542 }
16543 EOCP
16544
16545 i8type="signed char"
16546 u8type="unsigned char"
16547 i8size=1
16548 u8size=1
16549
16550 case "$i16type" in
16551 '')     case "$shortsize" in
16552         2)      i16type=short
16553                 u16type="unsigned short"
16554                 i16size=$shortsize
16555                 u16size=$shortsize
16556                 ;;
16557         esac
16558         ;;
16559 esac
16560 case "$i16type" in
16561 '')     set try -DINT16
16562         if eval $compile; then
16563                 case "`$run ./try`" in
16564                 int16_t)
16565                         i16type=int16_t
16566                         u16type=uint16_t
16567                         i16size=2
16568                         u16size=2
16569                         ;;
16570                 esac
16571         fi
16572         ;;
16573 esac
16574 case "$i16type" in
16575 '')     if $test $shortsize -ge 2; then
16576                 i16type=short
16577                 u16type="unsigned short"
16578                 i16size=$shortsize
16579                 u16size=$shortsize
16580         fi
16581         ;;
16582 esac
16583
16584 case "$i32type" in
16585 '')     case "$longsize" in
16586         4)      i32type=long
16587                 u32type="unsigned long"
16588                 i32size=$longsize
16589                 u32size=$longsize
16590                 ;;
16591         *)      case "$intsize" in
16592                 4)      i32type=int
16593                         u32type="unsigned int"
16594                         i32size=$intsize
16595                         u32size=$intsize
16596                         ;;
16597                 esac
16598                 ;;
16599         esac
16600         ;;
16601 esac
16602 case "$i32type" in
16603 '')     set try -DINT32
16604         if eval $compile; then
16605                 case "`$run ./try`" in
16606                 int32_t)
16607                         i32type=int32_t
16608                         u32type=uint32_t
16609                         i32size=4
16610                         u32size=4
16611                         ;;
16612                 esac
16613         fi
16614         ;;
16615 esac
16616 case "$i32type" in
16617 '')     if $test $intsize -ge 4; then
16618                 i32type=int
16619                 u32type="unsigned int"
16620                 i32size=$intsize
16621                 u32size=$intsize
16622         fi
16623         ;;
16624 esac
16625
16626 case "$i64type" in
16627 '')     case "$d_quad:$quadtype" in
16628         define:?*)
16629                 i64type="$quadtype"
16630                 u64type="$uquadtype"
16631                 i64size=8
16632                 u64size=8
16633                 ;;
16634         esac
16635         ;;
16636 esac
16637
16638 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16639 $cat <<EOP >try.c
16640 #include <stdio.h>
16641 #$i_stdlib I_STDLIB
16642 #ifdef I_STDLIB
16643 #include <stdlib.h>
16644 #endif
16645 #include <sys/types.h>
16646 #include <signal.h>
16647 #ifdef SIGFPE
16648 /* volatile so that the compiler has to store it out to memory */
16649 volatile int bletched = 0;
16650 $signal_t blech(int s) { bletched = 1; }
16651 #endif
16652 int main() {
16653     $uvtype u = 0;
16654     $nvtype d;
16655     int     n = 8 * $uvsize;
16656     int     i;
16657 #ifdef SIGFPE
16658     signal(SIGFPE, blech);
16659 #endif
16660
16661     for (i = 0; i < n; i++) {
16662       u = u << 1 | ($uvtype)1;
16663       d = ($nvtype)u;
16664       if (($uvtype)d != u)
16665         break;
16666       if (d <= 0)
16667         break;
16668       d = ($nvtype)(u - 1);
16669       if (($uvtype)d != (u - 1))
16670         break;
16671 #ifdef SIGFPE
16672       if (bletched)
16673         break;
16674 #endif
16675     }
16676     printf("%d\n", ((i == n) ? -n : i));
16677     exit(0);
16678 }
16679 EOP
16680 set try
16681
16682 d_nv_preserves_uv="$undef"
16683 if eval $compile; then
16684         nv_preserves_uv_bits="`$run ./try`"
16685 fi
16686 case "$nv_preserves_uv_bits" in
16687 \-[1-9]*)
16688         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16689         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16690         d_nv_preserves_uv="$define"
16691         ;;
16692 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16693         d_nv_preserves_uv="$undef" ;;
16694 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16695         nv_preserves_uv_bits="0" ;;
16696 esac
16697 $rm_try
16698
16699 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16700 $cat <<EOP >try.c
16701 #include <stdio.h>
16702
16703 typedef $nvtype NV;
16704
16705 int
16706 main() {
16707   NV value = 2;
16708   int count = 1;
16709
16710   while(count < 256) {
16711     /* volatile so that the compiler has to store it out to memory */
16712     volatile NV up = value + 1.0;
16713     volatile NV negated = -value;
16714     volatile NV down = negated - 1.0;
16715     volatile NV got_up = up - value;
16716     int up_good = got_up == 1.0;
16717     int got_down = down - negated;
16718     int down_good = got_down == -1.0;
16719
16720     if (down_good != up_good) {
16721       fprintf(stderr,
16722               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16723               up_good, (double) got_up, down_good, (double) got_down,
16724               count, (double) value);
16725       return 1;
16726     }
16727     if (!up_good) {
16728       while (1) {
16729         if (count > 8) {
16730           count -= 8;
16731           fputs("256.0", stdout);
16732         } else {
16733           count--;
16734           fputs("2.0", stdout);
16735         }
16736         if (!count) {
16737           puts("");
16738           return 0;
16739         }
16740         fputs("*", stdout);
16741       }
16742     }
16743     value *= 2;
16744     ++count;
16745   }
16746   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16747           count, (double) value);
16748   return 1;
16749 }
16750 EOP
16751 set try
16752
16753 nv_overflows_integers_at='0'
16754 if eval $compile; then
16755     xxx="`$run ./try`"
16756     case "$?" in
16757         0)
16758             case "$xxx" in
16759                 2*)  cat >&4 <<EOM
16760 The largest integer your NVs can preserve is equal to $xxx
16761 EOM
16762                     nv_overflows_integers_at="$xxx"
16763                     ;;
16764                 *)  cat >&4 <<EOM
16765 Cannot determine the largest integer value your NVs can hold, unexpected output
16766 '$xxx'
16767 EOM
16768                     ;;
16769             esac
16770             ;;
16771         *)  cat >&4 <<EOM
16772 Cannot determine the largest integer value your NVs can hold
16773 EOM
16774             ;;
16775     esac
16776 fi
16777 $rm_try
16778
16779 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16780 $cat <<EOP >try.c
16781 #include <stdio.h>
16782 #$i_stdlib I_STDLIB
16783 #ifdef I_STDLIB
16784 #include <stdlib.h>
16785 #endif
16786 #include <string.h>
16787 #include <sys/types.h>
16788 #include <signal.h>
16789 #ifdef SIGFPE
16790 /* volatile so that the compiler has to store it out to memory */
16791 volatile int bletched = 0;
16792 $signal_t blech(int s) { bletched = 1; }
16793 #endif
16794
16795 int checkit($nvtype d, const char *where) {
16796     void *v = &d;
16797     unsigned char *p = (unsigned char *)v;
16798     unsigned char *end = p + sizeof(d);
16799     int fail = 0;
16800
16801     while (p < end)
16802         fail += *p++;
16803
16804     if (!fail)
16805         return 0;
16806
16807     p = (unsigned char *)v;
16808     printf("No - %s: 0x", where);
16809     while (p < end)
16810         printf ("%02X", *p++);
16811     printf("\n");
16812     return 1;
16813 }
16814
16815 int main(int argc, char **argv) {
16816     $nvtype d = 0.0;
16817     int fail = 0;
16818     fail += checkit(d, "0.0");
16819
16820     /* The compiler shouldn't be assuming that bletched is 0  */
16821     d = bletched;
16822
16823     fail += checkit(d, "bleched");
16824
16825 #ifdef SIGFPE
16826     signal(SIGFPE, blech);
16827 #endif
16828
16829     /* Paranoia - the compiler should have no way of knowing that ANSI says
16830        that argv[argc] will always be NULL.  Actually, if it did assume this it
16831        would be buggy, as this is C and main() can be called from elsewhere in
16832        the program.  */
16833     d = argv[argc] ? 1 : 0;
16834
16835     if (d) {
16836         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16837     }
16838
16839     fail += checkit(d, "ternary");
16840
16841     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16842
16843     if (d != 0.0) {
16844         printf("No - memset doesn't give 0.0\n");
16845         /* This might just blow up:  */
16846         printf("(gives %g)\n", d);
16847         return 1;
16848     }
16849
16850 #ifdef SIGFPE
16851     if (bletched) {
16852         printf("No - something bleched\n");
16853         return 1;
16854     }
16855 #endif
16856     if (fail) {
16857       printf("No - %d fail(s)\n", fail);
16858       return 1;
16859     }
16860     printf("Yes\n");
16861     return 0;
16862 }
16863 EOP
16864 set try
16865
16866 d_nv_zero_is_allbits_zero="$undef"
16867 if eval $compile; then
16868     xxx="`$run ./try`"
16869     case "$?" in
16870         0)
16871             case "$xxx" in
16872                 Yes)  cat >&4 <<EOM
16873 0.0 is represented as all bits zero in memory
16874 EOM
16875                     d_nv_zero_is_allbits_zero="$define"
16876                     ;;
16877                 *)  cat >&4 <<EOM
16878 0.0 is not represented as all bits zero in memory
16879 EOM
16880                     d_nv_zero_is_allbits_zero="$undef"
16881                     ;;
16882             esac
16883             ;;
16884         *)  cat >&4 <<EOM
16885 0.0 is not represented as all bits zero in memory
16886 EOM
16887             d_nv_zero_is_allbits_zero="$undef"
16888             ;;
16889     esac
16890 fi
16891 $rm_try
16892
16893 : check for off64_t
16894 echo " "
16895 echo "Checking to see if you have off64_t..." >&4
16896 $cat >try.c <<EOCP
16897 #include <sys/types.h>
16898 #include <unistd.h>
16899 int main() { off64_t x = 7; }
16900 EOCP
16901 set try
16902 if eval $compile; then
16903         val="$define"
16904         echo "You have off64_t."
16905 else
16906         val="$undef"
16907         echo "You do not have off64_t."
16908         case "$lseeksize" in
16909         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16910         esac
16911 fi
16912 $rm_try
16913 set d_off64_t
16914 eval $setvar
16915
16916 : how to create joinable pthreads
16917 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16918         echo " "
16919         echo "Checking what constant to use for creating joinable pthreads..." >&4
16920         $cat >try.c <<'EOCP'
16921 #include <pthread.h>
16922 int main() {
16923     int detachstate = JOINABLE;
16924 }
16925 EOCP
16926         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16927         if eval $compile; then
16928                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16929                 val="$undef" # Yes, undef.
16930                 set d_old_pthread_create_joinable
16931                 eval $setvar
16932                 val=""
16933                 set old_pthread_create_joinable
16934                 eval $setvar
16935         else
16936                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16937                 if eval $compile; then
16938                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16939                         val="$define"
16940                         set d_old_pthread_create_joinable
16941                         eval $setvar
16942                         val=PTHREAD_CREATE_UNDETACHED
16943                         set old_pthread_create_joinable
16944                         eval $setvar
16945                 else
16946                         set try -DJOINABLE=__UNDETACHED
16947                         if eval $compile; then
16948                                 echo "You seem to use __UNDETACHED." >&4
16949                                 val="$define"
16950                                 set d_old_pthread_create_joinable
16951                                 eval $setvar
16952                                 val=__UNDETACHED
16953                                 set old_pthread_create_joinable
16954                                 eval $setvar
16955                         else
16956                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16957                                 val="$define"
16958                                 set d_old_pthread_create_joinable
16959                                 eval $setvar
16960                                 val=0
16961                                 set old_pthread_create_joinable
16962                                 eval $setvar
16963                         fi
16964                 fi
16965         fi
16966         $rm_try
16967 else
16968     d_old_pthread_create_joinable="$undef"
16969     old_pthread_create_joinable=""
16970 fi
16971
16972 : see if pause exists
16973 set pause d_pause
16974 eval $inlibc
16975
16976 : see if pipe2 exists
16977 set pipe2 d_pipe2
16978 eval $inlibc
16979
16980 : see if poll exists
16981 set poll d_poll
16982 eval $inlibc
16983
16984 : see if prctl exists
16985 set prctl d_prctl
16986 eval $inlibc
16987
16988 : see if prctl supports PR_SET_NAME
16989 d_prctl_set_name=$undef
16990 case $d_prctl in
16991     $define)
16992         $cat >try.c <<EOM
16993 #ifdef __ANDROID__
16994 #include <unistd.h>
16995 #endif
16996 #include <sys/prctl.h>
16997
16998 int main (int argc, char *argv[])
16999 {
17000     return (prctl (PR_SET_NAME, "Test"));
17001     } /* main */
17002 EOM
17003         set try
17004         if eval $compile_ok && $run ./try; then
17005             echo "Your prctl (PR_SET_NAME, ...) works"
17006             d_prctl_set_name=$define
17007             fi
17008         $rm_try
17009         ;;
17010     esac
17011
17012 : see if readlink exists
17013 set readlink d_readlink
17014 eval $inlibc
17015
17016 : Check if there is a /proc symlink to the abs path of
17017 : the executing program.  We will honor hints of d_procselfexe=$undef
17018 : or procselfexe being non-empty, otherwise will try to determine both
17019 : if we have readlink.
17020 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17021 : referenced, and AmigaOS does not have a proc filesystem anyway.
17022 echo " "
17023 val="$undef"
17024 if $test "X$d_procselfexe" = Xundef; then
17025         procselfexe=''
17026 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17027         val="$define"
17028 elif $test "X$d_readlink" = Xdefine; then
17029         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17030         : and it feels more tidy to avoid an extra level of symlink
17031         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17032         while test $# -gt 0; do
17033             type=$1; try=$2
17034             shift; shift
17035             if $issymlink $try; then
17036                 $ls -l $try > reflect
17037                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17038                     echo "You have $type-like $try."
17039                     procselfexe='"'$try'"'
17040                     val="$define"
17041                     : This will break out of the loop
17042                     set X; shift
17043                 fi
17044             fi
17045         done
17046 fi
17047 $rm -f reflect
17048 set d_procselfexe
17049 eval $setvar
17050
17051 : backward compatibility for d_hvfork
17052 if test X$d_hvfork != X; then
17053         d_vfork="$d_hvfork"
17054         d_hvfork=''
17055 fi
17056 : see if there is a vfork
17057 val=''
17058 set vfork val
17059 eval $inlibc
17060
17061 d_pseudofork=$undef
17062
17063 : Ok, but do we want to use it. vfork is reportedly unreliable in
17064 : perl on Solaris 2.x, and probably elsewhere.
17065 case "$val" in
17066 $define)
17067         echo " "
17068         case "$usevfork" in
17069         false) dflt='n';;
17070         *) dflt='y';;
17071         esac
17072         cat <<'EOM'
17073
17074 Perl can only use a vfork() that doesn't suffer from strict
17075 restrictions on calling functions or modifying global data in
17076 the child.  For example, glibc-2.1 contains such a vfork()
17077 that is unsuitable.  If your system provides a proper fork()
17078 call, chances are that you do NOT want perl to use vfork().
17079
17080 EOM
17081         rp="Do you still want to use vfork()?"
17082         . ./myread
17083         case "$ans" in
17084         y|Y) ;;
17085         *)
17086                 echo "Ok, we won't use vfork()."
17087                 val="$undef"
17088                 ;;
17089         esac
17090         ;;
17091 esac
17092 set d_vfork
17093 eval $setvar
17094 case "$d_vfork" in
17095 $define) usevfork='true';;
17096 *) usevfork='false';;
17097 esac
17098
17099 : see whether the pthread_atfork exists
17100 $cat >try.c <<EOP
17101 #include <pthread.h>
17102 #include <stdio.h>
17103 int main() {
17104 #ifdef  PTHREAD_ATFORK
17105         pthread_atfork(NULL,NULL,NULL);
17106 #endif
17107 }
17108 EOP
17109
17110 : see if pthread_atfork exists
17111 set try -DPTHREAD_ATFORK
17112 if eval $compile; then
17113     val="$define"
17114 else
17115     val="$undef"
17116 fi
17117 case "$usethreads" in
17118 $define)
17119         case "$val" in
17120         $define) echo 'pthread_atfork found.' >&4        ;;
17121         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17122         esac
17123 esac
17124 set d_pthread_atfork
17125 eval $setvar
17126
17127 : see if pthread_attr_setscope exists
17128 set pthread_attr_setscope d_pthread_attr_setscope
17129 eval $inlibc
17130
17131 : see whether the various POSIXish _yields exist
17132 $cat >try.c <<EOP
17133 #include <pthread.h>
17134 #include <stdio.h>
17135 int main() {
17136 #ifdef SCHED_YIELD
17137         sched_yield();
17138 #else
17139 #ifdef PTHREAD_YIELD
17140         pthread_yield();
17141 #else
17142 #ifdef PTHREAD_YIELD_NULL
17143         pthread_yield(NULL);
17144 #endif
17145 #endif
17146 #endif
17147 }
17148 EOP
17149 : see if sched_yield exists
17150 set try -DSCHED_YIELD
17151 if eval $compile; then
17152     val="$define"
17153     sched_yield='sched_yield()'
17154 else
17155     val="$undef"
17156 fi
17157 case "$usethreads" in
17158 $define)
17159         case "$val" in
17160         $define) echo 'sched_yield() found.' >&4        ;;
17161         *)       echo 'sched_yield() NOT found.' >&4    ;;
17162         esac
17163 esac
17164 set d_sched_yield
17165 eval $setvar
17166
17167 : see if pthread_yield exists
17168 set try -DPTHREAD_YIELD
17169 if eval $compile; then
17170     val="$define"
17171     case "$sched_yield" in
17172     '') sched_yield='pthread_yield()' ;;
17173     esac
17174 else
17175     set try -DPTHREAD_YIELD_NULL
17176     if eval $compile; then
17177         val="$define"
17178         case "$sched_yield" in
17179         '') sched_yield='pthread_yield(NULL)' ;;
17180         esac
17181     else
17182         val="$undef"
17183     fi
17184 fi
17185 case "$usethreads" in
17186 $define)
17187         case "$val" in
17188         $define) echo 'pthread_yield() found.' >&4      ;;
17189         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17190         esac
17191         ;;
17192 esac
17193 set d_pthread_yield
17194 eval $setvar
17195 case "$sched_yield" in
17196 '') sched_yield=undef ;;
17197 esac
17198 $rm_try
17199
17200 : check for ptrdiff_t
17201 echo " "
17202 echo "Checking to see if you have ptrdiff_t..." >&4
17203 $cat >try.c <<EOCP
17204 #include <stddef.h>
17205 int main() { ptrdiff_t x = 7; }
17206 EOCP
17207 set try
17208 if eval $compile; then
17209         val="$define"
17210         echo "You have ptrdiff_t."
17211 else
17212         val="$undef"
17213         echo "You do not have ptrdiff_t."
17214 fi
17215 $rm_try
17216 set d_ptrdiff_t
17217 eval $setvar
17218
17219 : see if random_r exists
17220 set random_r d_random_r
17221 eval $inlibc
17222 case "$d_random_r" in
17223 "$define")
17224         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17225         case "$d_random_r_proto:$usethreads" in
17226         ":define")      d_random_r_proto=define
17227                 set d_random_r_proto random_r $hdrs
17228                 eval $hasproto ;;
17229         *)      ;;
17230         esac
17231         case "$d_random_r_proto" in
17232         define)
17233         case "$random_r_proto" in
17234         ''|0) try='int random_r(int*, struct random_data*);'
17235         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17236         esac
17237         case "$random_r_proto" in
17238         ''|0) try='int random_r(long*, struct random_data*);'
17239         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17240         esac
17241         case "$random_r_proto" in
17242         ''|0) try='int random_r(struct random_data*, int32_t*);'
17243         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17244         esac
17245         case "$random_r_proto" in
17246         ''|0)   d_random_r=undef
17247                 random_r_proto=0
17248                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17249         * )     case "$random_r_proto" in
17250                 REENTRANT_PROTO*) ;;
17251                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17252                 esac
17253                 echo "Prototype: $try" ;;
17254         esac
17255         ;;
17256         *)      case "$usethreads" in
17257                 define) echo "random_r has no prototype, not using it." >&4 ;;
17258                 esac
17259                 d_random_r=undef
17260                 random_r_proto=0
17261                 ;;
17262         esac
17263         ;;
17264 *)      random_r_proto=0
17265         ;;
17266 esac
17267
17268 : see if readdir and friends exist
17269 set readdir d_readdir
17270 eval $inlibc
17271 set seekdir d_seekdir
17272 eval $inlibc
17273 set telldir d_telldir
17274 eval $inlibc
17275 set rewinddir d_rewinddir
17276 eval $inlibc
17277
17278 : see if readdir64_r exists
17279 set readdir64_r d_readdir64_r
17280 eval $inlibc
17281 case "$d_readdir64_r" in
17282 "$define")
17283         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17284         case "$d_readdir64_r_proto:$usethreads" in
17285         ":define")      d_readdir64_r_proto=define
17286                 set d_readdir64_r_proto readdir64_r $hdrs
17287                 eval $hasproto ;;
17288         *)      ;;
17289         esac
17290         case "$d_readdir64_r_proto" in
17291         define)
17292         case "$readdir64_r_proto" in
17293         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17294         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17295         esac
17296         case "$readdir64_r_proto" in
17297         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17298         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17299         esac
17300         case "$readdir64_r_proto" in
17301         ''|0)   d_readdir64_r=undef
17302                 readdir64_r_proto=0
17303                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17304         * )     case "$readdir64_r_proto" in
17305                 REENTRANT_PROTO*) ;;
17306                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17307                 esac
17308                 echo "Prototype: $try" ;;
17309         esac
17310         ;;
17311         *)      case "$usethreads" in
17312                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17313                 esac
17314                 d_readdir64_r=undef
17315                 readdir64_r_proto=0
17316                 ;;
17317         esac
17318         ;;
17319 *)      readdir64_r_proto=0
17320         ;;
17321 esac
17322
17323 : see if readdir_r exists
17324 set readdir_r d_readdir_r
17325 eval $inlibc
17326 case "$d_readdir_r" in
17327 "$define")
17328         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17329         case "$d_readdir_r_proto:$usethreads" in
17330         ":define")      d_readdir_r_proto=define
17331                 set d_readdir_r_proto readdir_r $hdrs
17332                 eval $hasproto ;;
17333         *)      ;;
17334         esac
17335         case "$d_readdir_r_proto" in
17336         define)
17337         case "$readdir_r_proto" in
17338         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17339         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17340         esac
17341         case "$readdir_r_proto" in
17342         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17343         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17344         esac
17345         case "$readdir_r_proto" in
17346         ''|0)   d_readdir_r=undef
17347                 readdir_r_proto=0
17348                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17349         * )     case "$readdir_r_proto" in
17350                 REENTRANT_PROTO*) ;;
17351                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17352                 esac
17353                 echo "Prototype: $try" ;;
17354         esac
17355         ;;
17356         *)      case "$usethreads" in
17357                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17358                 esac
17359                 d_readdir_r=undef
17360                 readdir_r_proto=0
17361                 ;;
17362         esac
17363         ;;
17364 *)      readdir_r_proto=0
17365         ;;
17366 esac
17367
17368 : see if readv exists
17369 set readv d_readv
17370 eval $inlibc
17371
17372 : see if recvmsg exists
17373 set recvmsg d_recvmsg
17374 eval $inlibc
17375
17376 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17377 echo " "
17378 if set regcomp val -f d_regcomp; eval $csym; $val; then
17379         echo 'regcomp() found.' >&4
17380         d_regcomp="$define"
17381         d_regcmp="$undef"
17382         d_re_comp="$undef"
17383 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17384         echo 'regcmp() found.' >&4
17385         d_regcmp="$define"
17386         d_regcomp="$undef"
17387         d_re_comp="$undef"
17388 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17389         echo 're_comp() found, assuming re_exec() also exists.' >&4
17390         d_re_comp="$define"
17391         d_regcomp="$undef"
17392         d_regcmp="$undef"
17393 else
17394         $cat >&4 <<EOM
17395 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17396 EOM
17397         d_regcmp="$undef"
17398         d_re_comp="$undef"
17399         d_regcomp="$undef"
17400 fi
17401
17402 : see if remainder exists
17403 set remainder d_remainder
17404 eval $inlibc
17405
17406 : see if remquo exists
17407 set remquo d_remquo
17408 eval $inlibc
17409
17410 : see if rename exists
17411 set rename d_rename
17412 eval $inlibc
17413
17414 : see if rint exists
17415 set rint d_rint
17416 eval $inlibc
17417
17418 : see if rmdir exists
17419 set rmdir d_rmdir
17420 eval $inlibc
17421
17422 : see if round exists
17423 set round d_round
17424 eval $inlibc
17425
17426 : see if prototype for sbrk is available
17427 echo " "
17428 set d_sbrkproto sbrk $i_unistd unistd.h
17429 eval $hasproto
17430
17431 : see if scalbn exists
17432 set scalbn d_scalbn
17433 eval $inlibc
17434
17435 : see if select exists
17436 set select d_select
17437 eval $inlibc
17438
17439 : see if semctl exists
17440 set semctl d_semctl
17441 eval $inlibc
17442
17443 : see if semget exists
17444 set semget d_semget
17445 eval $inlibc
17446
17447 : see if semop exists
17448 set semop d_semop
17449 eval $inlibc
17450
17451 : see how much of the 'sem*(2)' library is present.
17452 h_sem=true
17453 echo " "
17454 case "$d_semctl$d_semget$d_semop" in
17455 *"$undef"*) h_sem=false;;
17456 esac
17457 case "$osname" in
17458 freebsd)
17459     case "`ipcs 2>&1`" in
17460     "SVID messages"*"not configured"*)
17461         echo "Your $osname does not have the sem*(2) configured." >&4
17462         h_sem=false
17463         val="$undef"
17464         set semctl d_semctl
17465         eval $setvar
17466         set semget d_semget
17467         eval $setvar
17468         set semop d_semop
17469         eval $setvar
17470         ;;
17471     esac
17472     ;;
17473 esac
17474 : we could also check for sys/ipc.h ...
17475 if $h_sem && $test `./findhdr sys/sem.h`; then
17476         echo "You have the full sem*(2) library." >&4
17477         val="$define"
17478 else
17479         echo "You don't have the full sem*(2) library." >&4
17480         val="$undef"
17481 fi
17482 set d_sem
17483 eval $setvar
17484
17485 : see whether sys/sem.h defines union semun
17486 echo " "
17487 $cat > try.c <<'END'
17488 #include <sys/types.h>
17489 #include <sys/ipc.h>
17490 #include <sys/sem.h>
17491 int main () { union semun semun; semun.buf = 0; }
17492 END
17493 set try
17494 if eval $compile; then
17495     echo "You have union semun in <sys/sem.h>." >&4
17496     val="$define"
17497 else
17498     echo "You do not have union semun in <sys/sem.h>." >&4
17499     val="$undef"
17500 fi
17501 $rm_try
17502 set d_union_semun
17503 eval $setvar
17504
17505 : see how to do semctl IPC_STAT
17506 case "$d_sem" in
17507 $define)
17508     echo " "
17509     $cat > tryh.h <<END
17510 #ifndef S_IRUSR
17511 #   ifdef S_IREAD
17512 #       define S_IRUSR S_IREAD
17513 #       define S_IWUSR S_IWRITE
17514 #       define S_IXUSR S_IEXEC
17515 #   else
17516 #       define S_IRUSR 0400
17517 #       define S_IWUSR 0200
17518 #       define S_IXUSR 0100
17519 #   endif
17520 #   define S_IRGRP (S_IRUSR>>3)
17521 #   define S_IWGRP (S_IWUSR>>3)
17522 #   define S_IXGRP (S_IXUSR>>3)
17523 #   define S_IROTH (S_IRUSR>>6)
17524 #   define S_IWOTH (S_IWUSR>>6)
17525 #   define S_IXOTH (S_IXUSR>>6)
17526 #endif
17527 #ifndef S_IRWXU
17528 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17529 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17530 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17531 #endif
17532 END
17533     : see whether semctl IPC_STAT can use union semun
17534     case "$d_semctl_semun" in
17535     '')
17536       val="$undef"
17537       $cat > try.c <<END
17538 #include <sys/types.h>
17539 #include <sys/ipc.h>
17540 #include <sys/sem.h>
17541 #include <sys/stat.h>
17542 #include <stdio.h>
17543 #include <errno.h>
17544 #include "tryh.h"
17545 #ifndef errno
17546 extern int errno;
17547 #endif
17548 #$d_union_semun HAS_UNION_SEMUN
17549 int main() {
17550     union semun
17551 #ifndef HAS_UNION_SEMUN
17552     {
17553         int val;
17554         struct semid_ds *buf;
17555         unsigned short *array;
17556     }
17557 #endif
17558     arg;
17559     int sem, st;
17560
17561 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17562     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17563     if (sem > -1) {
17564         struct semid_ds argbuf;
17565         arg.buf = &argbuf;
17566 #       ifdef IPC_STAT
17567         st = semctl(sem, 0, IPC_STAT, arg);
17568         if (st == 0)
17569             printf("semun\n");
17570         else
17571 #       endif /* IPC_STAT */
17572             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17573 #       ifdef IPC_RMID
17574         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17575 #       endif /* IPC_RMID */
17576             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17577     } else
17578 #endif /* IPC_PRIVATE && ... */
17579         printf("semget failed: errno = %d\n", errno);
17580   return 0;
17581 }
17582 END
17583       set try
17584       if eval $compile; then
17585           xxx=`$run ./try`
17586           case "$xxx" in
17587           semun) val="$define" ;;
17588           esac
17589       fi
17590       $rm_try
17591       set d_semctl_semun
17592       eval $setvar
17593       ;;
17594     esac
17595     case "$d_semctl_semun" in
17596     $define)
17597         echo "You can use union semun for semctl IPC_STAT." >&4
17598         also='also'
17599         ;;
17600     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17601         also=''
17602         ;;
17603     esac
17604
17605     : see whether semctl IPC_STAT can use struct semid_ds pointer
17606     case "$d_semctl_semid_ds" in
17607     '')
17608       val="$undef"
17609       $cat > try.c <<'END'
17610 #include <sys/types.h>
17611 #include <sys/ipc.h>
17612 #include <sys/sem.h>
17613 #include <sys/stat.h>
17614 #include "tryh.h"
17615 #include <stdio.h>
17616 #include <errno.h>
17617 #ifndef errno
17618 extern int errno;
17619 #endif
17620 int main() {
17621     union semun
17622 #ifndef HAS_UNION_SEMUN
17623     {
17624         int val;
17625         struct semid_ds *buf;
17626         unsigned short *array;
17627     }
17628 #endif
17629     arg;
17630     struct semid_ds argbuf;
17631     int sem, st;
17632
17633 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17634     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17635     if (sem > -1) {
17636         arg.buf = &argbuf;
17637 #       ifdef IPC_STAT
17638         st = semctl(sem, 0, IPC_STAT, arg);
17639         if (st == 0)
17640             printf("semid_ds\n");
17641         else
17642 #       endif /* IPC_STAT */
17643             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17644 #       ifdef IPC_RMID
17645         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17646 #       endif /* IPC_RMID */
17647             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17648     } else
17649 #endif /* IPC_PRIVATE && ... */
17650         printf("semget failed: errno = %d\n", errno);
17651
17652     return 0;
17653 }
17654 END
17655       set try
17656       if eval $compile; then
17657           xxx=`$run ./try`
17658           case "$xxx" in
17659           semid_ds) val="$define" ;;
17660           esac
17661       fi
17662       $rm_try
17663       set d_semctl_semid_ds
17664       eval $setvar
17665       ;;
17666     esac
17667     case "$d_semctl_semid_ds" in
17668     $define)
17669         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17670         ;;
17671     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17672         ;;
17673     esac
17674     ;;
17675 *)  val="$undef"
17676
17677     # We do not have the full sem*(2) library, so assume we can not
17678     # use either.
17679
17680     set d_semctl_semun
17681     eval $setvar
17682
17683     set d_semctl_semid_ds
17684     eval $setvar
17685     ;;
17686 esac
17687 $rm_try tryh.h
17688
17689 : see if sendmsg exists
17690 set sendmsg d_sendmsg
17691 eval $inlibc
17692
17693 : see if setegid exists
17694 set setegid d_setegid
17695 eval $inlibc
17696
17697 : see if seteuid exists
17698 set seteuid d_seteuid
17699 eval $inlibc
17700
17701 : see if setgrent exists
17702 set setgrent d_setgrent
17703 eval $inlibc
17704
17705 : see if setgrent_r exists
17706 set setgrent_r d_setgrent_r
17707 eval $inlibc
17708 case "$d_setgrent_r" in
17709 "$define")
17710         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17711         case "$d_setgrent_r_proto:$usethreads" in
17712         ":define")      d_setgrent_r_proto=define
17713                 set d_setgrent_r_proto setgrent_r $hdrs
17714                 eval $hasproto ;;
17715         *)      ;;
17716         esac
17717         case "$d_setgrent_r_proto" in
17718         define)
17719         case "$setgrent_r_proto" in
17720         ''|0) try='int setgrent_r(FILE**);'
17721         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17722         esac
17723         case "$setgrent_r_proto" in
17724         ''|0) try='void setgrent_r(FILE**);'
17725         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17726         esac
17727         case "$setgrent_r_proto" in
17728         ''|0)   d_setgrent_r=undef
17729                 setgrent_r_proto=0
17730                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17731         * )     case "$setgrent_r_proto" in
17732                 REENTRANT_PROTO*) ;;
17733                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17734                 esac
17735                 echo "Prototype: $try" ;;
17736         esac
17737         ;;
17738         *)      case "$usethreads" in
17739                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17740                 esac
17741                 d_setgrent_r=undef
17742                 setgrent_r_proto=0
17743                 ;;
17744         esac
17745         ;;
17746 *)      setgrent_r_proto=0
17747         ;;
17748 esac
17749
17750 : see if sethostent exists
17751 set sethostent d_sethent
17752 eval $inlibc
17753
17754 : see if sethostent_r exists
17755 set sethostent_r d_sethostent_r
17756 eval $inlibc
17757 case "$d_sethostent_r" in
17758 "$define")
17759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17760         case "$d_sethostent_r_proto:$usethreads" in
17761         ":define")      d_sethostent_r_proto=define
17762                 set d_sethostent_r_proto sethostent_r $hdrs
17763                 eval $hasproto ;;
17764         *)      ;;
17765         esac
17766         case "$d_sethostent_r_proto" in
17767         define)
17768         case "$sethostent_r_proto" in
17769         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17770         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17771         esac
17772         case "$sethostent_r_proto" in
17773         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17774         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17775         esac
17776         case "$sethostent_r_proto" in
17777         ''|0)   d_sethostent_r=undef
17778                 sethostent_r_proto=0
17779                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17780         * )     case "$sethostent_r_proto" in
17781                 REENTRANT_PROTO*) ;;
17782                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17783                 esac
17784                 echo "Prototype: $try" ;;
17785         esac
17786         ;;
17787         *)      case "$usethreads" in
17788                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17789                 esac
17790                 d_sethostent_r=undef
17791                 sethostent_r_proto=0
17792                 ;;
17793         esac
17794         ;;
17795 *)      sethostent_r_proto=0
17796         ;;
17797 esac
17798
17799 : see if setitimer exists
17800 set setitimer d_setitimer
17801 eval $inlibc
17802
17803 : see if setlinebuf exists
17804 set setlinebuf d_setlinebuf
17805 eval $inlibc
17806
17807 : see if locale.h is available
17808 set locale.h i_locale
17809 eval $inhdr
17810
17811 : see if this system has wctype.h
17812 set wctype.h i_wctype
17813 eval $inhdr
17814
17815 : see if towupper exists
17816 set towupper d_towupper
17817 eval $inlibc
17818
17819 : check for setlocale function and behavior
17820 $cat <<EOM
17821
17822 Checking to see if you have setlocale() and its behavior
17823 EOM
17824 $cat >try.c <<EOCP
17825 #include <stdlib.h>
17826 #include <string.h>
17827 #$i_locale I_LOCALE
17828 #ifdef I_LOCALE
17829 #  include <locale.h>
17830 #endif
17831 #$i_wctype I_WCTYPE
17832 #ifdef I_WCTYPE
17833 #  include <wctype.h>
17834 #endif
17835
17836 int main() {
17837     const char * invalid_name = "\a";   /* This is really invalid! */
17838     int accepts_any_locale_name = 0;
17839     int has_C_UTF8 = 0;
17840     unsigned char bad_setlocale = 255;
17841
17842     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17843      * disabled.  It's hard to imagine an instance where meaningful locale
17844      * handling could be done without LC_CTYPE */
17845     const char *  name = setlocale(LC_CTYPE, "C");
17846
17847     if (name == NULL || strcmp(name, "C") != 0) {
17848         exit(bad_setlocale);
17849     }
17850
17851     name = setlocale(LC_CTYPE, invalid_name);
17852     if (name != NULL) {
17853
17854         /* Let it pass if it accepts the name but gives back one of the C
17855          * locales */
17856         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17857             accepts_any_locale_name = 1;
17858         }
17859     }
17860
17861     name = setlocale(LC_CTYPE, "C.UTF-8");
17862     if (name != NULL) {
17863         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17864
17865 #$d_towupper HAS_TOWUPPER
17866 #ifdef HAS_TOWUPPER
17867
17868         /* We assume that if the machine doesn't have the C99 towupper, it
17869          * doesn't have C.UTF-8, even if we successfully changed locales to
17870          * include it.  This seems safer even on platforms that didn't accept
17871          * the really invalid name */
17872
17873         if (towupper(y_with_diaeresis) == 0x178) {
17874             has_C_UTF8 = 1;
17875         }
17876
17877 #endif
17878
17879     }
17880
17881 #if 0
17882
17883     /* Currently unused code to determine if LC_ALL with disparate values uses
17884      * category = value pairs or positional, and to determine the separator
17885      * between the categories.  We could add code so that if the separator were
17886      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17887      * every possible ASCII separator would fit in the 5 bits available in the
17888      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17889      * positional, we probably would want to know the order of the categories.
17890      * Using a file between the C program and the shell script would really be
17891      * require to do that */
17892 #ifdef LC_ALL
17893
17894     unsigned char min_separator = ' ' - 1;
17895     unsigned char separator = min_separator;
17896     int uses_name_value_pair_names = 0;
17897
17898     name = setlocale(LC_ALL, "C");
17899     if (name == NULL || strcmp(name, "C") != 0) {
17900         exit(bad_setlocale);
17901     }
17902
17903     if (has_C_UTF8) {
17904         char * pos;
17905
17906         name = setlocale(LC_CTYPE, "C.UTF-8");
17907         if (name == NULL) {
17908             exit(bad_setlocale);
17909         }
17910         name = setlocale(LC_ALL, NULL);
17911         if (name == NULL) {
17912             exit(bad_setlocale);
17913         }
17914
17915         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17916         if (pos != NULL) {
17917             uses_name_value_pair_names = 1;
17918             if (pos == name) {
17919                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17920             }
17921             else {
17922                 separator = *(pos - 1);
17923             }
17924         }
17925         else {
17926             pos = strstr(name, "C.UTF-8");
17927             if (pos == NULL) {
17928                 /* bad */
17929             }
17930             else if (pos == name) {
17931                 separator = name[sizeof("C.UTF-8") - 1];
17932             }
17933             else {
17934                 separator = *(pos - 1);
17935             }
17936         }
17937     }
17938
17939 #endif
17940 #endif
17941
17942     exit( 0 /* (separator - min_separator) << 3
17943         | uses_name_value_pair_names      << 2
17944           */
17945         | has_C_UTF8                      << 1
17946         | accepts_any_locale_name);
17947
17948 }
17949 EOCP
17950 set try
17951 if eval $compile; then
17952     echo "Your system has setlocale()..." >&4
17953     $run ./try
17954     case $? in
17955         0) echo "and it seems sane" >&4
17956            d_setlocale="$define"
17957            d_setlocale_accepts_any_locale_name="$undef"
17958            d_has_C_UTF8="false"
17959            ;;
17960         1) echo "and it seems sane, but accepts any locale name as valid" >&4
17961            d_setlocale="$define"
17962            d_setlocale_accepts_any_locale_name="$define"
17963            d_has_C_UTF8="false"
17964            ;;
17965         2) echo "and it seems sane" >&4
17966            d_setlocale="$define"
17967            d_setlocale_accepts_any_locale_name="$undef"
17968            d_has_C_UTF8="true"
17969            ;;
17970         3) echo "and it seems sane, but accepts any locale name as valid" >&4
17971            d_setlocale="$define"
17972            d_setlocale_accepts_any_locale_name="$define"
17973            d_has_C_UTF8="true"
17974            ;;
17975         *) echo "but it doesn't seem to work, so we won't use it." >&4
17976            d_setlocale="$undef"
17977            d_setlocale_accepts_any_locale_name="$undef"
17978            d_has_C_UTF8="false"
17979            ;;
17980     esac
17981 else
17982     echo "your system does not have setlocale()" >&4
17983     d_setlocale="$undef"
17984     d_setlocale_accepts_any_locale_name="$undef"
17985     d_has_C_UTF8="false"
17986 fi
17987 $rm_try
17988
17989 : see if setlocale_r exists
17990 set setlocale_r d_setlocale_r
17991 eval $inlibc
17992 case "$d_setlocale_r" in
17993 "$define")
17994         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17995         case "$d_setlocale_r_proto:$usethreads" in
17996         ":define")      d_setlocale_r_proto=define
17997                 set d_setlocale_r_proto setlocale_r $hdrs
17998                 eval $hasproto ;;
17999         *)      ;;
18000         esac
18001         case "$d_setlocale_r_proto" in
18002         define)
18003         case "$setlocale_r_proto" in
18004         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18005         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18006         esac
18007         case "$setlocale_r_proto" in
18008         ''|0)   d_setlocale_r=undef
18009                 setlocale_r_proto=0
18010                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18011         * )     case "$setlocale_r_proto" in
18012                 REENTRANT_PROTO*) ;;
18013                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18014                 esac
18015                 echo "Prototype: $try" ;;
18016         esac
18017         ;;
18018         *)      case "$usethreads" in
18019                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18020                 esac
18021                 d_setlocale_r=undef
18022                 setlocale_r_proto=0
18023                 ;;
18024         esac
18025         ;;
18026 *)      setlocale_r_proto=0
18027         ;;
18028 esac
18029
18030 : see if setnetent exists
18031 set setnetent d_setnent
18032 eval $inlibc
18033
18034 : see if setnetent_r exists
18035 set setnetent_r d_setnetent_r
18036 eval $inlibc
18037 case "$d_setnetent_r" in
18038 "$define")
18039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18040         case "$d_setnetent_r_proto:$usethreads" in
18041         ":define")      d_setnetent_r_proto=define
18042                 set d_setnetent_r_proto setnetent_r $hdrs
18043                 eval $hasproto ;;
18044         *)      ;;
18045         esac
18046         case "$d_setnetent_r_proto" in
18047         define)
18048         case "$setnetent_r_proto" in
18049         ''|0) try='int setnetent_r(int, struct netent_data*);'
18050         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18051         esac
18052         case "$setnetent_r_proto" in
18053         ''|0) try='void setnetent_r(int, struct netent_data*);'
18054         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18055         esac
18056         case "$setnetent_r_proto" in
18057         ''|0)   d_setnetent_r=undef
18058                 setnetent_r_proto=0
18059                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18060         * )     case "$setnetent_r_proto" in
18061                 REENTRANT_PROTO*) ;;
18062                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18063                 esac
18064                 echo "Prototype: $try" ;;
18065         esac
18066         ;;
18067         *)      case "$usethreads" in
18068                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18069                 esac
18070                 d_setnetent_r=undef
18071                 setnetent_r_proto=0
18072                 ;;
18073         esac
18074         ;;
18075 *)      setnetent_r_proto=0
18076         ;;
18077 esac
18078
18079 : see if setprotoent exists
18080 set setprotoent d_setpent
18081 eval $inlibc
18082
18083 : see if setpgid exists
18084 set setpgid d_setpgid
18085 eval $inlibc
18086
18087 : see if setpgrp2 exists
18088 set setpgrp2 d_setpgrp2
18089 eval $inlibc
18090
18091 : see if setpriority exists
18092 set setpriority d_setprior
18093 eval $inlibc
18094
18095 : see if setproctitle exists
18096 set setproctitle d_setproctitle
18097 eval $inlibc
18098
18099 : see if setprotoent_r exists
18100 set setprotoent_r d_setprotoent_r
18101 eval $inlibc
18102 case "$d_setprotoent_r" in
18103 "$define")
18104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18105         case "$d_setprotoent_r_proto:$usethreads" in
18106         ":define")      d_setprotoent_r_proto=define
18107                 set d_setprotoent_r_proto setprotoent_r $hdrs
18108                 eval $hasproto ;;
18109         *)      ;;
18110         esac
18111         case "$d_setprotoent_r_proto" in
18112         define)
18113         case "$setprotoent_r_proto" in
18114         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18115         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18116         esac
18117         case "$setprotoent_r_proto" in
18118         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18119         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18120         esac
18121         case "$setprotoent_r_proto" in
18122         ''|0)   d_setprotoent_r=undef
18123                 setprotoent_r_proto=0
18124                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18125         * )     case "$setprotoent_r_proto" in
18126                 REENTRANT_PROTO*) ;;
18127                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18128                 esac
18129                 echo "Prototype: $try" ;;
18130         esac
18131         ;;
18132         *)      case "$usethreads" in
18133                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18134                 esac
18135                 d_setprotoent_r=undef
18136                 setprotoent_r_proto=0
18137                 ;;
18138         esac
18139         ;;
18140 *)      setprotoent_r_proto=0
18141         ;;
18142 esac
18143
18144 : see if setpwent exists
18145 set setpwent d_setpwent
18146 eval $inlibc
18147
18148 : see if setpwent_r exists
18149 set setpwent_r d_setpwent_r
18150 eval $inlibc
18151 case "$d_setpwent_r" in
18152 "$define")
18153         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18154         case "$d_setpwent_r_proto:$usethreads" in
18155         ":define")      d_setpwent_r_proto=define
18156                 set d_setpwent_r_proto setpwent_r $hdrs
18157                 eval $hasproto ;;
18158         *)      ;;
18159         esac
18160         case "$d_setpwent_r_proto" in
18161         define)
18162         case "$setpwent_r_proto" in
18163         ''|0) try='int setpwent_r(FILE**);'
18164         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18165         esac
18166         case "$setpwent_r_proto" in
18167         ''|0) try='void setpwent_r(FILE**);'
18168         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18169         esac
18170         case "$setpwent_r_proto" in
18171         ''|0)   d_setpwent_r=undef
18172                 setpwent_r_proto=0
18173                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18174         * )     case "$setpwent_r_proto" in
18175                 REENTRANT_PROTO*) ;;
18176                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18177                 esac
18178                 echo "Prototype: $try" ;;
18179         esac
18180         ;;
18181         *)      case "$usethreads" in
18182                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18183                 esac
18184                 d_setpwent_r=undef
18185                 setpwent_r_proto=0
18186                 ;;
18187         esac
18188         ;;
18189 *)      setpwent_r_proto=0
18190         ;;
18191 esac
18192
18193 : see if setregid exists
18194 set setregid d_setregid
18195 eval $inlibc
18196 set setresgid d_setresgid
18197 eval $inlibc
18198
18199 : see if setreuid exists
18200 set setreuid d_setreuid
18201 eval $inlibc
18202 set setresuid d_setresuid
18203 eval $inlibc
18204
18205 : see if setrgid exists
18206 set setrgid d_setrgid
18207 eval $inlibc
18208
18209 : see if setruid exists
18210 set setruid d_setruid
18211 eval $inlibc
18212
18213 : see if setservent exists
18214 set setservent d_setsent
18215 eval $inlibc
18216
18217 : see if setservent_r exists
18218 set setservent_r d_setservent_r
18219 eval $inlibc
18220 case "$d_setservent_r" in
18221 "$define")
18222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18223         case "$d_setservent_r_proto:$usethreads" in
18224         ":define")      d_setservent_r_proto=define
18225                 set d_setservent_r_proto setservent_r $hdrs
18226                 eval $hasproto ;;
18227         *)      ;;
18228         esac
18229         case "$d_setservent_r_proto" in
18230         define)
18231         case "$setservent_r_proto" in
18232         ''|0) try='int setservent_r(int, struct servent_data*);'
18233         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18234         esac
18235         case "$setservent_r_proto" in
18236         ''|0) try='void setservent_r(int, struct servent_data*);'
18237         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18238         esac
18239         case "$setservent_r_proto" in
18240         ''|0)   d_setservent_r=undef
18241                 setservent_r_proto=0
18242                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18243         * )     case "$setservent_r_proto" in
18244                 REENTRANT_PROTO*) ;;
18245                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18246                 esac
18247                 echo "Prototype: $try" ;;
18248         esac
18249         ;;
18250         *)      case "$usethreads" in
18251                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18252                 esac
18253                 d_setservent_r=undef
18254                 setservent_r_proto=0
18255                 ;;
18256         esac
18257         ;;
18258 *)      setservent_r_proto=0
18259         ;;
18260 esac
18261
18262 : see if setsid exists
18263 set setsid d_setsid
18264 eval $inlibc
18265
18266 : see if setvbuf exists
18267 set setvbuf d_setvbuf
18268 eval $inlibc
18269
18270 : see if shmctl exists
18271 set shmctl d_shmctl
18272 eval $inlibc
18273
18274 : see if shmget exists
18275 set shmget d_shmget
18276 eval $inlibc
18277
18278 : see if shmat exists
18279 set shmat d_shmat
18280 eval $inlibc
18281 : see what shmat returns
18282 case "$d_shmat" in
18283 "$define")
18284         $cat >shmat.c <<'END'
18285 #include <sys/shm.h>
18286 void *shmat();
18287 END
18288         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18289                 shmattype='void *'
18290         else
18291                 shmattype='char *'
18292         fi
18293         echo "and it returns ($shmattype)." >&4
18294         : see if a prototype for shmat is available
18295         xxx=`./findhdr sys/shm.h`
18296         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18297         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18298                 val="$define"
18299         else
18300                 val="$undef"
18301         fi
18302         $rm -f shmat.[co]
18303         ;;
18304 *)
18305         val="$undef"
18306         ;;
18307 esac
18308 set d_shmatprototype
18309 eval $setvar
18310
18311 : see if shmdt exists
18312 set shmdt d_shmdt
18313 eval $inlibc
18314
18315 : see how much of the 'shm*(2)' library is present.
18316 h_shm=true
18317 echo " "
18318 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18319 *"$undef"*) h_shm=false;;
18320 esac
18321 case "$osname" in
18322 freebsd)
18323     case "`ipcs 2>&1`" in
18324     "SVID shared memory"*"not configured"*)
18325         echo "Your $osname does not have the shm*(2) configured." >&4
18326         h_shm=false
18327         val="$undef"
18328         set shmctl d_shmctl
18329         eval $setvar
18330         set shmget d_shmget
18331         eval $setvar
18332         set shmat d_shmat
18333         eval $setvar
18334         set shmdt d_shmdt
18335         eval $setvar
18336         ;;
18337     esac
18338     ;;
18339 esac
18340 : we could also check for sys/ipc.h ...
18341 if $h_shm && $test `./findhdr sys/shm.h`; then
18342         echo "You have the full shm*(2) library." >&4
18343         val="$define"
18344 else
18345         echo "You don't have the full shm*(2) library." >&4
18346         val="$undef"
18347 fi
18348 set d_shm
18349 eval $setvar
18350
18351 : see if we have sigaction
18352 echo " "
18353 if set sigaction val -f d_sigaction; eval $csym; $val; then
18354         echo 'sigaction() found.' >&4
18355         $cat > try.c <<EOP
18356 #include <stdio.h>
18357 #include <sys/types.h>
18358 #include <signal.h>
18359 #$i_stdlib I_STDLIB
18360 #ifdef I_STDLIB
18361 #include <stdlib.h>
18362 #endif
18363 int main()
18364 {
18365     struct sigaction act, oact;
18366     act.sa_flags = 0;
18367     oact.sa_handler = 0;
18368     /* so that act and oact are used */
18369     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18370 }
18371 EOP
18372         set try
18373         if eval $compile_ok; then
18374                 val="$define"
18375         else
18376                 echo "But you don't seem to have a usable struct sigaction." >&4
18377                 val="$undef"
18378         fi
18379 else
18380         echo 'sigaction NOT found.' >&4
18381         val="$undef"
18382 fi
18383 set d_sigaction; eval $setvar
18384 $rm_try
18385
18386 : see what type pids are declared as in the kernel
18387 rp="What is the type of process ids on this system?"
18388 set pid_t pidtype int stdio.h sys/types.h
18389 eval $typedef_ask
18390
18391 : see what type uids are declared as in the kernel
18392 echo " "
18393 echo "Looking for the type for user ids returned by getuid()."
18394 set uid_t uidtype xxx stdio.h sys/types.h
18395 eval $typedef
18396 case "$uidtype" in
18397 xxx)
18398         xxx=`./findhdr sys/user.h`
18399         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18400         case $1 in
18401         unsigned) dflt="$1 $2" ;;
18402         *) dflt="$1" ;;
18403         esac
18404         ;;
18405 *) dflt="$uidtype";;
18406 esac
18407 case "$uidtype" in
18408 uid_t)  echo "uid_t found." ;;
18409 *)      rp="What is the type for user ids returned by getuid()?"
18410         . ./myread
18411         uidtype="$ans"
18412         ;;
18413 esac
18414
18415 : Define hasfield_t macro for Configure internal use
18416 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18417 while $test $# -ge 2; do
18418     case "$1" in
18419         $define) echo "#include <$2>";;
18420     esac ;
18421     shift 2;
18422 done > try.c;
18423 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18424 set try;
18425 if eval $compile; then
18426         val="$define";
18427 else
18428         val="$undef";
18429 fi;
18430 set $varname;
18431 eval $setvar;
18432 $rm_try'
18433
18434 : see what siginfo fields we have
18435 case "$d_sigaction" in
18436 "$define")
18437         echo "Checking if your siginfo_t has si_errno field...">&4
18438         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18439         eval $hasfield_t;
18440
18441         echo "Checking if your siginfo_t has si_pid field...">&4
18442         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18443         eval $hasfield_t;
18444
18445         echo "Checking if your siginfo_t has si_uid field...">&4
18446         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18447         eval $hasfield_t;
18448
18449         echo "Checking if your siginfo_t has si_addr field...">&4
18450         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18451         eval $hasfield_t;
18452
18453         echo "Checking if your siginfo_t has si_status field...">&4
18454         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18455         eval $hasfield_t;
18456
18457         echo "Checking if your siginfo_t has si_band field...">&4
18458         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18459         eval $hasfield_t;
18460
18461         echo "Checking if your siginfo_t has si_value field...">&4
18462         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18463         eval $hasfield_t;
18464
18465         echo "Checking if your siginfo_t has si_fd field...">&4
18466         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18467         eval $hasfield_t;
18468
18469         ;;
18470 *)
18471         d_siginfo_si_errno="$undef"
18472         d_siginfo_si_pid="$undef"
18473         d_siginfo_si_uid="$undef"
18474         d_siginfo_si_addr="$undef"
18475         d_siginfo_si_status="$undef"
18476         d_siginfo_si_band="$undef"
18477         d_siginfo_si_value="$undef"
18478         d_siginfo_si_fd="$undef"
18479         ;;
18480 esac
18481
18482 : see if this is a sunmath.h system
18483 set sunmath.h i_sunmath
18484 eval $inhdr
18485
18486 : see if signbit exists
18487 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18488 $cat >try.c <<EOCP
18489 #$i_sunmath I_SUNMATH
18490 #include <math.h>
18491 #ifdef I_SUNMATH  /* Solaris special math library */
18492 #  include <sunmath.h>
18493 #endif
18494 #define NV $nvtype
18495 int main(int argc, char **argv)
18496 {
18497     NV x = 0.0;
18498     NV y = -1.0;
18499     if ((signbit(x) == 0) && (signbit(y) != 0))
18500         return 0;
18501     else
18502         return 1;
18503 }
18504 EOCP
18505 val="$undef"
18506 set try
18507 if eval $compile; then
18508     if $run ./try; then
18509         $echo "Yes." >&4
18510         val="$define"
18511     else
18512         $echo "Signbit seems to be available, but doesn't work as I expected."
18513         $echo "I won't use it." >&4
18514         val="$undef"
18515     fi
18516 else
18517     $echo "Nope." >&4
18518     dflt="$undef"
18519 fi
18520 set d_signbit
18521 eval $setvar
18522 $rm_try
18523
18524 : see if sigprocmask exists
18525 set sigprocmask d_sigprocmask
18526 eval $inlibc
18527
18528 : see if sigsetjmp exists
18529 echo " "
18530 case "$d_sigsetjmp" in
18531 '')
18532         $cat >try.c <<EOP
18533 #include <setjmp.h>
18534 #$i_stdlib I_STDLIB
18535 #ifdef I_STDLIB
18536 #include <stdlib.h>
18537 #endif
18538 sigjmp_buf env;
18539 int set = 1;
18540 int main()
18541 {
18542         if (sigsetjmp(env,1))
18543                 exit(set);
18544         set = 0;
18545         siglongjmp(env, 1);
18546         exit(1);
18547 }
18548 EOP
18549         set try
18550         if eval $compile; then
18551                 if $run ./try >/dev/null 2>&1; then
18552                         echo "POSIX sigsetjmp found." >&4
18553                         val="$define"
18554                 else
18555                         $cat >&4 <<EOM
18556 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18557 I'll ignore them.
18558 EOM
18559                         val="$undef"
18560                 fi
18561         else
18562                 echo "sigsetjmp not found." >&4
18563                 val="$undef"
18564         fi
18565         ;;
18566 *) val="$d_sigsetjmp"
18567         case "$d_sigsetjmp" in
18568         $define) echo "POSIX sigsetjmp found." >&4;;
18569         $undef) echo "sigsetjmp not found." >&4;;
18570         esac
18571         ;;
18572 esac
18573 set d_sigsetjmp
18574 eval $setvar
18575 $rm_try
18576
18577 : see if snprintf exists
18578 set snprintf d_snprintf
18579 eval $inlibc
18580
18581 : see if vsnprintf exists
18582 set vsnprintf d_vsnprintf
18583 eval $inlibc
18584
18585 case "$d_snprintf-$d_vsnprintf" in
18586 "$define-$define")
18587     $cat <<EOM
18588 Checking whether your snprintf() and vsnprintf() work okay...
18589 EOM
18590     $cat >try.c <<'EOCP'
18591 /* v?snprintf testing logic courtesy of Russ Allbery.
18592  * According to C99:
18593  * - if the buffer is too short it still must be \0-terminated
18594  * - if the buffer is too short the potentially required length
18595  *   must be returned and not -1
18596  * - if the buffer is NULL the potentially required length
18597  *   must be returned and not -1 or core dump
18598  */
18599 #include <stdio.h>
18600 #include <stdarg.h>
18601
18602 char buf[2];
18603
18604 int test (char *format, ...)
18605 {
18606     va_list args;
18607     int count;
18608
18609     va_start (args, format);
18610     count = vsnprintf (buf, sizeof buf, format, args);
18611     va_end (args);
18612     return count;
18613 }
18614
18615 int main ()
18616 {
18617     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18618              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18619 }
18620 EOCP
18621     set try
18622     if eval $compile; then
18623         `$run ./try`
18624         case "$?" in
18625         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18626         *) cat <<EOM >&4
18627 Your snprintf() and snprintf() don't seem to be working okay.
18628 EOM
18629            d_snprintf="$undef"
18630            d_vsnprintf="$undef"
18631            ;;
18632         esac
18633     else
18634         echo "(I can't seem to compile the test program--assuming they don't)"
18635         d_snprintf="$undef"
18636         d_vsnprintf="$undef"
18637     fi
18638     $rm_try
18639     ;;
18640 esac
18641
18642 : see if sockatmark exists
18643 set sockatmark d_sockatmark
18644 eval $inlibc
18645
18646 : see if prototype for sockatmark is available
18647 echo " "
18648 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18649 eval $hasproto
18650
18651 : see if socks5_init exists
18652 set socks5_init d_socks5_init
18653 eval $inlibc
18654
18655 : see if srand48_r exists
18656 set srand48_r d_srand48_r
18657 eval $inlibc
18658 case "$d_srand48_r" in
18659 "$define")
18660         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18661         case "$d_srand48_r_proto:$usethreads" in
18662         ":define")      d_srand48_r_proto=define
18663                 set d_srand48_r_proto srand48_r $hdrs
18664                 eval $hasproto ;;
18665         *)      ;;
18666         esac
18667         case "$d_srand48_r_proto" in
18668         define)
18669         case "$srand48_r_proto" in
18670         ''|0) try='int srand48_r(long, struct drand48_data*);'
18671         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18672         esac
18673         case "$srand48_r_proto" in
18674         ''|0)   d_srand48_r=undef
18675                 srand48_r_proto=0
18676                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18677         * )     case "$srand48_r_proto" in
18678                 REENTRANT_PROTO*) ;;
18679                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18680                 esac
18681                 echo "Prototype: $try" ;;
18682         esac
18683         ;;
18684         *)      case "$usethreads" in
18685                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18686                 esac
18687                 d_srand48_r=undef
18688                 srand48_r_proto=0
18689                 ;;
18690         esac
18691         ;;
18692 *)      srand48_r_proto=0
18693         ;;
18694 esac
18695
18696 : see if srandom_r exists
18697 set srandom_r d_srandom_r
18698 eval $inlibc
18699 case "$d_srandom_r" in
18700 "$define")
18701         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18702         case "$d_srandom_r_proto:$usethreads" in
18703         ":define")      d_srandom_r_proto=define
18704                 set d_srandom_r_proto srandom_r $hdrs
18705                 eval $hasproto ;;
18706         *)      ;;
18707         esac
18708         case "$d_srandom_r_proto" in
18709         define)
18710         case "$srandom_r_proto" in
18711         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18712         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18713         esac
18714         case "$srandom_r_proto" in
18715         ''|0)   d_srandom_r=undef
18716                 srandom_r_proto=0
18717                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18718         * )     case "$srandom_r_proto" in
18719                 REENTRANT_PROTO*) ;;
18720                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18721                 esac
18722                 echo "Prototype: $try" ;;
18723         esac
18724         ;;
18725         *)      case "$usethreads" in
18726                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18727                 esac
18728                 d_srandom_r=undef
18729                 srandom_r_proto=0
18730                 ;;
18731         esac
18732         ;;
18733 *)      srandom_r_proto=0
18734         ;;
18735 esac
18736
18737 : see if prototype for setresgid is available
18738 echo " "
18739 set d_sresgproto setresgid $i_unistd unistd.h
18740 eval $hasproto
18741
18742 : see if prototype for setresuid is available
18743 echo " "
18744 set d_sresuproto setresuid $i_unistd unistd.h
18745 eval $hasproto
18746
18747 : see if stat exists
18748 set stat d_stat
18749 eval $inlibc
18750
18751 : see if sys/stat.h is available
18752 set sys/stat.h i_sysstat
18753 eval $inhdr
18754
18755 : see if stat knows about block sizes
18756 echo " "
18757 echo "Checking to see if your struct stat has st_blocks field..." >&4
18758 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18759 eval $hasfield
18760
18761 : see if this is a sys/vfs.h system
18762 set sys/vfs.h i_sysvfs
18763 eval $inhdr
18764
18765 : see if this is a sys/statfs.h system
18766 set sys/statfs.h i_sysstatfs
18767 eval $inhdr
18768
18769 : Check for statfs_s
18770 echo " "
18771 echo "Checking to see if your system supports struct statfs..." >&4
18772 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
18773 eval $hasstruct
18774 case "$d_statfs_s" in
18775 "$define")      echo "Yes, it does."   ;;
18776 *)              echo "No, it doesn't." ;;
18777 esac
18778
18779 : see if struct statfs knows about f_flags
18780 case "$d_statfs_s" in
18781 define)
18782         echo " "
18783         echo "Checking to see if your struct statfs has f_flags field..." >&4
18784         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
18785         eval $hasfield
18786         ;;
18787 *)      val="$undef"
18788         set d_statfs_f_flags
18789         eval $setvar
18790         ;;
18791 esac
18792 case "$d_statfs_f_flags" in
18793 "$define")      echo "Yes, it does."   ;;
18794 *)              echo "No, it doesn't." ;;
18795 esac
18796
18797 : see what flavor, if any, of static inline is supported
18798 echo " "
18799 echo "Checking to see if your system supports static inline..."
18800 $cat > try.c <<'EOCP'
18801 #include <stdlib.h>
18802 extern int f_via_a(int x);
18803 extern int f_via_b(int x);
18804 int main(int argc, char **argv)
18805 {
18806     int y;
18807
18808     y = f_via_a(0);
18809 #ifdef USE_B
18810     y = f_via_b(0);
18811 #endif
18812     if (y == 42) {
18813         return EXIT_SUCCESS;
18814     }
18815     else {
18816         return EXIT_FAILURE;
18817     }
18818 }
18819 EOCP
18820 $cat > a.c <<'EOCP'
18821 static INLINE int f(int x) {
18822     int y;
18823     y = x + 42;
18824     return y;
18825 }
18826
18827 int f_via_a(int x)
18828 {
18829     return f(x);
18830 }
18831 EOCP
18832 $cat > b.c <<'EOCP'
18833 extern int f(int x);
18834
18835 int f_via_b(int x)
18836 {
18837     return f(x);
18838 }
18839 EOCP
18840
18841 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18842 case "$perl_static_inline" in
18843 '')     # Check the various possibilities, and break out on success.
18844         # For gcc, prefer __inline__, which will still permit
18845         # cflags.SH to add in -ansi.
18846         case "$gccversion" in
18847                 '') xxx="inline __inline__ __inline _inline";;
18848                 *)  xxx="__inline__ inline __inline _inline";;
18849         esac
18850         for inline in $xxx; do
18851                 set try -DINLINE=$inline a.c
18852                 if eval $compile && $run ./try; then
18853                         # Now make sure there is no external linkage of static
18854                         # functions
18855                         set try -DINLINE=$inline -DUSE_B a.c b.c
18856                         if eval $compile && $run ./try; then
18857                                 $echo "Your compiler supports static $inline, " >&4
18858                                 $echo "but it also creates an external definition," >&4
18859                                 $echo "so I won't use it." >&4
18860                                 val=$undef
18861                         else
18862                                 $echo "Your compiler supports static $inline." >&4
18863                                 val=$define
18864                                 perl_static_inline="static $inline";
18865                                 break;
18866                         fi
18867                 else
18868                         $echo "Your compiler does NOT support static $inline." >&4
18869                         val="$undef"
18870                 fi
18871         done
18872         ;;
18873 *inline*) # Some variant of inline exists.
18874         echo "Keeping your $hint value of $perl_static_inline."
18875         val=$define
18876         ;;
18877 static)  # No inline capabilities
18878         echo "Keeping your $hint value of $perl_static_inline."
18879         val=$undef
18880         ;;
18881 *)  # Unrecognized previous value -- blindly trust the supplied
18882         # value and hope it makes sense.  Use old value for
18883         # d_static_inline, if there is one.
18884         echo "Keeping your $hint value of $perl_static_inline."
18885         case "$d_static_inline" in
18886                 '') val=$define ;;
18887                 *)  val=$d_static_inline ;;
18888         esac
18889         ;;
18890 esac
18891 # Fallback to plain 'static' if nothing worked.
18892 case "$perl_static_inline" in
18893 '')
18894         perl_static_inline="static"
18895         val=$undef
18896         ;;
18897 esac
18898 set d_static_inline
18899 eval $setvar
18900 $rm -f a.[co] b.[co]
18901 $rm_try
18902
18903 : Check stream access
18904 $cat >&4 <<EOM
18905 Checking how to access stdio streams by file descriptor number...
18906 EOM
18907 case "$stdio_stream_array" in
18908 '')     $cat >try.c <<EOCP
18909 #include <stdio.h>
18910 int main() {
18911   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18912     printf("yes\n");
18913 }
18914 EOCP
18915         for s in _iob __iob __sF
18916         do
18917                 set try -DSTDIO_STREAM_ARRAY=$s
18918                 if eval $compile; then
18919                         case "`$run ./try`" in
18920                         yes)    stdio_stream_array=$s; break ;;
18921                         esac
18922                 fi
18923         done
18924         $rm_try
18925 esac
18926 case "$stdio_stream_array" in
18927 '')     $cat >&4 <<EOM
18928 I can't figure out how to access stdio streams by file descriptor number.
18929 EOM
18930         d_stdio_stream_array="$undef"
18931         ;;
18932 *)      $cat >&4 <<EOM
18933 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18934 EOM
18935         d_stdio_stream_array="$define"
18936         ;;
18937 esac
18938
18939 : see if strcoll exists
18940 set strcoll d_strcoll
18941 eval $inlibc
18942
18943 : see if strerror_l exists
18944 set strerror_l d_strerror_l
18945 eval $inlibc
18946
18947 : see if strerror_r exists
18948 set strerror_r d_strerror_r
18949 eval $inlibc
18950 case "$d_strerror_r" in
18951 "$define")
18952         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18953         case "$d_strerror_r_proto:$usethreads" in
18954         ":define")      d_strerror_r_proto=define
18955                 set d_strerror_r_proto strerror_r $hdrs
18956                 eval $hasproto ;;
18957         *)      ;;
18958         esac
18959         case "$d_strerror_r_proto" in
18960         define)
18961         case "$strerror_r_proto" in
18962         ''|0) try='int strerror_r(int, char*, size_t);'
18963         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18964         esac
18965         case "$strerror_r_proto" in
18966         ''|0) try='int strerror_r(int, char*, int);'
18967         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18968         esac
18969         case "$strerror_r_proto" in
18970         ''|0) try='char* strerror_r(int, char*, size_t);'
18971         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18972         esac
18973         case "$strerror_r_proto" in
18974         ''|0)   d_strerror_r=undef
18975                 strerror_r_proto=0
18976                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18977         * )     case "$strerror_r_proto" in
18978                 REENTRANT_PROTO*) ;;
18979                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18980                 esac
18981                 echo "Prototype: $try" ;;
18982         esac
18983         ;;
18984         *)      case "$usethreads" in
18985                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18986                 esac
18987                 d_strerror_r=undef
18988                 strerror_r_proto=0
18989                 ;;
18990         esac
18991         ;;
18992 *)      strerror_r_proto=0
18993         ;;
18994 esac
18995
18996 : see if strftime exists
18997 set strftime d_strftime
18998 eval $inlibc
18999
19000 : see if strlcat exists
19001 : We need both a prototype in string.h and the symbol in libc.
19002 echo " "
19003 d_strlcat_proto=''
19004 xx1="#$d_gnulibc HAS_GNULIBC"
19005 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19006 xx3='#   define _GNU_SOURCE'
19007 xx4='#endif'
19008 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19009 eval $hasproto
19010 case "$d_strlcat_proto" in
19011     define) # see if strlcat exists
19012         set strlcat d_strlcat
19013         eval $inlibc
19014         ;;
19015     *)  val=$undef
19016         set d_strlcat
19017         eval $setvar
19018         ;;
19019 esac
19020
19021 : see if strlcpy exists
19022 : We need both a prototype in string.h and the symbol in libc.
19023 echo " "
19024 d_strlcpy_proto=''
19025 xx1="#$d_gnulibc HAS_GNULIBC"
19026 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19027 xx3='#   define _GNU_SOURCE'
19028 xx4='#endif'
19029 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19030 eval $hasproto
19031 case "$d_strlcpy_proto" in
19032     define) # see if strlcpy exists
19033         set strlcpy d_strlcpy
19034         eval $inlibc
19035         ;;
19036     *)  val=$undef
19037         set d_strlcpy
19038         eval $setvar
19039         ;;
19040 esac
19041
19042 : see if strnlen exists
19043 set strnlen d_strnlen
19044 eval $inlibc
19045
19046 : see if strtod exists
19047 set strtod d_strtod
19048 eval $inlibc
19049
19050 : see if strtod_l exists
19051 set strtod_l d_strtod_l
19052 eval $inlibc
19053
19054 : see if strtol exists
19055 set strtol d_strtol
19056 eval $inlibc
19057
19058 : see if strtold exists
19059 set strtold d_strtold
19060 eval $inlibc
19061
19062 : see if strtold_l exists
19063 set strtold_l d_strtold_l
19064 eval $inlibc
19065
19066 : see if strtoll exists
19067 set strtoll d_strtoll
19068 eval $inlibc
19069
19070 case "$d_longlong-$d_strtoll" in
19071 "$define-$define")
19072         $cat <<EOM
19073 Checking whether your strtoll() works okay...
19074 EOM
19075         $cat >try.c <<'EOCP'
19076 #include <errno.h>
19077 #ifdef __hpux
19078 #define strtoll __strtoll
19079 #endif
19080 #ifdef __EMX__
19081 #define strtoll _strtoll
19082 #endif
19083 #include <stdio.h>
19084 extern long long int strtoll(char *s, char **, int);
19085 static int bad = 0;
19086 int check(char *s, long long ell, int een) {
19087         long long gll;
19088         errno = 0;
19089         gll = strtoll(s, 0, 10);
19090         if (!((gll == ell) && (errno == een)))
19091                 bad++;
19092 }
19093 int main() {
19094         check(" 1",                                      1LL, 0);
19095         check(" 0",                                      0LL, 0);
19096         check("-1",                                     -1LL, 0);
19097         check("-9223372036854775808", -9223372036854775808LL, 0);
19098         check("-9223372036854775808", -9223372036854775808LL, 0);
19099         check(" 9223372036854775807",  9223372036854775807LL, 0);
19100         check("-9223372036854775808", -9223372036854775808LL, 0);
19101         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19102         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19103         if (!bad)
19104                 printf("ok\n");
19105 }
19106 EOCP
19107         set try
19108         if eval $compile; then
19109                 yyy=`$run ./try`
19110                 case "$yyy" in
19111                 ok) echo "Your strtoll() seems to be working okay." ;;
19112                 *) cat <<EOM >&4
19113 Your strtoll() doesn't seem to be working okay.
19114 EOM
19115                    d_strtoll="$undef"
19116                    ;;
19117                 esac
19118         else
19119                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19120                 d_strtoll="$undef"
19121         fi
19122         ;;
19123 esac
19124
19125 : see if strtoq exists
19126 set strtoq d_strtoq
19127 eval $inlibc
19128
19129 : see if strtoul exists
19130 set strtoul d_strtoul
19131 eval $inlibc
19132
19133 case "$d_strtoul" in
19134 "$define")
19135         $cat <<EOM
19136 Checking whether your strtoul() works okay...
19137 EOM
19138         $cat >try.c <<'EOCP'
19139 #include <errno.h>
19140 #include <stdio.h>
19141 extern unsigned long int strtoul(char *s, char **, int);
19142 static int bad = 0;
19143 void check(char *s, unsigned long eul, int een) {
19144         unsigned long gul;
19145         errno = 0;
19146         gul = strtoul(s, 0, 10);
19147         if (!((gul == eul) && (errno == een)))
19148                 bad++;
19149 }
19150 int main() {
19151         check(" 1", 1L, 0);
19152         check(" 0", 0L, 0);
19153 EOCP
19154         case "$longsize" in
19155         8)
19156             $cat >>try.c <<'EOCP'
19157         check("18446744073709551615", 18446744073709551615UL, 0);
19158         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19159 #if 0 /* strtoul() for /^-/ strings is undefined. */
19160         check("-1", 18446744073709551615UL, 0);
19161         check("-18446744073709551614", 2, 0);
19162         check("-18446744073709551615", 1, 0);
19163         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19164         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19165 #endif
19166 EOCP
19167                 ;;
19168         4)
19169                     $cat >>try.c <<'EOCP'
19170         check("4294967295", 4294967295UL, 0);
19171         check("4294967296", 4294967295UL, ERANGE);
19172 #if 0 /* strtoul() for /^-/ strings is undefined. */
19173         check("-1", 4294967295UL, 0);
19174         check("-4294967294", 2, 0);
19175         check("-4294967295", 1, 0);
19176         check("-4294967296", 4294967295UL, ERANGE);
19177         check("-4294967297", 4294967295UL, ERANGE);
19178 #endif
19179 EOCP
19180                 ;;
19181         *)
19182 : Should we write these tests to be more portable by sprintf-ing
19183 : ~0 and then manipulating that char string as input for strtol?
19184                 ;;
19185         esac
19186         $cat >>try.c <<'EOCP'
19187         if (!bad)
19188                 printf("ok\n");
19189         return 0;
19190 }
19191 EOCP
19192         set try
19193         if eval $compile; then
19194                 case "`$run ./try`" in
19195                 ok) echo "Your strtoul() seems to be working okay." ;;
19196                 *) cat <<EOM >&4
19197 Your strtoul() doesn't seem to be working okay.
19198 EOM
19199                    d_strtoul="$undef"
19200                    ;;
19201                 esac
19202         else
19203                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19204                 d_strtoul="$undef"
19205         fi
19206         ;;
19207 esac
19208
19209 : see if strtoull exists
19210 set strtoull d_strtoull
19211 eval $inlibc
19212
19213 case "$d_longlong-$d_strtoull" in
19214 "$define-$define")
19215         $cat <<EOM
19216 Checking whether your strtoull() works okay...
19217 EOM
19218         $cat >try.c <<'EOCP'
19219 #include <errno.h>
19220 #ifdef __hpux
19221 #define strtoull __strtoull
19222 #endif
19223 #include <stdio.h>
19224 extern unsigned long long int strtoull(char *s, char **, int);
19225 static int bad = 0;
19226 int check(char *s, long long eull, int een) {
19227         long long gull;
19228         errno = 0;
19229         gull = strtoull(s, 0, 10);
19230         if (!((gull == eull) && (errno == een)))
19231                 bad++;
19232 }
19233 int main() {
19234         check(" 1",                                        1LL, 0);
19235         check(" 0",                                        0LL, 0);
19236         check("18446744073709551615",  18446744073709551615ULL, 0);
19237         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19238 #if 0 /* strtoull() for /^-/ strings is undefined. */
19239         check("-1",                    18446744073709551615ULL, 0);
19240         check("-18446744073709551614",                     2LL, 0);
19241         check("-18446744073709551615",                     1LL, 0);
19242         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19243         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19244 #endif
19245         if (!bad)
19246                 printf("ok\n");
19247 }
19248 EOCP
19249         set try
19250         if eval $compile; then
19251                 case "`$run ./try`" in
19252                 ok) echo "Your strtoull() seems to be working okay." ;;
19253                 *) cat <<EOM >&4
19254 Your strtoull() doesn't seem to be working okay.
19255 EOM
19256                    d_strtoull="$undef"
19257                    ;;
19258                 esac
19259         else
19260                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19261                 d_strtoull="$undef"
19262         fi
19263         ;;
19264 esac
19265
19266 : see if strtouq exists
19267 set strtouq d_strtouq
19268 eval $inlibc
19269
19270 case "$d_strtouq" in
19271 "$define")
19272         $cat <<EOM
19273 Checking whether your strtouq() works okay...
19274 EOM
19275         $cat >try.c <<'EOCP'
19276 #include <errno.h>
19277 #include <stdio.h>
19278 extern unsigned long long int strtouq(char *s, char **, int);
19279 static int bad = 0;
19280 void check(char *s, unsigned long long eull, int een) {
19281         unsigned long long gull;
19282         errno = 0;
19283         gull = strtouq(s, 0, 10);
19284         if (!((gull == eull) && (errno == een)))
19285                 bad++;
19286 }
19287 int main() {
19288         check(" 1",                                        1LL, 0);
19289         check(" 0",                                        0LL, 0);
19290         check("18446744073709551615",  18446744073709551615ULL, 0);
19291         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19292 #if 0 /* strtouq() for /^-/ strings is undefined. */
19293         check("-1",                    18446744073709551615ULL, 0);
19294         check("-18446744073709551614",                     2LL, 0);
19295         check("-18446744073709551615",                     1LL, 0);
19296         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19297         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19298 #endif
19299         if (!bad)
19300                 printf("ok\n");
19301         return 0;
19302 }
19303 EOCP
19304         set try
19305         if eval $compile; then
19306                 case "`$run ./try`" in
19307                 ok) echo "Your strtouq() seems to be working okay." ;;
19308                 *) cat <<EOM >&4
19309 Your strtouq() doesn't seem to be working okay.
19310 EOM
19311                    d_strtouq="$undef"
19312                    ;;
19313                 esac
19314         else
19315                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19316                 d_strtouq="$undef"
19317         fi
19318         ;;
19319 esac
19320
19321 : see if strxfrm exists
19322 set strxfrm d_strxfrm
19323 eval $inlibc
19324
19325 : see if symlink exists
19326 set symlink d_symlink
19327 eval $inlibc
19328
19329 : see if syscall exists
19330 set syscall d_syscall
19331 eval $inlibc
19332
19333 : see if prototype for syscall is available
19334 echo " "
19335 set d_syscallproto syscall $i_unistd unistd.h
19336 eval $hasproto
19337
19338 : see if sysconf exists
19339 set sysconf d_sysconf
19340 eval $inlibc
19341
19342 : see if sys_errlist[] exists
19343 echo " "
19344 if test "X$d_syserrlst" = X; then
19345         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19346                 echo "You have sys_errlist[], so we could roll our own strerror."
19347                 d_syserrlst="$define"
19348         else
19349                 echo "You don't have sys_errlist[], so strerror() is welcome."
19350                 d_syserrlst="$undef"
19351         fi
19352 fi
19353
19354 : see if system exists
19355 set system d_system
19356 eval $inlibc
19357
19358 : see if tcgetpgrp exists
19359 set tcgetpgrp d_tcgetpgrp
19360 eval $inlibc
19361
19362 : see if tcsetpgrp exists
19363 set tcsetpgrp d_tcsetpgrp
19364 eval $inlibc
19365
19366 : see if prototype for telldir is available
19367 echo " "
19368 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19369 eval $hasproto
19370
19371 : see if tgamma exists
19372 set tgamma d_tgamma
19373 eval $inlibc
19374
19375 : check for thread_safe_nl_langinfo_l item
19376 $cat <<EOM
19377
19378 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19379 EOM
19380 $cat >try.c <<EOCP
19381 #$i_stdlib I_STDLIB
19382 #ifdef I_STDLIB
19383 #  include <stdlib.h>
19384 #endif
19385 #include <string.h>
19386 #$i_langinfo I_LANGINFO
19387 #ifdef I_LANGINFO
19388 #  include <langinfo.h>
19389 #endif
19390 #$i_pthread I_PTHREAD
19391 #ifdef I_PTHREAD
19392 #  include <pthread.h>
19393 #endif
19394 #$i_locale I_LOCALE
19395 #ifdef I_LOCALE
19396 #  include <locale.h>
19397 #endif
19398
19399 void *
19400 thread_start(void * arg)
19401 {
19402     nl_langinfo(RADIXCHAR);
19403 }
19404
19405 int main() {
19406     char * main_buffer;
19407     char save_main_buffer[1000];
19408     pthread_t subthread;
19409     pthread_attr_t attr;
19410
19411     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19412
19413     /* If too large for our generous allowance, just assume we don't have
19414      * it. */
19415     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19416         exit(1);
19417     }
19418
19419     strcpy(save_main_buffer, main_buffer);
19420
19421     if (pthread_attr_init(&attr) != 0) {
19422         exit(1);
19423     }
19424
19425     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19426         exit(1);
19427     }
19428
19429     if (pthread_join(subthread, NULL) != 0) {
19430         exit(1);
19431     }
19432
19433     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19434 }
19435 EOCP
19436 case "$usethreads" in
19437     define)
19438         set try
19439         if eval $compile; then
19440             echo "Your system has nl_langinfo_l()..." >&4
19441             if $run ./try; then
19442                 echo "and it is thread-safe (just as I'd hoped)." >&4
19443                 d_thread_safe_nl_langinfo_l="$define"
19444                 echo "$d_thread_safe_nl_langinfo_l" >&4
19445             else
19446                 echo "but it isn't thread-safe, so we won't use it." >&4
19447             fi
19448         else
19449             echo "your system does not have nl_langinfo_l()" >&4
19450         fi
19451         ;;
19452     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19453 esac
19454 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19455         d_thread_safe_nl_langinfo_l="$undef"
19456 fi
19457 $rm_try
19458
19459 : see if time exists
19460 echo " "
19461 if test "X$d_time" = X -o X"$timetype" = X; then
19462     if set time val -f d_time; eval $csym; $val; then
19463                 echo 'time() found.' >&4
19464                 val="$define"
19465                 rp="What is the type returned by time() on this system?"
19466                 set time_t timetype long stdio.h sys/types.h
19467                 eval $typedef_ask
19468     else
19469                 echo 'time() not found, hope that will do.' >&4
19470                 val="$undef"
19471                 timetype='int';
19472     fi
19473     set d_time
19474     eval $setvar
19475 fi
19476
19477 : see if timegm exists
19478 set timegm d_timegm
19479 eval $inlibc
19480
19481 : see if this is a sys/times.h system
19482 set sys/times.h i_systimes
19483 eval $inhdr
19484
19485 : see if times exists
19486 echo " "
19487 if set times val -f d_times; eval $csym; $val; then
19488         echo 'times() found.' >&4
19489         d_times="$define"
19490         inc=''
19491         case "$i_systimes" in
19492         "$define") inc='sys/times.h';;
19493         esac
19494         rp="What is the type returned by times() on this system?"
19495         set clock_t clocktype long stdio.h sys/types.h $inc
19496         eval $typedef_ask
19497 else
19498         echo 'times() NOT found, hope that will do.' >&4
19499         d_times="$undef"
19500         clocktype='int'
19501 fi
19502
19503 : see if tmpnam_r exists
19504 set tmpnam_r d_tmpnam_r
19505 eval $inlibc
19506 case "$d_tmpnam_r" in
19507 "$define")
19508         hdrs="$i_systypes sys/types.h define stdio.h "
19509         case "$d_tmpnam_r_proto:$usethreads" in
19510         ":define")      d_tmpnam_r_proto=define
19511                 set d_tmpnam_r_proto tmpnam_r $hdrs
19512                 eval $hasproto ;;
19513         *)      ;;
19514         esac
19515         case "$d_tmpnam_r_proto" in
19516         define)
19517         case "$tmpnam_r_proto" in
19518         ''|0) try='char* tmpnam_r(char*);'
19519         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19520         esac
19521         case "$tmpnam_r_proto" in
19522         ''|0)   d_tmpnam_r=undef
19523                 tmpnam_r_proto=0
19524                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19525         * )     case "$tmpnam_r_proto" in
19526                 REENTRANT_PROTO*) ;;
19527                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19528                 esac
19529                 echo "Prototype: $try" ;;
19530         esac
19531         ;;
19532         *)      case "$usethreads" in
19533                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19534                 esac
19535                 d_tmpnam_r=undef
19536                 tmpnam_r_proto=0
19537                 ;;
19538         esac
19539         ;;
19540 *)      tmpnam_r_proto=0
19541         ;;
19542 esac
19543
19544 : see if towlower exists
19545 set towlower d_towlower
19546 eval $inlibc
19547
19548 : see if trunc exists
19549 set trunc d_trunc
19550 eval $inlibc
19551
19552 : see if truncate exists
19553 set truncate d_truncate
19554 eval $inlibc
19555
19556 : see if ttyname_r exists
19557 set ttyname_r d_ttyname_r
19558 eval $inlibc
19559 case "$d_ttyname_r" in
19560 "$define")
19561         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19562         case "$d_ttyname_r_proto:$usethreads" in
19563         ":define")      d_ttyname_r_proto=define
19564                 set d_ttyname_r_proto ttyname_r $hdrs
19565                 eval $hasproto ;;
19566         *)      ;;
19567         esac
19568         case "$d_ttyname_r_proto" in
19569         define)
19570         case "$ttyname_r_proto" in
19571         ''|0) try='int ttyname_r(int, char*, size_t);'
19572         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19573         esac
19574         case "$ttyname_r_proto" in
19575         ''|0) try='int ttyname_r(int, char*, int);'
19576         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19577         esac
19578         case "$ttyname_r_proto" in
19579         ''|0) try='char* ttyname_r(int, char*, int);'
19580         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19581         esac
19582         case "$ttyname_r_proto" in
19583         ''|0)   d_ttyname_r=undef
19584                 ttyname_r_proto=0
19585                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19586         * )     case "$ttyname_r_proto" in
19587                 REENTRANT_PROTO*) ;;
19588                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19589                 esac
19590                 echo "Prototype: $try" ;;
19591         esac
19592         ;;
19593         *)      case "$usethreads" in
19594                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19595                 esac
19596                 d_ttyname_r=undef
19597                 ttyname_r_proto=0
19598                 ;;
19599         esac
19600         ;;
19601 *)      ttyname_r_proto=0
19602         ;;
19603 esac
19604
19605 : see if tzname[] exists
19606 echo " "
19607 if set tzname val -a d_tzname; eval $csym; $val; then
19608         val="$define"
19609         echo 'tzname[] found.' >&4
19610 else
19611         val="$undef"
19612         echo 'tzname[] NOT found.' >&4
19613 fi
19614 set d_tzname
19615 eval $setvar
19616
19617 : Check if is a multiplatform env
19618 case "$osname" in
19619 darwin) multiarch="$define" ;;
19620 esac
19621 case "$multiarch" in
19622 ''|[nN]*) multiarch="$undef" ;;
19623 esac
19624
19625 : check for ordering of bytes in a UV
19626 echo " "
19627 case "$multiarch" in
19628 *$define*)
19629         $cat <<EOM
19630 You seem to be doing a multiarchitecture build,
19631 skipping the byteorder check.
19632
19633 EOM
19634         byteorder='ffff'
19635         ;;
19636 *)
19637         case "$byteorder" in
19638         '')
19639                 $cat <<'EOM'
19640 In the following, larger digits indicate more significance.  A big-endian
19641 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19642 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19643 machines may have weird orders like 3412.  A Cray will report 87654321,
19644 an Alpha will report 12345678. If the test program works the default is
19645 probably right.
19646 I'm now running the test program...
19647 EOM
19648                 $cat >try.c <<EOCP
19649 #include <stdio.h>
19650 #$i_stdlib I_STDLIB
19651 #ifdef I_STDLIB
19652 #include <stdlib.h>
19653 #endif
19654 #include <sys/types.h>
19655 typedef $uvtype UV;
19656 int main()
19657 {
19658         int i;
19659         union {
19660                 UV l;
19661                 char c[$uvsize];
19662         } u;
19663
19664         if ($uvsize > 4)
19665                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19666         else
19667                 u.l = (UV)0x04030201;
19668         for (i = 0; i < $uvsize; i++)
19669                 printf("%c", u.c[i]+'0');
19670         printf("\n");
19671         exit(0);
19672 }
19673 EOCP
19674                 xxx_prompt=y
19675                 set try
19676                 if eval $compile && $run ./try > /dev/null; then
19677                         dflt=`$run ./try`
19678                         case "$dflt" in
19679                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19680                                 echo "(The test program ran ok.)"
19681                                 echo "byteorder=$dflt"
19682                                 xxx_prompt=n
19683                         ;;
19684                         ????|????????) echo "(The test program ran ok.)" ;;
19685                         *) echo "(The test program didn't run right for some reason.)" ;;
19686                         esac
19687                 else
19688                         dflt='4321'
19689                         cat <<'EOM'
19690 (I can't seem to compile the test program.  Guessing big-endian...)
19691 EOM
19692                 fi
19693                 case "$xxx_prompt" in
19694                 y)
19695                         rp="What is the order of bytes in $uvtype?"
19696                         . ./myread
19697                         byteorder="$ans"
19698                         ;;
19699                 *)      byteorder=$dflt
19700                         ;;
19701                 esac
19702                 ;;
19703         esac
19704         $rm_try
19705         ;;
19706 esac
19707
19708 : Checking 32bit alignedness
19709 $cat <<EOM
19710
19711 Checking to see whether you can access character data unalignedly...
19712 EOM
19713 case "$d_u32align" in
19714 '')   $cat >try.c <<EOCP
19715 #include <stdio.h>
19716 #$i_stdlib I_STDLIB
19717 #ifdef I_STDLIB
19718 #include <stdlib.h>
19719 #endif
19720 #define U32 $u32type
19721 #define BYTEORDER 0x$byteorder
19722 #define U8 $u8type
19723 #include <signal.h>
19724 #ifdef SIGBUS
19725 $signal_t bletch(int s) { exit(4); }
19726 #endif
19727 int main() {
19728 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19729     volatile U8 buf[8];
19730     volatile U32 *up;
19731     int i;
19732
19733     if (sizeof(U32) != 4) {
19734         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19735         exit(1);
19736     }
19737
19738     fflush(stdout);
19739
19740 #ifdef SIGBUS
19741     signal(SIGBUS, bletch);
19742 #endif
19743
19744     buf[0] = 0;
19745     buf[1] = 0;
19746     buf[2] = 0;
19747     buf[3] = 1;
19748     buf[4] = 0;
19749     buf[5] = 0;
19750     buf[6] = 0;
19751     buf[7] = 1;
19752
19753     for (i = 0; i < 4; i++) {
19754         up = (U32*)(buf + i);
19755         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19756                (*up == 1 << (8*(3-i)))  /* little-endian */
19757               )
19758            )
19759         {
19760             printf("read failed (%x)\n", *up);
19761             exit(2);
19762         }
19763     }
19764
19765     /* write test */
19766     for (i = 0; i < 4; i++) {
19767         up = (U32*)(buf + i);
19768         *up = 0xBeef;
19769         if (*up != 0xBeef) {
19770             printf("write failed (%x)\n", *up);
19771             exit(3);
19772         }
19773     }
19774
19775     exit(0);
19776 #else
19777     printf("1\n");
19778     exit(1);
19779 #endif
19780     return 0;
19781 }
19782 EOCP
19783 set try
19784 if eval $compile_ok; then
19785         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19786         $run ./try 2>&1 >/dev/null
19787         case "$?" in
19788         0)      cat >&4 <<EOM
19789 You can access character data pretty unalignedly.
19790 EOM
19791                 d_u32align="$undef"
19792                 ;;
19793         *)      cat >&4 <<EOM
19794 It seems that you must access character data in an aligned manner.
19795 EOM
19796                 d_u32align="$define"
19797                 ;;
19798         esac
19799 else
19800         rp='Can you access character data at unaligned addresses?'
19801         dflt='n'
19802         . ./myread
19803         case "$ans" in
19804         [yY]*)  d_u32align="$undef"  ;;
19805         *)      d_u32align="$define" ;;
19806         esac
19807 fi
19808 $rm_try
19809 ;;
19810 esac
19811
19812 : see if ualarm exists
19813 set ualarm d_ualarm
19814 eval $inlibc
19815
19816 : see if umask exists
19817 set umask d_umask
19818 eval $inlibc
19819
19820 : see if unordered exists
19821 set unordered d_unordered
19822 eval $inlibc
19823
19824 : see if unsetenv exists
19825 set unsetenv d_unsetenv
19826 eval $inlibc
19827
19828 : see if usleep exists
19829 set usleep d_usleep
19830 eval $inlibc
19831
19832 : see if prototype for usleep is available
19833 echo " "
19834 set d_usleepproto usleep $i_unistd unistd.h
19835 eval $hasproto
19836
19837 : see if ustat exists
19838 set ustat d_ustat
19839 eval $inlibc
19840
19841 : see if closedir exists
19842 set closedir d_closedir
19843 eval $inlibc
19844
19845 case "$d_closedir" in
19846 "$define")
19847         echo " "
19848         echo "Checking whether closedir() returns a status..." >&4
19849         cat > try.c <<EOM
19850 #$i_dirent I_DIRENT             /**/
19851 #$i_sysdir I_SYS_DIR            /**/
19852 #$i_sysndir I_SYS_NDIR          /**/
19853 #$i_systypes I_SYS_TYPES        /**/
19854
19855 #if defined(I_SYS_TYPES)
19856 #include <sys/types.h>
19857 #endif
19858 #if defined(I_DIRENT)
19859 #include <dirent.h>
19860 #else
19861 #ifdef I_SYS_NDIR
19862 #include <sys/ndir.h>
19863 #else
19864 #ifdef I_SYS_DIR
19865 #include <sys/dir.h>
19866 #endif
19867 #endif
19868 #endif
19869 int main() { return closedir(opendir(".")); }
19870 EOM
19871         set try
19872         if eval $compile_ok; then
19873                 if $run ./try > /dev/null 2>&1 ; then
19874                         echo "Yes, it does."
19875                         val="$undef"
19876                 else
19877                         echo "No, it doesn't."
19878                         val="$define"
19879                 fi
19880         else
19881                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19882                 val="$define"
19883         fi
19884         ;;
19885 *)
19886         val="$undef";
19887         ;;
19888 esac
19889 set d_void_closedir
19890 eval $setvar
19891 $rm_try
19892
19893 : see if there is a wait4
19894 set wait4 d_wait4
19895 eval $inlibc
19896
19897 : see if waitpid exists
19898 set waitpid d_waitpid
19899 eval $inlibc
19900
19901 : look for wcscmp
19902 echo " "
19903 $cat >try.c <<'EOCP'
19904 #include <stdio.h>
19905 #include <wchar.h>
19906 int main ()
19907 {
19908     wchar_t *s = L" ";
19909     return (wcscmp (s, s) ? 1 : 0);
19910     }
19911 EOCP
19912 set try
19913 val="$undef"
19914 if eval $compile; then
19915     `$run ./try`
19916     case "$?" in
19917         0)  echo "A working wcscmp() found." >&4
19918             val="$define" ;;
19919         *)  echo "wcscmp() found, but it doesn't work" >&4
19920             ;;
19921         esac
19922 else
19923     echo "wcscmp() NOT found." >&4
19924     fi
19925 set d_wcscmp
19926 eval $setvar
19927 $rm_try
19928
19929 : see if wcstombs exists
19930 set wcstombs d_wcstombs
19931 eval $inlibc
19932
19933 : look for wcsxfrm
19934 echo " "
19935 $cat >try.c <<'EOCP'
19936 #include <errno.h>
19937 #include <wchar.h>
19938 int main ()
19939 {
19940     wchar_t dst[4], *src = L" ";
19941     errno = 0;
19942     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19943     }
19944 EOCP
19945 set try
19946 val="$undef"
19947 if eval $compile; then
19948     `$run ./try`
19949     case "$?" in
19950         0)  echo "A working wcsxfrm() found." >&4
19951             val="$define" ;;
19952         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19953             ;;
19954         esac
19955 else
19956     echo "wcsxfrm() NOT found." >&4
19957     fi
19958 set d_wcsxfrm
19959 eval $setvar
19960 $rm_try
19961
19962 : see if wctomb exists
19963 set wctomb d_wctomb
19964 eval $inlibc
19965
19966 : see if writev exists
19967 set writev d_writev
19968 eval $inlibc
19969
19970 : check for alignment requirements
19971 echo " "
19972 case "$alignbytes" in
19973     '') echo "Checking alignment constraints..." >&4
19974         $cat >try.c <<EOCP
19975 #include <stdio.h>
19976 struct foobar {
19977     char foo;
19978     $nvtype bar;
19979 } try_algn;
19980 int main()
19981 {
19982     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19983     return(0);
19984 }
19985 EOCP
19986         set try
19987         if eval $compile_ok; then
19988             dflt=`$run ./try`
19989         else
19990             dflt='8'
19991             echo "(I can't seem to compile the test program...)"
19992         fi
19993         case "$multiarch" in
19994             *$define*)
19995                 : The usual safe value is 8, but Darwin with -Duselongdouble
19996                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19997                 : Configure to pick a larger value if needed.
19998                 if $test "$dflt" -lt 8; then
19999                     dflt='8'
20000                     echo "Setting alignment to 8 for multiarch support.">&4
20001                 fi
20002                 ;;
20003         esac
20004         ;;
20005     *) dflt="$alignbytes"
20006         ;;
20007 esac
20008 rp="Doubles must be aligned on a how-many-byte boundary?"
20009 . ./myread
20010 alignbytes="$ans"
20011 $rm_try
20012
20013 : set the base revision
20014 baserev=5.0
20015
20016 : length of character in bytes. Is always 1, otherwise it is not C
20017 : This used to be a test using sizeof
20018 charsize=1
20019
20020 : Check for the number of bits in a character
20021 case "$charbits" in
20022 '')     echo "Checking how long a character is (in bits)..." >&4
20023         $cat >try.c <<EOCP
20024 #include <stdio.h>
20025 int main ()
20026 {
20027     int n;
20028     unsigned char c;
20029     for (c = 1, n = 0; c; c <<= 1, n++) ;
20030     printf ("%d\n", n);
20031     return (0);
20032     }
20033 EOCP
20034         set try
20035         if eval $compile_ok; then
20036                 dflt=`$run ./try`
20037         else
20038                 dflt='8'
20039                 echo "(I can't seem to compile the test program.  Guessing...)"
20040         fi
20041         ;;
20042 *)
20043         dflt="$charbits"
20044         ;;
20045 esac
20046 rp="What is the length of a character (in bits)?"
20047 . ./myread
20048 charbits="$ans"
20049 $rm_try
20050 case "$charbits" in
20051 8)      ;;
20052 *)      cat >&4 << EOM
20053 Your system has an unsigned character size of $charbits bits, which
20054 is rather unusual (normally it is 8 bits).  Perl likely will not work
20055 correctly on your system, with subtle bugs in various places.
20056 EOM
20057         rp='Do you really want to continue?'
20058         dflt='n'
20059         . ./myread
20060         case "$ans" in
20061                 [yY])   echo >&4 "Okay, continuing."    ;;
20062                 *)      exit 1                          ;;
20063         esac
20064 esac
20065
20066 : how do we concatenate cpp tokens here?
20067 echo " "
20068 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20069 $cat >cpp_stuff.c <<'EOCP'
20070 #define RCAT(a,b)a/**/b
20071 #define ACAT(a,b)a ## b
20072 RCAT(Rei,ser)
20073 ACAT(Cir,cus)
20074 EOCP
20075 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20076 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20077         echo "Oh!  Smells like ANSI's been here." >&4
20078         echo "We can catify or stringify, separately or together!"
20079         cpp_stuff=42
20080 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20081         echo "Ah, yes!  The good old days!" >&4
20082         echo "However, in the good old days we don't know how to stringify and"
20083         echo "catify at the same time."
20084         cpp_stuff=1
20085 else
20086         $cat >&4 <<EOM
20087 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20088 You're going to have to edit the values of CAT[2-5] in config.h...
20089 EOM
20090         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20091 fi
20092 $rm -f cpp_stuff.*
20093
20094 : see if this is a db.h system
20095 set db.h i_db
20096 eval $inhdr
20097
20098 case "$i_db" in
20099 $define)
20100         : Check db version.
20101         echo " "
20102         echo "Checking Berkeley DB version ..." >&4
20103         $cat >try.c <<EOCP
20104 #include <sys/types.h>
20105 #include <stdio.h>
20106 #$i_stdlib I_STDLIB
20107 #ifdef I_STDLIB
20108 #include <stdlib.h>
20109 #endif
20110 #include <db.h>
20111 int main(int argc, char *argv[])
20112 {
20113 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20114     int Major, Minor, Patch ;
20115     unsigned long Version ;
20116     (void)db_version(&Major, &Minor, &Patch) ;
20117     if (argc == 2) {
20118         printf("%d %d %d %d %d %d\n",
20119                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20120                Major, Minor, Patch);
20121         exit(0);
20122     }
20123     printf("You have Berkeley DB Version 2 or greater.\n");
20124
20125     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20126                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20127     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20128                 Major, Minor, Patch) ;
20129
20130     /* check that db.h & libdb are compatible */
20131     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20132         printf("db.h and libdb are incompatible.\n") ;
20133         exit(3);
20134     }
20135
20136     printf("db.h and libdb are compatible.\n") ;
20137
20138     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20139                 + DB_VERSION_PATCH ;
20140
20141     /* needs to be >= 2.3.4 */
20142     if (Version < 2003004) {
20143     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20144         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20145         exit(2);
20146     }
20147
20148     exit(0);
20149 #else
20150 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20151     if (argc == 2) {
20152         printf("1 0 0\n");
20153         exit(0);
20154     }
20155     printf("You have Berkeley DB Version 1.\n");
20156     exit(0);    /* DB version < 2: the coast is clear. */
20157 #else
20158     exit(1);    /* <db.h> not Berkeley DB? */
20159 #endif
20160 #endif
20161 }
20162 EOCP
20163         set try
20164         if eval $compile_ok && $run ./try; then
20165                 echo 'Looks OK.' >&4
20166                 set `$run ./try 1`
20167                 db_version_major=$1
20168                 db_version_minor=$2
20169                 db_version_patch=$3
20170         else
20171                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20172                 i_db=$undef
20173                 case " $libs " in
20174                 *"-ldb "*)
20175                         : Remove db from list of libraries to use
20176                         echo "Removing unusable -ldb from library list" >&4
20177                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20178                         shift
20179                         libs="$*"
20180                         echo "libs = $libs" >&4
20181                         ;;
20182                 esac
20183         fi
20184         $rm_try
20185         ;;
20186 esac
20187
20188 case "$i_db" in
20189 define)
20190         : Check the return type needed for hash
20191         echo " "
20192         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20193         $cat >try.c <<EOCP
20194 #include <sys/types.h>
20195 #include <db.h>
20196
20197 #ifndef DB_VERSION_MAJOR
20198 u_int32_t hash_cb (const void* ptr, size_t size)
20199 {
20200         return 0;
20201 }
20202 HASHINFO info;
20203 int main()
20204 {
20205         info.hash = hash_cb;
20206 }
20207 #endif
20208 EOCP
20209         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20210                 if $contains warning try.out >>/dev/null 2>&1 ; then
20211                         db_hashtype='int'
20212                 else
20213                         db_hashtype='u_int32_t'
20214                 fi
20215         else
20216                 : XXX Maybe we should just give up here.
20217                 db_hashtype=u_int32_t
20218                 $cat try.out >&4
20219                 echo "Help:  I can't seem to compile the db test program." >&4
20220                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20221         fi
20222         $rm_try
20223         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20224         ;;
20225 *)      db_hashtype=u_int32_t
20226         ;;
20227 esac
20228 case "$i_db" in
20229 define)
20230         : Check the return type needed for prefix
20231         echo " "
20232         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20233         cat >try.c <<EOCP
20234 #include <sys/types.h>
20235 #include <db.h>
20236
20237 #ifndef DB_VERSION_MAJOR
20238 size_t prefix_cb (const DBT *key1, const DBT *key2)
20239 {
20240         return 0;
20241 }
20242 BTREEINFO info;
20243 int main()
20244 {
20245         info.prefix = prefix_cb;
20246 }
20247 #endif
20248 EOCP
20249         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20250                 if $contains warning try.out >>/dev/null 2>&1 ; then
20251                         db_prefixtype='int'
20252                 else
20253                         db_prefixtype='size_t'
20254                 fi
20255         else
20256                 db_prefixtype='size_t'
20257                 : XXX Maybe we should just give up here.
20258                 $cat try.out >&4
20259                 echo "Help:  I can't seem to compile the db test program." >&4
20260                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20261         fi
20262         $rm_try
20263         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20264         ;;
20265 *)      db_prefixtype='size_t'
20266         ;;
20267 esac
20268
20269 : Include . in @INC
20270 $cat <<EOM
20271
20272 Historically Perl has provided a final fallback of the current working
20273 directory '.' when searching for a library. This, however, can lead to
20274 problems when a Perl program which loads optional modules is called from
20275 a shared directory. This can lead to executing unexpected code.
20276
20277 EOM
20278
20279 # When changing to exclude by default:
20280 case "$default_inc_excludes_dot" in
20281     $undef|false|[nN]*) dflt="n" ;;
20282     *)                  dflt="y" ;;
20283 esac
20284 # To turn exclude off by default:
20285 #case "$default_inc_excludes_dot" in
20286 #    $define|true|[yY]*) dflt="y" ;;
20287 #    *)                  dflt="n" ;;
20288 #esac
20289
20290 rp='Exclude '.' from @INC by default? '
20291 . ./myread
20292 case "$ans" in
20293     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20294     *)          default_inc_excludes_dot="$define" ;;
20295 esac
20296
20297 : Check what kind of inf/nan your system has
20298 $echo "Checking the kind of infinities and nans you have..." >&4
20299 $echo "(The following tests may crash.  That's okay.)" >&4
20300 $cat >try.c <<EOP
20301 #define DOUBLESIZE $doublesize
20302 #$d_longdbl HAS_LONG_DOUBLE
20303 #ifdef HAS_LONG_DOUBLE
20304 #define LONG_DOUBLESIZE $longdblsize
20305 #define LONG_DOUBLEKIND $longdblkind
20306 #endif
20307 #include <math.h>
20308 #include <string.h>
20309 #include <stdio.h>
20310 /* Note that whether the sign bit is on or off
20311  * for NaN depends on the CPU/FPU, and possibly
20312  * can be affected by the build toolchain.
20313  *
20314  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20315  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20316  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20317  * (respectively) as opposed to the more usual
20318  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20319  *
20320  * Pre-IEEE-754 floating point format do not even have inf/nan support
20321  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20322  * to even mention, causing immediate SIGFPE or equivalent: this is
20323  * the case with VAX floating point, for example.
20324  */
20325 static void bytes(void *v, unsigned int n) {
20326   unsigned char *p = (unsigned char *)v;
20327   int i;
20328   for (i = 0; i < n; i++) {
20329     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20330   }
20331 }
20332 int main(int argc, char *argv[]) {
20333    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20334     * because some compilers are 'smart' and not only warn but refuse to
20335     * compile such 'illegal' values. */
20336    double dinf = exp(1e9);
20337    double dnan = sqrt(-1.0);
20338 #ifdef HAS_LONG_DOUBLE
20339    long double ldinf = (long double)exp(1e9);
20340    long double ldnan = (long double)sqrt(-1.0);
20341 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20342 /* the 80-bit long doubles might have garbage in their excess bytes */
20343     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20344     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20345 # endif
20346   if (argc == 2) {
20347     switch (argv[1][0]) {
20348     case '1': bytes(&dinf, sizeof(dinf)); break;
20349     case '2': bytes(&dnan, sizeof(dnan)); break;
20350     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20351     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20352 #endif
20353     }
20354   }
20355   return 0;
20356 }
20357 EOP
20358 set try
20359 if eval $compile; then
20360     doubleinfbytes=`$run ./try 1`
20361     doublenanbytes=`$run ./try 2`
20362     case "$d_longdbl" in
20363     $define)
20364       longdblinfbytes=`$run ./try 3`
20365       longdblnanbytes=`$run ./try 4`
20366       ;;
20367     esac
20368 else
20369     # Defaults in case the above test program failed.
20370     case "$doublekind" in
20371     1) # IEEE 754 32-bit LE
20372        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20373        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20374        ;;
20375     2) # IEEE 754 32-bit BE
20376        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20377        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20378        ;;
20379     3) # IEEE 754 64-bit LE
20380        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20381        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20382        ;;
20383     4) # IEEE 754 64-bit BE
20384        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20385        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20386        ;;
20387     5) # IEEE 754 128-bit LE
20388        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20389        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20390        ;;
20391     6) # IEEE 754 128-bit BE
20392        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20393        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20394        ;;
20395     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20396        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20397        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20398        ;;
20399     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20400        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20401        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20402        ;;
20403     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20404        doubleinfbytes=$undef
20405        doublenanbytes=$undef
20406        ;;
20407     *) # No idea.
20408        doubleinfbytes=$undef
20409        doublenanbytes=$undef
20410        ;;
20411     esac
20412     case "$longdblkind" in
20413     1) # IEEE 754 128-bit LE
20414        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20415        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20416        ;;
20417     2) # IEEE 754 128-bit BE
20418        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20419        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20420        ;;
20421     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20422        case "$longdblsize" in
20423        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20424            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20425            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20426            ;;
20427        16) # x86_64
20428            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20429            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20430            ;;
20431        *)  # No idea.
20432            longdblinfbytes=$undef
20433            longdblnanbytes=$undef
20434        ;;
20435        esac
20436        ;;
20437     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20438        case "$longdblsize" in
20439        12) # 32-bit system
20440            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20441            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20442            ;;
20443        16) # 64-bit system
20444            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20445            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20446            ;;
20447        *)  # No idea.
20448            longdblinfbytes=$undef
20449            longdblnanbytes=$undef
20450        ;;
20451        esac
20452        ;;
20453     5) # 128-bit LE-LE "double double"
20454        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20455        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20456        ;;
20457     6) # 128-bit BE-BE "double double"
20458        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20459        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20460        ;;
20461     7) # 128-bit LE-BE "double double"
20462        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20463        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20464        ;;
20465     8) # 128-bit BE-LE "double double"
20466        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20467        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20468        ;;
20469     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20470        longdblinfbytes=$undef
20471        longdblnanbytes=$undef
20472        ;;
20473     *) # No idea.
20474        longdblinfbytes=$undef
20475        longdblnanbytes=$undef
20476        ;;
20477     esac
20478 fi
20479 # In case the program crashed the values are empty, turn them undef.
20480 case "$doubleinfbytes" in
20481 '') doubleinfbytes=$undef ;;
20482 esac
20483 case "$doublenanbytes" in
20484 '') doublenanbytes=$undef ;;
20485 esac
20486 case "$longdblinfbytes" in
20487 '') longdblinfbytes=$undef ;;
20488 esac
20489 case "$longdblnanbytes" in
20490 '') longdblnanbytes=$undef ;;
20491 esac
20492 $rm_try
20493
20494 : Check the length of the double mantissa
20495 $echo "Checking how many mantissa bits your doubles have..." >&4
20496 $cat >try.c <<EOP
20497 #$i_sunmath I_SUNMATH
20498 #include <float.h>
20499 #ifdef I_SUNMATH
20500 # include <sunmath.h>
20501 #endif
20502 #ifdef DBL_MANT_DIG
20503 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20504 #endif
20505 #include <stdio.h>
20506 int main(int argc, char *argv[]) {
20507 #ifdef BITS
20508   printf("%d\n", BITS);
20509 #endif
20510   return 0;
20511 }
20512 EOP
20513 set try
20514 if eval $compile; then
20515     doublemantbits=`$run ./try`
20516 else
20517     doublemantbits="$undef"
20518 fi
20519 $rm_try
20520
20521 : Check the length of the longdouble mantissa
20522 $echo "Checking how many mantissa bits your long doubles have..." >&4
20523 $cat >try.c <<EOP
20524 #$i_sunmath I_SUNMATH
20525 #include <float.h>
20526 #ifdef I_SUNMATH
20527 # include <sunmath.h>
20528 #endif
20529 #$d_longdbl HAS_LONG_DOUBLE
20530 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20531 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20532 /* This format has no implicit bit.  Beware, however, that for
20533  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20534  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20535  * and the top bit must have been one since 387, zero is plain invalid.
20536  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20537 #  define BITS LDBL_MANT_DIG
20538 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20539 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20540  * reason e.g. Irix thinks 107.  But in any case, we want only
20541  * the number of real bits, the implicit bits are of no interest.  */
20542 #  define BITS 2 * (DBL_MANT_DIG - 1)
20543 # else
20544 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20545 # endif
20546 #endif
20547 #include <stdio.h>
20548 int main(int argc, char *argv[]) {
20549 #ifdef BITS
20550   printf("%d\n", BITS);
20551 #endif
20552   return 0;
20553 }
20554 EOP
20555 set try
20556 if eval $compile; then
20557     longdblmantbits=`$run ./try`
20558 else
20559     longdblmantbits="$undef"
20560 fi
20561 $rm_try
20562
20563 : Check the length of the NV mantissa
20564 $echo "Checking how many mantissa bits your NVs have..." >&4
20565 if test "X$usequadmath" = "X$define"; then
20566   nvmantbits=112 # 128-1-15
20567 else
20568   if test "X$nvsize" = "X$doublesize"; then
20569     nvmantbits="$doublemantbits"
20570   else
20571      if test "X$nvsize" = "X$longdblsize"; then
20572        nvmantbits="$longdblmantbits"
20573      else
20574        nvmantbits="$undef"
20575      fi
20576   fi
20577 fi
20578
20579 : How can we generate normalized random numbers ?
20580 echo " "
20581 echo "Using our internal random number implementation..." >&4
20582
20583 case "$ccflags" in
20584 *-Dmy_rand=*|*-Dmy_srand=*)
20585         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20586         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20587         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20588         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20589         ;;
20590 esac
20591
20592 randfunc=Perl_drand48
20593 drand01="Perl_drand48()"
20594 seedfunc="Perl_drand48_init"
20595 randbits=48
20596 randseedtype=U32
20597
20598 : Probe whether dtrace builds an object, as newer Illumos requires an input
20599 : object file that uses at least one of the probes defined in the .d file
20600 case "$usedtrace" in
20601 $define)
20602     case "$dtracexnolibs" in
20603     $define|true|[yY]*)
20604         dtracexnolibs=$define
20605         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20606         ;;
20607     ' '|'')
20608         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20609              dtracexnolibs=$define
20610              echo "Your dtrace accepts -xnolibs"
20611         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20612              dtracexnolibs=$undef
20613              echo "Your dtrace doesn't accept -xnolibs"
20614         else
20615              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20616              exit 1
20617         fi
20618         ;;
20619     *)
20620         dtracexnolibs=$undef
20621         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20622         ;;
20623     esac
20624     case $dtracexnolibs in
20625     $define) xnolibs=-xnolibs ;;
20626     *) xnolibs= ;;
20627     esac
20628
20629     case "$dtraceobject" in
20630     $define|true|[yY]*)
20631         dtraceobject=$define
20632         ;;
20633     ' '|'')
20634         $cat >try.c <<EOM
20635 #include "perldtrace.h"
20636 int main(void) {
20637     PERL_LOADED_FILE("dummy");
20638     return 0;
20639 }
20640 EOM
20641         dtraceobject=$undef
20642         if $cc -c -o try.o $optimize $ccflags try.c \
20643                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20644                 dtraceobject=$define
20645             echo "Your dtrace builds an object file"
20646         fi
20647         ;;
20648     *) dtraceobject=$undef ;;
20649     esac
20650     $rm_try perldtrace.o perldtrace.h
20651 esac
20652
20653 : Determine if this is an EBCDIC system
20654 echo " "
20655 echo "Determining whether or not we are on an EBCDIC system..." >&4
20656 $cat >try.c <<'EOM'
20657 int main()
20658 {
20659   if ('M'==0xd4) return 0;
20660   return 1;
20661 }
20662 EOM
20663
20664 val=$undef
20665 set try
20666 if eval $compile_ok; then
20667         if $run ./try; then
20668                 echo "You seem to speak EBCDIC." >&4
20669                 val="$define"
20670         else
20671                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20672         fi
20673 else
20674         echo "I'm unable to compile the test program." >&4
20675         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20676 fi
20677 $rm_try
20678 set ebcdic
20679 eval $setvar
20680
20681 : Check how to flush
20682 echo " "
20683 $cat >&4 <<EOM
20684 Checking how to flush all pending stdio output...
20685 EOM
20686 # I only know how to find the first 32 possibly open files on SunOS.
20687 # See also hints/sunos_4_1.sh and util.c  --AD
20688 case "$osname" in
20689 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20690 esac
20691 $cat >>try.c <<EOCP
20692 #include <stdio.h>
20693 #$i_stdlib I_STDLIB
20694 #ifdef I_STDLIB
20695 #include <stdlib.h>
20696 #endif
20697 #$i_unistd I_UNISTD
20698 #ifdef I_UNISTD
20699 # include <unistd.h>
20700 #endif
20701 #$d_sysconf HAS_SYSCONF
20702 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20703 #ifdef HAS_STDIO_STREAM_ARRAY
20704 # define STDIO_STREAM_ARRAY $stdio_stream_array
20705 #endif
20706 int main() {
20707   FILE* p;
20708   unlink("try.out");
20709   p = fopen("try.out", "w");
20710 #ifdef TRY_FPUTC
20711   fputc('x', p);
20712 #else
20713 # ifdef TRY_FPRINTF
20714   fprintf(p, "x");
20715 # endif
20716 #endif
20717 #ifdef TRY_FFLUSH_NULL
20718   fflush(NULL);
20719 #endif
20720 #ifdef TRY_FFLUSH_ALL
20721   {
20722     long open_max = -1;
20723 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20724     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20725 # else
20726 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20727     open_max = sysconf(_SC_OPEN_MAX);
20728 #  else
20729 #   ifdef FOPEN_MAX
20730     open_max = FOPEN_MAX;
20731 #   else
20732 #    ifdef OPEN_MAX
20733     open_max = OPEN_MAX;
20734 #    else
20735 #     ifdef _NFILE
20736     open_max = _NFILE;
20737 #     endif
20738 #    endif
20739 #   endif
20740 #  endif
20741 # endif
20742 # ifdef HAS_STDIO_STREAM_ARRAY
20743     if (open_max > 0) {
20744       long i;
20745       for (i = 0; i < open_max; i++)
20746             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20747                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20748                 STDIO_STREAM_ARRAY[i]._flag)
20749                 fflush(&STDIO_STREAM_ARRAY[i]);
20750     }
20751   }
20752 # endif
20753 #endif
20754   _exit(42);
20755 }
20756 EOCP
20757 : first we have to find out how _not_ to flush
20758 $to try.c
20759 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20760     output=''
20761     set try -DTRY_FPUTC
20762     if eval $compile; then
20763             $run ./try 2>/dev/null
20764             code="$?"
20765             $from try.out
20766             if $test ! -s try.out -a "X$code" = X42; then
20767                 output=-DTRY_FPUTC
20768             fi
20769     fi
20770     case "$output" in
20771     '')
20772             set try -DTRY_FPRINTF
20773             if eval $compile; then
20774                     $run ./try 2>/dev/null
20775                     code="$?"
20776                     $from try.out
20777                     if $test ! -s try.out -a "X$code" = X42; then
20778                         output=-DTRY_FPRINTF
20779                     fi
20780             fi
20781         ;;
20782     esac
20783 fi
20784 : check for fflush NULL behavior
20785 case "$fflushNULL" in
20786 '')     set try -DTRY_FFLUSH_NULL $output
20787         if eval $compile; then
20788                 $run ./try 2>/dev/null
20789                 code="$?"
20790                 $from try.out
20791                 if $test -s try.out -a "X$code" = X42; then
20792                         fflushNULL="`$cat try.out`"
20793                 else
20794                         if $test "X$code" != X42; then
20795                                 $cat >&4 <<EOM
20796 (If this test failed, don't worry, we'll try another method shortly.)
20797 EOM
20798                         fi
20799                 fi
20800         fi
20801         $rm -f core try.core core.try.*
20802         case "$fflushNULL" in
20803         x)      $cat >&4 <<EOM
20804 Your fflush(NULL) works okay for output streams.
20805 Let's see if it clobbers input pipes...
20806 EOM
20807 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20808 # bug that improperly flushes the input end of pipes.  So we avoid the
20809 # autoflush on fork/system/exec support for now. :-(
20810 $cat >tryp.c <<EOCP
20811 #include <stdio.h>
20812 int
20813 main(int argc, char **argv)
20814 {
20815     char buf[1024];
20816     int i;
20817     char *bp = buf;
20818     while (1) {
20819         while ((i = getc(stdin)) != -1
20820                && (*bp++ = i) != '\n'
20821                && bp < &buf[1024])
20822         /* DO NOTHING */ ;
20823         *bp = '\0';
20824         fprintf(stdout, "%s", buf);
20825         fflush(NULL);
20826         if (i == -1)
20827             return 0;
20828         bp = buf;
20829     }
20830 }
20831 EOCP
20832                 fflushNULL="$define"
20833                 set tryp
20834                 if eval $compile; then
20835                     $rm -f tryp.out
20836                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20837                     if $test "X$targethost" != X; then
20838                         $to tryp.c
20839                         $to tryp
20840                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20841                     else
20842                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20843                     fi
20844                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20845                        $cat >&4 <<EOM
20846 fflush(NULL) seems to behave okay with input streams.
20847 EOM
20848                         fflushNULL="$define"
20849                     else
20850                         $cat >&4 <<EOM
20851 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20852 EOM
20853                         fflushNULL="$undef"
20854                     fi
20855                 fi
20856                 $rm -f core tryp.c tryp.core core.tryp.*
20857                 ;;
20858         '')     $cat >&4 <<EOM
20859 Your fflush(NULL) isn't working (contrary to ANSI C).
20860 EOM
20861                 fflushNULL="$undef"
20862                 ;;
20863         *)      $cat >&4 <<EOM
20864 Cannot figure out whether your fflush(NULL) works or not.
20865 I'm assuming it doesn't (contrary to ANSI C).
20866 EOM
20867                 fflushNULL="$undef"
20868                 ;;
20869         esac
20870         ;;
20871 $define|true|[yY]*)
20872         fflushNULL="$define"
20873         ;;
20874 *)
20875         fflushNULL="$undef"
20876         ;;
20877 esac
20878 : check explicit looping only if NULL did not work, and if the pipe
20879 : bug does not show up on an explicit flush too
20880 case "$fflushNULL" in
20881 "$undef")
20882         $cat >tryp.c <<EOCP
20883 #include <stdio.h>
20884 int
20885 main(int argc, char **argv)
20886 {
20887     char buf[1024];
20888     int i;
20889     char *bp = buf;
20890     while (1) {
20891         while ((i = getc(stdin)) != -1
20892                && (*bp++ = i) != '\n'
20893                && bp < &buf[1024])
20894         /* DO NOTHING */ ;
20895         *bp = '\0';
20896         fprintf(stdout, "%s", buf);
20897         fflush(stdin);
20898         if (i == -1)
20899             return 0;
20900         bp = buf;
20901     }
20902 }
20903 EOCP
20904         set tryp
20905         if eval $compile; then
20906             $rm -f tryp.out
20907             if $test "X$targethost" != X; then
20908                 $to tryp.c
20909                 $to tryp
20910                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20911             else
20912                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20913             fi
20914             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20915                $cat >&4 <<EOM
20916 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20917 EOM
20918                 : now check for fflushall behaviour
20919                 case "$fflushall" in
20920                 '')     set try -DTRY_FFLUSH_ALL $output
20921                         if eval $compile; then
20922                                 $cat >&4 <<EOM
20923 (Now testing the other method--but note that this also may fail.)
20924 EOM
20925                                 $run ./try 2>/dev/null
20926                                 code=$?
20927                                 $from try.out
20928                                 if $test -s try.out -a "X$code" = X42; then
20929                                         fflushall="`$cat try.out`"
20930                                 fi
20931                         fi
20932                         $rm_try
20933                         case "$fflushall" in
20934                         x)      $cat >&4 <<EOM
20935 Whew. Flushing explicitly all the stdio streams works.
20936 EOM
20937                                 fflushall="$define"
20938                                 ;;
20939                         '')     $cat >&4 <<EOM
20940 Sigh. Flushing explicitly all the stdio streams doesn't work.
20941 EOM
20942                                 fflushall="$undef"
20943                                 ;;
20944                         *)      $cat >&4 <<EOM
20945 Cannot figure out whether flushing stdio streams explicitly works or not.
20946 I'm assuming it doesn't.
20947 EOM
20948                                 fflushall="$undef"
20949                                 ;;
20950                         esac
20951                         ;;
20952                 "$define"|true|[yY]*)
20953                         fflushall="$define"
20954                         ;;
20955                 *)
20956                         fflushall="$undef"
20957                         ;;
20958                 esac
20959             else
20960                 $cat >&4 <<EOM
20961 All is futile.  Even fflush(stdin) clobbers input pipes!
20962 EOM
20963                 fflushall="$undef"
20964             fi
20965         else
20966             fflushall="$undef"
20967         fi
20968         $rm -f core tryp.c tryp.core core.tryp.*
20969         ;;
20970 *)      fflushall="$undef"
20971         ;;
20972 esac
20973
20974 case "$fflushNULL$fflushall" in
20975 undefundef)
20976         $cat <<EOM
20977 OK, I give up.  I cannot figure out how to flush pending stdio output.
20978 We won't be flushing handles at all before fork/exec/popen.
20979 EOM
20980         ;;
20981 esac
20982 $rm_try tryp
20983
20984 : Store the full pathname to the ar program for use in the C program
20985 : Respect a hint or command line value for full_ar.
20986 case "$full_ar" in
20987 '') full_ar=$ar ;;
20988 esac
20989
20990 : Store the full pathname to the sed program for use in the C program
20991 full_sed=$sed
20992
20993 : see what type gids are declared as in the kernel
20994 echo " "
20995 echo "Looking for the type for group ids returned by getgid()."
20996 set gid_t gidtype xxx stdio.h sys/types.h
20997 eval $typedef
20998 case "$gidtype" in
20999 xxx)
21000         xxx=`./findhdr sys/user.h`
21001         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21002         case $1 in
21003         unsigned) dflt="$1 $2" ;;
21004         *) dflt="$1" ;;
21005         esac
21006         ;;
21007 *) dflt="$gidtype";;
21008 esac
21009 case "$gidtype" in
21010 gid_t) echo "gid_t found." ;;
21011 *)      rp="What is the type for group ids returned by getgid()?"
21012         . ./myread
21013         gidtype="$ans"
21014         ;;
21015 esac
21016
21017 : Check the size of GID
21018 echo " "
21019 case "$gidtype" in
21020 *_t) zzz="$gidtype"     ;;
21021 *)   zzz="gid"          ;;
21022 esac
21023 echo "Checking the size of $zzz..." >&4
21024 cat > try.c <<EOCP
21025 #include <sys/types.h>
21026 #include <stdio.h>
21027 #$i_stdlib I_STDLIB
21028 #ifdef I_STDLIB
21029 #include <stdlib.h>
21030 #endif
21031 int main() {
21032     printf("%d\n", (int)sizeof($gidtype));
21033     exit(0);
21034 }
21035 EOCP
21036 set try
21037 if eval $compile_ok; then
21038         yyy=`$run ./try`
21039         case "$yyy" in
21040         '')     gidsize=4
21041                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21042                 ;;
21043         *)      gidsize=$yyy
21044                 echo "Your $zzz is $gidsize bytes long."
21045                 ;;
21046         esac
21047 else
21048         gidsize=4
21049         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21050 fi
21051
21052 : Check if GID is signed
21053 echo " "
21054 case "$gidtype" in
21055 *_t) zzz="$gidtype"     ;;
21056 *)   zzz="gid"          ;;
21057 esac
21058 echo "Checking the sign of $zzz..." >&4
21059 cat > try.c <<EOCP
21060 #include <sys/types.h>
21061 #include <stdio.h>
21062 int main() {
21063         $gidtype foo = -1;
21064         if (foo < 0)
21065                 printf("-1\n");
21066         else
21067                 printf("1\n");
21068 }
21069 EOCP
21070 set try
21071 if eval $compile; then
21072         yyy=`$run ./try`
21073         case "$yyy" in
21074         '')     gidsign=1
21075                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21076                 ;;
21077         *)      gidsign=$yyy
21078                 case "$gidsign" in
21079                  1) echo "Your $zzz is unsigned." ;;
21080                 -1) echo "Your $zzz is signed."   ;;
21081                 esac
21082                 ;;
21083         esac
21084 else
21085         gidsign=1
21086         echo "(I can't compile the test program--guessing unsigned.)" >&4
21087 fi
21088
21089 : Check 64bit sizes
21090 echo " "
21091
21092 if $test X"$quadtype" != X; then
21093
21094 echo "Checking how to print 64-bit integers..." >&4
21095
21096 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21097         $cat >try.c <<'EOCP'
21098 #include <sys/types.h>
21099 #include <stdio.h>
21100 int main() {
21101   int q = 12345678901;
21102   printf("%ld\n", q);
21103 }
21104 EOCP
21105         set try
21106         if eval $compile; then
21107                 yyy=`$run ./try`
21108                 case "$yyy" in
21109                 12345678901)
21110                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21111                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21112                         echo "We will use %d."
21113                         ;;
21114                 esac
21115         fi
21116 fi
21117
21118 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21119         $cat >try.c <<'EOCP'
21120 #include <sys/types.h>
21121 #include <stdio.h>
21122 int main() {
21123   long q = 12345678901;
21124   printf("%ld\n", q);
21125 }
21126 EOCP
21127         set try
21128         if eval $compile; then
21129                 yyy=`$run ./try`
21130                 case "$yyy" in
21131                 12345678901)
21132                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21133                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21134                         echo "We will use %ld."
21135                         ;;
21136                 esac
21137         fi
21138 fi
21139
21140 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21141         $cat >try.c <<'EOCP'
21142 #include <sys/types.h>
21143 #include <inttypes.h>
21144 #include <stdio.h>
21145 int main() {
21146   int64_t q = 12345678901;
21147   printf("%" PRId64 "\n", q);
21148 }
21149 EOCP
21150         set try
21151         if eval $compile; then
21152                 yyy=`$run ./try`
21153                 case "$yyy" in
21154                 12345678901)
21155                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21156                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21157                         echo "We will use the C9X style."
21158                         ;;
21159                 esac
21160         fi
21161 fi
21162
21163 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21164         $cat >try.c <<EOCP
21165 #include <sys/types.h>
21166 #include <stdio.h>
21167 int main() {
21168   $quadtype q = 12345678901;
21169   printf("%Ld\n", q);
21170 }
21171 EOCP
21172         set try
21173         if eval $compile; then
21174                 yyy=`$run ./try`
21175                 case "$yyy" in
21176                 12345678901)
21177                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21178                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21179                         echo "We will use %Ld."
21180                         ;;
21181                 esac
21182         fi
21183 fi
21184
21185 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21186         $cat >try.c <<'EOCP'
21187 #include <sys/types.h>
21188 #include <stdio.h>
21189 int main() {
21190   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21191   printf("%lld\n", q);
21192 }
21193 EOCP
21194         set try
21195         if eval $compile; then
21196                 yyy=`$run ./try`
21197                 case "$yyy" in
21198                 12345678901)
21199                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21200                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21201                         echo "We will use the %lld style."
21202                         ;;
21203                 esac
21204         fi
21205 fi
21206
21207 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21208         $cat >try.c <<EOCP
21209 #include <sys/types.h>
21210 #include <stdio.h>
21211 int main() {
21212   $quadtype q = 12345678901;
21213   printf("%qd\n", q);
21214 }
21215 EOCP
21216         set try
21217         if eval $compile; then
21218                 yyy=`$run ./try`
21219                 case "$yyy" in
21220                 12345678901)
21221                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21222                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21223                         echo "We will use %qd."
21224                         ;;
21225                 esac
21226         fi
21227 fi
21228
21229 if $test X"$sPRId64" = X; then
21230         echo "Cannot figure out how to print 64-bit integers." >&4
21231 fi
21232 $rm_try
21233
21234 fi
21235
21236 case "$sPRId64" in
21237 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21238         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21239         ;;
21240 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21241         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21242         ;;
21243 esac
21244
21245 : Check format strings for internal types
21246 echo " "
21247 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21248
21249 if $test X"$ivsize" = X8; then
21250         ivdformat="$sPRId64"
21251         uvuformat="$sPRIu64"
21252         uvoformat="$sPRIo64"
21253         uvxformat="$sPRIx64"
21254         uvXUformat="$sPRIXU64"
21255 else
21256         if $test X"$ivsize" = X"$longsize"; then
21257                 ivdformat='"ld"'
21258                 uvuformat='"lu"'
21259                 uvoformat='"lo"'
21260                 uvxformat='"lx"'
21261                 uvXUformat='"lX"'
21262         else
21263                 if $test X"$ivsize" = X"$intsize"; then
21264                         ivdformat='"d"'
21265                         uvuformat='"u"'
21266                         uvoformat='"o"'
21267                         uvxformat='"x"'
21268                         uvXUformat='"X"'
21269                 else
21270                         : far out
21271                         if $test X"$ivsize" = X"$shortsize"; then
21272                                 ivdformat='"hd"'
21273                                 uvuformat='"hu"'
21274                                 uvoformat='"ho"'
21275                                 uvxformat='"hx"'
21276                                 uvXUformat='"hX"'
21277                         fi
21278                 fi
21279         fi
21280 fi
21281
21282 if $test X"$usequadmath" = X"$define"; then
21283     nveformat='"Qe"'
21284     nvfformat='"Qf"'
21285     nvgformat='"Qg"'
21286     nvEUformat='"QE"'
21287     nvFUformat='"QF"'
21288     nvGUformat='"QG"'
21289 else
21290     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21291         nveformat="$sPRIeldbl"
21292         nvfformat="$sPRIfldbl"
21293         nvgformat="$sPRIgldbl"
21294         nvEUformat="$sPRIEUldbl"
21295         nvFUformat="$sPRIFUldbl"
21296         nvGUformat="$sPRIGUldbl"
21297     else
21298         nveformat='"e"'
21299         nvfformat='"f"'
21300         nvgformat='"g"'
21301         nvEUformat='"E"'
21302         nvFUformat='"F"'
21303         nvGUformat='"G"'
21304     fi
21305 fi
21306
21307 case "$ivdformat" in
21308 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21309     exit 1
21310     ;;
21311 esac
21312
21313 : Check format string for GID
21314
21315 echo " "
21316 $echo "Checking the format string to be used for gids..." >&4
21317
21318 case "$gidsign" in
21319 -1)     if $test X"$gidsize" = X"$ivsize"; then
21320                 gidformat="$ivdformat"
21321         else
21322                 if $test X"$gidsize" = X"$longsize"; then
21323                         gidformat='"ld"'
21324                 else
21325                         if $test X"$gidsize" = X"$intsize"; then
21326                                 gidformat='"d"'
21327                         else
21328                                 if $test X"$gidsize" = X"$shortsize"; then
21329                                         gidformat='"hd"'
21330                                 fi
21331                         fi
21332                 fi
21333         fi
21334         ;;
21335 *)      if $test X"$gidsize" = X"$uvsize"; then
21336                 gidformat="$uvuformat"
21337         else
21338                 if $test X"$gidsize" = X"$longsize"; then
21339                         gidformat='"lu"'
21340                 else
21341                         if $test X"$gidsize" = X"$intsize"; then
21342                                 gidformat='"u"'
21343                         else
21344                                 if $test X"$gidsize" = X"$shortsize"; then
21345                                         gidformat='"hu"'
21346                                 fi
21347                         fi
21348                 fi
21349         fi
21350         ;;
21351 esac
21352
21353 : see if getgroups exists
21354 set getgroups d_getgrps
21355 eval $inlibc
21356
21357 : see if setgroups exists
21358 set setgroups d_setgrps
21359 eval $inlibc
21360
21361 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21362 echo " "
21363 case "$d_getgrps$d_setgrps" in
21364 *define*)
21365         case "$groupstype" in
21366         '') dflt="$gidtype" ;;
21367         *)  dflt="$groupstype" ;;
21368         esac
21369         $cat <<EOM
21370 What type of pointer is the second argument to getgroups() and setgroups()?
21371 Usually this is the same as group ids, $gidtype, but not always.
21372
21373 EOM
21374         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21375         . ./myread
21376         groupstype="$ans"
21377         ;;
21378 *)  groupstype="$gidtype";;
21379 esac
21380
21381 : check whether make sets MAKE
21382 echo " "
21383 echo "Checking if your $make program sets \$(MAKE)..." >&4
21384 case "$make_set_make" in
21385 '')
21386         $sed 's/^X //' > testmake.mak << 'EOF'
21387 Xall:
21388 X       @echo 'maketemp="$(MAKE)"'
21389 EOF
21390         case "`$make -f testmake.mak 2>/dev/null`" in
21391         *maketemp=*) make_set_make='#' ;;
21392         *)      make_set_make="MAKE=$make" ;;
21393         esac
21394         $rm -f testmake.mak
21395         ;;
21396 esac
21397 case "$make_set_make" in
21398 '#') echo "Yup, it does.";;
21399 *) echo "Nope, it doesn't.";;
21400 esac
21401
21402 : see what type is used for mode_t
21403 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21404 set mode_t modetype int stdio.h sys/types.h
21405 eval $typedef_ask
21406
21407 : see if we need va_copy
21408 echo " "
21409 $cat >try.c <<EOCP
21410 #include <stdarg.h>
21411 #include <stdio.h>
21412 #include <stdlib.h>
21413 #include <signal.h>
21414
21415 int
21416 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21417 {
21418   return vfprintf(f, fmt, *valp);
21419 }
21420
21421 int
21422 myvfprintf(FILE *f, const  char *fmt, va_list val)
21423 {
21424   return ivfprintf(f, fmt, &val);
21425 }
21426
21427 int
21428 myprintf(char *fmt, ...)
21429 {
21430   va_list val;
21431   va_start(val, fmt);
21432   return myvfprintf(stdout, fmt, val);
21433 }
21434
21435 int
21436 main(int ac, char **av)
21437 {
21438   signal(SIGSEGV, exit);
21439
21440   myprintf("%s%cs all right, then\n", "that", '\'');
21441   exit(0);
21442 }
21443 EOCP
21444 set try
21445 if eval $compile && $run ./try 2>&1 >/dev/null; then
21446         case "`$run ./try`" in
21447         "that's all right, then")
21448                 okay=yes
21449                 ;;
21450         esac
21451 fi
21452 case "$okay" in
21453 yes)    echo "It seems that you don't need va_copy()." >&4
21454         need_va_copy="$undef"
21455         ;;
21456 *)      echo "It seems that va_copy() or similar will be needed." >&4
21457         need_va_copy="$define"
21458         ;;
21459 esac
21460 $rm_try
21461
21462 : see what type is used for size_t
21463 rp="What is the type used for the length parameter for string functions?"
21464 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21465 eval $typedef_ask
21466
21467 : check for type of arguments to gethostbyaddr.
21468 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21469         case "$d_gethbyaddr" in
21470         $define)
21471                 $cat <<EOM
21472
21473 Checking to see what type of arguments are accepted by gethostbyaddr().
21474 EOM
21475                 hdrs="$define sys/types.h
21476                         $d_socket sys/socket.h
21477                         $i_niin netinet/in.h
21478                         $i_netdb netdb.h
21479                         $i_unistd unistd.h"
21480                 : The first arg can 'char *' or 'void *'
21481                 : The second arg is some of integral type
21482                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21483                         for yyy in size_t long int; do
21484                                 case "$netdb_host_type" in
21485                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21486                                         if ./protochk "$try" $hdrs; then
21487                                                 echo "Your system accepts $xxx for the first arg."
21488                                                 echo "...and $yyy for the second arg."
21489                                                 netdb_host_type="$xxx"
21490                                                 netdb_hlen_type="$yyy"
21491                                         fi
21492                                         ;;
21493                                 esac
21494                         done
21495                 done
21496                 : In case none of those worked, prompt the user.
21497                 case "$netdb_host_type" in
21498                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21499                         dflt='char *'
21500                         . ./myread
21501                         netdb_host_type=$ans
21502                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21503                         dflt="$sizetype"
21504                         . ./myread
21505                         netdb_hlen_type=$ans
21506                         ;;
21507                 esac
21508                 ;;
21509         *)      : no gethostbyaddr, so pick harmless defaults
21510                 netdb_host_type='char *'
21511                 netdb_hlen_type="$sizetype"
21512                 ;;
21513         esac
21514         # Remove the "const" if needed. -- but then we'll have a
21515         # prototype clash!
21516         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21517 fi
21518
21519 : check for type of argument to gethostbyname.
21520 if test "X$netdb_name_type" = X ; then
21521         case "$d_gethbyname" in
21522         $define)
21523                 $cat <<EOM
21524
21525 Checking to see what type of argument is accepted by gethostbyname().
21526 EOM
21527                 hdrs="$define sys/types.h
21528                         $d_socket sys/socket.h
21529                         $i_niin netinet/in.h
21530                         $i_netdb netdb.h
21531                         $i_unistd unistd.h"
21532                 for xxx in "const char *" "char *"; do
21533                         case "$netdb_name_type" in
21534                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21535                                 if ./protochk "$try" $hdrs; then
21536                                         echo "Your system accepts $xxx."
21537                                         netdb_name_type="$xxx"
21538                                 fi
21539                                 ;;
21540                         esac
21541                 done
21542                 : In case none of those worked, prompt the user.
21543                 case "$netdb_name_type" in
21544                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21545                         dflt='char *'
21546                         . ./myread
21547                         netdb_name_type=$ans
21548                         ;;
21549                 esac
21550                 ;;
21551         *)      : no gethostbyname, so pick harmless default
21552                 netdb_name_type='char *'
21553                 ;;
21554         esac
21555 fi
21556
21557 : check for type of 1st argument to getnetbyaddr.
21558 if test "X$netdb_net_type" = X ; then
21559         case "$d_getnbyaddr" in
21560         $define)
21561                 $cat <<EOM
21562
21563 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21564 EOM
21565                 hdrs="$define sys/types.h
21566                         $d_socket sys/socket.h
21567                         $i_niin netinet/in.h
21568                         $i_netdb netdb.h
21569                         $i_unistd unistd.h"
21570                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21571                         case "$netdb_net_type" in
21572                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21573                                 if ./protochk "$try" $hdrs; then
21574                                         echo "Your system accepts $xxx."
21575                                         netdb_net_type="$xxx"
21576                                 fi
21577                                 ;;
21578                         esac
21579                 done
21580                 : In case none of those worked, prompt the user.
21581                 case "$netdb_net_type" in
21582                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21583                         dflt='long'
21584                         . ./myread
21585                         netdb_net_type=$ans
21586                         ;;
21587                 esac
21588                 ;;
21589         *)      : no getnetbyaddr, so pick harmless default
21590                 netdb_net_type='long'
21591                 ;;
21592         esac
21593 fi
21594 : locate the preferred pager for this system
21595 fn=f/
21596 case "$pager" in
21597 '')
21598         dflt=''
21599         case "$pg" in
21600         /*) dflt=$pg;;
21601         [a-zA-Z]:/*) dflt=$pg;;
21602         esac
21603         case "$more" in
21604         /*) dflt=$more;;
21605         [a-zA-Z]:/*) dflt=$more;;
21606         esac
21607         case "$less" in
21608         /*) dflt=$less;;
21609         [a-zA-Z]:/*) dflt=$less;;
21610         esac
21611         case "$dflt" in
21612         '') dflt=/usr/ucb/more;;
21613         esac
21614         ;;
21615 *)      dflt="$pager"
21616         ;;
21617 esac
21618 fn="f/($dflt)"
21619 echo " "
21620 rp='What pager is used on your system?'
21621 . ./getfile
21622 pager="$ans"
21623
21624 : see if ar generates random libraries by itself
21625 echo " "
21626 echo "Checking how to generate random libraries on your machine..." >&4
21627 echo 'int bar1() { return bar2(); }' > bar1.c
21628 echo 'int bar2() { return 2; }' > bar2.c
21629 $cat > foo.c <<EOP
21630 #$i_stdlib I_STDLIB
21631 #ifdef I_STDLIB
21632 #include <stdlib.h>
21633 #endif
21634 int main() { printf("%d\n", bar1()); exit(0); }
21635 EOP
21636 $cc $ccflags -c bar1.c >/dev/null 2>&1
21637 $cc $ccflags -c bar2.c >/dev/null 2>&1
21638 $cc $ccflags -c foo.c >/dev/null 2>&1
21639 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21640 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21641         $run ./foobar >/dev/null 2>&1; then
21642         echo "$ar appears to generate random libraries itself."
21643         orderlib=false
21644         if [ "X$ranlib" = "X" ]; then
21645             ranlib=":"
21646         fi
21647 elif $ar s bar$_a >/dev/null 2>&1 &&
21648         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21649         $run ./foobar >/dev/null 2>&1; then
21650                 echo "a table of contents needs to be added with '$ar s'."
21651                 orderlib=false
21652                 ranlib="$ar s"
21653 elif $ar ts bar$_a >/dev/null 2>&1 &&
21654         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21655         $run ./foobar >/dev/null 2>&1; then
21656                 echo "a table of contents needs to be added with '$ar ts'."
21657                 orderlib=false
21658                 ranlib="$ar ts"
21659 else
21660         case "$ranlib" in
21661         :) ranlib='';;
21662         '')
21663                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21664                 $test -f $ranlib || ranlib=''
21665                 ;;
21666         esac
21667         if $test -n "$ranlib"; then
21668                 echo "your system has '$ranlib'; we'll use that."
21669                 orderlib=false
21670         else
21671                 echo "your system doesn't seem to support random libraries"
21672                 echo "so we'll use lorder and tsort to order the libraries."
21673                 orderlib=true
21674                 ranlib=":"
21675         fi
21676 fi
21677 $rm -f foo* bar*
21678
21679 : Check the max offset that gmtime and localtime accept
21680 echo "Checking max offsets that gmtime () accepts"
21681
21682 case "$sGMTIME_min/$sGMTIME_max" in
21683     0/0|/)
21684         $cat >try.c <<EOCP
21685 #include <sys/types.h>
21686 #include <stdio.h>
21687 #include <time.h>
21688
21689 int i;
21690 struct tm *tmp;
21691 time_t pt;
21692
21693 void gm_check (time_t t, int min_year, int max_year)
21694 {
21695     tmp = gmtime (&t);
21696     if ( tmp == NULL ||
21697         /* Check tm_year overflow */
21698          tmp->tm_year < min_year || tmp->tm_year > max_year)
21699         tmp = NULL;
21700     else
21701         pt = t;
21702     } /* gm_check */
21703
21704 int check_max ()
21705 {
21706     tmp = NULL;
21707     pt  = 0;
21708 #ifdef MAXLONG
21709     gm_check (MAXLONG, 69, 0x7fffffff);
21710 #endif
21711     if (tmp == NULL || tmp->tm_year < 0) {
21712         for (i = 63; i >= 0; i--) {
21713             time_t x = pt | ((time_t)1 << i);
21714             if (x < 0 || x < pt) continue;
21715             gm_check (x, 69, 0x7fffffff);
21716             }
21717         }
21718     printf ("sGMTIME_max=%ld\n", pt);
21719     return (0);
21720     } /* check_max */
21721
21722 int check_min ()
21723 {
21724     tmp = NULL;
21725     pt  = 0;
21726 #ifdef MINLONG
21727     gm_check (MINLONG, -1900, 70);
21728 #endif
21729     if (tmp == NULL) {
21730         for (i = 36; i >= 0; i--) {
21731             time_t x = pt - ((time_t)1 << i);
21732             if (x > 0) continue;
21733             gm_check (x, -1900, 70);
21734             }
21735         }
21736     printf ("sGMTIME_min=%ld\n", pt);
21737     return (0);
21738     } /* check_min */
21739
21740 int main (int argc, char *argv[])
21741 {
21742     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21743     check_max ();
21744     check_min ();
21745     return (0);
21746     } /* main */
21747 EOCP
21748         set try
21749         if eval $compile; then
21750             eval `$run ./try 2>/dev/null`
21751         else
21752             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21753             fi
21754         $rm_try
21755         ;;
21756     esac
21757
21758 echo "Checking max offsets that localtime () accepts"
21759
21760 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21761     0/0|/)
21762         $cat >try.c <<EOCP
21763 #include <sys/types.h>
21764 #include <stdio.h>
21765 #include <time.h>
21766
21767 int i;
21768 struct tm *tmp;
21769 time_t pt;
21770
21771 void local_check (time_t t, int min_year, int max_year)
21772 {
21773     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21774         tmp = NULL;
21775     else
21776         tmp = localtime (&t);
21777     if ( tmp == NULL ||
21778         /* Check tm_year overflow */
21779          tmp->tm_year < min_year || tmp->tm_year > max_year)
21780         tmp = NULL;
21781     else
21782         pt = t;
21783     } /* local_check */
21784
21785 int check_max ()
21786 {
21787     tmp = NULL;
21788     pt  = 0;
21789 #ifdef MAXLONG
21790     local_check (MAXLONG, 69, 0x7fffffff);
21791 #endif
21792     if (tmp == NULL || tmp->tm_year < 0) {
21793         for (i = 63; i >= 0; i--) {
21794             time_t x = pt | ((time_t)1 << i);
21795             if (x < 0 || x < pt) continue;
21796             local_check (x, 69, 0x7fffffff);
21797             }
21798         }
21799     printf ("sLOCALTIME_max=%ld\n", pt);
21800     return (0);
21801    } /* check_max */
21802
21803 int check_min ()
21804 {
21805     tmp = NULL;
21806     pt  = 0;
21807 #ifdef MINLONG
21808     local_check (MINLONG, -1900, 70);
21809 #endif
21810     if (tmp == NULL) {
21811         for (i = 36; i >= 0; i--) {
21812             time_t x = pt - ((time_t)1 << i);
21813             if (x > 0) continue;
21814             local_check (x, -1900, 70);
21815             }
21816         }
21817     printf ("sLOCALTIME_min=%ld\n", pt);
21818     return (0);
21819     } /* check_min */
21820
21821 int main (int argc, char *argv[])
21822 {
21823     check_max ();
21824     check_min ();
21825     return (0);
21826     } /* main */
21827 EOCP
21828         set try
21829         if eval $compile; then
21830             eval `$run ./try 2>/dev/null`
21831         else
21832             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21833             fi
21834         $rm_try
21835         ;;
21836     esac
21837
21838 : check for type of arguments to select.
21839 case "$selecttype" in
21840 '') case "$d_select" in
21841         $define)
21842                 echo " "
21843                 $cat <<EOM
21844 Checking to see what type of arguments are accepted by select().
21845 EOM
21846                 hdrs="$define sys/types.h
21847                         $i_systime sys/time.h
21848                         $i_sysselct sys/select.h
21849                         $d_socket sys/socket.h"
21850                 : The first arg can be int, unsigned, or size_t
21851                 : The last arg may or may not be 'const'
21852                 val=''
21853                 : void pointer has been seen but using that
21854                 : breaks the selectminbits test
21855                 for xxx in 'fd_set *' 'int *'; do
21856                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21857                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21858                                         case "$val" in
21859                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21860                                                 if ./protochk "$try" $hdrs; then
21861                                                         echo "Your system accepts $xxx."
21862                                                         val="$xxx"
21863                                                 fi
21864                                                 ;;
21865                                         esac
21866                                 done
21867                         done
21868                 done
21869                 case "$val" in
21870                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21871                         case "$d_fd_set" in
21872                                 $define) dflt="fd_set *" ;;
21873                                 *)              dflt="int *" ;;
21874                         esac
21875                         . ./myread
21876                         val=$ans
21877                         ;;
21878                 esac
21879                 selecttype="$val"
21880                 ;;
21881         *)      : no select, so pick a harmless default
21882                 selecttype='int *'
21883                 ;;
21884         esac
21885         ;;
21886 esac
21887
21888 : check for the select 'width'
21889 case "$selectminbits" in
21890 '') safebits=`expr $ptrsize \* 8`
21891     case "$d_select" in
21892         $define)
21893                 $cat <<EOM
21894
21895 Checking to see on how many bits at a time your select() operates...
21896 EOM
21897                 $cat >try.c <<EOCP
21898 #include <sys/types.h>
21899 #$i_time I_TIME
21900 #$i_systime I_SYS_TIME
21901 #$i_systimek I_SYS_TIME_KERNEL
21902 #ifdef I_TIME
21903 #   include <time.h>
21904 #endif
21905 #ifdef I_SYS_TIME
21906 #   ifdef I_SYS_TIME_KERNEL
21907 #       define KERNEL
21908 #   endif
21909 #   include <sys/time.h>
21910 #   ifdef I_SYS_TIME_KERNEL
21911 #       undef KERNEL
21912 #   endif
21913 #endif
21914 #$i_sysselct I_SYS_SELECT
21915 #ifdef I_SYS_SELECT
21916 #include <sys/select.h>
21917 #endif
21918 #$d_socket HAS_SOCKET
21919 #ifdef HAS_SOCKET
21920 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21921 #endif
21922 #include <stdio.h>
21923 #$i_stdlib I_STDLIB
21924 #ifdef I_STDLIB
21925 #include <stdlib.h>
21926 #endif
21927 $selecttype b;
21928 #define S sizeof(*(b))
21929 #define MINBITS 64
21930 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21931 #define NBITS  (NBYTES * 8)
21932 int main() {
21933     char *s = (char *)malloc(NBYTES);
21934     struct timeval t;
21935     int i;
21936     FILE* fp;
21937     int fd;
21938
21939     if (!s)
21940         exit(1);
21941     fclose(stdin);
21942     fp = fopen("try.c", "r");
21943     if (fp == 0)
21944       exit(2);
21945     fd = fileno(fp);
21946     if (fd < 0)
21947       exit(3);
21948     b = ($selecttype)s;
21949     for (i = 0; i < NBITS; i++)
21950         FD_SET(i, b);
21951     t.tv_sec  = 0;
21952     t.tv_usec = 0;
21953     select(fd + 1, b, 0, 0, &t);
21954     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21955     free(s);
21956     printf("%d\n", i + 1);
21957     return 0;
21958 }
21959 EOCP
21960                 set try
21961                 if eval $compile_ok; then
21962                         selectminbits=`$run ./try 2>/dev/null`
21963                         case "$selectminbits" in
21964                         '')     cat >&4 <<EOM
21965 Cannot figure out on how many bits at a time your select() operates.
21966 I'll play safe and guess it is $safebits bits.
21967 EOM
21968                                 selectminbits=$safebits
21969                                 bits="$safebits bits"
21970                                 ;;
21971                         1)      bits="1 bit" ;;
21972                         *)      bits="$selectminbits bits" ;;
21973                         esac
21974                         echo "Your select() operates on $bits at a time." >&4
21975                 else
21976                         rp='What is the minimum number of bits your select() operates on?'
21977                         case "$byteorder" in
21978                         12345678)       dflt=64 ;;
21979                         1234)           dflt=32 ;;
21980                         *)              dflt=1  ;;
21981                         esac
21982                         . ./myread
21983                         val=$ans
21984                         selectminbits="$val"
21985                 fi
21986                 $rm_try
21987                 ;;
21988         *)      : no select, so pick a harmless default
21989                 selectminbits=$safebits
21990                 ;;
21991         esac
21992         ;;
21993 esac
21994
21995 : Trace out the files included by signal.h, then look for SIGxxx names.
21996 case "$sig_num_init" in
21997 '')
21998 if [ "X$fieldn" = X ]; then
21999         : Just make some guesses.  We check them later.
22000         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22001 else
22002         xxx=`echo '#include <signal.h>' |
22003         $cppstdin $cppminus $cppflags 2>/dev/null |
22004         $grep '^[       ]*#.*include' |
22005         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22006                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22007 fi
22008 xxxfiles=''
22009 for xx in $xxx /dev/null ; do
22010         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22011 done
22012 case "$xxxfiles" in
22013 '')     xxxfiles=`./findhdr signal.h` ;;
22014 esac
22015 xxx=`awk '
22016 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22017         print substr($2, 4, 20)
22018 }
22019 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22020         print substr($3, 4, 20)
22021 }' $xxxfiles`
22022 : Append some common names just in case the awk scan failed.
22023 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22024 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22025 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22026 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22027 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22028
22029 : generate a few handy files for later
22030 $cat > signal.c <<EOCP
22031 #include <sys/types.h>
22032 #include <signal.h>
22033 #$i_stdlib I_STDLIB
22034 #ifdef I_STDLIB
22035 #include <stdlib.h>
22036 #endif
22037 #include <stdio.h>
22038 int main() {
22039
22040 /* Strange style to avoid deeply-nested #if/#else/#endif */
22041 #ifndef NSIG
22042 #  ifdef _NSIG
22043 #    define NSIG (_NSIG)
22044 #  endif
22045 #endif
22046
22047 #ifndef NSIG
22048 #  ifdef SIGMAX
22049 #    define NSIG (SIGMAX+1)
22050 #  endif
22051 #endif
22052
22053 #ifndef NSIG
22054 #  ifdef SIG_MAX
22055 #    define NSIG (SIG_MAX+1)
22056 #  endif
22057 #endif
22058
22059 #ifndef NSIG
22060 #  ifdef _SIG_MAX
22061 #    define NSIG (_SIG_MAX+1)
22062 #  endif
22063 #endif
22064
22065 #ifndef NSIG
22066 #  ifdef MAXSIG
22067 #    define NSIG (MAXSIG+1)
22068 #  endif
22069 #endif
22070
22071 #ifndef NSIG
22072 #  ifdef MAX_SIG
22073 #    define NSIG (MAX_SIG+1)
22074 #  endif
22075 #endif
22076
22077 #ifndef NSIG
22078 #  ifdef SIGARRAYSIZE
22079 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22080 #  endif
22081 #endif
22082
22083 #ifndef NSIG
22084 #  ifdef _sys_nsig
22085 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22086 #  endif
22087 #endif
22088
22089 /* Default to some arbitrary number that's big enough to get most
22090    of the common signals.
22091 */
22092 #ifndef NSIG
22093 #    define NSIG 50
22094 #endif
22095
22096 printf("NSIG %d\n", NSIG);
22097
22098 #ifndef JUST_NSIG
22099
22100 EOCP
22101
22102 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22103 {
22104         printf "#ifdef SIG"; printf $1; printf "\n"
22105         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22106         printf $1; printf ");\n"
22107         printf "#endif\n"
22108 }
22109 END {
22110         printf "#endif /* JUST_NSIG */\n";
22111         printf "exit(0);\n}\n";
22112 }
22113 ' >>signal.c
22114 $cat >signal.awk <<'EOP'
22115 BEGIN { ndups = 0 }
22116 $1 ~ /^NSIG$/ { nsig = $2 }
22117 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22118     if ($2 > maxsig) { maxsig = $2 }
22119     if (sig_name[$2]) {
22120         dup_name[ndups] = $1
22121         dup_num[ndups] = $2
22122         ndups++
22123     }
22124     else {
22125         sig_name[$2] = $1
22126         sig_num[$2] = $2
22127     }
22128 }
22129 END {
22130     if (nsig == 0) {
22131         nsig = maxsig + 1
22132     }
22133     printf("NSIG %d\n", nsig);
22134     for (n = 1; n < nsig; n++) {
22135         if (sig_name[n]) {
22136             printf("%s %d\n", sig_name[n], sig_num[n])
22137         }
22138         else {
22139             printf("NUM%d %d\n", n, n)
22140         }
22141     }
22142     for (n = 0; n < ndups; n++) {
22143         printf("%s %d\n", dup_name[n], dup_num[n])
22144     }
22145 }
22146 EOP
22147 $cat >signal_cmd <<EOS
22148 $startsh
22149 if $test -s signal.lst; then
22150     echo "Using your existing signal.lst file"
22151         exit 0
22152 fi
22153 xxx="$xxx"
22154 EOS
22155 $cat >>signal_cmd <<'EOS'
22156
22157 set signal
22158 if eval $compile_ok; then
22159         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22160                 $uniq | $awk -f signal.awk >signal.lst
22161 else
22162         echo "(I can't seem be able to compile the whole test program)" >&4
22163         echo "(I'll try it in little pieces.)" >&4
22164         set signal -DJUST_NSIG
22165         if eval $compile_ok; then
22166                 $run ./signal$_exe > signal.nsg
22167                 $cat signal.nsg
22168         else
22169                 echo "I can't seem to figure out how many signals you have." >&4
22170                 echo "Guessing 50." >&4
22171                 echo 'NSIG 50' > signal.nsg
22172         fi
22173         : Now look at all the signal names, one at a time.
22174         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22175                 $cat > signal.c <<EOCP
22176 #include <sys/types.h>
22177 #include <signal.h>
22178 #include <stdio.h>
22179 int main() {
22180 printf("$xx %d\n", SIG${xx});
22181 return 0;
22182 }
22183 EOCP
22184                 set signal
22185                 if eval $compile; then
22186                         echo "SIG${xx} found."
22187                         $run ./signal$_exe  >> signal.ls1
22188                 else
22189                         echo "SIG${xx} NOT found."
22190                 fi
22191         done
22192         if $test -s signal.ls1; then
22193                 $cat signal.nsg signal.ls1 |
22194                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22195         fi
22196
22197 fi
22198 if $test -s signal.lst; then
22199         :
22200 else
22201         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22202         echo 'kill -l' >signal
22203         set X `csh -f <signal`
22204         $rm -f signal
22205         shift
22206         case $# in
22207         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22208         esac
22209         echo $@ | $tr ' ' $trnl | \
22210             $awk '{ printf "%s %d\n", $1, ++s; }
22211                   END { printf "NSIG %d\n", ++s }' >signal.lst
22212 fi
22213 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22214 EOS
22215 chmod a+x signal_cmd
22216 $eunicefix signal_cmd
22217 ;;
22218 esac
22219
22220 : generate list of signal names
22221 case "$sig_num_init" in
22222 '')
22223 echo " "
22224 case "$sig_name_init" in
22225 '') doinit=yes ;;
22226 *)  case "$sig_num_init" in
22227     ''|*,*) doinit=yes ;;
22228     esac ;;
22229 esac
22230 case "$doinit" in
22231 yes)
22232         echo "Generating a list of signal names and numbers..." >&4
22233         . ./signal_cmd
22234         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22235         sig_name=`$awk 'BEGIN { printf "ZERO " }
22236                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22237         sig_num=`$awk  'BEGIN { printf "0 " }
22238                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22239         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22240                              !/^NSIG/   { printf "\"%s\", ", $1 }
22241                              END        { printf "0\n" }' signal.lst`
22242         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22243                              !/^NSIG/   { printf "%d, ", $2}
22244                              END        { printf "0\n"}' signal.lst`
22245         ;;
22246 esac
22247 echo "The following $sig_count signals are available:"
22248 echo " "
22249 echo $sig_name | $awk \
22250 'BEGIN { linelen = 0 }
22251 {
22252         for (i = 1; i <= NF; i++) {
22253                 name = "SIG" $i " "
22254                 linelen = linelen + length(name)
22255                 if (linelen > 70) {
22256                         printf "\n"
22257                         linelen = length(name)
22258                 }
22259                 printf "%s", name
22260         }
22261         printf "\n"
22262 }'
22263 sig_size=`echo $sig_name | awk '{print NF}'`
22264 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22265 ;;
22266 esac
22267
22268 : Check size of size
22269 echo " "
22270 case "$sizetype" in
22271 *_t) zzz="$sizetype"    ;;
22272 *)   zzz="filesize"     ;;
22273 esac
22274 echo "Checking the size of $zzz..." >&4
22275 cat > try.c <<EOCP
22276 #include <sys/types.h>
22277 #include <stdio.h>
22278 #$i_stdlib I_STDLIB
22279 #ifdef I_STDLIB
22280 #include <stdlib.h>
22281 #endif
22282 int main() {
22283     printf("%d\n", (int)sizeof($sizetype));
22284     exit(0);
22285 }
22286 EOCP
22287 set try
22288 if eval $compile_ok; then
22289         yyy=`$run ./try`
22290         case "$yyy" in
22291         '')     sizesize=4
22292                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22293                 ;;
22294         *)      sizesize=$yyy
22295                 echo "Your $zzz size is $sizesize bytes."
22296                 ;;
22297         esac
22298 else
22299         sizesize=4
22300         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22301 fi
22302
22303 : check for socklen_t
22304 echo " "
22305 echo "Checking to see if you have socklen_t..." >&4
22306 $cat >try.c <<EOCP
22307 #include <sys/types.h>
22308 #$d_socket HAS_SOCKET
22309 #ifdef HAS_SOCKET
22310 #include <sys/socket.h>
22311 #endif
22312 int main() { socklen_t x = 16; }
22313 EOCP
22314 set try
22315 if eval $compile; then
22316         val="$define"
22317         echo "You have socklen_t."
22318 else
22319         val="$undef"
22320         echo "You do not have socklen_t."
22321         case "$sizetype" in
22322         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22323         esac
22324 fi
22325 $rm_try
22326 set d_socklen_t
22327 eval $setvar
22328
22329 : see if this is a socks.h system
22330 set socks.h i_socks
22331 eval $inhdr
22332
22333 : check for type of the size argument to socket calls
22334 case "$d_socket" in
22335 "$define")
22336         $cat <<EOM
22337
22338 Checking to see what type is the last argument of accept().
22339 EOM
22340         yyy=''
22341         case "$d_socklen_t" in
22342         "$define") yyy="$yyy socklen_t"
22343         esac
22344         yyy="$yyy $sizetype int long unsigned"
22345         for xxx in $yyy; do
22346                 case "$socksizetype" in
22347                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22348                         case "$usesocks" in
22349                         "$define")
22350                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22351                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22352                                         socksizetype="$xxx"
22353                                 fi
22354                                 ;;
22355                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22356                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22357                                         socksizetype="$xxx"
22358                                 fi
22359                                 ;;
22360                         esac
22361                         ;;
22362                 esac
22363         done
22364 : In case none of those worked, prompt the user.
22365         case "$socksizetype" in
22366         '')     rp='What is the type for socket address structure sizes?'
22367                 dflt='int'
22368                 . ./myread
22369                 socksizetype=$ans
22370                 ;;
22371         esac
22372         ;;
22373 *)      : no sockets, so pick relatively harmless default
22374         socksizetype='int'
22375         ;;
22376 esac
22377
22378 : see what type is used for signed size_t
22379 set ssize_t ssizetype int stdio.h sys/types.h
22380 eval $typedef
22381 dflt="$ssizetype"
22382 $cat > try.c <<EOM
22383 #include <stdio.h>
22384 #$i_stdlib I_STDLIB
22385 #ifdef I_STDLIB
22386 #include <stdlib.h>
22387 #endif
22388 #include <sys/types.h>
22389 #define Size_t $sizetype
22390 #define SSize_t $dflt
22391 int main()
22392 {
22393         if (sizeof(Size_t) == sizeof(SSize_t))
22394                 printf("$dflt\n");
22395         else if (sizeof(Size_t) == sizeof(int))
22396                 printf("int\n");
22397         else
22398                 printf("long\n");
22399         exit(0);
22400 }
22401 EOM
22402 echo " "
22403 set try
22404 if eval $compile_ok && $run ./try > /dev/null; then
22405         ssizetype=`$run ./try`
22406         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22407 else
22408         $cat >&4 <<EOM
22409 Help! I can't compile and run the ssize_t test program: please enlighten me!
22410 (This is probably a misconfiguration in your system or libraries, and
22411 you really ought to fix it.  Still, I'll try anyway.)
22412
22413 I need a type that is the same size as $sizetype, but is guaranteed to
22414 be signed.  Common values are ssize_t, int and long.
22415
22416 EOM
22417         rp="What signed type is the same size as $sizetype?"
22418         . ./myread
22419         ssizetype="$ans"
22420 fi
22421 $rm_try
22422
22423 : Check the size of st_ino
22424 $echo " "
22425 $echo "Checking the size of st_ino..." >&4
22426 $cat > try.c <<EOCP
22427 #include <sys/stat.h>
22428 #include <stdio.h>
22429 #$i_stdlib I_STDLIB
22430 #ifdef I_STDLIB
22431 #include <stdlib.h>
22432 #endif
22433 int main() {
22434     struct stat st;
22435     printf("%d\n", (int)sizeof(st.st_ino));
22436     exit(0);
22437 }
22438 EOCP
22439 set try
22440 if eval $compile_ok; then
22441         val=`$run ./try`
22442         case "$val" in
22443         '')     st_ino_size=4
22444                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22445                 ;;
22446         *)      st_ino_size=$val
22447                 $echo "Your st_ino is $st_ino_size bytes long."
22448                 ;;
22449         esac
22450 else
22451         st_ino_size=4
22452         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22453 fi
22454 $rm_try
22455
22456 : Check if st_ino is signed
22457 $echo " "
22458 $echo "Checking the sign of st_ino..." >&4
22459 $cat > try.c <<EOCP
22460 #include <sys/stat.h>
22461 #include <stdio.h>
22462 int main() {
22463         struct stat foo;
22464         foo.st_ino = -1;
22465         if (foo.st_ino < 0)
22466                 printf("-1\n");
22467         else
22468                 printf("1\n");
22469 }
22470 EOCP
22471 set try
22472 if eval $compile; then
22473         val=`$run ./try`
22474         case "$val" in
22475         '')     st_ino_sign=1
22476                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22477                 ;;
22478         *)      st_ino_sign=$val
22479                 case "$st_ino_sign" in
22480                  1) $echo "Your st_ino is unsigned." ;;
22481                 -1) $echo "Your st_ino is signed."   ;;
22482                 esac
22483                 ;;
22484         esac
22485 else
22486         st_ino_sign=1
22487         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22488 fi
22489 $rm_try
22490
22491 : see what type of char stdio uses.
22492 echo " "
22493 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22494 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22495         echo "Your stdio uses unsigned chars." >&4
22496         stdchar="unsigned char"
22497 else
22498         echo "Your stdio uses signed chars." >&4
22499         stdchar="char"
22500 fi
22501 $rm -f stdioh
22502
22503 : Check size of UID
22504 echo " "
22505 case "$uidtype" in
22506 *_t) zzz="$uidtype"     ;;
22507 *)   zzz="uid"          ;;
22508 esac
22509 echo "Checking the size of $zzz..." >&4
22510 cat > try.c <<EOCP
22511 #include <sys/types.h>
22512 #include <stdio.h>
22513 #$i_stdlib I_STDLIB
22514 #ifdef I_STDLIB
22515 #include <stdlib.h>
22516 #endif
22517 int main() {
22518     printf("%d\n", (int)sizeof($uidtype));
22519     exit(0);
22520 }
22521 EOCP
22522 set try
22523 if eval $compile_ok; then
22524         yyy=`$run ./try`
22525         case "$yyy" in
22526         '')     uidsize=4
22527                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22528                 ;;
22529         *)      uidsize=$yyy
22530                 echo "Your $zzz is $uidsize bytes long."
22531                 ;;
22532         esac
22533 else
22534         uidsize=4
22535         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22536 fi
22537
22538 : Check if UID is signed
22539 echo " "
22540 case "$uidtype" in
22541 *_t) zzz="$uidtype"     ;;
22542 *)   zzz="uid"          ;;
22543 esac
22544 echo "Checking the sign of $zzz..." >&4
22545 cat > try.c <<EOCP
22546 #include <sys/types.h>
22547 #include <stdio.h>
22548 int main() {
22549         $uidtype foo = -1;
22550         if (foo < 0)
22551                 printf("-1\n");
22552         else
22553                 printf("1\n");
22554 }
22555 EOCP
22556 set try
22557 if eval $compile; then
22558         yyy=`$run ./try`
22559         case "$yyy" in
22560         '')     uidsign=1
22561                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22562                 ;;
22563         *)      uidsign=$yyy
22564                 case "$uidsign" in
22565                  1) echo "Your $zzz is unsigned." ;;
22566                 -1) echo "Your $zzz is signed."   ;;
22567                 esac
22568                 ;;
22569         esac
22570 else
22571         uidsign=1
22572         echo "(I can't compile the test program--guessing unsigned.)" >&4
22573 fi
22574
22575 : Check format string for UID
22576 echo " "
22577 $echo "Checking the format string to be used for uids..." >&4
22578
22579 case "$uidsign" in
22580 -1)     if $test X"$uidsize" = X"$ivsize"; then
22581                 uidformat="$ivdformat"
22582         else
22583                 if $test X"$uidsize" = X"$longsize"; then
22584                         uidformat='"ld"'
22585                 else
22586                         if $test X"$uidsize" = X"$intsize"; then
22587                                 uidformat='"d"'
22588                         else
22589                                 if $test X"$uidsize" = X"$shortsize"; then
22590                                         uidformat='"hd"'
22591                                 fi
22592                         fi
22593                 fi
22594         fi
22595         ;;
22596 *)      if $test X"$uidsize" = X"$uvsize"; then
22597                 uidformat="$uvuformat"
22598         else
22599                 if $test X"$uidsize" = X"$longsize"; then
22600                         uidformat='"lu"'
22601                 else
22602                         if $test X"$uidsize" = X"$intsize"; then
22603                                 uidformat='"u"'
22604                         else
22605                                 if $test X"$uidsize" = X"$shortsize"; then
22606                                         uidformat='"hu"'
22607                                 fi
22608                         fi
22609                 fi
22610         fi
22611         ;;
22612 esac
22613
22614 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22615 echo " "
22616 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22617 $cat >try.c <<'EOM'
22618 /* Intentionally a long probe as I'd like to sanity check that the exact
22619    approach is going to work, as thinking it will work, but only having it
22620    part working at runtime is worse than not having it.  */
22621
22622 #include <sys/types.h>
22623 #include <sys/sysctl.h>
22624 #include <sys/param.h>
22625 #include <stdio.h>
22626 #include <string.h>
22627 #include <stdlib.h>
22628 #include <unistd.h>
22629
22630 int
22631 main(int argc, char **argv) {
22632     char *buffer;
22633     char *argv_leaf = strrchr(argv[0], '/');
22634     char *buffer_leaf;
22635     size_t size = 0;
22636     int mib[4];
22637
22638     mib[0] = CTL_KERN;
22639     mib[1] = KERN_PROC;
22640     mib[2] = KERN_PROC_PATHNAME;
22641     mib[3] = -1;
22642
22643     if (!argv_leaf) {
22644         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22645         return 1;
22646     }
22647
22648     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22649         perror("sysctl");
22650         return 2;
22651     }
22652
22653     if (size < strlen(argv_leaf) + 1) {
22654         fprintf(stderr, "size %lu is too short for a path\n",
22655                 (unsigned long) size);
22656         return 3;
22657     }
22658
22659     if (size > MAXPATHLEN * MAXPATHLEN) {
22660         fprintf(stderr, "size %lu is too long for a path\n",
22661                 (unsigned long) size);
22662         return 4;
22663     }
22664
22665     buffer = (char *)malloc(size);
22666     if (!buffer) {
22667         perror("malloc");
22668         return 5;
22669     }
22670
22671     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22672         perror("sysctl");
22673         return 6;
22674     }
22675
22676     if (strlen(buffer) + 1 != size) {
22677         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22678                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22679         return 7;
22680     }
22681
22682
22683     if (*buffer != '/') {
22684         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22685         return 8;
22686     }
22687
22688     if (strstr(buffer, "/./")) {
22689         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22690         return 9;
22691     }
22692
22693     if (strstr(buffer, "/../")) {
22694         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22695         return 10;
22696     }
22697
22698     buffer_leaf = strrchr(buffer, '/');
22699     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22700         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22701         return 11;
22702     }
22703
22704     free(buffer);
22705
22706     return 0;
22707 }
22708 EOM
22709
22710 val=$undef
22711 set try
22712 if eval $compile; then
22713         if $run ./try; then
22714                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22715                 val="$define"
22716         else
22717                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22718                 val="$undef"
22719         fi
22720 else
22721         echo "I'm unable to compile the test program." >&4
22722         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22723         val="$undef"
22724 fi
22725 $rm_try
22726 set usekernprocpathname
22727 eval $setvar
22728
22729 : Determine if we can use _NSGetExecutablePath to find executing program
22730 echo " "
22731 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22732 $cat >try.c <<'EOM'
22733 /* Intentionally a long probe as I'd like to sanity check that the exact
22734    approach is going to work, as thinking it will work, but only having it
22735    part working at runtime is worse than not having it.  */
22736 #include <mach-o/dyld.h>
22737 #include <stdio.h>
22738 #include <stdlib.h>
22739 #include <sys/param.h>
22740 #include <string.h>
22741
22742 int
22743 main(int argc, char **argv) {
22744     char buf[1];
22745     uint32_t size = sizeof(buf);
22746     int result;
22747     char *buffer;
22748     char *tidied;
22749     char *argv_leaf = strrchr(argv[0], '/');
22750     char *tidied_leaf;
22751
22752     if (!argv_leaf) {
22753         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22754         return 1;
22755     }
22756
22757     _NSGetExecutablePath(buf, &size);
22758     if (size > MAXPATHLEN * MAXPATHLEN) {
22759         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22760                 (unsigned int) size);
22761         return 2;
22762     }
22763
22764     buffer = (char *)malloc(size);
22765     if (!buffer) {
22766         perror("malloc");
22767         return 3;
22768     }
22769
22770     result = _NSGetExecutablePath(buffer, &size);
22771     if (result != 0) {
22772         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22773                 result, (unsigned int) size);
22774         return 4;
22775     }
22776
22777     tidied = realpath(buffer, NULL);
22778     if (!tidied) {
22779         perror("realpath");
22780         return 5;
22781     }
22782
22783     free(buffer);
22784
22785     if (*tidied != '/') {
22786         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22787         return 6;
22788     }
22789
22790     if (strstr(tidied, "/./")) {
22791         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22792         return 7;
22793     }
22794
22795     if (strstr(tidied, "/../")) {
22796         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22797         return 8;
22798     }
22799
22800     tidied_leaf = strrchr(tidied, '/');
22801     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22802         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22803         return 9;
22804     }
22805
22806     free(tidied);
22807
22808     return 0;
22809 }
22810 EOM
22811
22812 val=$undef
22813 set try
22814 if eval $compile; then
22815         if $run ./try; then
22816                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22817                 val="$define"
22818         else
22819                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22820         fi
22821 else
22822         echo "I'm unable to compile the test program." >&4
22823         echo "I'll assume no _NSGetExecutablePath here." >&4
22824 fi
22825 $rm_try
22826 set usensgetexecutablepath
22827 eval $setvar
22828
22829 : Check if site customization support was requested
22830 case "$usesitecustomize" in
22831     $define|true|[Yy]*)
22832         usesitecustomize="$define"
22833         ;;
22834     *)
22835         usesitecustomize="$undef"
22836         ;;
22837     esac
22838
22839 : determine compiler compiler
22840 case "$yacc" in
22841 '')
22842         dflt=yacc;;
22843 *)
22844         dflt="$yacc";;
22845 esac
22846 echo " "
22847 comp='yacc'
22848 if $test -f "$byacc$_exe"; then
22849         dflt="$byacc"
22850         comp="byacc or $comp"
22851 fi
22852 if $test -f "$bison$_exe"; then
22853         comp="$comp or bison -y"
22854 fi
22855 rp="Which compiler compiler ($comp) shall I use?"
22856 . ./myread
22857 yacc="$ans"
22858 case "$yacc" in
22859 *bis*)
22860         case "$yacc" in
22861         *-y*) ;;
22862         *)
22863                 yacc="$yacc -y"
22864                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22865                 ;;
22866         esac
22867         ;;
22868 esac
22869
22870 : see if this is a bfd.h system
22871 set bfd.h i_bfd
22872 eval $inhdr
22873
22874 : see if this is an execinfo.h system
22875 set execinfo.h i_execinfo
22876 eval $inhdr
22877
22878 : see if this is a fenv.h system
22879 set fenv.h i_fenv
22880 eval $inhdr
22881
22882 : see if this is a fp.h system
22883 set fp.h i_fp
22884 eval $inhdr
22885
22886 : see if this is a fp_class.h system
22887 set fp_class.h i_fp_class
22888 eval $inhdr
22889
22890 : see if gdbm.h is available
22891 set gdbm.h t_gdbm
22892 eval $inhdr
22893 case "$t_gdbm" in
22894 $define)
22895         : see if gdbm_open exists
22896         set gdbm_open d_gdbm_open
22897         eval $inlibc
22898         case "$d_gdbm_open" in
22899         $undef)
22900                 t_gdbm="$undef"
22901                 echo "We won't be including <gdbm.h>"
22902                 ;;
22903         esac
22904         ;;
22905 esac
22906 val="$t_gdbm"
22907 set i_gdbm
22908 eval $setvar
22909
22910 : see if this is a ieeefp.h system
22911 case "$i_ieeefp" in
22912 '' ) set ieeefp.h i_ieeefp
22913      eval $inhdr
22914      ;;
22915 esac
22916
22917 : see if this is a libutil.h system
22918 set libutil.h i_libutil
22919 eval $inhdr
22920
22921 : see if mach cthreads are available
22922 if test "X$usethreads" = "X$define"; then
22923         set mach/cthreads.h i_machcthr
22924         eval $inhdr
22925 else
22926         i_machcthr="$undef"
22927 fi
22928
22929 : see if this is a mntent.h system
22930 set mntent.h i_mntent
22931 eval $inhdr
22932
22933 : see if net/errno.h is available
22934 val=''
22935 set net/errno.h val
22936 eval $inhdr
22937
22938 : Unfortunately, it causes problems on some systems.  Arrgh.
22939 case "$val" in
22940 $define)
22941         cat > try.c <<'EOM'
22942 #include <stdio.h>
22943 #include <errno.h>
22944 #include <net/errno.h>
22945 int func()
22946 {
22947         return ENOTSOCK;
22948 }
22949 EOM
22950         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22951                 echo "We'll be including <net/errno.h>." >&4
22952         else
22953                 echo "We won't be including <net/errno.h>." >&4
22954                 val="$undef"
22955         fi
22956         $rm_try
22957         ;;
22958 esac
22959 set i_neterrno
22960 eval $setvar
22961
22962 : see if netinet/tcp.h is available
22963 set netinet/tcp.h i_netinettcp
22964 eval $inhdr
22965
22966 : see if this is a poll.h system
22967 set poll.h i_poll
22968 eval $inhdr
22969
22970 : see if this is a prot.h system
22971 set prot.h i_prot
22972 eval $inhdr
22973
22974 : Preprocessor symbols
22975 echo " "
22976 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22977 $cat <<'EOSH' > Cppsym.know
22978 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22979 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22980 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22981 arch_pwr ardent ARM ARM32 atarist att386 att3b
22982 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22983 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22984 byteorder byte_order
22985 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22986 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22987 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22988 ELF encore EPI EXTENSIONS
22989 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22990 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22991 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22992 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22993 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22994 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22995 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22996 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22997 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22998 ksr1
22999 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23000 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23001 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23002 luna88k Lynx
23003 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23004 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23005 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23006 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23007 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23008 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23009 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23010 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23011 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23012 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23013 ns32000 ns32016 ns32332 ns32k nsc32000
23014 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23015 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23016 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23017 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23018 QK_USER QNX
23019 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23020 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23021 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23022 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23023 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23024 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23025 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23026 SYSV4 SYSV5 sysV68 sysV88
23027 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23028 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23029 tower32_800 tower32_850 tss
23030 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23031 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23032 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23033 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23034 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23035 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23036 uxpm uxps
23037 vax venix VMESA vms
23038 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23039 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23040 z8000 zarch
23041 EOSH
23042 # Maybe put other stuff here too.
23043 ./tr '-' '_' <<EOSH >>Cppsym.know
23044 $osname
23045 EOSH
23046 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23047 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23048 $cat Cppsym.know > Cppsym.c
23049 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23050 $rm -f Cppsym.a Cppsym.b Cppsym.c
23051 cat <<EOSH > Cppsym
23052 $startsh
23053 if $test \$# -gt 0; then
23054     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23055     if $test -s Cppsym.got; then
23056         $rm -f Cppsym.got
23057         exit 0
23058     fi
23059     $rm -f Cppsym.got
23060     exit 1
23061 else
23062     $tr " " "$trnl" | ./Cppsym.try
23063     exit 0
23064 fi
23065 EOSH
23066 chmod +x Cppsym
23067 $eunicefix Cppsym
23068 cat <<EOSH > Cppsym.try
23069 $startsh
23070 cat <<'EOCP' > try.c
23071 #include <stdio.h>
23072 #if cpp_stuff == 1
23073 #define STRINGIFY(a)    "a"
23074 #endif
23075 #if cpp_stuff == 42
23076 #define StGiFy(a)  #a
23077 #define STRINGIFY(a)    StGiFy(a)
23078 #endif
23079 #if $cpp_stuff != 1 && $cpp_stuff != 42
23080 #   include "Bletch: How does this C preprocessor stringify macros?"
23081 #endif
23082 int main() {
23083 EOCP
23084 $awk \\
23085 EOSH
23086 cat <<'EOSH' >> Cppsym.try
23087 'length($1) > 0 {
23088     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23089     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23090     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23091     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23092 }' >> try.c
23093 echo 'return 0;}' >> try.c
23094 EOSH
23095 cat <<EOSH >> Cppsym.try
23096 ccflags="$ccflags"
23097 case "$osname-$gccversion" in
23098 irix-) ccflags="\$ccflags -woff 1178" ;;
23099 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23100 esac
23101 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23102 EOSH
23103 chmod +x Cppsym.try
23104 $eunicefix Cppsym.try
23105 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23106 : Add in any Linux cpp "predefined macros":
23107 case "$osname::$gccversion" in
23108   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23109     tHdrH=_tmpHdr
23110     rm -f $tHdrH'.h' $tHdrH
23111     touch $tHdrH'.h'
23112     # Filter out macro arguments, such as Linux's __INT8_C(c)
23113     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23114        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23115        if [ -s $tHdrH'_cppsym.real' ]; then
23116           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23117        fi
23118     fi
23119     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23120   ;;
23121 esac
23122 : now check the C compiler for additional symbols
23123 postprocess_cc_v=''
23124 case "$osname" in
23125 aix) postprocess_cc_v="|$tr , ' '" ;;
23126 esac
23127 $cat >ccsym <<EOS
23128 $startsh
23129 $cat >tmp.c <<EOF
23130 extern int foo;
23131 EOF
23132 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23133 do
23134         case "\$i" in
23135         -D*) echo "\$i" | $sed 's/^-D//';;
23136         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23137         esac
23138 done
23139 $rm_try
23140 EOS
23141 postprocess_cc_v=''
23142 chmod +x ccsym
23143 $eunicefix ccsym
23144 ./ccsym > ccsym1.raw
23145 if $test -s ccsym1.raw; then
23146     $sort ccsym1.raw | $uniq >ccsym.raw
23147 else
23148     mv ccsym1.raw ccsym.raw
23149 fi
23150
23151 $awk '/\=/ { print $0; next }
23152         { print $0"=1" }' ccsym.raw >ccsym.list
23153 $comm -13 Cppsym.true ccsym.list >ccsym.own
23154 $comm -12 Cppsym.true ccsym.list >ccsym.com
23155 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23156 also=''
23157 if $test -z ccsym.raw; then
23158         echo "Your C compiler doesn't seem to define any symbols!" >&4
23159         echo " "
23160         echo "However, your C preprocessor defines the following symbols:"
23161         $cat Cppsym.true
23162         ccsymbols=''
23163         cppsymbols=`$cat Cppsym.true`
23164         cppsymbols=`echo $cppsymbols`
23165         cppccsymbols="$cppsymbols"
23166 else
23167         if $test -s ccsym.com; then
23168                 echo "Your C compiler and pre-processor define these symbols:"
23169                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23170                 also='also '
23171                 symbols='ones'
23172                 cppccsymbols=`$cat ccsym.com`
23173                 cppccsymbols=`echo $cppccsymbols`
23174                 $test "$silent" || sleep 1
23175         fi
23176         if $test -s ccsym.cpp; then
23177                 $test "$also" && echo " "
23178                 echo "Your C pre-processor ${also}defines the following symbols:"
23179                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23180                 also='further '
23181                 cppsymbols=`$cat ccsym.cpp`
23182                 cppsymbols=`echo $cppsymbols`
23183                 $test "$silent" || sleep 1
23184         fi
23185         if $test -s ccsym.own; then
23186                 $test "$also" && echo " "
23187                 echo "Your C compiler ${also}defines the following cpp symbols:"
23188                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23189                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23190                 ccsymbols=`$cat ccsym.own`
23191                 ccsymbols=`echo $ccsymbols`
23192                 $test "$silent" || sleep 1
23193         fi
23194 fi
23195
23196 : add -D_FORTIFY_SOURCE if feasible and not already there
23197 case "$gccversion" in
23198 [456789].*)     case "$optimize$ccflags" in
23199         *-O*)   case "$ccflags$cppsymbols" in
23200                 *_FORTIFY_SOURCE=*) # Don't add it again.
23201                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23202                         ;;
23203                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23204                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23205                         ;;
23206                 esac
23207                 ;;
23208         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23209                 ;;
23210         esac
23211         ;;
23212 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23213         ;;
23214 esac
23215
23216 : script used to emit important warnings
23217 cat >warn <<EOS
23218 $startsh
23219 if test \$# -gt 0; then
23220         echo "\$@" >msg
23221 else
23222         cat >msg
23223 fi
23224 echo "*** WARNING:" >&4
23225 sed -e 's/^/*** /' <msg >&4
23226 echo "*** " >&4
23227 cat msg >>config.msg
23228 echo " " >>config.msg
23229 rm -f msg
23230 EOS
23231 chmod +x warn
23232 $eunicefix warn
23233
23234 : see if this is a termio system
23235 val="$undef"
23236 val2="$undef"
23237 val3="$undef"
23238 if $test `./findhdr termios.h`; then
23239     set tcsetattr i_termios
23240     eval $inlibc
23241     val3="$i_termios"
23242 fi
23243 echo " "
23244 case "$val3" in
23245     "$define") echo "You have POSIX termios.h... good!" >&4;;
23246     *)  if ./Cppsym pyr; then
23247             case "`$run /bin/universe`" in
23248                 ucb) if $test `./findhdr sgtty.h`; then
23249                         val2="$define"
23250                         echo "<sgtty.h> found." >&4
23251                     else
23252                         echo "System is pyramid with BSD universe."
23253                         ./warn "<sgtty.h> not found--you could have problems."
23254                     fi;;
23255                 *)  if $test `./findhdr termio.h`; then
23256                         val="$define"
23257                         echo "<termio.h> found." >&4
23258                     else
23259                         echo "System is pyramid with USG universe."
23260                         ./warn "<termio.h> not found--you could have problems."
23261                     fi;;
23262             esac
23263         elif ./usg; then
23264             if $test `./findhdr termio.h`; then
23265                 echo "<termio.h> found." >&4
23266                 val="$define"
23267             elif $test `./findhdr sgtty.h`; then
23268                 echo "<sgtty.h> found." >&4
23269                 val2="$define"
23270             else
23271                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23272             fi
23273         else
23274             if $test `./findhdr sgtty.h`; then
23275                 echo "<sgtty.h> found." >&4
23276                 val2="$define"
23277             elif $test `./findhdr termio.h`; then
23278                 echo "<termio.h> found." >&4
23279                 val="$define"
23280             else
23281                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23282             fi
23283         fi;;
23284 esac
23285 set i_termio; eval $setvar
23286 val=$val2; set i_sgtty; eval $setvar
23287 val=$val3; set i_termios; eval $setvar
23288
23289 : see if stdbool is available
23290 : we want a real compile instead of Inhdr because some Solaris systems
23291 : have stdbool.h, but it can only be used if the compiler indicates it
23292 : is sufficiently c99-compliant.
23293 echo " "
23294 $cat >try.c <<EOCP
23295 #include <stdio.h>
23296 #include <stdbool.h>
23297 int func(bool x)
23298 {
23299     return x ? 1 : 0;
23300 }
23301 int main(int argc, char **argv)
23302 {
23303     return func(0);
23304 }
23305 EOCP
23306 set try
23307 if eval $compile; then
23308         echo "<stdbool.h> found." >&4
23309         val="$define"
23310 else
23311         echo "<stdbool.h> NOT found." >&4
23312         val="$undef"
23313 fi
23314 $rm_try
23315 set i_stdbool
23316 eval $setvar
23317
23318 : see if stdint is available
23319 set stdint.h i_stdint
23320 eval $inhdr
23321
23322 : see if sys/access.h is available
23323 set sys/access.h i_sysaccess
23324 eval $inhdr
23325
23326 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23327 set sys/filio.h i_sysfilio
23328 eval $inhdr
23329 echo " "
23330 if $test `./findhdr sys/ioctl.h`; then
23331         val="$define"
23332         echo '<sys/ioctl.h> found.' >&4
23333 else
23334         val="$undef"
23335         if $test $i_sysfilio = "$define"; then
23336             echo '<sys/ioctl.h> NOT found.' >&4
23337         else
23338                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23339                 $test $i_termio = "$define" && xxx="termio.h"
23340                 $test $i_termios = "$define" && xxx="termios.h"
23341 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23342         fi
23343 fi
23344 set i_sysioctl
23345 eval $setvar
23346
23347 : see if socket ioctl defs are in sys/sockio.h
23348 echo " "
23349 xxx=`./findhdr sys/sockio.h`
23350 if $test "$xxx"; then
23351         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23352                 val="$define"
23353                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23354         else
23355                 val="$undef"
23356                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23357         fi
23358 else
23359         val="$undef"
23360         $cat <<EOM
23361 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23362 EOM
23363 fi
23364 set i_syssockio
23365 eval $setvar
23366
23367 : see if this is a syslog.h system
23368 set syslog.h i_syslog
23369 eval $inhdr
23370
23371 : see if this is a sys/mode.h system
23372 set sys/mode.h i_sysmode
23373 eval $inhdr
23374
23375 : see if there is a sys/poll.h file
23376 set sys/poll.h i_syspoll
23377 eval $inhdr
23378
23379 : see if sys/resource.h has to be included
23380 set sys/resource.h i_sysresrc
23381 eval $inhdr
23382
23383 : see if sys/security.h is available
23384 set sys/security.h i_syssecrt
23385 eval $inhdr
23386
23387 : see if this is a sys/statvfs.h system
23388 set sys/statvfs.h i_sysstatvfs
23389 eval $inhdr
23390
23391 : see if this is a sys/un.h system
23392 set sys/un.h i_sysun
23393 eval $inhdr
23394
23395 : see if this is a sys/utsname.h system
23396 set sys/utsname.h i_sysutsname
23397 eval $inhdr
23398
23399 : see if this is a syswait system
23400 set sys/wait.h i_syswait
23401 eval $inhdr
23402
23403 : see if this is a ustat.h system
23404 set ustat.h i_ustat
23405 eval $inhdr
23406
23407 : see if this is an utime system
23408 set utime.h i_utime
23409 eval $inhdr
23410
23411 : see if this is a vfork system
23412 case "$d_vfork" in
23413 "$define")
23414         set vfork.h i_vfork
23415         eval $inhdr
23416         ;;
23417 *)
23418         i_vfork="$undef"
23419         ;;
23420 esac
23421
23422 : see if wchar.h is present
23423 set wchar.h i_wchar
23424 eval $inhdr
23425
23426 : Check extensions
23427 echo " "
23428 echo "Looking for extensions..." >&4
23429 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23430 : contain old or inaccurate or duplicate values.
23431 nonxs_extensions=''
23432 xs_extensions=''
23433 : We do not use find because it might not be available.
23434 : We do not just use MANIFEST because the user may have dropped
23435 : some additional extensions into the source tree and expect them
23436 : to be built.
23437
23438 : Function to recursively find available extensions, ignoring DynaLoader
23439 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23440 : In 5.10.1 and later, extensions are stored in directories
23441 : like File-Glob instead of the older File/Glob/.
23442 find_extensions='
23443     for xxx in *; do
23444         case "$xxx" in
23445             DynaLoader|dynaload) ;;
23446             *)
23447             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23448             case "$this_ext" in
23449                 Scalar/List/Utils) this_ext="List/Util" ;;
23450                 PathTools)         this_ext="Cwd"       ;;
23451             esac;
23452             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23453             if $contains " $this_ext " "$tdir/$$.tmp"; then
23454                 echo >&4;
23455                 echo "Duplicate directories detected for extension $xxx" >&4;
23456                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23457                 case "$knowitall" in
23458                 "") dflt=y;;
23459                 *) dflt=n;;
23460                 esac;
23461                 . ../UU/myread;
23462                 case "$ans" in
23463                 n*|N*) ;;
23464                 *) echo >&4;
23465                     echo "Ok.  Stopping Configure." >&4;
23466                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23467                     exit 1;;
23468                 esac;
23469                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23470             fi;
23471             $ls -1 "$xxx" > "$tdir/$$.tmp";
23472             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23473                 xs_extensions="$xs_extensions $this_ext";
23474             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23475                 xs_extensions="$xs_extensions $this_ext";
23476             elif $test -d "$xxx"; then
23477                 nonxs_extensions="$nonxs_extensions $this_ext";
23478             fi;
23479             $rm -f "$tdir/$$.tmp";
23480             ;;
23481         esac;
23482     done'
23483 tdir=`pwd`
23484 cd "$rsrc/cpan"
23485 set X
23486 shift
23487 eval $find_extensions
23488 cd "$rsrc/dist"
23489 set X
23490 shift
23491 eval $find_extensions
23492 cd "$rsrc/ext"
23493 set X
23494 shift
23495 eval $find_extensions
23496 set X $xs_extensions
23497 shift
23498 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23499 set X $nonxs_extensions
23500 shift
23501 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23502 cd "$tdir"
23503 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23504
23505 : Now see which are supported on this system.
23506 avail_ext=''
23507 for xxx in $xs_extensions ; do
23508         case "$xxx" in
23509         Amiga*)
23510                 case "$osname" in
23511                 amigaos) avail_ext="$avail_ext $xxx" ;;
23512                 esac
23513                 ;;
23514         DB_File|db_file)
23515                 case "$i_db" in
23516                 $define) avail_ext="$avail_ext $xxx" ;;
23517                 esac
23518                 ;;
23519         GDBM_File|gdbm_fil)
23520                 case "$i_gdbm" in
23521                 $define) avail_ext="$avail_ext $xxx" ;;
23522                 esac
23523                 ;;
23524         IPC/SysV|ipc/sysv)
23525                 : XXX Do we need a useipcsysv variable here
23526                 case "${d_msg}${d_sem}${d_shm}" in
23527                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23528                 esac
23529                 ;;
23530         NDBM_File|ndbm_fil)
23531                 case "$d_ndbm" in
23532                 $define)
23533                     case "$osname-$use64bitint" in
23534                     hpux-define)
23535                         case "$libs" in
23536                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23537                         esac
23538                         ;;
23539                     *) avail_ext="$avail_ext $xxx" ;;
23540                     esac
23541                     ;;
23542                 esac
23543                 ;;
23544         ODBM_File|odbm_fil)
23545                 case "${i_dbm}${i_rpcsvcdbm}" in
23546                 *"${define}"*)
23547                     case "$d_cplusplus" in
23548                     define) ;; # delete as a function name will not work
23549                     *)  case "$osname-$use64bitint" in
23550                         hpux-define)
23551                             case "$libs" in
23552                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23553                             esac
23554                             ;;
23555                         *) avail_ext="$avail_ext $xxx" ;;
23556                         esac
23557                         ;;
23558                     esac
23559                     ;;
23560                 esac
23561                 ;;
23562         Opcode|opcode)
23563                 case "$useopcode" in
23564                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23565                 esac
23566                 ;;
23567         POSIX|posix)
23568                 case "$useposix" in
23569                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23570                 esac
23571                 ;;
23572         Socket|socket)
23573                 case "$d_socket" in
23574                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23575                 esac
23576                 ;;
23577         I18N/Langinfo|langinfo)
23578                 case "$uselanginfo" in
23579                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23580                 esac
23581                 ;;
23582         Sys/Syslog|sys/syslog)
23583                 case $osname in
23584                         amigaos) ;; # not really very useful on AmigaOS
23585                         *)
23586                         : XXX syslog requires socket
23587                         case "$d_socket" in
23588                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23589                         esac
23590                         ;;
23591                 esac
23592                 ;;
23593         Thread|thread)
23594                 case "$usethreads" in
23595                 true|$define|y)
23596                         case "$use5005threads" in
23597                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23598                         esac
23599                 esac
23600                 ;;
23601         threads|threads/shared)
23602                 # threads and threads::shared are special cases.
23603                 # To stop people from asking "Perl 5.8.0 was supposed
23604                 # to have this new fancy threads implementation but my
23605                 # perl doesn't have it" and from people trying to
23606                 # (re)install the threads module using CPAN.pm and
23607                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23608                 # the threads.pm and threads/shared.pm will always be
23609                 # there, croaking informatively ("you need to rebuild
23610                 # all of Perl with threads, sorry") when threads haven't
23611                 # been compiled in.
23612                 # --jhi
23613                 avail_ext="$avail_ext $xxx"
23614                 ;;
23615         VMS*)
23616                 ;;
23617         Win32*)
23618                 case "$osname" in
23619                 cygwin) avail_ext="$avail_ext $xxx" ;;
23620                 esac
23621                 ;;
23622         XS/APItest|xs/apitest)
23623                 # This is just for testing.  Skip it unless we have dynamic loading.
23624
23625                 case "$usedl" in
23626                 $define) avail_ext="$avail_ext $xxx" ;;
23627                 esac
23628                 ;;
23629         XS/Typemap|xs/typemap)
23630                 # This is just for testing.  Skip it unless we have dynamic loading.
23631                 case "$usedl" in
23632                 $define) avail_ext="$avail_ext $xxx" ;;
23633                 esac
23634                 ;;
23635         *)      avail_ext="$avail_ext $xxx"
23636                 ;;
23637         esac
23638 done
23639
23640 set X $avail_ext
23641 shift
23642 avail_ext="$*"
23643
23644 case "$onlyextensions" in
23645 '') ;;
23646 *)  keepextensions=''
23647     echo "You have requested that only certain extensions be included..." >&4
23648     for i in $onlyextensions; do
23649         case " $avail_ext " in
23650         *" $i "*)
23651             echo "Keeping extension $i."
23652             keepextensions="$keepextensions $i"
23653             ;;
23654         *) echo "Ignoring extension $i." ;;
23655         esac
23656     done
23657     avail_ext="$keepextensions"
23658     ;;
23659 esac
23660
23661 case "$noextensions" in
23662 '') ;;
23663 *)  keepextensions=''
23664     echo "You have requested that certain extensions be ignored..." >&4
23665     for i in $avail_ext; do
23666         case " $noextensions " in
23667         *" $i "*) echo "Ignoring extension $i." ;;
23668         *) echo "Keeping extension $i.";
23669            keepextensions="$keepextensions $i"
23670            ;;
23671         esac
23672     done
23673     avail_ext="$keepextensions"
23674     ;;
23675 esac
23676
23677 : Now see which nonxs extensions are supported on this system.
23678 : For now assume all are.
23679 nonxs_ext=''
23680 for xxx in $nonxs_extensions ; do
23681         case "$xxx" in
23682         VMS*)
23683                 ;;
23684         *)      nonxs_ext="$nonxs_ext $xxx"
23685                 ;;
23686         esac
23687 done
23688
23689 set X $nonxs_ext
23690 shift
23691 nonxs_ext="$*"
23692
23693 case $usedl in
23694 $define)
23695         $cat <<EOM
23696 A number of extensions are supplied with $package.  You may choose to
23697 compile these extensions for dynamic loading (the default), compile
23698 them into the $package executable (static loading), or not include
23699 them at all.  Answer "none" to include no extensions.
23700 Note that DynaLoader is always built and need not be mentioned here.
23701
23702 EOM
23703         case "$dynamic_ext" in
23704         '')
23705                 : Exclude those listed in static_ext
23706                 dflt=''
23707                 for xxx in $avail_ext; do
23708                         case " $static_ext " in
23709                         *" $xxx "*) ;;
23710                         *) dflt="$dflt $xxx" ;;
23711                         esac
23712                 done
23713                 set X $dflt
23714                 shift
23715                 dflt="$*"
23716                 ;;
23717         *)      dflt="$dynamic_ext"
23718                 # Perhaps we are reusing an old out-of-date config.sh.
23719                 case "$hint" in
23720                 previous)
23721                         if test X"$dynamic_ext" != X"$avail_ext"; then
23722                                 $cat <<EOM
23723 NOTICE:  Your previous config.sh list may be incorrect.
23724 The extensions now available to you are
23725         ${avail_ext}
23726 but the default list from your previous config.sh is
23727         ${dynamic_ext}
23728
23729 EOM
23730                         fi
23731                         ;;
23732                 esac
23733                 ;;
23734         esac
23735         case "$dflt" in
23736         '')     dflt=none;;
23737         esac
23738         rp="What extensions do you wish to load dynamically?"
23739         . ./myread
23740         case "$ans" in
23741         none) dynamic_ext=' ' ;;
23742         *) dynamic_ext="$ans" ;;
23743         esac
23744
23745         case "$static_ext" in
23746         '')
23747                 : Exclude those already listed in dynamic linking
23748                 dflt=''
23749                 for xxx in $avail_ext; do
23750                         case " $dynamic_ext " in
23751                         *" $xxx "*) ;;
23752                         *) dflt="$dflt $xxx" ;;
23753                         esac
23754                 done
23755                 set X $dflt
23756                 shift
23757                 dflt="$*"
23758                 ;;
23759         *)  dflt="$static_ext"
23760                 ;;
23761         esac
23762
23763         case "$dflt" in
23764         '')     dflt=none;;
23765         esac
23766         rp="What extensions do you wish to load statically?"
23767         . ./myread
23768         case "$ans" in
23769         none) static_ext=' ' ;;
23770         *) static_ext="$ans" ;;
23771         esac
23772         ;;
23773 *)
23774         $cat <<EOM
23775 A number of extensions are supplied with $package.  Answer "none"
23776 to include no extensions.
23777 Note that DynaLoader is always built and need not be mentioned here.
23778
23779 EOM
23780         case "$static_ext" in
23781         '') dflt="$avail_ext" ;;
23782         *)      dflt="$static_ext"
23783                 # Perhaps we are reusing an old out-of-date config.sh.
23784                 case "$hint" in
23785                 previous)
23786                         if test X"$static_ext" != X"$avail_ext"; then
23787                                 $cat <<EOM
23788 NOTICE:  Your previous config.sh list may be incorrect.
23789 The extensions now available to you are
23790         ${avail_ext}
23791 but the default list from your previous config.sh is
23792         ${static_ext}
23793
23794 EOM
23795                         fi
23796                         ;;
23797                 esac
23798                 ;;
23799         esac
23800         : Exclude those that are not xs extensions
23801         case "$dflt" in
23802         '')     dflt=none;;
23803         esac
23804         rp="What extensions do you wish to include?"
23805         . ./myread
23806         case "$ans" in
23807         none) static_ext=' ' ;;
23808         *) static_ext="$ans" ;;
23809         esac
23810         ;;
23811 esac
23812 #
23813 # Encode is a special case.  If we are building Encode as a static
23814 # extension, we need to explicitly list its subextensions as well.
23815 # For other nested extensions, this is handled automatically by
23816 # the appropriate Makefile.PL.
23817 case " $static_ext " in
23818         *" Encode "*) # Add the subextensions of Encode
23819         cd "$rsrc/cpan"
23820         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23821                 static_ext="$static_ext Encode/$xxx"
23822                 known_extensions="$known_extensions Encode/$xxx"
23823         done
23824         cd "$tdir"
23825         ;;
23826 esac
23827
23828 set X $dynamic_ext $static_ext $nonxs_ext
23829 shift
23830 extensions="$*"
23831
23832 # Sanity check:  We require an extension suitable for use with
23833 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23834 # should show up as failures in the test suite, but it's helpful to
23835 # catch them now.) The 'extensions' list is normally sorted
23836 # alphabetically, so we need to accept either
23837 #    DB_File ... Fcntl ... IO  ....
23838 # or something like
23839 #    Fcntl ... NDBM_File ... IO  ....
23840 case " $extensions"  in
23841 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23842 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23843 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23844 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23845    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23846    ;;
23847 esac
23848
23849 : Remove libraries needed only for extensions
23850 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23851 : The exception is SunOS 4.x, which needs them.
23852 case "${osname}X${osvers}" in
23853 sunos*X4*)
23854     perllibs="$libs"
23855     ;;
23856 *) case "$usedl" in
23857     $define|true|[yY]*)
23858             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23859             shift
23860             perllibs="$*"
23861             ;;
23862     *)  perllibs="$libs"
23863             ;;
23864     esac
23865     ;;
23866 esac
23867
23868 : Remove build directory name from cppstdin so it can be used from
23869 : either the present location or the final installed location.
23870 echo " "
23871 : Get out of the UU directory to get correct path name.
23872 cd ..
23873 case "$cppstdin" in
23874 `pwd`/cppstdin)
23875         echo "Stripping down cppstdin path name"
23876         cppstdin=cppstdin
23877         ;;
23878 esac
23879 cd UU
23880
23881 : end of configuration questions
23882 echo " "
23883 echo "End of configuration questions."
23884 echo " "
23885
23886 : back to where it started
23887 if test -d ../UU; then
23888         cd ..
23889 fi
23890
23891 : configuration may be unconditionally patched via a 'config.arch' file
23892 if $test -f config.arch; then
23893         echo "I see a config.arch file, loading it." >&4
23894         . ./config.arch
23895 fi
23896
23897 : configuration may be patched via a 'config.over' file
23898 if $test -f config.over; then
23899         echo " "
23900         dflt=y
23901         rp='I see a config.over file.  Do you wish to load it?'
23902         . UU/myread
23903         case "$ans" in
23904         n*) echo "OK, I'll ignore it.";;
23905         *)      . ./config.over
23906                 echo "Configuration override changes have been loaded."
23907                 ;;
23908         esac
23909 fi
23910
23911 : in case they want portability, strip down executable paths
23912 case "$d_portable" in
23913 "$define")
23914         echo " "
23915         echo "Stripping down executable paths..." >&4
23916         for file in $loclist $trylist; do
23917                 eval temp=\$$file
23918                 eval $file=`basename $temp`
23919         done
23920         ;;
23921 esac
23922
23923 : create config.sh file
23924 echo " "
23925 echo "Creating config.sh..." >&4
23926 $spitshell <<EOT >config.sh
23927 $startsh
23928 #
23929 # This file was produced by running the Configure script. It holds all the
23930 # definitions figured out by Configure. Should you modify one of these values,
23931 # do not forget to propagate your changes by running "Configure -der". You may
23932 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23933 #
23934
23935 # Package name      : $package
23936 # Source directory  : $src
23937 # Configuration time: $cf_time
23938 # Configured by     : $cf_by
23939 # Target system     : $myuname
23940
23941 EOT
23942 : Add in command line options if available
23943 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23944
23945 $spitshell <<EOT >>config.sh
23946
23947 Author='$Author'
23948 Date='$Date'
23949 Header='$Header'
23950 Id='$Id'
23951 Locker='$Locker'
23952 Log='$Log'
23953 RCSfile='$RCSfile'
23954 Revision='$Revision'
23955 Source='$Source'
23956 State='$State'
23957 _a='$_a'
23958 _exe='$_exe'
23959 _o='$_o'
23960 afs='$afs'
23961 afsroot='$afsroot'
23962 alignbytes='$alignbytes'
23963 aphostname='$aphostname'
23964 api_revision='$api_revision'
23965 api_subversion='$api_subversion'
23966 api_version='$api_version'
23967 api_versionstring='$api_versionstring'
23968 ar='$ar'
23969 archlib='$archlib'
23970 archlibexp='$archlibexp'
23971 archname64='$archname64'
23972 archname='$archname'
23973 archobjs='$archobjs'
23974 asctime_r_proto='$asctime_r_proto'
23975 awk='$awk'
23976 baserev='$baserev'
23977 bash='$bash'
23978 bin='$bin'
23979 bin_ELF='$bin_ELF'
23980 binexp='$binexp'
23981 bison='$bison'
23982 byacc='$byacc'
23983 byteorder='$byteorder'
23984 c='$c'
23985 castflags='$castflags'
23986 cat='$cat'
23987 cc='$cc'
23988 cccdlflags='$cccdlflags'
23989 ccdlflags='$ccdlflags'
23990 ccflags='$ccflags'
23991 ccflags_uselargefiles='$ccflags_uselargefiles'
23992 ccname='$ccname'
23993 ccsymbols='$ccsymbols'
23994 ccversion='$ccversion'
23995 cf_by='$cf_by'
23996 cf_email='$cf_email'
23997 cf_time='$cf_time'
23998 charbits='$charbits'
23999 charsize='$charsize'
24000 chgrp='$chgrp'
24001 chmod='$chmod'
24002 chown='$chown'
24003 clocktype='$clocktype'
24004 comm='$comm'
24005 compress='$compress'
24006 contains='$contains'
24007 cp='$cp'
24008 cpio='$cpio'
24009 cpp='$cpp'
24010 cpp_stuff='$cpp_stuff'
24011 cppccsymbols='$cppccsymbols'
24012 cppflags='$cppflags'
24013 cpplast='$cpplast'
24014 cppminus='$cppminus'
24015 cpprun='$cpprun'
24016 cppstdin='$cppstdin'
24017 cppsymbols='$cppsymbols'
24018 crypt_r_proto='$crypt_r_proto'
24019 cryptlib='$cryptlib'
24020 csh='$csh'
24021 ctermid_r_proto='$ctermid_r_proto'
24022 ctime_r_proto='$ctime_r_proto'
24023 d_Gconvert='$d_Gconvert'
24024 d_PRIEUldbl='$d_PRIEUldbl'
24025 d_PRIFUldbl='$d_PRIFUldbl'
24026 d_PRIGUldbl='$d_PRIGUldbl'
24027 d_PRIXU64='$d_PRIXU64'
24028 d_PRId64='$d_PRId64'
24029 d_PRIeldbl='$d_PRIeldbl'
24030 d_PRIfldbl='$d_PRIfldbl'
24031 d_PRIgldbl='$d_PRIgldbl'
24032 d_PRIi64='$d_PRIi64'
24033 d_PRIo64='$d_PRIo64'
24034 d_PRIu64='$d_PRIu64'
24035 d_PRIx64='$d_PRIx64'
24036 d_SCNfldbl='$d_SCNfldbl'
24037 d__fwalk='$d__fwalk'
24038 d_accept4='$d_accept4'
24039 d_access='$d_access'
24040 d_accessx='$d_accessx'
24041 d_acosh='$d_acosh'
24042 d_aintl='$d_aintl'
24043 d_alarm='$d_alarm'
24044 d_archlib='$d_archlib'
24045 d_asctime64='$d_asctime64'
24046 d_asctime_r='$d_asctime_r'
24047 d_asinh='$d_asinh'
24048 d_atanh='$d_atanh'
24049 d_atolf='$d_atolf'
24050 d_atoll='$d_atoll'
24051 d_attribute_deprecated='$d_attribute_deprecated'
24052 d_attribute_format='$d_attribute_format'
24053 d_attribute_malloc='$d_attribute_malloc'
24054 d_attribute_nonnull='$d_attribute_nonnull'
24055 d_attribute_noreturn='$d_attribute_noreturn'
24056 d_attribute_pure='$d_attribute_pure'
24057 d_attribute_unused='$d_attribute_unused'
24058 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24059 d_backtrace='$d_backtrace'
24060 d_bsd='$d_bsd'
24061 d_bsdgetpgrp='$d_bsdgetpgrp'
24062 d_bsdsetpgrp='$d_bsdsetpgrp'
24063 d_builtin_add_overflow='$d_builtin_add_overflow'
24064 d_builtin_choose_expr='$d_builtin_choose_expr'
24065 d_builtin_expect='$d_builtin_expect'
24066 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24067 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24068 d_c99_variadic_macros='$d_c99_variadic_macros'
24069 d_casti32='$d_casti32'
24070 d_castneg='$d_castneg'
24071 d_cbrt='$d_cbrt'
24072 d_chown='$d_chown'
24073 d_chroot='$d_chroot'
24074 d_chsize='$d_chsize'
24075 d_class='$d_class'
24076 d_clearenv='$d_clearenv'
24077 d_closedir='$d_closedir'
24078 d_cmsghdr_s='$d_cmsghdr_s'
24079 d_copysign='$d_copysign'
24080 d_copysignl='$d_copysignl'
24081 d_cplusplus='$d_cplusplus'
24082 d_crypt='$d_crypt'
24083 d_crypt_r='$d_crypt_r'
24084 d_csh='$d_csh'
24085 d_ctermid='$d_ctermid'
24086 d_ctermid_r='$d_ctermid_r'
24087 d_ctime64='$d_ctime64'
24088 d_ctime_r='$d_ctime_r'
24089 d_cuserid='$d_cuserid'
24090 d_dbminitproto='$d_dbminitproto'
24091 d_difftime64='$d_difftime64'
24092 d_difftime='$d_difftime'
24093 d_dir_dd_fd='$d_dir_dd_fd'
24094 d_dirfd='$d_dirfd'
24095 d_dirnamlen='$d_dirnamlen'
24096 d_dladdr='$d_dladdr'
24097 d_dlerror='$d_dlerror'
24098 d_dlopen='$d_dlopen'
24099 d_dlsymun='$d_dlsymun'
24100 d_dosuid='$d_dosuid'
24101 d_double_has_inf='$d_double_has_inf'
24102 d_double_has_nan='$d_double_has_nan'
24103 d_double_has_negative_zero='$d_double_has_negative_zero'
24104 d_double_has_subnormals='$d_double_has_subnormals'
24105 d_double_style_cray='$d_double_style_cray'
24106 d_double_style_ibm='$d_double_style_ibm'
24107 d_double_style_ieee='$d_double_style_ieee'
24108 d_double_style_vax='$d_double_style_vax'
24109 d_drand48_r='$d_drand48_r'
24110 d_drand48proto='$d_drand48proto'
24111 d_dup2='$d_dup2'
24112 d_dup3='$d_dup3'
24113 d_duplocale='$d_duplocale'
24114 d_eaccess='$d_eaccess'
24115 d_endgrent='$d_endgrent'
24116 d_endgrent_r='$d_endgrent_r'
24117 d_endhent='$d_endhent'
24118 d_endhostent_r='$d_endhostent_r'
24119 d_endnent='$d_endnent'
24120 d_endnetent_r='$d_endnetent_r'
24121 d_endpent='$d_endpent'
24122 d_endprotoent_r='$d_endprotoent_r'
24123 d_endpwent='$d_endpwent'
24124 d_endpwent_r='$d_endpwent_r'
24125 d_endsent='$d_endsent'
24126 d_endservent_r='$d_endservent_r'
24127 d_eofnblk='$d_eofnblk'
24128 d_erf='$d_erf'
24129 d_erfc='$d_erfc'
24130 d_eunice='$d_eunice'
24131 d_exp2='$d_exp2'
24132 d_expm1='$d_expm1'
24133 d_faststdio='$d_faststdio'
24134 d_fchdir='$d_fchdir'
24135 d_fchmod='$d_fchmod'
24136 d_fchmodat='$d_fchmodat'
24137 d_fchown='$d_fchown'
24138 d_fcntl='$d_fcntl'
24139 d_fcntl_can_lock='$d_fcntl_can_lock'
24140 d_fd_macros='$d_fd_macros'
24141 d_fd_set='$d_fd_set'
24142 d_fdclose='$d_fdclose'
24143 d_fdim='$d_fdim'
24144 d_fds_bits='$d_fds_bits'
24145 d_fegetround='$d_fegetround'
24146 d_fgetpos='$d_fgetpos'
24147 d_finite='$d_finite'
24148 d_finitel='$d_finitel'
24149 d_flexfnam='$d_flexfnam'
24150 d_flock='$d_flock'
24151 d_flockproto='$d_flockproto'
24152 d_fma='$d_fma'
24153 d_fmax='$d_fmax'
24154 d_fmin='$d_fmin'
24155 d_fork='$d_fork'
24156 d_fp_class='$d_fp_class'
24157 d_fp_classify='$d_fp_classify'
24158 d_fp_classl='$d_fp_classl'
24159 d_fpathconf='$d_fpathconf'
24160 d_fpclass='$d_fpclass'
24161 d_fpclassify='$d_fpclassify'
24162 d_fpclassl='$d_fpclassl'
24163 d_fpgetround='$d_fpgetround'
24164 d_fpos64_t='$d_fpos64_t'
24165 d_freelocale='$d_freelocale'
24166 d_frexpl='$d_frexpl'
24167 d_fs_data_s='$d_fs_data_s'
24168 d_fseeko='$d_fseeko'
24169 d_fsetpos='$d_fsetpos'
24170 d_fstatfs='$d_fstatfs'
24171 d_fstatvfs='$d_fstatvfs'
24172 d_fsync='$d_fsync'
24173 d_ftello='$d_ftello'
24174 d_ftime='$d_ftime'
24175 d_futimes='$d_futimes'
24176 d_gai_strerror='$d_gai_strerror'
24177 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24178 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24179 d_getaddrinfo='$d_getaddrinfo'
24180 d_getcwd='$d_getcwd'
24181 d_getespwnam='$d_getespwnam'
24182 d_getfsstat='$d_getfsstat'
24183 d_getgrent='$d_getgrent'
24184 d_getgrent_r='$d_getgrent_r'
24185 d_getgrgid_r='$d_getgrgid_r'
24186 d_getgrnam_r='$d_getgrnam_r'
24187 d_getgrps='$d_getgrps'
24188 d_gethbyaddr='$d_gethbyaddr'
24189 d_gethbyname='$d_gethbyname'
24190 d_gethent='$d_gethent'
24191 d_gethname='$d_gethname'
24192 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24193 d_gethostbyname_r='$d_gethostbyname_r'
24194 d_gethostent_r='$d_gethostent_r'
24195 d_gethostprotos='$d_gethostprotos'
24196 d_getitimer='$d_getitimer'
24197 d_getlogin='$d_getlogin'
24198 d_getlogin_r='$d_getlogin_r'
24199 d_getmnt='$d_getmnt'
24200 d_getmntent='$d_getmntent'
24201 d_getnameinfo='$d_getnameinfo'
24202 d_getnbyaddr='$d_getnbyaddr'
24203 d_getnbyname='$d_getnbyname'
24204 d_getnent='$d_getnent'
24205 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24206 d_getnetbyname_r='$d_getnetbyname_r'
24207 d_getnetent_r='$d_getnetent_r'
24208 d_getnetprotos='$d_getnetprotos'
24209 d_getpagsz='$d_getpagsz'
24210 d_getpbyname='$d_getpbyname'
24211 d_getpbynumber='$d_getpbynumber'
24212 d_getpent='$d_getpent'
24213 d_getpgid='$d_getpgid'
24214 d_getpgrp2='$d_getpgrp2'
24215 d_getpgrp='$d_getpgrp'
24216 d_getppid='$d_getppid'
24217 d_getprior='$d_getprior'
24218 d_getprotobyname_r='$d_getprotobyname_r'
24219 d_getprotobynumber_r='$d_getprotobynumber_r'
24220 d_getprotoent_r='$d_getprotoent_r'
24221 d_getprotoprotos='$d_getprotoprotos'
24222 d_getprpwnam='$d_getprpwnam'
24223 d_getpwent='$d_getpwent'
24224 d_getpwent_r='$d_getpwent_r'
24225 d_getpwnam_r='$d_getpwnam_r'
24226 d_getpwuid_r='$d_getpwuid_r'
24227 d_getsbyname='$d_getsbyname'
24228 d_getsbyport='$d_getsbyport'
24229 d_getsent='$d_getsent'
24230 d_getservbyname_r='$d_getservbyname_r'
24231 d_getservbyport_r='$d_getservbyport_r'
24232 d_getservent_r='$d_getservent_r'
24233 d_getservprotos='$d_getservprotos'
24234 d_getspnam='$d_getspnam'
24235 d_getspnam_r='$d_getspnam_r'
24236 d_gettimeod='$d_gettimeod'
24237 d_gmtime64='$d_gmtime64'
24238 d_gmtime_r='$d_gmtime_r'
24239 d_gnulibc='$d_gnulibc'
24240 d_grpasswd='$d_grpasswd'
24241 d_has_C_UTF8='$d_has_C_UTF8'
24242 d_hasmntopt='$d_hasmntopt'
24243 d_htonl='$d_htonl'
24244 d_hypot='$d_hypot'
24245 d_ilogb='$d_ilogb'
24246 d_ilogbl='$d_ilogbl'
24247 d_inc_version_list='$d_inc_version_list'
24248 d_inetaton='$d_inetaton'
24249 d_inetntop='$d_inetntop'
24250 d_inetpton='$d_inetpton'
24251 d_int64_t='$d_int64_t'
24252 d_ip_mreq='$d_ip_mreq'
24253 d_ip_mreq_source='$d_ip_mreq_source'
24254 d_ipv6_mreq='$d_ipv6_mreq'
24255 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24256 d_isascii='$d_isascii'
24257 d_isblank='$d_isblank'
24258 d_isfinite='$d_isfinite'
24259 d_isfinitel='$d_isfinitel'
24260 d_isinf='$d_isinf'
24261 d_isinfl='$d_isinfl'
24262 d_isless='$d_isless'
24263 d_isnan='$d_isnan'
24264 d_isnanl='$d_isnanl'
24265 d_isnormal='$d_isnormal'
24266 d_j0='$d_j0'
24267 d_j0l='$d_j0l'
24268 d_killpg='$d_killpg'
24269 d_lc_monetary_2008='$d_lc_monetary_2008'
24270 d_lchown='$d_lchown'
24271 d_ldbl_dig='$d_ldbl_dig'
24272 d_ldexpl='$d_ldexpl'
24273 d_lgamma='$d_lgamma'
24274 d_lgamma_r='$d_lgamma_r'
24275 d_libm_lib_version='$d_libm_lib_version'
24276 d_libname_unique='$d_libname_unique'
24277 d_link='$d_link'
24278 d_linkat='$d_linkat'
24279 d_llrint='$d_llrint'
24280 d_llrintl='$d_llrintl'
24281 d_llround='$d_llround'
24282 d_llroundl='$d_llroundl'
24283 d_localeconv_l='$d_localeconv_l'
24284 d_localtime64='$d_localtime64'
24285 d_localtime_r='$d_localtime_r'
24286 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24287 d_locconv='$d_locconv'
24288 d_lockf='$d_lockf'
24289 d_log1p='$d_log1p'
24290 d_log2='$d_log2'
24291 d_logb='$d_logb'
24292 d_long_double_style_ieee='$d_long_double_style_ieee'
24293 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24294 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24295 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24296 d_long_double_style_vax='$d_long_double_style_vax'
24297 d_longdbl='$d_longdbl'
24298 d_longlong='$d_longlong'
24299 d_lrint='$d_lrint'
24300 d_lrintl='$d_lrintl'
24301 d_lround='$d_lround'
24302 d_lroundl='$d_lroundl'
24303 d_lseekproto='$d_lseekproto'
24304 d_lstat='$d_lstat'
24305 d_madvise='$d_madvise'
24306 d_malloc_good_size='$d_malloc_good_size'
24307 d_malloc_size='$d_malloc_size'
24308 d_malloc_usable_size='$d_malloc_usable_size'
24309 d_mblen='$d_mblen'
24310 d_mbrlen='$d_mbrlen'
24311 d_mbrtowc='$d_mbrtowc'
24312 d_mbstowcs='$d_mbstowcs'
24313 d_mbtowc='$d_mbtowc'
24314 d_memmem='$d_memmem'
24315 d_memrchr='$d_memrchr'
24316 d_mkdir='$d_mkdir'
24317 d_mkdtemp='$d_mkdtemp'
24318 d_mkfifo='$d_mkfifo'
24319 d_mkostemp='$d_mkostemp'
24320 d_mkstemp='$d_mkstemp'
24321 d_mkstemps='$d_mkstemps'
24322 d_mktime64='$d_mktime64'
24323 d_mktime='$d_mktime'
24324 d_mmap='$d_mmap'
24325 d_modfl='$d_modfl'
24326 d_modflproto='$d_modflproto'
24327 d_mprotect='$d_mprotect'
24328 d_msg='$d_msg'
24329 d_msg_ctrunc='$d_msg_ctrunc'
24330 d_msg_dontroute='$d_msg_dontroute'
24331 d_msg_oob='$d_msg_oob'
24332 d_msg_peek='$d_msg_peek'
24333 d_msg_proxy='$d_msg_proxy'
24334 d_msgctl='$d_msgctl'
24335 d_msgget='$d_msgget'
24336 d_msghdr_s='$d_msghdr_s'
24337 d_msgrcv='$d_msgrcv'
24338 d_msgsnd='$d_msgsnd'
24339 d_msync='$d_msync'
24340 d_munmap='$d_munmap'
24341 d_mymalloc='$d_mymalloc'
24342 d_nan='$d_nan'
24343 d_nanosleep='$d_nanosleep'
24344 d_ndbm='$d_ndbm'
24345 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24346 d_nearbyint='$d_nearbyint'
24347 d_newlocale='$d_newlocale'
24348 d_nextafter='$d_nextafter'
24349 d_nexttoward='$d_nexttoward'
24350 d_nice='$d_nice'
24351 d_nl_langinfo='$d_nl_langinfo'
24352 d_nv_preserves_uv='$d_nv_preserves_uv'
24353 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24354 d_off64_t='$d_off64_t'
24355 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24356 d_oldpthreads='$d_oldpthreads'
24357 d_oldsock='$d_oldsock'
24358 d_open3='$d_open3'
24359 d_openat='$d_openat'
24360 d_pathconf='$d_pathconf'
24361 d_pause='$d_pause'
24362 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24363 d_phostname='$d_phostname'
24364 d_pipe2='$d_pipe2'
24365 d_pipe='$d_pipe'
24366 d_poll='$d_poll'
24367 d_portable='$d_portable'
24368 d_prctl='$d_prctl'
24369 d_prctl_set_name='$d_prctl_set_name'
24370 d_printf_format_null='$d_printf_format_null'
24371 d_procselfexe='$d_procselfexe'
24372 d_pseudofork='$d_pseudofork'
24373 d_pthread_atfork='$d_pthread_atfork'
24374 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24375 d_pthread_yield='$d_pthread_yield'
24376 d_ptrdiff_t='$d_ptrdiff_t'
24377 d_pwage='$d_pwage'
24378 d_pwchange='$d_pwchange'
24379 d_pwclass='$d_pwclass'
24380 d_pwcomment='$d_pwcomment'
24381 d_pwexpire='$d_pwexpire'
24382 d_pwgecos='$d_pwgecos'
24383 d_pwpasswd='$d_pwpasswd'
24384 d_pwquota='$d_pwquota'
24385 d_qgcvt='$d_qgcvt'
24386 d_quad='$d_quad'
24387 d_querylocale='$d_querylocale'
24388 d_random_r='$d_random_r'
24389 d_re_comp='$d_re_comp'
24390 d_readdir64_r='$d_readdir64_r'
24391 d_readdir='$d_readdir'
24392 d_readdir_r='$d_readdir_r'
24393 d_readlink='$d_readlink'
24394 d_readv='$d_readv'
24395 d_recvmsg='$d_recvmsg'
24396 d_regcmp='$d_regcmp'
24397 d_regcomp='$d_regcomp'
24398 d_remainder='$d_remainder'
24399 d_remquo='$d_remquo'
24400 d_rename='$d_rename'
24401 d_renameat='$d_renameat'
24402 d_rewinddir='$d_rewinddir'
24403 d_rint='$d_rint'
24404 d_rmdir='$d_rmdir'
24405 d_round='$d_round'
24406 d_sbrkproto='$d_sbrkproto'
24407 d_scalbn='$d_scalbn'
24408 d_scalbnl='$d_scalbnl'
24409 d_sched_yield='$d_sched_yield'
24410 d_scm_rights='$d_scm_rights'
24411 d_seekdir='$d_seekdir'
24412 d_select='$d_select'
24413 d_sem='$d_sem'
24414 d_semctl='$d_semctl'
24415 d_semctl_semid_ds='$d_semctl_semid_ds'
24416 d_semctl_semun='$d_semctl_semun'
24417 d_semget='$d_semget'
24418 d_semop='$d_semop'
24419 d_sendmsg='$d_sendmsg'
24420 d_setegid='$d_setegid'
24421 d_seteuid='$d_seteuid'
24422 d_setgrent='$d_setgrent'
24423 d_setgrent_r='$d_setgrent_r'
24424 d_setgrps='$d_setgrps'
24425 d_sethent='$d_sethent'
24426 d_sethostent_r='$d_sethostent_r'
24427 d_setitimer='$d_setitimer'
24428 d_setlinebuf='$d_setlinebuf'
24429 d_setlocale='$d_setlocale'
24430 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24431 d_setlocale_r='$d_setlocale_r'
24432 d_setnent='$d_setnent'
24433 d_setnetent_r='$d_setnetent_r'
24434 d_setpent='$d_setpent'
24435 d_setpgid='$d_setpgid'
24436 d_setpgrp2='$d_setpgrp2'
24437 d_setpgrp='$d_setpgrp'
24438 d_setprior='$d_setprior'
24439 d_setproctitle='$d_setproctitle'
24440 d_setprotoent_r='$d_setprotoent_r'
24441 d_setpwent='$d_setpwent'
24442 d_setpwent_r='$d_setpwent_r'
24443 d_setregid='$d_setregid'
24444 d_setresgid='$d_setresgid'
24445 d_setresuid='$d_setresuid'
24446 d_setreuid='$d_setreuid'
24447 d_setrgid='$d_setrgid'
24448 d_setruid='$d_setruid'
24449 d_setsent='$d_setsent'
24450 d_setservent_r='$d_setservent_r'
24451 d_setsid='$d_setsid'
24452 d_setvbuf='$d_setvbuf'
24453 d_shm='$d_shm'
24454 d_shmat='$d_shmat'
24455 d_shmatprototype='$d_shmatprototype'
24456 d_shmctl='$d_shmctl'
24457 d_shmdt='$d_shmdt'
24458 d_shmget='$d_shmget'
24459 d_sigaction='$d_sigaction'
24460 d_siginfo_si_addr='$d_siginfo_si_addr'
24461 d_siginfo_si_band='$d_siginfo_si_band'
24462 d_siginfo_si_errno='$d_siginfo_si_errno'
24463 d_siginfo_si_fd='$d_siginfo_si_fd'
24464 d_siginfo_si_pid='$d_siginfo_si_pid'
24465 d_siginfo_si_status='$d_siginfo_si_status'
24466 d_siginfo_si_uid='$d_siginfo_si_uid'
24467 d_siginfo_si_value='$d_siginfo_si_value'
24468 d_signbit='$d_signbit'
24469 d_sigprocmask='$d_sigprocmask'
24470 d_sigsetjmp='$d_sigsetjmp'
24471 d_sin6_scope_id='$d_sin6_scope_id'
24472 d_sitearch='$d_sitearch'
24473 d_snprintf='$d_snprintf'
24474 d_sockaddr_in6='$d_sockaddr_in6'
24475 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24476 d_sockatmark='$d_sockatmark'
24477 d_sockatmarkproto='$d_sockatmarkproto'
24478 d_socket='$d_socket'
24479 d_socklen_t='$d_socklen_t'
24480 d_sockpair='$d_sockpair'
24481 d_socks5_init='$d_socks5_init'
24482 d_sqrtl='$d_sqrtl'
24483 d_srand48_r='$d_srand48_r'
24484 d_srandom_r='$d_srandom_r'
24485 d_sresgproto='$d_sresgproto'
24486 d_sresuproto='$d_sresuproto'
24487 d_stat='$d_stat'
24488 d_statblks='$d_statblks'
24489 d_statfs_f_flags='$d_statfs_f_flags'
24490 d_statfs_s='$d_statfs_s'
24491 d_static_inline='$d_static_inline'
24492 d_statvfs='$d_statvfs'
24493 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24494 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24495 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24496 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24497 d_stdio_stream_array='$d_stdio_stream_array'
24498 d_stdiobase='$d_stdiobase'
24499 d_stdstdio='$d_stdstdio'
24500 d_strcoll='$d_strcoll'
24501 d_strerror_l='$d_strerror_l'
24502 d_strerror_r='$d_strerror_r'
24503 d_strftime='$d_strftime'
24504 d_strlcat='$d_strlcat'
24505 d_strlcpy='$d_strlcpy'
24506 d_strnlen='$d_strnlen'
24507 d_strtod='$d_strtod'
24508 d_strtod_l='$d_strtod_l'
24509 d_strtol='$d_strtol'
24510 d_strtold='$d_strtold'
24511 d_strtold_l='$d_strtold_l'
24512 d_strtoll='$d_strtoll'
24513 d_strtoq='$d_strtoq'
24514 d_strtoul='$d_strtoul'
24515 d_strtoull='$d_strtoull'
24516 d_strtouq='$d_strtouq'
24517 d_strxfrm='$d_strxfrm'
24518 d_suidsafe='$d_suidsafe'
24519 d_symlink='$d_symlink'
24520 d_syscall='$d_syscall'
24521 d_syscallproto='$d_syscallproto'
24522 d_sysconf='$d_sysconf'
24523 d_sysernlst='$d_sysernlst'
24524 d_syserrlst='$d_syserrlst'
24525 d_system='$d_system'
24526 d_tcgetpgrp='$d_tcgetpgrp'
24527 d_tcsetpgrp='$d_tcsetpgrp'
24528 d_telldir='$d_telldir'
24529 d_telldirproto='$d_telldirproto'
24530 d_tgamma='$d_tgamma'
24531 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24532 d_time='$d_time'
24533 d_timegm='$d_timegm'
24534 d_times='$d_times'
24535 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24536 d_tm_tm_zone='$d_tm_tm_zone'
24537 d_tmpnam_r='$d_tmpnam_r'
24538 d_towlower='$d_towlower'
24539 d_towupper='$d_towupper'
24540 d_trunc='$d_trunc'
24541 d_truncate='$d_truncate'
24542 d_truncl='$d_truncl'
24543 d_ttyname_r='$d_ttyname_r'
24544 d_tzname='$d_tzname'
24545 d_u32align='$d_u32align'
24546 d_ualarm='$d_ualarm'
24547 d_umask='$d_umask'
24548 d_uname='$d_uname'
24549 d_union_semun='$d_union_semun'
24550 d_unlinkat='$d_unlinkat'
24551 d_unordered='$d_unordered'
24552 d_unsetenv='$d_unsetenv'
24553 d_uselocale='$d_uselocale'
24554 d_usleep='$d_usleep'
24555 d_usleepproto='$d_usleepproto'
24556 d_ustat='$d_ustat'
24557 d_vendorarch='$d_vendorarch'
24558 d_vendorbin='$d_vendorbin'
24559 d_vendorlib='$d_vendorlib'
24560 d_vendorscript='$d_vendorscript'
24561 d_vfork='$d_vfork'
24562 d_void_closedir='$d_void_closedir'
24563 d_voidsig='$d_voidsig'
24564 d_voidtty='$d_voidtty'
24565 d_vsnprintf='$d_vsnprintf'
24566 d_wait4='$d_wait4'
24567 d_waitpid='$d_waitpid'
24568 d_wcscmp='$d_wcscmp'
24569 d_wcstombs='$d_wcstombs'
24570 d_wcsxfrm='$d_wcsxfrm'
24571 d_wctomb='$d_wctomb'
24572 d_writev='$d_writev'
24573 d_xenix='$d_xenix'
24574 date='$date'
24575 db_hashtype='$db_hashtype'
24576 db_prefixtype='$db_prefixtype'
24577 db_version_major='$db_version_major'
24578 db_version_minor='$db_version_minor'
24579 db_version_patch='$db_version_patch'
24580 default_inc_excludes_dot='$default_inc_excludes_dot'
24581 direntrytype='$direntrytype'
24582 dlext='$dlext'
24583 dlsrc='$dlsrc'
24584 doubleinfbytes='$doubleinfbytes'
24585 doublekind='$doublekind'
24586 doublemantbits='$doublemantbits'
24587 doublenanbytes='$doublenanbytes'
24588 doublesize='$doublesize'
24589 drand01='$drand01'
24590 drand48_r_proto='$drand48_r_proto'
24591 dtrace='$dtrace'
24592 dtraceobject='$dtraceobject'
24593 dtracexnolibs='$dtracexnolibs'
24594 dynamic_ext='$dynamic_ext'
24595 eagain='$eagain'
24596 ebcdic='$ebcdic'
24597 echo='$echo'
24598 egrep='$egrep'
24599 emacs='$emacs'
24600 endgrent_r_proto='$endgrent_r_proto'
24601 endhostent_r_proto='$endhostent_r_proto'
24602 endnetent_r_proto='$endnetent_r_proto'
24603 endprotoent_r_proto='$endprotoent_r_proto'
24604 endpwent_r_proto='$endpwent_r_proto'
24605 endservent_r_proto='$endservent_r_proto'
24606 eunicefix='$eunicefix'
24607 exe_ext='$exe_ext'
24608 expr='$expr'
24609 extensions='$extensions'
24610 extern_C='$extern_C'
24611 extras='$extras'
24612 fflushNULL='$fflushNULL'
24613 fflushall='$fflushall'
24614 find='$find'
24615 firstmakefile='$firstmakefile'
24616 flex='$flex'
24617 fpossize='$fpossize'
24618 fpostype='$fpostype'
24619 freetype='$freetype'
24620 from='$from'
24621 full_ar='$full_ar'
24622 full_csh='$full_csh'
24623 full_sed='$full_sed'
24624 gccansipedantic='$gccansipedantic'
24625 gccosandvers='$gccosandvers'
24626 gccversion='$gccversion'
24627 getgrent_r_proto='$getgrent_r_proto'
24628 getgrgid_r_proto='$getgrgid_r_proto'
24629 getgrnam_r_proto='$getgrnam_r_proto'
24630 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24631 gethostbyname_r_proto='$gethostbyname_r_proto'
24632 gethostent_r_proto='$gethostent_r_proto'
24633 getlogin_r_proto='$getlogin_r_proto'
24634 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24635 getnetbyname_r_proto='$getnetbyname_r_proto'
24636 getnetent_r_proto='$getnetent_r_proto'
24637 getprotobyname_r_proto='$getprotobyname_r_proto'
24638 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24639 getprotoent_r_proto='$getprotoent_r_proto'
24640 getpwent_r_proto='$getpwent_r_proto'
24641 getpwnam_r_proto='$getpwnam_r_proto'
24642 getpwuid_r_proto='$getpwuid_r_proto'
24643 getservbyname_r_proto='$getservbyname_r_proto'
24644 getservbyport_r_proto='$getservbyport_r_proto'
24645 getservent_r_proto='$getservent_r_proto'
24646 getspnam_r_proto='$getspnam_r_proto'
24647 gidformat='$gidformat'
24648 gidsign='$gidsign'
24649 gidsize='$gidsize'
24650 gidtype='$gidtype'
24651 glibpth='$glibpth'
24652 gmake='$gmake'
24653 gmtime_r_proto='$gmtime_r_proto'
24654 gnulibc_version='$gnulibc_version'
24655 grep='$grep'
24656 groupcat='$groupcat'
24657 groupstype='$groupstype'
24658 gzip='$gzip'
24659 h_fcntl='$h_fcntl'
24660 h_sysfile='$h_sysfile'
24661 hint='$hint'
24662 hostcat='$hostcat'
24663 hostgenerate='$hostgenerate'
24664 hostosname='$hostosname'
24665 hostperl='$hostperl'
24666 html1dir='$html1dir'
24667 html1direxp='$html1direxp'
24668 html3dir='$html3dir'
24669 html3direxp='$html3direxp'
24670 i16size='$i16size'
24671 i16type='$i16type'
24672 i32size='$i32size'
24673 i32type='$i32type'
24674 i64size='$i64size'
24675 i64type='$i64type'
24676 i8size='$i8size'
24677 i8type='$i8type'
24678 i_arpainet='$i_arpainet'
24679 i_bfd='$i_bfd'
24680 i_bsdioctl='$i_bsdioctl'
24681 i_crypt='$i_crypt'
24682 i_db='$i_db'
24683 i_dbm='$i_dbm'
24684 i_dirent='$i_dirent'
24685 i_dlfcn='$i_dlfcn'
24686 i_execinfo='$i_execinfo'
24687 i_fcntl='$i_fcntl'
24688 i_fenv='$i_fenv'
24689 i_fp='$i_fp'
24690 i_fp_class='$i_fp_class'
24691 i_gdbm='$i_gdbm'
24692 i_gdbm_ndbm='$i_gdbm_ndbm'
24693 i_gdbmndbm='$i_gdbmndbm'
24694 i_grp='$i_grp'
24695 i_ieeefp='$i_ieeefp'
24696 i_inttypes='$i_inttypes'
24697 i_langinfo='$i_langinfo'
24698 i_libutil='$i_libutil'
24699 i_locale='$i_locale'
24700 i_machcthr='$i_machcthr'
24701 i_malloc='$i_malloc'
24702 i_mallocmalloc='$i_mallocmalloc'
24703 i_mntent='$i_mntent'
24704 i_ndbm='$i_ndbm'
24705 i_netdb='$i_netdb'
24706 i_neterrno='$i_neterrno'
24707 i_netinettcp='$i_netinettcp'
24708 i_niin='$i_niin'
24709 i_poll='$i_poll'
24710 i_prot='$i_prot'
24711 i_pthread='$i_pthread'
24712 i_pwd='$i_pwd'
24713 i_quadmath='$i_quadmath'
24714 i_rpcsvcdbm='$i_rpcsvcdbm'
24715 i_sgtty='$i_sgtty'
24716 i_shadow='$i_shadow'
24717 i_socks='$i_socks'
24718 i_stdbool='$i_stdbool'
24719 i_stdint='$i_stdint'
24720 i_stdlib='$i_stdlib'
24721 i_sunmath='$i_sunmath'
24722 i_sysaccess='$i_sysaccess'
24723 i_sysdir='$i_sysdir'
24724 i_sysfile='$i_sysfile'
24725 i_sysfilio='$i_sysfilio'
24726 i_sysin='$i_sysin'
24727 i_sysioctl='$i_sysioctl'
24728 i_syslog='$i_syslog'
24729 i_sysmman='$i_sysmman'
24730 i_sysmode='$i_sysmode'
24731 i_sysmount='$i_sysmount'
24732 i_sysndir='$i_sysndir'
24733 i_sysparam='$i_sysparam'
24734 i_syspoll='$i_syspoll'
24735 i_sysresrc='$i_sysresrc'
24736 i_syssecrt='$i_syssecrt'
24737 i_sysselct='$i_sysselct'
24738 i_syssockio='$i_syssockio'
24739 i_sysstat='$i_sysstat'
24740 i_sysstatfs='$i_sysstatfs'
24741 i_sysstatvfs='$i_sysstatvfs'
24742 i_systime='$i_systime'
24743 i_systimek='$i_systimek'
24744 i_systimes='$i_systimes'
24745 i_systypes='$i_systypes'
24746 i_sysuio='$i_sysuio'
24747 i_sysun='$i_sysun'
24748 i_sysutsname='$i_sysutsname'
24749 i_sysvfs='$i_sysvfs'
24750 i_syswait='$i_syswait'
24751 i_termio='$i_termio'
24752 i_termios='$i_termios'
24753 i_time='$i_time'
24754 i_unistd='$i_unistd'
24755 i_ustat='$i_ustat'
24756 i_utime='$i_utime'
24757 i_vfork='$i_vfork'
24758 i_wchar='$i_wchar'
24759 i_wctype='$i_wctype'
24760 i_xlocale='$i_xlocale'
24761 ignore_versioned_solibs='$ignore_versioned_solibs'
24762 inc_version_list='$inc_version_list'
24763 inc_version_list_init='$inc_version_list_init'
24764 incpath='$incpath'
24765 incpth='$incpth'
24766 inews='$inews'
24767 initialinstalllocation='$initialinstalllocation'
24768 installarchlib='$installarchlib'
24769 installbin='$installbin'
24770 installhtml1dir='$installhtml1dir'
24771 installhtml3dir='$installhtml3dir'
24772 installman1dir='$installman1dir'
24773 installman3dir='$installman3dir'
24774 installprefix='$installprefix'
24775 installprefixexp='$installprefixexp'
24776 installprivlib='$installprivlib'
24777 installscript='$installscript'
24778 installsitearch='$installsitearch'
24779 installsitebin='$installsitebin'
24780 installsitehtml1dir='$installsitehtml1dir'
24781 installsitehtml3dir='$installsitehtml3dir'
24782 installsitelib='$installsitelib'
24783 installsiteman1dir='$installsiteman1dir'
24784 installsiteman3dir='$installsiteman3dir'
24785 installsitescript='$installsitescript'
24786 installstyle='$installstyle'
24787 installusrbinperl='$installusrbinperl'
24788 installvendorarch='$installvendorarch'
24789 installvendorbin='$installvendorbin'
24790 installvendorhtml1dir='$installvendorhtml1dir'
24791 installvendorhtml3dir='$installvendorhtml3dir'
24792 installvendorlib='$installvendorlib'
24793 installvendorman1dir='$installvendorman1dir'
24794 installvendorman3dir='$installvendorman3dir'
24795 installvendorscript='$installvendorscript'
24796 intsize='$intsize'
24797 issymlink='$issymlink'
24798 ivdformat='$ivdformat'
24799 ivsize='$ivsize'
24800 ivtype='$ivtype'
24801 known_extensions='$known_extensions'
24802 ksh='$ksh'
24803 ld='$ld'
24804 ld_can_script='$ld_can_script'
24805 lddlflags='$lddlflags'
24806 ldflags='$ldflags'
24807 ldflags_uselargefiles='$ldflags_uselargefiles'
24808 ldlibpthname='$ldlibpthname'
24809 less='$less'
24810 lib_ext='$lib_ext'
24811 libc='$libc'
24812 libperl='$libperl'
24813 libpth='$libpth'
24814 libs='$libs'
24815 libsdirs='$libsdirs'
24816 libsfiles='$libsfiles'
24817 libsfound='$libsfound'
24818 libspath='$libspath'
24819 libswanted='$libswanted'
24820 libswanted_uselargefiles='$libswanted_uselargefiles'
24821 line='$line'
24822 lint='$lint'
24823 lkflags='$lkflags'
24824 ln='$ln'
24825 lns='$lns'
24826 localtime_r_proto='$localtime_r_proto'
24827 locincpth='$locincpth'
24828 loclibpth='$loclibpth'
24829 longdblinfbytes='$longdblinfbytes'
24830 longdblkind='$longdblkind'
24831 longdblmantbits='$longdblmantbits'
24832 longdblnanbytes='$longdblnanbytes'
24833 longdblsize='$longdblsize'
24834 longlongsize='$longlongsize'
24835 longsize='$longsize'
24836 lp='$lp'
24837 lpr='$lpr'
24838 ls='$ls'
24839 lseeksize='$lseeksize'
24840 lseektype='$lseektype'
24841 mail='$mail'
24842 mailx='$mailx'
24843 make='$make'
24844 make_set_make='$make_set_make'
24845 mallocobj='$mallocobj'
24846 mallocsrc='$mallocsrc'
24847 malloctype='$malloctype'
24848 man1dir='$man1dir'
24849 man1direxp='$man1direxp'
24850 man1ext='$man1ext'
24851 man3dir='$man3dir'
24852 man3direxp='$man3direxp'
24853 man3ext='$man3ext'
24854 mips_type='$mips_type'
24855 mistrustnm='$mistrustnm'
24856 mkdir='$mkdir'
24857 mmaptype='$mmaptype'
24858 modetype='$modetype'
24859 more='$more'
24860 multiarch='$multiarch'
24861 mv='$mv'
24862 myarchname='$myarchname'
24863 mydomain='$mydomain'
24864 myhostname='$myhostname'
24865 myuname='$myuname'
24866 n='$n'
24867 need_va_copy='$need_va_copy'
24868 netdb_hlen_type='$netdb_hlen_type'
24869 netdb_host_type='$netdb_host_type'
24870 netdb_name_type='$netdb_name_type'
24871 netdb_net_type='$netdb_net_type'
24872 nm='$nm'
24873 nm_opt='$nm_opt'
24874 nm_so_opt='$nm_so_opt'
24875 nonxs_ext='$nonxs_ext'
24876 nroff='$nroff'
24877 nvEUformat='$nvEUformat'
24878 nvFUformat='$nvFUformat'
24879 nvGUformat='$nvGUformat'
24880 nv_overflows_integers_at='$nv_overflows_integers_at'
24881 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24882 nveformat='$nveformat'
24883 nvfformat='$nvfformat'
24884 nvgformat='$nvgformat'
24885 nvmantbits='$nvmantbits'
24886 nvsize='$nvsize'
24887 nvtype='$nvtype'
24888 o_nonblock='$o_nonblock'
24889 obj_ext='$obj_ext'
24890 old_pthread_create_joinable='$old_pthread_create_joinable'
24891 optimize='$optimize'
24892 orderlib='$orderlib'
24893 osname='$osname'
24894 osvers='$osvers'
24895 otherlibdirs='$otherlibdirs'
24896 package='$package'
24897 pager='$pager'
24898 passcat='$passcat'
24899 patchlevel='$patchlevel'
24900 path_sep='$path_sep'
24901 perl5='$perl5'
24902 perl='$perl'
24903 perl_patchlevel='$perl_patchlevel'
24904 perl_static_inline='$perl_static_inline'
24905 perladmin='$perladmin'
24906 perllibs='$perllibs'
24907 perlpath='$perlpath'
24908 pg='$pg'
24909 phostname='$phostname'
24910 pidtype='$pidtype'
24911 plibpth='$plibpth'
24912 pmake='$pmake'
24913 pr='$pr'
24914 prefix='$prefix'
24915 prefixexp='$prefixexp'
24916 privlib='$privlib'
24917 privlibexp='$privlibexp'
24918 procselfexe='$procselfexe'
24919 ptrsize='$ptrsize'
24920 quadkind='$quadkind'
24921 quadtype='$quadtype'
24922 randbits='$randbits'
24923 randfunc='$randfunc'
24924 random_r_proto='$random_r_proto'
24925 randseedtype='$randseedtype'
24926 ranlib='$ranlib'
24927 rd_nodata='$rd_nodata'
24928 readdir64_r_proto='$readdir64_r_proto'
24929 readdir_r_proto='$readdir_r_proto'
24930 revision='$revision'
24931 rm='$rm'
24932 rm_try='$rm_try'
24933 rmail='$rmail'
24934 run='$run'
24935 runnm='$runnm'
24936 sGMTIME_max='$sGMTIME_max'
24937 sGMTIME_min='$sGMTIME_min'
24938 sLOCALTIME_max='$sLOCALTIME_max'
24939 sLOCALTIME_min='$sLOCALTIME_min'
24940 sPRIEUldbl='$sPRIEUldbl'
24941 sPRIFUldbl='$sPRIFUldbl'
24942 sPRIGUldbl='$sPRIGUldbl'
24943 sPRIXU64='$sPRIXU64'
24944 sPRId64='$sPRId64'
24945 sPRIeldbl='$sPRIeldbl'
24946 sPRIfldbl='$sPRIfldbl'
24947 sPRIgldbl='$sPRIgldbl'
24948 sPRIi64='$sPRIi64'
24949 sPRIo64='$sPRIo64'
24950 sPRIu64='$sPRIu64'
24951 sPRIx64='$sPRIx64'
24952 sSCNfldbl='$sSCNfldbl'
24953 sched_yield='$sched_yield'
24954 scriptdir='$scriptdir'
24955 scriptdirexp='$scriptdirexp'
24956 sed='$sed'
24957 seedfunc='$seedfunc'
24958 selectminbits='$selectminbits'
24959 selecttype='$selecttype'
24960 sendmail='$sendmail'
24961 setgrent_r_proto='$setgrent_r_proto'
24962 sethostent_r_proto='$sethostent_r_proto'
24963 setlocale_r_proto='$setlocale_r_proto'
24964 setnetent_r_proto='$setnetent_r_proto'
24965 setprotoent_r_proto='$setprotoent_r_proto'
24966 setpwent_r_proto='$setpwent_r_proto'
24967 setservent_r_proto='$setservent_r_proto'
24968 sh='$sh'
24969 shar='$shar'
24970 sharpbang='$sharpbang'
24971 shmattype='$shmattype'
24972 shortsize='$shortsize'
24973 shrpenv='$shrpenv'
24974 shsharp='$shsharp'
24975 sig_count='$sig_count'
24976 sig_name='$sig_name'
24977 sig_name_init='$sig_name_init'
24978 sig_num='$sig_num'
24979 sig_num_init='$sig_num_init'
24980 sig_size='$sig_size'
24981 signal_t='$signal_t'
24982 sitearch='$sitearch'
24983 sitearchexp='$sitearchexp'
24984 sitebin='$sitebin'
24985 sitebinexp='$sitebinexp'
24986 sitehtml1dir='$sitehtml1dir'
24987 sitehtml1direxp='$sitehtml1direxp'
24988 sitehtml3dir='$sitehtml3dir'
24989 sitehtml3direxp='$sitehtml3direxp'
24990 sitelib='$sitelib'
24991 sitelib_stem='$sitelib_stem'
24992 sitelibexp='$sitelibexp'
24993 siteman1dir='$siteman1dir'
24994 siteman1direxp='$siteman1direxp'
24995 siteman3dir='$siteman3dir'
24996 siteman3direxp='$siteman3direxp'
24997 siteprefix='$siteprefix'
24998 siteprefixexp='$siteprefixexp'
24999 sitescript='$sitescript'
25000 sitescriptexp='$sitescriptexp'
25001 sizesize='$sizesize'
25002 sizetype='$sizetype'
25003 sleep='$sleep'
25004 smail='$smail'
25005 so='$so'
25006 sockethdr='$sockethdr'
25007 socketlib='$socketlib'
25008 socksizetype='$socksizetype'
25009 sort='$sort'
25010 spackage='$spackage'
25011 spitshell='$spitshell'
25012 srand48_r_proto='$srand48_r_proto'
25013 srandom_r_proto='$srandom_r_proto'
25014 src='$src'
25015 ssizetype='$ssizetype'
25016 st_ino_sign='$st_ino_sign'
25017 st_ino_size='$st_ino_size'
25018 startperl='$startperl'
25019 startsh='$startsh'
25020 static_ext='$static_ext'
25021 stdchar='$stdchar'
25022 stdio_base='$stdio_base'
25023 stdio_bufsiz='$stdio_bufsiz'
25024 stdio_cnt='$stdio_cnt'
25025 stdio_filbuf='$stdio_filbuf'
25026 stdio_ptr='$stdio_ptr'
25027 stdio_stream_array='$stdio_stream_array'
25028 strerror_r_proto='$strerror_r_proto'
25029 submit='$submit'
25030 subversion='$subversion'
25031 sysman='$sysman'
25032 sysroot='$sysroot'
25033 tail='$tail'
25034 tar='$tar'
25035 targetarch='$targetarch'
25036 targetdir='$targetdir'
25037 targetenv='$targetenv'
25038 targethost='$targethost'
25039 targetmkdir='$targetmkdir'
25040 targetport='$targetport'
25041 targetsh='$targetsh'
25042 tbl='$tbl'
25043 tee='$tee'
25044 test='$test'
25045 timeincl='$timeincl'
25046 timetype='$timetype'
25047 tmpnam_r_proto='$tmpnam_r_proto'
25048 to='$to'
25049 touch='$touch'
25050 tr='$tr'
25051 trnl='$trnl'
25052 troff='$troff'
25053 ttyname_r_proto='$ttyname_r_proto'
25054 u16size='$u16size'
25055 u16type='$u16type'
25056 u32size='$u32size'
25057 u32type='$u32type'
25058 u64size='$u64size'
25059 u64type='$u64type'
25060 u8size='$u8size'
25061 u8type='$u8type'
25062 uidformat='$uidformat'
25063 uidsign='$uidsign'
25064 uidsize='$uidsize'
25065 uidtype='$uidtype'
25066 uname='$uname'
25067 uniq='$uniq'
25068 uquadtype='$uquadtype'
25069 use5005threads='$use5005threads'
25070 use64bitall='$use64bitall'
25071 use64bitint='$use64bitint'
25072 usecbacktrace='$usecbacktrace'
25073 usecrosscompile='$usecrosscompile'
25074 usedevel='$usedevel'
25075 usedl='$usedl'
25076 usedtrace='$usedtrace'
25077 usefaststdio='$usefaststdio'
25078 useithreads='$useithreads'
25079 usekernprocpathname='$usekernprocpathname'
25080 uselanginfo='$uselanginfo'
25081 uselargefiles='$uselargefiles'
25082 uselongdouble='$uselongdouble'
25083 usemallocwrap='$usemallocwrap'
25084 usemorebits='$usemorebits'
25085 usemultiplicity='$usemultiplicity'
25086 usemymalloc='$usemymalloc'
25087 usenm='$usenm'
25088 usensgetexecutablepath='$usensgetexecutablepath'
25089 useopcode='$useopcode'
25090 useperlio='$useperlio'
25091 useposix='$useposix'
25092 usequadmath='$usequadmath'
25093 usereentrant='$usereentrant'
25094 userelocatableinc='$userelocatableinc'
25095 useshrplib='$useshrplib'
25096 usesitecustomize='$usesitecustomize'
25097 usesocks='$usesocks'
25098 usethreads='$usethreads'
25099 usevendorprefix='$usevendorprefix'
25100 useversionedarchname='$useversionedarchname'
25101 usevfork='$usevfork'
25102 usrinc='$usrinc'
25103 uuname='$uuname'
25104 uvXUformat='$uvXUformat'
25105 uvoformat='$uvoformat'
25106 uvsize='$uvsize'
25107 uvtype='$uvtype'
25108 uvuformat='$uvuformat'
25109 uvxformat='$uvxformat'
25110 vendorarch='$vendorarch'
25111 vendorarchexp='$vendorarchexp'
25112 vendorbin='$vendorbin'
25113 vendorbinexp='$vendorbinexp'
25114 vendorhtml1dir='$vendorhtml1dir'
25115 vendorhtml1direxp='$vendorhtml1direxp'
25116 vendorhtml3dir='$vendorhtml3dir'
25117 vendorhtml3direxp='$vendorhtml3direxp'
25118 vendorlib='$vendorlib'
25119 vendorlib_stem='$vendorlib_stem'
25120 vendorlibexp='$vendorlibexp'
25121 vendorman1dir='$vendorman1dir'
25122 vendorman1direxp='$vendorman1direxp'
25123 vendorman3dir='$vendorman3dir'
25124 vendorman3direxp='$vendorman3direxp'
25125 vendorprefix='$vendorprefix'
25126 vendorprefixexp='$vendorprefixexp'
25127 vendorscript='$vendorscript'
25128 vendorscriptexp='$vendorscriptexp'
25129 version='$version'
25130 version_patchlevel_string='$version_patchlevel_string'
25131 versiononly='$versiononly'
25132 vi='$vi'
25133 xlibpth='$xlibpth'
25134 yacc='$yacc'
25135 yaccflags='$yaccflags'
25136 zcat='$zcat'
25137 zip='$zip'
25138 EOT
25139
25140 : add special variables
25141 $test -f $src/patchlevel.h && \
25142 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25143 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25144 echo "PERL_CONFIG_SH=true" >>config.sh
25145
25146 : propagate old symbols
25147 if $test -f UU/config.sh; then
25148         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25149         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25150                 config.sh config.sh UU/oldconfig.sh |\
25151                 $sort | $uniq -u >UU/oldsyms
25152         set X `$cat UU/oldsyms`
25153         shift
25154         case $# in
25155         0) ;;
25156         *)
25157                 $cat <<EOM
25158 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25159 EOM
25160                 echo ": Variables propagated from previous config.sh file." >>config.sh
25161                 for sym in `$cat UU/oldsyms`; do
25162                         echo "    Propagating $hint variable "'$'"$sym..."
25163                         eval 'tmp="$'"${sym}"'"'
25164                         echo "$tmp" | \
25165                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25166                 done
25167                 ;;
25168         esac
25169 fi
25170
25171 : preserve RCS keywords in files with variable substitution, grrr
25172 Id='$Id'
25173
25174 : Finish up by extracting the .SH files
25175 case "$alldone" in
25176 exit)
25177         echo "Stopping at your request, leaving temporary files around."
25178         exit 0
25179         ;;
25180 cont)
25181         ;;
25182 '')
25183         dflt=''
25184         nostick=true
25185         $cat <<EOM
25186
25187 If you'd like to make any changes to the config.sh file before I begin
25188 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25189
25190 EOM
25191         rp="Press return or use a shell escape to edit config.sh:"
25192         . UU/myread
25193         nostick=''
25194         case "$ans" in
25195         '') ;;
25196         *) : in case they cannot read
25197                 sh 1>&4 -c "$ans";;
25198         esac
25199         ;;
25200 esac
25201
25202 : if this fails, just run all the .SH files by hand
25203 . ./config.sh
25204
25205 echo " "
25206 exec 1>&4
25207 pwd=`pwd`
25208 . ./UU/extract
25209 cd "$pwd"
25210
25211 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25212         dflt=y
25213         case "$silent" in
25214         true) ;;
25215         *)
25216                 $cat <<EOM
25217
25218 Now you need to generate make dependencies by running "$make depend".
25219 You might prefer to run it in background: "$make depend > makedepend.out &"
25220 It can take a while, so you might not want to run it right now.
25221
25222 EOM
25223                 ;;
25224         esac
25225         rp="Run $make depend now?"
25226         . UU/myread
25227         case "$ans" in
25228         y*)
25229                 $make depend && echo "Now you must run '$make'."
25230                 ;;
25231         *)
25232                 echo "You must run '$make depend' then '$make'."
25233                 ;;
25234         esac
25235 elif test -f [Mm]akefile; then
25236         echo " "
25237         echo "Now you must run a $make."
25238 else
25239         echo "Configure done."
25240 fi
25241
25242 if $test -f Policy.sh; then
25243     $cat <<EOM
25244
25245 If you compile $package on a different machine or from a different object
25246 directory, copy the Policy.sh file from this object directory to the
25247 new one before you run Configure -- this will help you with most of
25248 the policy defaults.
25249
25250 EOM
25251 fi
25252 if $test -f UU/config.msg; then
25253     echo "Hmm.  I also noted the following information while running:"
25254     echo " "
25255     $cat UU/config.msg >&4
25256 fi
25257 $rm -f kit*isdone ark*isdone
25258 $rm -rf UU
25259
25260 : End of Configure
25261