This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Small fixup to explain conference names
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # with additional metaconfig patches from https://github.com/Perl/metaconfig
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 uselanginfo=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_accept4=''
376 d_access=''
377 d_accessx=''
378 d_acosh=''
379 d_aintl=''
380 d_alarm=''
381 asctime_r_proto=''
382 d_asctime_r=''
383 d_asinh=''
384 d_atanh=''
385 d_attribute_always_inline=''
386 d_attribute_deprecated=''
387 d_attribute_format=''
388 d_attribute_malloc=''
389 d_attribute_nonnull=''
390 d_attribute_noreturn=''
391 d_attribute_pure=''
392 d_attribute_unused=''
393 d_attribute_warn_unused_result=''
394 d_printf_format_null=''
395 d_backtrace=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_builtin_add_overflow=''
399 d_builtin_mul_overflow=''
400 d_builtin_sub_overflow=''
401 d_c99_variadic_macros=''
402 d_casti32=''
403 castflags=''
404 d_castneg=''
405 d_cbrt=''
406 d_chown=''
407 d_chroot=''
408 d_chsize=''
409 d_class=''
410 d_clearenv=''
411 d_closedir=''
412 d_void_closedir=''
413 d_cmsghdr_s=''
414 d_copysign=''
415 d_copysignl=''
416 d_cplusplus=''
417 cryptlib=''
418 d_crypt=''
419 crypt_r_proto=''
420 d_crypt_r=''
421 d_csh=''
422 full_csh=''
423 d_ctermid=''
424 ctermid_r_proto=''
425 d_ctermid_r=''
426 ctime_r_proto=''
427 d_ctime_r=''
428 d_cuserid=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_dup3=''
444 d_eaccess=''
445 d_endgrent=''
446 d_endgrent_r=''
447 endgrent_r_proto=''
448 d_endhent=''
449 d_endhostent_r=''
450 endhostent_r_proto=''
451 d_endnent=''
452 d_endnetent_r=''
453 endnetent_r_proto=''
454 d_endpent=''
455 d_endprotoent_r=''
456 endprotoent_r_proto=''
457 d_endpwent=''
458 d_endpwent_r=''
459 endpwent_r_proto=''
460 d_endsent=''
461 d_endservent_r=''
462 endservent_r_proto=''
463 d_erf=''
464 d_erfc=''
465 d_exp2=''
466 d_expm1=''
467 d_faststdio=''
468 d_fchdir=''
469 d_fchmod=''
470 d_fchown=''
471 d_fcntl=''
472 d_fcntl_can_lock=''
473 d_fd_macros=''
474 d_fd_set=''
475 d_fds_bits=''
476 d_fdclose=''
477 d_fdim=''
478 d_fegetround=''
479 d_fgetpos=''
480 d_finite=''
481 d_finitel=''
482 d_flexfnam=''
483 d_flock=''
484 d_flockproto=''
485 d_fma=''
486 d_fmax=''
487 d_fmin=''
488 d_fork=''
489 d_fp_class=''
490 d_fp_classl=''
491 d_fpclass=''
492 d_fp_classify=''
493 d_fpclassify=''
494 d_fpclassl=''
495 d_fpgetround=''
496 d_fpos64_t=''
497 d_frexpl=''
498 d_fs_data_s=''
499 d_fchmodat=''
500 d_linkat=''
501 d_openat=''
502 d_renameat=''
503 d_unlinkat=''
504 d_fseeko=''
505 d_fsetpos=''
506 d_fstatfs=''
507 d_fsync=''
508 d_ftello=''
509 d_ftime=''
510 d_gettimeod=''
511 d_futimes=''
512 d_gai_strerror=''
513 d_Gconvert=''
514 d_getaddrinfo=''
515 d_getcwd=''
516 d_getespwnam=''
517 d_getfsstat=''
518 d_getgrent=''
519 d_getgrent_r=''
520 getgrent_r_proto=''
521 d_getgrgid_r=''
522 getgrgid_r_proto=''
523 d_getgrnam_r=''
524 getgrnam_r_proto=''
525 d_getgrps=''
526 d_gethbyaddr=''
527 d_gethbyname=''
528 d_gethent=''
529 aphostname=''
530 d_gethname=''
531 d_phostname=''
532 d_uname=''
533 d_gethostbyaddr_r=''
534 gethostbyaddr_r_proto=''
535 d_gethostbyname_r=''
536 gethostbyname_r_proto=''
537 d_gethostent_r=''
538 gethostent_r_proto=''
539 d_gethostprotos=''
540 d_getitimer=''
541 d_getlogin=''
542 d_getlogin_r=''
543 getlogin_r_proto=''
544 d_getmnt=''
545 d_getmntent=''
546 d_getnameinfo=''
547 d_getnbyaddr=''
548 d_getnbyname=''
549 d_getnent=''
550 d_getnetbyaddr_r=''
551 getnetbyaddr_r_proto=''
552 d_getnetbyname_r=''
553 getnetbyname_r_proto=''
554 d_getnetent_r=''
555 getnetent_r_proto=''
556 d_getnetprotos=''
557 d_getpagsz=''
558 d_getpent=''
559 d_getpgid=''
560 d_getpgrp2=''
561 d_bsdgetpgrp=''
562 d_getpgrp=''
563 d_getppid=''
564 d_getprior=''
565 d_getpbyname=''
566 d_getpbynumber=''
567 d_getprotobyname_r=''
568 getprotobyname_r_proto=''
569 d_getprotobynumber_r=''
570 getprotobynumber_r_proto=''
571 d_getprotoent_r=''
572 getprotoent_r_proto=''
573 d_getprotoprotos=''
574 d_getprpwnam=''
575 d_getpwent=''
576 d_getpwent_r=''
577 getpwent_r_proto=''
578 d_getpwnam_r=''
579 getpwnam_r_proto=''
580 d_getpwuid_r=''
581 getpwuid_r_proto=''
582 d_getsent=''
583 d_getservbyname_r=''
584 getservbyname_r_proto=''
585 d_getservbyport_r=''
586 getservbyport_r_proto=''
587 d_getservent_r=''
588 getservent_r_proto=''
589 d_getservprotos=''
590 d_getspnam=''
591 d_getspnam_r=''
592 getspnam_r_proto=''
593 d_getsbyname=''
594 d_getsbyport=''
595 d_gmtime_r=''
596 gmtime_r_proto=''
597 d_gnulibc=''
598 gnulibc_version=''
599 d_hasmntopt=''
600 d_htonl=''
601 d_hypot=''
602 d_ilogb=''
603 d_ilogbl=''
604 d_inetaton=''
605 d_inetntop=''
606 d_inetpton=''
607 d_int64_t=''
608 d_isascii=''
609 d_isblank=''
610 d_isfinite=''
611 d_isfinitel=''
612 d_isinf=''
613 d_isinfl=''
614 d_isless=''
615 d_isnan=''
616 d_isnanl=''
617 d_isnormal=''
618 d_j0=''
619 d_j0l=''
620 d_killpg=''
621 d_lc_monetary_2008=''
622 d_lchown=''
623 d_ldbl_dig=''
624 d_lgamma=''
625 d_lgamma_r=''
626 d_libm_lib_version=''
627 d_link=''
628 d_llrint=''
629 d_llrintl=''
630 d_llround=''
631 d_llroundl=''
632 d_localeconv_l=''
633 d_localtime_r=''
634 d_localtime_r_needs_tzset=''
635 localtime_r_proto=''
636 d_locconv=''
637 d_lockf=''
638 d_log1p=''
639 d_log2=''
640 d_logb=''
641 d_ldexpl=''
642 d_long_double_style_ieee=''
643 d_long_double_style_ieee_doubledouble=''
644 d_long_double_style_ieee_extended=''
645 d_long_double_style_ieee_std=''
646 d_long_double_style_vax=''
647 d_longdbl=''
648 longdblkind=''
649 longdblsize=''
650 d_longlong=''
651 longlongsize=''
652 d_lrint=''
653 d_lrintl=''
654 d_lround=''
655 d_lroundl=''
656 d_lseekproto=''
657 d_lstat=''
658 d_madvise=''
659 d_malloc_good_size=''
660 d_malloc_size=''
661 d_malloc_usable_size=''
662 d_mblen=''
663 d_mbrlen=''
664 d_mbrtowc=''
665 d_mbstowcs=''
666 d_mbtowc=''
667 d_memmem=''
668 d_memrchr=''
669 d_mkdir=''
670 d_mkdtemp=''
671 d_mkfifo=''
672 d_mkostemp=''
673 d_mkstemp=''
674 d_mkstemps=''
675 d_mktime=''
676 d_mmap=''
677 mmaptype=''
678 d_modfl=''
679 d_modflproto=''
680 d_mprotect=''
681 d_msg=''
682 d_msgctl=''
683 d_msgget=''
684 d_msghdr_s=''
685 d_msgrcv=''
686 d_msgsnd=''
687 d_msync=''
688 d_munmap=''
689 d_nan=''
690 d_nanosleep=''
691 d_nearbyint=''
692 d_duplocale=''
693 d_freelocale=''
694 d_newlocale=''
695 d_querylocale=''
696 d_uselocale=''
697 i_xlocale=''
698 d_nextafter=''
699 d_nexttoward=''
700 d_nice=''
701 d_nl_langinfo=''
702 d_thread_safe_nl_langinfo_l=''
703 d_off64_t=''
704 d_open3=''
705 d_fpathconf=''
706 d_pathconf=''
707 d_pause=''
708 d_pipe2=''
709 d_pipe=''
710 d_poll=''
711 d_portable=''
712 d_prctl=''
713 d_prctl_set_name=''
714 d_procselfexe=''
715 procselfexe=''
716 d_old_pthread_create_joinable=''
717 old_pthread_create_joinable=''
718 d_pthread_atfork=''
719 d_pthread_attr_setscope=''
720 d_pthread_yield=''
721 d_sched_yield=''
722 sched_yield=''
723 d_ptrdiff_t=''
724 d_qgcvt=''
725 d_random_r=''
726 random_r_proto=''
727 d_readdir64_r=''
728 readdir64_r_proto=''
729 d_readdir=''
730 d_rewinddir=''
731 d_seekdir=''
732 d_telldir=''
733 d_readdir_r=''
734 readdir_r_proto=''
735 d_readlink=''
736 d_readv=''
737 d_recvmsg=''
738 d_re_comp=''
739 d_regcmp=''
740 d_regcomp=''
741 d_remainder=''
742 d_remquo=''
743 d_rename=''
744 d_rint=''
745 d_rmdir=''
746 d_round=''
747 d_sbrkproto=''
748 d_scalbn=''
749 d_scalbnl=''
750 d_select=''
751 d_sem=''
752 d_semctl=''
753 d_semget=''
754 d_semop=''
755 d_sendmsg=''
756 d_setegid=''
757 d_seteuid=''
758 d_setgrent=''
759 d_setgrent_r=''
760 setgrent_r_proto=''
761 d_setgrps=''
762 d_sethent=''
763 d_sethostent_r=''
764 sethostent_r_proto=''
765 d_setitimer=''
766 d_setlinebuf=''
767 d_has_C_UTF8=''
768 d_setlocale=''
769 d_setlocale_accepts_any_locale_name=''
770 d_setlocale_r=''
771 setlocale_r_proto=''
772 d_setnent=''
773 d_setnetent_r=''
774 setnetent_r_proto=''
775 d_setpent=''
776 d_setpgid=''
777 d_setpgrp2=''
778 d_bsdsetpgrp=''
779 d_setpgrp=''
780 d_setprior=''
781 d_setproctitle=''
782 d_setprotoent_r=''
783 setprotoent_r_proto=''
784 d_setpwent=''
785 d_setpwent_r=''
786 setpwent_r_proto=''
787 d_setregid=''
788 d_setresgid=''
789 d_setresuid=''
790 d_setreuid=''
791 d_setrgid=''
792 d_setruid=''
793 d_setsent=''
794 d_setservent_r=''
795 setservent_r_proto=''
796 d_setsid=''
797 d_setvbuf=''
798 d_shm=''
799 d_shmat=''
800 d_shmatprototype=''
801 shmattype=''
802 d_shmctl=''
803 d_shmdt=''
804 d_shmget=''
805 d_sigaction=''
806 d_siginfo_si_addr=''
807 d_siginfo_si_band=''
808 d_siginfo_si_errno=''
809 d_siginfo_si_fd=''
810 d_siginfo_si_pid=''
811 d_siginfo_si_status=''
812 d_siginfo_si_uid=''
813 d_siginfo_si_value=''
814 d_signbit=''
815 d_sigprocmask=''
816 d_sigsetjmp=''
817 usesitecustomize=''
818 d_snprintf=''
819 d_vsnprintf=''
820 d_sockatmark=''
821 d_sockatmarkproto=''
822 d_ip_mreq=''
823 d_ip_mreq_source=''
824 d_ipv6_mreq=''
825 d_ipv6_mreq_source=''
826 d_msg_ctrunc=''
827 d_msg_dontroute=''
828 d_msg_oob=''
829 d_msg_peek=''
830 d_msg_proxy=''
831 d_oldsock=''
832 d_scm_rights=''
833 d_sin6_scope_id=''
834 d_sockaddr_in6=''
835 d_sockaddr_sa_len=''
836 d_sockaddr_storage=''
837 d_socket=''
838 d_sockpair=''
839 sockethdr=''
840 socketlib=''
841 d_socklen_t=''
842 d_socks5_init=''
843 d_sqrtl=''
844 d_srand48_r=''
845 srand48_r_proto=''
846 d_srandom_r=''
847 srandom_r_proto=''
848 d_sresgproto=''
849 d_sresuproto=''
850 d_stat=''
851 d_statblks=''
852 d_statfs_f_flags=''
853 d_statfs_s=''
854 d_static_inline=''
855 perl_static_inline=''
856 d_fstatvfs=''
857 d_statvfs=''
858 d_stdio_cnt_lval=''
859 d_stdio_ptr_lval=''
860 d_stdio_ptr_lval_nochange_cnt=''
861 d_stdio_ptr_lval_sets_cnt=''
862 d_stdiobase=''
863 d_stdstdio=''
864 stdio_base=''
865 stdio_bufsiz=''
866 stdio_cnt=''
867 stdio_filbuf=''
868 stdio_ptr=''
869 d_strcoll=''
870 d_sysernlst=''
871 d_syserrlst=''
872 d_strerror_l=''
873 d_strerror_r=''
874 strerror_r_proto=''
875 d_strftime=''
876 d_strlcat=''
877 d_strlcpy=''
878 d_strnlen=''
879 d_strtod=''
880 d_strtod_l=''
881 d_strtol=''
882 d_strtold=''
883 d_strtold_l=''
884 d_strtoll=''
885 d_strtoq=''
886 d_strtoul=''
887 d_strtoull=''
888 d_strtouq=''
889 d_strxfrm=''
890 d_symlink=''
891 d_syscall=''
892 d_syscallproto=''
893 d_sysconf=''
894 d_system=''
895 d_tcgetpgrp=''
896 d_tcsetpgrp=''
897 d_telldirproto=''
898 d_tgamma=''
899 d_time=''
900 timetype=''
901 d_asctime64=''
902 d_ctime64=''
903 d_difftime64=''
904 d_gmtime64=''
905 d_localtime64=''
906 d_mktime64=''
907 d_timegm=''
908 clocktype=''
909 d_times=''
910 d_tmpnam_r=''
911 tmpnam_r_proto=''
912 d_towlower=''
913 d_towupper=''
914 d_trunc=''
915 d_truncate=''
916 d_truncl=''
917 d_ttyname_r=''
918 ttyname_r_proto=''
919 d_tzname=''
920 d_u32align=''
921 d_ualarm=''
922 d_umask=''
923 d_semctl_semid_ds=''
924 d_semctl_semun=''
925 d_union_semun=''
926 d_unordered=''
927 d_unsetenv=''
928 d_usleep=''
929 d_usleepproto=''
930 d_ustat=''
931 d_pseudofork=''
932 d_vfork=''
933 usevfork=''
934 d_voidsig=''
935 signal_t=''
936 d_wait4=''
937 d_waitpid=''
938 d_wcrtomb=''
939 d_wcscmp=''
940 d_wcstombs=''
941 d_wcsxfrm=''
942 d_wctomb=''
943 d_writev=''
944 default_inc_excludes_dot=''
945 dlext=''
946 bin_ELF=''
947 cccdlflags=''
948 ccdlflags=''
949 dlsrc=''
950 ld=''
951 ld_can_script=''
952 lddlflags=''
953 usedl=''
954 doublesize=''
955 dtraceobject=''
956 dtracexnolibs=''
957 ebcdic=''
958 fflushNULL=''
959 fflushall=''
960 fpossize=''
961 fpostype=''
962 gccansipedantic=''
963 gccosandvers=''
964 gccversion=''
965 gidformat=''
966 gidsign=''
967 gidsize=''
968 gidtype=''
969 groupstype=''
970 h_fcntl=''
971 h_sysfile=''
972 html1dir=''
973 html1direxp=''
974 installhtml1dir=''
975 html3dir=''
976 html3direxp=''
977 installhtml3dir=''
978 i_arpainet=''
979 i_bfd=''
980 i_crypt=''
981 db_hashtype=''
982 db_prefixtype=''
983 db_version_major=''
984 db_version_minor=''
985 db_version_patch=''
986 i_db=''
987 i_dbm=''
988 i_rpcsvcdbm=''
989 d_dirnamlen=''
990 direntrytype=''
991 i_dirent=''
992 i_dlfcn=''
993 i_execinfo=''
994 i_fcntl=''
995 i_fenv=''
996 i_fp=''
997 i_fp_class=''
998 i_gdbm=''
999 d_grpasswd=''
1000 i_grp=''
1001 i_ieeefp=''
1002 i_inttypes=''
1003 i_langinfo=''
1004 i_libutil=''
1005 i_locale=''
1006 i_machcthr=''
1007 i_malloc=''
1008 i_mallocmalloc=''
1009 i_mntent=''
1010 d_gdbm_ndbm_h_uses_prototypes=''
1011 d_gdbmndbm_h_uses_prototypes=''
1012 d_ndbm=''
1013 d_ndbm_h_uses_prototypes=''
1014 i_gdbm_ndbm=''
1015 i_gdbmndbm=''
1016 i_ndbm=''
1017 i_netdb=''
1018 i_neterrno=''
1019 i_netinettcp=''
1020 i_niin=''
1021 i_sysin=''
1022 i_poll=''
1023 i_prot=''
1024 i_pthread=''
1025 d_pwage=''
1026 d_pwchange=''
1027 d_pwclass=''
1028 d_pwcomment=''
1029 d_pwexpire=''
1030 d_pwgecos=''
1031 d_pwpasswd=''
1032 d_pwquota=''
1033 i_pwd=''
1034 i_quadmath=''
1035 i_shadow=''
1036 i_socks=''
1037 i_stdbool=''
1038 i_stdint=''
1039 i_stdlib=''
1040 i_sunmath=''
1041 i_sysaccess=''
1042 i_sysdir=''
1043 i_sysfile=''
1044 d_voidtty=''
1045 i_bsdioctl=''
1046 i_sysfilio=''
1047 i_sysioctl=''
1048 i_syssockio=''
1049 i_syslog=''
1050 i_sysmman=''
1051 i_sysmode=''
1052 i_sysmount=''
1053 i_sysndir=''
1054 i_sysparam=''
1055 i_syspoll=''
1056 i_sysresrc=''
1057 i_syssecrt=''
1058 i_sysselct=''
1059 i_sysstat=''
1060 i_sysstatfs=''
1061 i_sysstatvfs=''
1062 i_systimes=''
1063 i_systypes=''
1064 i_sysuio=''
1065 i_sysun=''
1066 i_sysutsname=''
1067 i_sysvfs=''
1068 i_syswait=''
1069 i_sgtty=''
1070 i_termio=''
1071 i_termios=''
1072 d_tm_tm_gmtoff=''
1073 d_tm_tm_zone=''
1074 i_systime=''
1075 i_systimek=''
1076 i_time=''
1077 timeincl=''
1078 i_unistd=''
1079 i_ustat=''
1080 i_utime=''
1081 i_vfork=''
1082 i_wchar=''
1083 i_wctype=''
1084 d_inc_version_list=''
1085 inc_version_list=''
1086 inc_version_list_init=''
1087 doubleinfbytes=''
1088 doublenanbytes=''
1089 longdblinfbytes=''
1090 longdblnanbytes=''
1091 installprefix=''
1092 installprefixexp=''
1093 installstyle=''
1094 installusrbinperl=''
1095 intsize=''
1096 longsize=''
1097 shortsize=''
1098 issymlink=''
1099 libc=''
1100 ldlibpthname=''
1101 libperl=''
1102 shrpenv=''
1103 useshrplib=''
1104 glibpth=''
1105 incpth=''
1106 libpth=''
1107 loclibpth=''
1108 plibpth=''
1109 xlibpth=''
1110 ignore_versioned_solibs=''
1111 libs=''
1112 libsdirs=''
1113 libsfiles=''
1114 libsfound=''
1115 libspath=''
1116 lns=''
1117 d_PRIEUldbl=''
1118 d_PRIFUldbl=''
1119 d_PRIGUldbl=''
1120 d_PRIeldbl=''
1121 d_PRIfldbl=''
1122 d_PRIgldbl=''
1123 d_SCNfldbl=''
1124 d_double_has_inf=''
1125 d_double_has_nan=''
1126 d_double_has_negative_zero=''
1127 d_double_has_subnormals=''
1128 d_double_style_cray=''
1129 d_double_style_ibm=''
1130 d_double_style_ieee=''
1131 d_double_style_vax=''
1132 doublekind=''
1133 sPRIEUldbl=''
1134 sPRIFUldbl=''
1135 sPRIGUldbl=''
1136 sPRIeldbl=''
1137 sPRIfldbl=''
1138 sPRIgldbl=''
1139 sSCNfldbl=''
1140 lseeksize=''
1141 lseektype=''
1142 make_set_make=''
1143 d_mymalloc=''
1144 freetype=''
1145 mallocobj=''
1146 mallocsrc=''
1147 malloctype=''
1148 usemallocwrap=''
1149 usemymalloc=''
1150 installman1dir=''
1151 man1dir=''
1152 man1direxp=''
1153 man1ext=''
1154 installman3dir=''
1155 man3dir=''
1156 man3direxp=''
1157 man3ext=''
1158 doublemantbits=''
1159 longdblmantbits=''
1160 nvmantbits=''
1161 modetype=''
1162 multiarch=''
1163 mydomain=''
1164 myhostname=''
1165 phostname=''
1166 c=''
1167 n=''
1168 d_eofnblk=''
1169 eagain=''
1170 o_nonblock=''
1171 rd_nodata=''
1172 need_va_copy=''
1173 netdb_hlen_type=''
1174 netdb_host_type=''
1175 netdb_name_type=''
1176 netdb_net_type=''
1177 groupcat=''
1178 hostcat=''
1179 passcat=''
1180 orderlib=''
1181 ranlib=''
1182 d_perl_otherlibdirs=''
1183 otherlibdirs=''
1184 package=''
1185 spackage=''
1186 pager=''
1187 api_revision=''
1188 api_subversion=''
1189 api_version=''
1190 api_versionstring=''
1191 patchlevel=''
1192 perl_patchlevel=''
1193 revision=''
1194 subversion=''
1195 version=''
1196 version_patchlevel_string=''
1197 perl5=''
1198 perladmin=''
1199 perlpath=''
1200 d_nv_preserves_uv=''
1201 d_nv_zero_is_allbits_zero=''
1202 i16size=''
1203 i16type=''
1204 i32size=''
1205 i32type=''
1206 i64size=''
1207 i64type=''
1208 i8size=''
1209 i8type=''
1210 ivsize=''
1211 ivtype=''
1212 nv_overflows_integers_at=''
1213 nv_preserves_uv_bits=''
1214 nvsize=''
1215 nvtype=''
1216 u16size=''
1217 u16type=''
1218 u32size=''
1219 u32type=''
1220 u64size=''
1221 u64type=''
1222 u8size=''
1223 u8type=''
1224 uvsize=''
1225 uvtype=''
1226 ivdformat=''
1227 nvEUformat=''
1228 nvFUformat=''
1229 nvGUformat=''
1230 nveformat=''
1231 nvfformat=''
1232 nvgformat=''
1233 uvXUformat=''
1234 uvoformat=''
1235 uvuformat=''
1236 uvxformat=''
1237 pidtype=''
1238 prefix=''
1239 prefixexp=''
1240 installprivlib=''
1241 privlib=''
1242 privlibexp=''
1243 ptrsize=''
1244 d_PRIXU64=''
1245 d_PRId64=''
1246 d_PRIi64=''
1247 d_PRIo64=''
1248 d_PRIu64=''
1249 d_PRIx64=''
1250 sPRIXU64=''
1251 sPRId64=''
1252 sPRIi64=''
1253 sPRIo64=''
1254 sPRIu64=''
1255 sPRIx64=''
1256 d_quad=''
1257 quadkind=''
1258 quadtype=''
1259 uquadtype=''
1260 drand01=''
1261 randbits=''
1262 randfunc=''
1263 randseedtype=''
1264 seedfunc=''
1265 installscript=''
1266 scriptdir=''
1267 scriptdirexp=''
1268 selectminbits=''
1269 selecttype=''
1270 sh=''
1271 targetsh=''
1272 sig_count=''
1273 sig_name=''
1274 sig_name_init=''
1275 sig_num=''
1276 sig_num_init=''
1277 sig_size=''
1278 d_sitearch=''
1279 installsitearch=''
1280 sitearch=''
1281 sitearchexp=''
1282 installsitebin=''
1283 sitebin=''
1284 sitebinexp=''
1285 installsitehtml1dir=''
1286 sitehtml1dir=''
1287 sitehtml1direxp=''
1288 installsitehtml3dir=''
1289 sitehtml3dir=''
1290 sitehtml3direxp=''
1291 installsitelib=''
1292 sitelib=''
1293 sitelib_stem=''
1294 sitelibexp=''
1295 installsiteman1dir=''
1296 siteman1dir=''
1297 siteman1direxp=''
1298 installsiteman3dir=''
1299 siteman3dir=''
1300 siteman3direxp=''
1301 siteprefix=''
1302 siteprefixexp=''
1303 installsitescript=''
1304 sitescript=''
1305 sitescriptexp=''
1306 sizesize=''
1307 sizetype=''
1308 d_libname_unique=''
1309 so=''
1310 socksizetype=''
1311 sharpbang=''
1312 shsharp=''
1313 spitshell=''
1314 src=''
1315 ssizetype=''
1316 st_ino_sign=''
1317 st_ino_size=''
1318 startperl=''
1319 startsh=''
1320 stdchar=''
1321 d_stdio_stream_array=''
1322 stdio_stream_array=''
1323 sysman=''
1324 sGMTIME_max=''
1325 sGMTIME_min=''
1326 sLOCALTIME_max=''
1327 sLOCALTIME_min=''
1328 trnl=''
1329 uidformat=''
1330 uidsign=''
1331 uidsize=''
1332 uidtype=''
1333 archname64=''
1334 use64bitall=''
1335 use64bitint=''
1336 usecbacktrace=''
1337 dtrace=''
1338 usedtrace=''
1339 usefaststdio=''
1340 usekernprocpathname=''
1341 ccflags_uselargefiles=''
1342 ldflags_uselargefiles=''
1343 libswanted_uselargefiles=''
1344 uselargefiles=''
1345 uselongdouble=''
1346 usemorebits=''
1347 usemultiplicity=''
1348 nm_opt=''
1349 nm_so_opt=''
1350 runnm=''
1351 usenm=''
1352 usensgetexecutablepath=''
1353 useperlio=''
1354 usequadmath=''
1355 usesocks=''
1356 d_oldpthreads=''
1357 use5005threads=''
1358 useithreads=''
1359 usereentrant=''
1360 usethreads=''
1361 incpath=''
1362 mips_type=''
1363 usrinc=''
1364 d_vendorarch=''
1365 installvendorarch=''
1366 vendorarch=''
1367 vendorarchexp=''
1368 d_vendorbin=''
1369 installvendorbin=''
1370 vendorbin=''
1371 vendorbinexp=''
1372 installvendorhtml1dir=''
1373 vendorhtml1dir=''
1374 vendorhtml1direxp=''
1375 installvendorhtml3dir=''
1376 vendorhtml3dir=''
1377 vendorhtml3direxp=''
1378 d_vendorlib=''
1379 installvendorlib=''
1380 vendorlib=''
1381 vendorlib_stem=''
1382 vendorlibexp=''
1383 installvendorman1dir=''
1384 vendorman1dir=''
1385 vendorman1direxp=''
1386 installvendorman3dir=''
1387 vendorman3dir=''
1388 vendorman3direxp=''
1389 usevendorprefix=''
1390 vendorprefix=''
1391 vendorprefixexp=''
1392 d_vendorscript=''
1393 installvendorscript=''
1394 vendorscript=''
1395 vendorscriptexp=''
1396 versiononly=''
1397 yacc=''
1398 yaccflags=''
1399 CONFIG=''
1400
1401 : Detect odd OSs
1402 define='define'
1403 undef='undef'
1404 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1405 rmlist=''
1406
1407 : We must find out about Eunice early
1408 eunicefix=':'
1409 if test -f /etc/unixtovms; then
1410         eunicefix=/etc/unixtovms
1411 fi
1412 if test -f /etc/unixtovms.exe; then
1413         eunicefix=/etc/unixtovms.exe
1414 fi
1415
1416 : Set executable suffix now -- needed before hints available
1417 if test -f "/libs/version.library"; then
1418 : Amiga OS
1419     _exe=""
1420 elif test -f "/system/gnu_library/bin/ar.pm"; then
1421 : Stratus VOS
1422     _exe=".pm"
1423 elif test -n "$DJGPP"; then
1424 : DOS DJGPP
1425     _exe=".exe"
1426 elif test -f /kern/cookiejar; then
1427 : MiNT
1428     _exe=""
1429 elif test -d c:/. -o -n "$is_os2" ; then
1430 : OS/2 or cygwin
1431     _exe=".exe"
1432 fi
1433
1434 groupstype=''
1435 i_whoami=''
1436 : Possible local include directories to search.
1437 : Set locincpth to "" in a hint file to defeat local include searches.
1438 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1439 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1440 :
1441 : no include file wanted by default
1442 inclwanted=''
1443
1444 : Enable -DEBUGGING and -DDEBUGGING from the command line
1445 EBUGGING=''
1446 DEBUGGING=''
1447
1448 : Trailing extension.  Override this in a hint file, if needed.
1449 : Extra object files, if any, needed on this platform.
1450 archobjs=''
1451 libnames=''
1452 : change the next line if compiling for Xenix/286 on Xenix/386
1453 xlibpth='/usr/lib/386 /lib/386'
1454 : Possible local library directories to search.
1455 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1456 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1457
1458 : general looking path for locating libraries
1459 glibpth="/lib /usr/lib $xlibpth"
1460 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1461 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1462 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1463 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1464
1465 : Private path used by Configure to find libraries.  Its value
1466 : is prepended to libpth. This variable takes care of special
1467 : machines, like the mips.  Usually, it should be empty.
1468 plibpth=''
1469
1470 : default library list
1471 libswanted=''
1472 : some systems want to use only the non-versioned libso:s
1473 ignore_versioned_solibs=''
1474 ccname=''
1475 ccversion=''
1476 perllibs=''
1477 : set useposix=false in your hint file to disable the POSIX extension.
1478 useposix=true
1479 : set useopcode=false in your hint file to disable the Opcode extension.
1480 useopcode=true
1481 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1482 uselanginfo=true
1483 archname64=''
1484 ccflags_uselargefiles=''
1485 ldflags_uselargefiles=''
1486 libswanted_uselargefiles=''
1487 : set usemultiplicity on the Configure command line to enable multiplicity.
1488 : set usesocks on the Configure command line to enable socks.
1489 archname=''
1490 : set usethreads on the Configure command line to enable threads.
1491 usereentrant='undef'
1492 : List of libraries we want.
1493 : If anyone needs extra -lxxx, put those in a hint file.
1494 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1495 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1496 : We probably want to search /usr/shlib before most other libraries.
1497 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1498 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1499 glibpth="/usr/shlib $glibpth"
1500 : Do not use vfork unless overridden by a hint file.
1501 usevfork=false
1502
1503 : Find the basic shell for Bourne shell scripts
1504 case "$sh" in
1505 '')
1506         case "$SYSTYPE" in
1507         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1508         *) xxx='/bin/sh';;
1509         esac
1510         if test -f "$xxx"; then
1511                 sh="$xxx"
1512         else
1513                 : Build up a list and do a single loop so we can 'break' out.
1514                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1515                 for xxx in sh bash ksh pdksh ash; do
1516                         for p in $pth; do
1517                                 try="$try ${p}/${xxx}"
1518                         done
1519                 done
1520                 for xxx in $try; do
1521                         if test -f "$xxx"; then
1522                                 sh="$xxx";
1523                                 break
1524                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1525                                 sh="$xxx";
1526                                 break
1527                         elif test -f "$xxx.exe"; then
1528                                 sh="$xxx";
1529                                 break
1530                         fi
1531                 done
1532         fi
1533         ;;
1534 esac
1535
1536 case "$sh" in
1537 '')     cat >&2 <<EOM
1538 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1539
1540 Usually it's in /bin/sh.  How did you even get this far?
1541 Please report this issue at https://github.com/Perl/perl5/issues
1542 and we'll try to straighten this all out.
1543 EOM
1544         exit 1
1545         ;;
1546 esac
1547
1548 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1549 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1550 targetsh=$sh
1551
1552 : see if sh knows # comments
1553 if `$sh -c '#' >/dev/null 2>&1`; then
1554         shsharp=true
1555         spitshell=cat
1556         xcat=/bin/cat
1557         test -f $xcat$_exe || xcat=/usr/bin/cat
1558         if test ! -f $xcat$_exe; then
1559                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1560                         if test -f $p/cat$_exe; then
1561                                 xcat=$p/cat
1562                                 break
1563                         fi
1564                 done
1565                 if test ! -f $xcat$_exe; then
1566                         echo "Can't find cat anywhere!"
1567                         exit 1
1568                 fi
1569         fi
1570         echo "#!$xcat" >sharp
1571         $eunicefix sharp
1572         chmod +x sharp
1573         ./sharp > today 2>/dev/null
1574         if test -s today; then
1575                 sharpbang='#!'
1576         else
1577                 echo "#! $xcat" > sharp
1578                 $eunicefix sharp
1579                 chmod +x sharp
1580                 ./sharp > today 2>/dev/null
1581                 if test -s today; then
1582                         sharpbang='#! '
1583                 else
1584                         sharpbang=': use '
1585                 fi
1586         fi
1587 else
1588         echo " "
1589         echo "Your $sh doesn't grok # comments--I will strip them later on."
1590         shsharp=false
1591         cd ..
1592         echo "exec grep -v '^[  ]*#'" >spitshell
1593         chmod +x spitshell
1594         $eunicefix spitshell
1595         spitshell=`pwd`/spitshell
1596         cd UU
1597         echo "I presume that if # doesn't work, #! won't work either!"
1598         sharpbang=': use '
1599 fi
1600 rm -f sharp today
1601
1602 : figure out how to guarantee sh startup
1603 case "$startsh" in
1604 '') startsh=${sharpbang}${sh} ;;
1605 *)
1606 esac
1607 cat >sharp <<EOSS
1608 $startsh
1609 set abc
1610 test "$?abc" != 1
1611 EOSS
1612
1613 chmod +x sharp
1614 $eunicefix sharp
1615 if ./sharp; then
1616         : echo "Yup, it does."
1617 else
1618         echo "Hmm... '$startsh' does not guarantee sh startup..."
1619         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1620 fi
1621 rm -f sharp
1622
1623 : Save command line options in file UU/cmdline.opt for later use in
1624 : generating config.sh.
1625 cat > cmdline.opt <<EOSH
1626 : Configure command line arguments.
1627 config_arg0='$0'
1628 config_args='$*'
1629 config_argc=$#
1630 EOSH
1631 argn=1
1632 args_exp=''
1633 args_sep=''
1634 for arg in "$@"; do
1635         cat >>cmdline.opt <<EOSH
1636 config_arg$argn='$arg'
1637 EOSH
1638         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1639 $arg
1640 EOC
1641         arg_exp=`cat cmdl.opt`
1642         args_exp="$args_exp$args_sep'$arg_exp'"
1643         argn=`expr $argn + 1`
1644         args_sep=' '
1645 done
1646 rm -f cmdl.opt
1647
1648 : produce awk script to parse command line options
1649 cat >options.awk <<'EOF'
1650 BEGIN {
1651         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1652
1653         len = length(optstr);
1654         for (i = 1; i <= len; i++) {
1655                 c = substr(optstr, i, 1);
1656                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1657                 if (a == ":") {
1658                         arg[c] = 1;
1659                         i++;
1660                 }
1661                 opt[c] = 1;
1662         }
1663 }
1664 {
1665         expect = 0;
1666         str = $0;
1667         if (substr(str, 1, 1) != "-") {
1668                 printf("'%s'\n", str);
1669                 next;
1670         }
1671         len = length($0);
1672         for (i = 2; i <= len; i++) {
1673                 c = substr(str, i, 1);
1674                 if (!opt[c]) {
1675                         printf("-%s\n", substr(str, i));
1676                         next;
1677                 }
1678                 printf("-%s\n", c);
1679                 if (arg[c]) {
1680                         if (i < len)
1681                                 printf("'%s'\n", substr(str, i + 1));
1682                         else
1683                                 expect = 1;
1684                         next;
1685                 }
1686         }
1687 }
1688 END {
1689         if (expect)
1690                 print "?";
1691 }
1692 EOF
1693
1694 : process the command line options
1695 set X `for arg in "$@"; do echo "X$arg"; done |
1696         sed -e s/X// | awk -f options.awk`
1697 eval "set $*"
1698 shift
1699 rm -f options.awk
1700
1701 : set up default values
1702 fastread=''
1703 reuseval=false
1704 config_sh=''
1705 alldone=''
1706 error=''
1707 silent=''
1708 extractsh=''
1709 knowitall=''
1710 rm -f optdef.sh posthint.sh
1711 cat >optdef.sh <<EOS
1712 $startsh
1713 EOS
1714
1715
1716 : option parsing
1717 while test $# -gt 0; do
1718         case "$1" in
1719         -d) shift; fastread=yes;;
1720         -e) shift; alldone=cont;;
1721         -f)
1722                 shift
1723                 cd ..
1724                 if test -r "$1"; then
1725                         config_sh="$1"
1726                 else
1727                         echo "$me: cannot read config file $1." >&2
1728                         error=true
1729                 fi
1730                 cd UU
1731                 shift;;
1732         --help|\
1733         -h) shift; error=true;;
1734         -r) shift; reuseval=true;;
1735         -s) shift; silent=true; realsilent=true;;
1736         -E) shift; alldone=exit;;
1737         -K) shift; knowitall=true;;
1738         -O) shift;;
1739         -S) shift; silent=true; extractsh=true;;
1740         -D)
1741                 shift
1742                 case "$1" in
1743                 *=)
1744                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1745                         echo "$me: ignoring -D $1" >&2
1746                         ;;
1747                 *=*) echo "$1" | \
1748                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1749                 *) echo "$1='define'" >> optdef.sh;;
1750                 esac
1751                 shift
1752                 ;;
1753         -U)
1754                 shift
1755                 case "$1" in
1756                 *=) echo "$1" >> optdef.sh;;
1757                 *=*)
1758                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1759                         echo "$me: ignoring -U $1" >&2
1760                         ;;
1761                 *) echo "$1='undef'" >> optdef.sh;;
1762                 esac
1763                 shift
1764                 ;;
1765         -A)
1766             shift
1767             xxx=''
1768             yyy="$1"
1769             zzz=''
1770             uuu=undef
1771             case "$yyy" in
1772             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1773                  case "$zzz" in
1774                  *:*) zzz='' ;;
1775                  *)   xxx=append
1776                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                  esac
1779                  ;;
1780             esac
1781             case "$xxx" in
1782             '')  case "$yyy" in
1783                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1784                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1785                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1786                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1787                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1788                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1789                  esac
1790                  ;;
1791             esac
1792             case "$xxx" in
1793             append)
1794                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1795             clear)
1796                 echo "$yyy=''"                  >> posthint.sh ;;
1797             define)
1798                 case "$zzz" in
1799                 '') zzz=define ;;
1800                 esac
1801                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1802             eval)
1803                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1804             prepend)
1805                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1806             undef)
1807                 case "$zzz" in
1808                 '') zzz="$uuu" ;;
1809                 esac
1810                 echo "$yyy=$zzz"                >> posthint.sh ;;
1811             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1812             esac
1813             shift
1814             ;;
1815         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1816             exit 0;;
1817         --) break;;
1818         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1819         *) break;;
1820         esac
1821 done
1822
1823 case "$error" in
1824 true)
1825         cat >&2 <<EOM
1826 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1827                  [-U symbol] [-U symbol=] [-A command:symbol...]
1828   -d : use defaults for all answers.
1829   -e : go on without questioning past the production of config.sh.
1830   -f : specify an alternate default configuration file.
1831   -h : print this help message and exit (with an error status).
1832   -r : reuse C symbols value if possible (skips costly nm extraction).
1833   -s : silent mode, only echoes questions and essential information.
1834   -D : define symbol to have some value:
1835          -D symbol         symbol gets the value 'define'
1836          -D symbol=value   symbol gets the value 'value'
1837        common used examples (see INSTALL for more info):
1838          -Duse64bitint            use 64bit integers
1839          -Duse64bitall            use 64bit integers and pointers
1840          -Dusethreads             use thread support
1841          -Dinc_version_list=none  do not include older perl trees in @INC
1842          -DEBUGGING=none          DEBUGGING options
1843          -Dcc=gcc                 choose your compiler
1844          -Dprefix=/opt/perl5      choose your destination
1845   -E : stop at the end of questions, after having produced config.sh.
1846   -K : do not use unless you know what you are doing.
1847   -O : ignored for backward compatibility
1848   -S : perform variable substitutions on all .SH files (can mix with -f)
1849   -U : undefine symbol:
1850          -U symbol    symbol gets the value 'undef'
1851          -U symbol=   symbol gets completely empty
1852        e.g.:  -Uversiononly
1853   -A : manipulate symbol after the platform specific hints have been applied:
1854          -A append:symbol=value   append value to symbol
1855          -A symbol=value          like append:, but with a separating space
1856          -A define:symbol=value   define symbol to have value
1857          -A clear:symbol          define symbol to be ''
1858          -A define:symbol         define symbol to be 'define'
1859          -A eval:symbol=value     define symbol to be eval of value
1860          -A prepend:symbol=value  prepend value to symbol
1861          -A undef:symbol          define symbol to be 'undef'
1862          -A undef:symbol=         define symbol to be ''
1863        e.g.:  -A prepend:libswanted='cl pthread '
1864               -A ccflags=-DSOME_MACRO
1865   -V : print version number and exit (with a zero status).
1866 EOM
1867         exit 1
1868         ;;
1869 esac
1870
1871 : Sanity checks
1872 case "$fastread$alldone" in
1873 yescont|yesexit) ;;
1874 *)
1875         case "$extractsh" in
1876         true) ;;
1877         *)
1878                 if test ! -t 0; then
1879                         echo "Say 'sh Configure', not 'sh <Configure'"
1880                         exit 1
1881                 fi
1882                 ;;
1883         esac
1884         ;;
1885 esac
1886
1887 exec 4>&1
1888 case "$silent" in
1889 true) exec 1>/dev/null;;
1890 esac
1891
1892 : run the defines and the undefines, if any, but leave the file out there...
1893 touch optdef.sh
1894 grep '\\' optdef.sh >/dev/null 2>&1
1895 if test $? = 0; then
1896     echo "Configure does not support \\ in -D arguments"
1897     exit 1
1898 fi
1899 . ./optdef.sh
1900 : create the posthint manipulation script and leave the file out there...
1901 touch posthint.sh
1902
1903 : set package name
1904 package='perl5'
1905 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1906 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1907 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1908 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1909 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1910 esac
1911
1912 : Some greps do not return status, grrr.
1913 echo "grimblepritz" >grimble
1914 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1915         contains=contains
1916 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1917         contains=grep
1918 else
1919         contains=contains
1920 fi
1921 rm -f grimble
1922 : the following should work in any shell
1923 case "$contains" in
1924 contains*)
1925         echo " "
1926         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1927         cat >contains <<'EOSS'
1928 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1929 EOSS
1930 chmod +x contains
1931 esac
1932
1933 : Find the path to the source tree
1934 case "$src" in
1935 '') case "$0" in
1936     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1937          case "$src" in
1938          /*)    ;;
1939          .)     ;;
1940          *)     src=`cd ../$src && pwd` ;;
1941          esac
1942          ;;
1943     *)   src='.';;
1944     esac;;
1945 esac
1946 case "$src" in
1947 '')     src=/
1948         rsrc=/
1949         ;;
1950 /*)     rsrc="$src";;
1951 *)      rsrc="../$src";;
1952 esac
1953 if test -f $rsrc/Configure && \
1954         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1955 then
1956    : found it, so we are ok.
1957 else
1958         rsrc=''
1959         for src in . .. ../.. ../../.. ../../../..; do
1960                 if test -f ../$src/Configure && \
1961                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1962                 then
1963                         rsrc=../$src
1964                         break
1965                 fi
1966         done
1967 fi
1968 case "$rsrc" in
1969 '')
1970         cat <<EOM >&4
1971
1972 Sorry, I can't seem to locate the source dir for $package.  Please start
1973 Configure with an explicit path -- i.e. /some/path/Configure.
1974
1975 EOM
1976         exit 1
1977         ;;
1978 ../.)   rsrc='..';;
1979 *)
1980         echo " "
1981         echo "Sources for $package found in \"$src\"." >&4
1982         ;;
1983 esac
1984
1985 : script used to extract .SH files with variable substitutions
1986 cat >extract <<'EOS'
1987 PERL_CONFIG_SH=true
1988 echo "Doing variable substitutions on .SH files..."
1989 if test -f MANIFEST; then
1990         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1991 else
1992         echo "(Looking for .SH files under the source directory.)"
1993         set x `(cd "$src"; find . -name "*.SH" -print)`
1994 fi
1995 shift
1996 case $# in
1997 0) set x `(cd "$src"; echo *.SH)`; shift;;
1998 esac
1999 if test ! -f "$src/$1"; then
2000         shift
2001 fi
2002 mkdir_p='
2003 name=$1;
2004 create="";
2005 while test $name; do
2006         if test ! -d "$name"; then
2007                 create="$name $create";
2008                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2009                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2010         else
2011                 name="";
2012         fi;
2013 done;
2014 for file in $create; do
2015         mkdir $file;
2016 done
2017 '
2018 for file in $*; do
2019         case "$src" in
2020         ".")
2021                 case "$file" in
2022                 */*)
2023                         dir=`expr X$file : 'X\(.*\)/'`
2024                         file=`expr X$file : 'X.*/\(.*\)'`
2025                         (cd "$dir" && . ./$file)
2026                         ;;
2027                 *)
2028                         . ./$file
2029                         ;;
2030                 esac
2031                 ;;
2032         *)
2033                 case "$file" in
2034                 */*)
2035                         dir=`expr X$file : 'X\(.*\)/'`
2036                         file=`expr X$file : 'X.*/\(.*\)'`
2037                         (set x $dir; shift; eval $mkdir_p)
2038                         sh <"$src/$dir/$file"
2039                         ;;
2040                 *)
2041                         sh <"$src/$file"
2042                         ;;
2043                 esac
2044                 ;;
2045         esac
2046 done
2047 if test -f "$src/config_h.SH"; then
2048         if test ! -f config.h; then
2049         : oops, they left it out of MANIFEST, probably, so do it anyway.
2050         . "$src/config_h.SH"
2051         fi
2052 fi
2053 EOS
2054
2055 : extract files and exit if asked to do so
2056 case "$extractsh" in
2057 true)
2058         case "$realsilent" in
2059         true) ;;
2060         *) exec 1>&4;;
2061         esac
2062         case "$config_sh" in
2063         '') config_sh='config.sh';;
2064         esac
2065         echo " "
2066         echo "Fetching answers from $config_sh..."
2067         cd ..
2068         . $config_sh
2069         . UU/optdef.sh
2070         echo " "
2071         . UU/extract
2072         rm -rf UU
2073         echo "Extraction done."
2074         exit 0
2075         ;;
2076 esac
2077
2078 : Eunice requires " " instead of "", can you believe it
2079 echo " "
2080 : Here we go...
2081 echo "Beginning of configuration questions for $package."
2082
2083 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2084
2085 : first determine how to suppress newline on echo command
2086 echo " "
2087 echo "Checking echo to see how to suppress newlines..."
2088 (echo "hi there\c" ; echo " ") >.echotmp
2089 if $contains c .echotmp >/dev/null 2>&1 ; then
2090         echo "...using -n."
2091         n='-n'
2092         c=''
2093 else
2094         cat <<'EOM'
2095 ...using \c
2096 EOM
2097         n=''
2098         c='\c'
2099 fi
2100 echo $n "The star should be here-->$c"
2101 echo '*'
2102 rm -f .echotmp
2103
2104 : Now test for existence of everything in MANIFEST
2105 echo " "
2106 if test -f "$rsrc/MANIFEST"; then
2107         echo "First let's make sure your kit is complete.  Checking..." >&4
2108         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2109                 (split -l 50 2>/dev/null || split -50)
2110         rm -f missing
2111         tmppwd=`pwd`
2112         for filelist in x??; do
2113                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2114                         >/dev/null 2>>"$tmppwd/missing")
2115         done
2116         if test -s missing; then
2117                 cat missing >&4
2118                 cat >&4 <<'EOM'
2119
2120 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2121
2122 You have the option of continuing the configuration process, despite the
2123 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2124 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2125 and contact the author (https://github.com/Perl/perl5/issues).
2126
2127 EOM
2128                 echo $n "Continue? [n] $c" >&4
2129                 read ans
2130                 case "$ans" in
2131                 y*)
2132                         echo "Continuing..." >&4
2133                         rm -f missing
2134                         ;;
2135                 *)
2136                         echo "ABORTING..." >&4
2137                         kill $$
2138                         ;;
2139                 esac
2140         else
2141                 echo "Looks good..."
2142         fi
2143 else
2144         echo "There is no MANIFEST file.  I hope your kit is complete !"
2145 fi
2146 rm -f missing x??
2147
2148 : Find the appropriate value for a newline for tr
2149 if test -n "$DJGPP"; then
2150        trnl='\012'
2151 fi
2152 if test X"$trnl" = X; then
2153         case "`echo foo | tr '\n' x 2>/dev/null`" in
2154         foox) trnl='\n' ;;
2155         esac
2156 fi
2157 if test X"$trnl" = X; then
2158         case "`echo foo | tr '\012' x 2>/dev/null`" in
2159         foox) trnl='\012' ;;
2160         esac
2161 fi
2162 if test X"$trnl" = X; then
2163        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2164        fooxy) trnl='\n\r' ;;
2165        esac
2166 fi
2167 if test X"$trnl" = X; then
2168         cat <<EOM >&2
2169
2170 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2171
2172 EOM
2173         exit 1
2174 fi
2175
2176 : compute the number of columns on the terminal for proper question formatting
2177 case "$COLUMNS" in
2178 '') COLUMNS='80';;
2179 esac
2180
2181 : set up the echo used in my read
2182 myecho="case \"\$xxxm\" in
2183 '') echo $n \"\$rp $c\" >&4;;
2184 *) case \"\$rp\" in
2185         '') echo $n \"[\$xxxm] $c\";;
2186         *)
2187                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2188                         echo \"\$rp\" >&4
2189                         echo $n \"[\$xxxm] $c\" >&4
2190                 else
2191                         echo $n \"\$rp [\$xxxm] $c\" >&4
2192                 fi
2193                 ;;
2194         esac;;
2195 esac"
2196
2197 : now set up to do reads with possible shell escape and default assignment
2198 cat <<EOSC >myread
2199 $startsh
2200 xxxm=\$dflt
2201 $myecho
2202 ans='!'
2203 case "\$fastread" in
2204 yes) case "\$dflt" in
2205         '') ;;
2206         *) ans='';
2207                 case "\$silent-\$rp" in
2208                 true-) ;;
2209                 *) echo " " >&4;;
2210                 esac;;
2211         esac;;
2212 *) case "\$silent" in
2213         true) case "\$rp" in
2214                 '') ans='';;
2215                 esac;;
2216         esac;;
2217 esac
2218 while expr "X\$ans" : "X!" >/dev/null; do
2219         read answ
2220         set x \$xxxm
2221         shift
2222         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2223         case  "\$answ" in
2224         "!")
2225                 sh 1>&4
2226                 echo " "
2227                 $myecho
2228                 ;;
2229         !*)
2230                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2231                 shift
2232                 sh 1>&4 -c "\$*"
2233                 echo " "
2234                 $myecho
2235                 ;;
2236         "\$ans")
2237                 case "\$ans" in
2238                 \\&*)
2239                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2240                         shift
2241                         case "\$1" in
2242                         -d)
2243                                 fastread=yes
2244                                 echo "(OK, I'll run with -d after this question.)" >&4
2245                                 ;;
2246                         -*)
2247                                 echo "*** Sorry, \$1 not supported yet." >&4
2248                                 ;;
2249                         esac
2250                         $myecho
2251                         ans=!
2252                         ;;
2253                 esac;;
2254         *)
2255                 case "\$aok" in
2256                 y)
2257                         echo "*** Substitution done -- please confirm."
2258                         xxxm="\$ans"
2259                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2260                         xxxm="\$ans"
2261                         ans=!
2262                         ;;
2263                 *)
2264                         echo "*** Error -- try again."
2265                         ans=!
2266                         ;;
2267                 esac
2268                 $myecho
2269                 ;;
2270         esac
2271         case "\$ans\$xxxm\$nostick" in
2272         '')
2273                 ans=!
2274                 $myecho
2275                 ;;
2276         esac
2277 done
2278 case "\$ans" in
2279 '') ans="\$xxxm";;
2280 esac
2281 EOSC
2282
2283 : create .config dir to save info across Configure sessions
2284 test -d ../.config || mkdir ../.config
2285 cat >../.config/README <<EOF
2286 This directory created by Configure to save information that should
2287 persist across sessions for $package.
2288
2289 You may safely delete it if you wish.
2290 EOF
2291
2292 : See if we are using a devel version and want that
2293 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2294 case "$usedevel" in
2295 $define|true|[yY]*)
2296     usedevel="$define" ;;
2297 *) case "$xversion" in
2298    *[13579])
2299         cat >&4 <<EOH
2300 *** WHOA THERE!!! ***
2301
2302     This is an UNSTABLE DEVELOPMENT release.
2303     The version of this $package distribution is $xversion, that is, odd,
2304     (as opposed to even) and that signifies a development release.
2305     If you want a maintenance release, you want an even-numbered version.
2306
2307     Do ***NOT*** install this into production use.
2308     Data corruption and crashes are possible.
2309
2310     It is most seriously suggested that you do not continue any further
2311     unless you want to help in developing and debugging Perl.
2312
2313     If you *still* want to build perl, you can answer 'y' now,
2314     or pass -Dusedevel to Configure.
2315
2316 EOH
2317         rp='Do you really want to continue?'
2318         dflt='n'
2319         . ./myread
2320         case "$ans" in
2321         [yY]) echo >&4 "Okay, continuing."
2322               usedevel="$define" ;;
2323         *) echo >&4 "Okay, bye."
2324            exit 1
2325            ;;
2326         esac
2327         ;;
2328     esac
2329     usedevel="$undef"
2330     ;;
2331 esac
2332 case "$usedevel" in
2333 $define|true|[yY]*)
2334         case "$versiononly" in
2335         '') versiononly="$define" ;;
2336         esac
2337         case "$installusrbinperl" in
2338         '') installusrbinperl="$undef" ;;
2339         esac
2340         ;;
2341 esac
2342
2343 : general instructions
2344 needman=true
2345 firsttime=true
2346 user=`(logname) 2>/dev/null`
2347 case "$user" in
2348 '') user=`whoami 2>&1`;;
2349 esac
2350 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2351         firsttime=false
2352         echo " "
2353         rp='Would you like to see the instructions?'
2354         dflt=n
2355         . ./myread
2356         case "$ans" in
2357         [yY]*) ;;
2358         *) needman=false;;
2359         esac
2360 fi
2361 if $needman; then
2362         cat <<EOH
2363
2364 This installation shell script will examine your system and ask you questions
2365 to determine how the perl5 package should be installed. If you get
2366 stuck on a question, you may use a ! shell escape to start a subshell or
2367 execute a command.  Many of the questions will have default answers in square
2368 brackets; typing carriage return will give you the default.
2369
2370 On some of the questions which ask for file or directory names you are allowed
2371 to use the ~name construct to specify the login directory belonging to "name",
2372 even if you don't have a shell which knows about that.  Questions where this is
2373 allowed will be marked "(~name ok)".
2374
2375 EOH
2376         rp=''
2377         dflt='Type carriage return to continue'
2378         . ./myread
2379         cat <<'EOH'
2380
2381 The prompter used in this script allows you to use shell variables and
2382 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2383 in the default answer, as if the default line was a set of arguments given to a
2384 script shell.  This means you may also use $* to repeat the whole default line,
2385 so you do not have to re-type everything to add something to the default.
2386
2387 Every time there is a substitution, you will have to confirm.  If there is an
2388 error (e.g. an unmatched backtick), the default answer will remain unchanged
2389 and you will be prompted again.
2390
2391 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2392 the questions and use the computed defaults (or the previous answers if there
2393 was already a config.sh file). Type 'Configure -h' for a list of options.
2394 You may also start interactively and then answer '& -d' at any prompt to turn
2395 on the non-interactive behaviour for the remainder of the execution.
2396
2397 EOH
2398         . ./myread
2399         cat <<EOH
2400
2401 Much effort has been expended to ensure that this shell script will run on any
2402 Unix system.  If despite that it blows up on yours, your best bet is to edit
2403 Configure and run it again.  If you can't run Configure for some reason,
2404 you'll have to generate a config.sh file by hand.  Whatever problems you
2405 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2406
2407 This installation script affects things in two ways:
2408
2409 1) it may do direct variable substitutions on some of the files included
2410    in this kit.
2411 2) it builds a config.h file for inclusion in C programs.  You may edit
2412    any of these files as the need arises after running this script.
2413
2414 If you make a mistake on a question, there is no easy way to back up to it
2415 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2416 files.  Configure will offer to let you do this before it runs the SH files.
2417
2418 EOH
2419         dflt='Type carriage return to continue'
2420         . ./myread
2421         case "$firsttime" in
2422         true) echo $user >>../.config/instruct;;
2423         esac
2424 fi
2425
2426 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2427 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2428 if test "X$sysroot" = X; then
2429     sysroot=""
2430 else
2431     case "$cc" in
2432         *gcc*|*g++*)
2433             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2434             # _sysroot is used in places where we need --sysroot=foo
2435             # but using the rest of the flags could cause issues.
2436             _sysroot="--sysroot=$sysroot";
2437             case "$ccflags" in
2438                 *sysroot*) ;;
2439                 'undef'|*)
2440                 ccflags="$ccflags $_sysroot"
2441             esac
2442             case "$ldflags" in
2443                 *sysroot*) ;;
2444                 'undef'|*)
2445                 ldflags="$ldflags $_sysroot"
2446             esac
2447             case "$cppflags" in
2448                 *sysroot*) ;;
2449                 'undef'|*)
2450                 cppflags="$cppflags $_sysroot"
2451             esac
2452             # lddlflags updated below in lddlflags section;
2453             # same with cccdlflags
2454             ;;
2455     esac
2456
2457     # Adjust some defaults to also use $sysroot
2458     for var in xlibpth loclibpth locincpth glibpth; do
2459         eval xxx=\$$var
2460         eval $var=''
2461         for path in $xxx; do
2462             eval $var=\"\$$var $sysroot$path\"
2463         done
2464     done
2465
2466 fi
2467
2468 : find out where common programs are
2469 echo " "
2470 echo "Locating common programs..." >&4
2471 cat <<EOSC >loc
2472 $startsh
2473 case \$# in
2474 0) exit 1;;
2475 esac
2476 thing=\$1
2477 shift
2478 dflt=\$1
2479 shift
2480 for dir in \$*; do
2481         case "\$thing" in
2482         .)
2483         if test -d \$dir/\$thing; then
2484                 echo \$dir
2485                 exit 0
2486         fi
2487         ;;
2488         *)
2489         for thisthing in \$dir/\$thing; do
2490                 : just loop through to pick last item
2491         done
2492         if test -f \$thisthing; then
2493                 echo \$thisthing
2494                 exit 0
2495         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2496                 echo \$thisthing
2497                 exit 0
2498         elif test -f \$dir/\$thing.exe; then
2499                 if test -n "$DJGPP"; then
2500                         echo \$dir/\$thing.exe
2501                 elif test "$eunicefix" != ":"; then
2502                         : on Eunice apparently
2503                         echo \$dir/\$thing
2504                 fi
2505                 exit 0
2506         fi
2507         ;;
2508         esac
2509 done
2510 echo \$dflt
2511 exit 1
2512 EOSC
2513 chmod +x loc
2514 $eunicefix loc
2515 loclist="
2516 awk
2517 cat
2518 chmod
2519 comm
2520 cp
2521 echo
2522 expr
2523 grep
2524 ls
2525 mkdir
2526 rm
2527 sed
2528 sort
2529 touch
2530 tr
2531 uniq
2532 "
2533 trylist="
2534 ar
2535 bison
2536 byacc
2537 cpp
2538 csh
2539 date
2540 egrep
2541 gmake
2542 gzip
2543 less
2544 ln
2545 make
2546 more
2547 nm
2548 nroff
2549 perl
2550 pg
2551 test
2552 uname
2553 zip
2554 "
2555 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2556 pth="$pth $sysroot/lib $sysroot/usr/lib"
2557 for file in $loclist; do
2558         eval xxx=\$$file
2559         case "$xxx" in
2560         /*|?:[\\/]*)
2561                 if test -f "$xxx"; then
2562                         : ok
2563                 else
2564                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2565                         xxx=`./loc $file $file $pth`
2566                 fi
2567                 ;;
2568         '') xxx=`./loc $file $file $pth`;;
2569         *) xxx=`./loc $xxx $xxx $pth`;;
2570         esac
2571         eval $file=$xxx$_exe
2572         eval _$file=$xxx
2573         case "$xxx" in
2574         /*)
2575                 echo $file is in $xxx.
2576                 ;;
2577         ?:[\\/]*)
2578                 echo $file is in $xxx.
2579                 ;;
2580         *)
2581                 echo "I don't know where '$file' is, and my life depends on it." >&4
2582                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2583                 exit 1
2584                 ;;
2585         esac
2586 done
2587 echo " "
2588 echo "Don't worry if any of the following aren't found..."
2589 say=offhand
2590 for file in $trylist; do
2591         eval xxx=\$$file
2592         case "$xxx" in
2593         /*|?:[\\/]*)
2594                 if test -f "$xxx"; then
2595                         : ok
2596                 else
2597                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2598                         xxx=`./loc $file $file $pth`
2599                 fi
2600                 ;;
2601         '') xxx=`./loc $file $file $pth`;;
2602         *) xxx=`./loc $xxx $xxx $pth`;;
2603         esac
2604         eval $file=$xxx$_exe
2605         eval _$file=$xxx
2606         case "$xxx" in
2607         /*)
2608                 echo $file is in $xxx.
2609                 ;;
2610         ?:[\\/]*)
2611                 echo $file is in $xxx.
2612                 ;;
2613         *)
2614                 echo "I don't see $file out there, $say."
2615                 say=either
2616                 ;;
2617         esac
2618 done
2619 case "$egrep" in
2620 egrep)
2621         echo "Substituting grep for egrep."
2622         egrep=$grep
2623         _egrep=$grep
2624         ;;
2625 esac
2626 case "$less" in
2627 '')     ;;
2628 *)      if $less -R </dev/null >/dev/null 2>&1; then
2629                echo "Substituting less -R for less."
2630                less="$less -R"
2631                _less=$less
2632         fi
2633         ;;
2634 esac
2635 case "$ln" in
2636 ln)
2637         echo "Substituting cp for ln."
2638         ln=$cp
2639         _ln=$cp
2640         ;;
2641 esac
2642 case "$make" in
2643 make)
2644         case "$gmake" in
2645         gmake)
2646         echo "I can't find make or gmake, and my life depends on it." >&4
2647         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2648         exit 1
2649         ;;
2650         esac
2651         ;;
2652 esac
2653 case "$gmake" in
2654 gmake)  ;;
2655 *)      # We can't have osname yet.
2656         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2657                 # Assume that gmake, if found, is definitely GNU make
2658                 # and prefer it over the system make.
2659                 echo "Substituting gmake for make."
2660                 make=$gmake
2661                 _make=$gmake
2662         fi
2663         ;;
2664 esac
2665 case "$test" in
2666 test)
2667         echo "Hopefully test is built into your sh."
2668         ;;
2669 *)
2670         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2671                 echo "Using the test built into your sh."
2672                 test=test
2673                 _test=test
2674         fi
2675         ;;
2676 esac
2677 case "$echo" in
2678 echo)
2679         echo "Hopefully echo is built into your sh."
2680         ;;
2681 '') ;;
2682 *)
2683         echo " "
2684 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2685         $echo $n "hi there$c" >foo1
2686         echo $n "hi there$c" >foo2
2687         if cmp foo1 foo2 >/dev/null 2>&1; then
2688                 echo "They are compatible.  In fact, they may be identical."
2689         else
2690                 case "$n" in
2691                 '-n') n='' c='\c';;
2692                 *) n='-n' c='';;
2693                 esac
2694                 cat <<FOO
2695 They are not compatible!  You are probably running ksh on a non-USG system.
2696 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2697 have echo built in and we may have to run some Bourne shell scripts.  That
2698 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2699
2700 FOO
2701                 $echo $n "The star should be here-->$c"
2702                 $echo "*"
2703         fi
2704         $rm -f foo1 foo2
2705         ;;
2706 esac
2707
2708 # This question was auctioned at YAPC::Europe-2007 in Vienna
2709 # I never promised you could answer it. I only auctioned the question.
2710 cat <<FOO
2711 The following message is sponsored by
2712
2713   Dresden.pm<--The stars should be here.
2714
2715 Dear Perl user, system administrator or package
2716 maintainer, the Perl community sends greetings to
2717 you. Do you (emblematical) greet back [Y/n]? n
2718
2719 FOO
2720
2721 : Check what type of C compiler we use
2722 cat <<EOS >trygcc
2723 $startsh
2724 EOS
2725 cat <<'EOSC' >>trygcc
2726 case "$cc" in
2727 '') ;;
2728 *)  $rm -f try try.*
2729     $cat >try.c <<EOM
2730 int main(int argc, char *argv[]) {
2731   return 0;
2732 }
2733 EOM
2734     if $cc -o try $ccflags $ldflags try.c; then
2735        :
2736     else
2737         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2738         despair=yes
2739         trygcc=yes
2740         case "$cc" in
2741         *gcc*) trygcc=no ;;
2742         esac
2743         # Skip this test because it gives a false match on output like:
2744         #    ./trygcc: line 23: cc: command not found
2745         # case "`$cc -v -c try.c 2>&1`" in
2746         # *gcc*) trygcc=no ;;
2747         # esac
2748         if $test X"$trygcc" = Xyes; then
2749             if gcc -o try -c try.c; then
2750                 echo " "
2751                 echo "You seem to have a working gcc, though." >&4
2752                 # Switching compilers may undo the work of hints files.
2753                 # The most common problem is -D_REENTRANT for threads.
2754                 # This heuristic catches that case, but gets false positives
2755                 # if -Dusethreads was not actually specified.  Better to
2756                 # bail out here with a useful message than fail
2757                 # mysteriously later. Should we perhaps just try to
2758                 # re-invoke Configure -Dcc=gcc config_args ?
2759                 if $test -f usethreads.cbu; then
2760                         $cat >&4 <<EOM
2761
2762 *** However, any setting of the C compiler flags (e.g. for thread support)
2763 *** will be lost.  It may be necessary for you to restart Configure and
2764 *** add -Dcc=gcc to your Configure command line.
2765
2766 EOM
2767                         rp="Would you like to go ahead and try gcc anyway?"
2768                         dflt=n
2769                 else
2770                         rp="Would you like to use it?"
2771                         dflt=y
2772                 fi
2773                 if $test -f myread; then
2774                     . ./myread
2775                 else
2776                     if $test -f UU/myread; then
2777                         . ./UU/myread
2778                     else
2779                         echo "Cannot find myread, sorry.  Aborting." >&2
2780                         exit 1
2781                     fi
2782                 fi
2783                 case "$ans" in
2784                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2785                 esac
2786             fi
2787         fi
2788     fi
2789     $rm -f try try.*
2790     ;;
2791 esac
2792 EOSC
2793
2794 cat <<EOS >checkcc
2795 $startsh
2796 EOS
2797 cat <<'EOSC' >>checkcc
2798 case "$cc" in
2799 '') ;;
2800 *)  $rm -f try try.*
2801     $cat >try.c <<EOM
2802 int main(int argc, char *argv[]) {
2803   return 0;
2804 }
2805 EOM
2806     if $cc -o try $ccflags $ldflags try.c; then
2807        :
2808     else
2809         if $test X"$despair" = Xyes; then
2810            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2811         fi
2812         $cat >&4 <<EOM
2813 You need to find a working C compiler.
2814 Either (purchase and) install the C compiler supplied by your OS vendor,
2815 or for a free C compiler try http://gcc.gnu.org/
2816 I cannot continue any further, aborting.
2817 EOM
2818         exit 1
2819     fi
2820     $rm -f try try.*
2821     ;;
2822 esac
2823 EOSC
2824
2825 : determine whether symbolic links are supported
2826 echo " "
2827 $touch blurfl
2828 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2829         echo "Symbolic links are supported." >&4
2830         lns="$ln -s"
2831 else
2832         echo "Symbolic links are NOT supported." >&4
2833         lns="$ln"
2834 fi
2835 $rm -f blurfl sym
2836
2837 : determine whether symbolic links are supported
2838 echo " "
2839 case "$lns" in
2840 *"ln"*" -s")
2841         echo "Checking how to test for symbolic links..." >&4
2842         $lns blurfl sym
2843         if $test "X$issymlink" = X; then
2844                 case "$newsh" in
2845                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2846                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2847                 esac
2848                 if test $? = 0; then
2849                         issymlink="test -h"
2850                 else
2851                         echo "Your builtin 'test -h' may be broken." >&4
2852                         case "$test" in
2853                         /*)     ;;
2854                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2855                                 for p in $pth
2856                                 do
2857                                         if test -f "$p/$test"; then
2858                                                 test="$p/$test"
2859                                                 break
2860                                         fi
2861                                 done
2862                                 ;;
2863                         esac
2864                         case "$test" in
2865                         /*)
2866                                 echo "Trying external '$test -h'." >&4
2867                                 issymlink="$test -h"
2868                                 if $test ! -h sym >/dev/null 2>&1; then
2869                                         echo "External '$test -h' is broken, too." >&4
2870                                         issymlink=''
2871                                 fi
2872                                 ;;
2873                         *)      issymlink='' ;;
2874                         esac
2875                 fi
2876         fi
2877         if $test "X$issymlink" = X; then
2878                 if $test -L sym 2>/dev/null; then
2879                         issymlink="$test -L"
2880                         echo "The builtin '$test -L' worked." >&4
2881                 fi
2882         fi
2883         if $test "X$issymlink" != X; then
2884                 echo "You can test for symbolic links with '$issymlink'." >&4
2885         else
2886                 echo "I do not know how you can test for symbolic links." >&4
2887         fi
2888         $rm -f blurfl sym
2889         ;;
2890 *)      echo "No symbolic links, so not testing for their testing..." >&4
2891         ;;
2892 esac
2893
2894 : Make symlinks util
2895 case "$mksymlinks" in
2896 $define|true|[yY]*)
2897         case "$src" in
2898         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2899                 exit 1
2900                 ;;
2901         *)      case "$lns:$issymlink" in
2902                 *"ln"*" -s:"*"test -"?)
2903                         echo "Creating the symbolic links..." >&4
2904                         cd ..
2905                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2906                         awk 'NF == 1 {
2907                                 dir=".";
2908                                 file=$1 "";
2909                              }
2910                              NF == 2 {
2911                                 dir=$1 "";
2912                                 file=$2 "";
2913                              }
2914                              {
2915                                  print "# dir = ", dir, "file = ", file
2916                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2917                              } END {
2918                                  for (d in mf) {
2919                                      if (d != ".") { print("mkdir -p "d) }
2920                                      print("ln -sf "mf[d]" "d);
2921                                  }
2922                              }' source="$src" > UU/mksymlinks.$$
2923                         sh UU/mksymlinks.$$
2924                         rm UU/mksymlinks.$$
2925                         # Sanity check 1.
2926                         if test ! -d t/base; then
2927                                 echo "Failed to create the subdirectories.  Aborting." >&4
2928                                 exit 1
2929                         fi
2930                         # Sanity check 2.
2931                         if test ! -f t/base/lex.t; then
2932                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2933                                 exit 1
2934                         fi
2935                         if test ! -f win32/win32.c; then
2936                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2937                                 exit 1
2938                         fi
2939                         cd UU
2940                         ;;
2941                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2942                         ;;
2943                 esac
2944                 ;;
2945         esac
2946         ;;
2947 esac
2948
2949 : Check for Cross-Compilation
2950 if $test "X$targethost" = "X"; then
2951     targethost=""
2952 fi
2953 if $test "X$targetenv" = "X"; then
2954     targetenv=""
2955 fi
2956 case "$usecrosscompile" in
2957 $define|true|[yY]*)
2958         $echo "Cross-compiling..."
2959         croak=''
2960         case "$cc" in
2961         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2962             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2963             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2964             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2965             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2966             # leave out ld, choosing it is more complex
2967             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2968             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2969             # We are in a weird spot. Just before us, some values
2970             # were 'saved', to be restored after the hints are
2971             # run.  This means that the changes we made to ar,
2972             # nm and ranlib will get reverted.
2973             # To avoid that, we hijack the saving mechanism and
2974             # have it save our new values.
2975             for file in ar nm ranlib; do
2976                 eval xxx=\$$file
2977                 eval $file=$xxx$_exe
2978                 eval _$file=$xxx
2979             done
2980         ;;
2981         esac
2982         case "$targetarch" in
2983         '') echo "Targetarch not defined." >&4; croak=y ;;
2984         *)  echo "Using targetarch $targetarch." >&4 ;;
2985         esac
2986         case "$targethost" in
2987         '') echo "Targethost not defined." >&4; croak=n ;;
2988         *)  echo "Using targethost $targethost." >&4
2989         esac
2990         locincpth=' '
2991         loclibpth=' '
2992         case "$croak" in
2993         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2994         esac
2995     : compile a host miniperl and generate_uudmap, unless we got passed them
2996     if $test "X$hostperl" = X; then
2997       echo "Building host miniperl and generate_uudmap binaries" >&4
2998       before_host=`pwd`
2999       cd ..
3000       cd $src
3001       src=`pwd`
3002       rm -rf $src/host
3003       mkdir $src/host
3004       cd $src/host
3005       $src/Configure -des -Dusedevel -Dmksymlinks
3006       $make miniperl
3007       case "$hostgenerate" in
3008       '') $make generate_uudmap
3009           hostgenerate=$src/host/generate_uudmap
3010           ;;
3011        "$undef") hostgenerate=''
3012           ;;
3013       esac
3014       hostperl=$src/host/miniperl
3015       cd $before_host
3016     fi
3017     hostosname=`$hostperl -le 'print $^O'`
3018     ;;
3019 *)
3020     usecrosscompile="$undef"
3021     ;;
3022 esac
3023
3024 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3025 case "$targethost" in
3026     '') echo "Checking for cross-compile" >&4
3027     case "$usecrosscompile$multiarch" in
3028        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3029          if [ -f Makefile ]; then
3030            echo " "
3031            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3032          else
3033            echo "Configure done."
3034          fi
3035        exit 0
3036        ;;
3037      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3038         run=''
3039         to=:
3040         from=:
3041         ;;
3042     esac
3043     ;;
3044     *) echo "Using targethost $targethost." >&4
3045         case "$src" in
3046         /*) run=$src/Cross/run
3047             targetmkdir=$src/Cross/mkdir
3048             to=$src/Cross/to
3049             from=$src/Cross/from
3050             ;;
3051         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3052             run=$pwd/Cross/run
3053             targetmkdir=$pwd/Cross/mkdir
3054             to=$pwd/Cross/to
3055             from=$pwd/Cross/from
3056             ;;
3057         esac
3058         case "$targetrun" in
3059         '') targetrun=ssh ;;
3060         esac
3061         case "$targetto" in
3062         '') targetto=scp ;;
3063         esac
3064         case "$targetfrom" in
3065         '') targetfrom=scp ;;
3066         esac
3067         run=$run-$targetrun
3068         to=$to-$targetto
3069         from=$from-$targetfrom
3070         case "$targetdir" in
3071         '')  targetdir=/tmp
3072              echo "Guessing targetdir $targetdir." >&4
3073              ;;
3074         esac
3075         case "$targetuser" in
3076         '')  targetuser=root
3077              echo "Guessing targetuser $targetuser." >&4
3078              ;;
3079         esac
3080         case "$targetport" in
3081         '')  targetport=22
3082              echo "Guessing targetport $targetport." >&4
3083              ;;
3084         esac
3085         case "$targetfrom" in
3086         scp)    q=-q ;;
3087         *)      q='' ;;
3088         esac
3089         case "$targetrun" in
3090         ssh|rsh)
3091             cat >$run <<EOF
3092 #!/bin/sh
3093 env=''
3094 case "\$1" in
3095 -cwd)
3096   shift
3097   cwd=\$1
3098   shift
3099   ;;
3100 esac
3101 case "\$1" in
3102 -env)
3103   shift
3104   env=\$1
3105   shift
3106   ;;
3107 esac
3108 case "\$cwd" in
3109 '') cwd=$targetdir ;;
3110 esac
3111 exe=\$1
3112 shift
3113 $to \$exe
3114 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3115 EOF
3116             ;;
3117         adb)
3118             $touch $run
3119             ;;
3120         *)  echo "Unknown targetrun '$targetrun'" >&4
3121             exit 1
3122             ;;
3123         esac
3124         case "$targetmkdir" in
3125         */Cross/mkdir)
3126             cat >$targetmkdir <<EOF
3127 #!/bin/sh
3128 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3129 EOF
3130             $chmod a+rx $targetmkdir
3131             ;;
3132         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3133             exit 1
3134             ;;
3135         esac
3136         case "$targetto" in
3137         scp|rcp)
3138             cat >$to <<EOF
3139 #!/bin/sh
3140 for f in \$@
3141 do
3142   case "\$f" in
3143   /*)
3144     $targetmkdir \`dirname \$f\`
3145     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3146     ;;
3147   *)
3148     $targetmkdir $targetdir/\`dirname \$f\`
3149     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3150     ;;
3151   esac
3152 done
3153 exit 0
3154 EOF
3155             ;;
3156         cp) cat >$to <<EOF
3157 #!/bin/sh
3158 for f in \$@
3159 do
3160   case "\$f" in
3161   /*)
3162     $mkdir -p $targetdir/\`dirname \$f\`
3163     $cp \$f $targetdir/\$f || exit 1
3164     ;;
3165   *)
3166     $targetmkdir $targetdir/\`dirname \$f\`
3167     $cp \$f $targetdir/\$f || exit 1
3168     ;;
3169   esac
3170 done
3171 exit 0
3172 EOF
3173             ;;
3174         *)  echo "Unknown targetto '$targetto'" >&4
3175             exit 1
3176             ;;
3177         esac
3178         case "$targetfrom" in
3179         scp|rcp)
3180           cat >$from <<EOF
3181 #!/bin/sh
3182 for f in \$@
3183 do
3184   $rm -f \$f
3185   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3186 done
3187 exit 0
3188 EOF
3189             ;;
3190         cp) cat >$from <<EOF
3191 #!/bin/sh
3192 for f in \$@
3193 do
3194   $rm -f \$f
3195   cp $targetdir/\$f . || exit 1
3196 done
3197 exit 0
3198 EOF
3199             ;;
3200         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3201             exit 1
3202             ;;
3203         esac
3204         if $test ! -f $run; then
3205             echo "Target 'run' script '$run' not found." >&4
3206         else
3207             $chmod a+rx $run
3208         fi
3209         if $test ! -f $to; then
3210             echo "Target 'to' script '$to' not found." >&4
3211         else
3212             $chmod a+rx $to
3213         fi
3214         if $test ! -f $from; then
3215             echo "Target 'from' script '$from' not found." >&4
3216         else
3217             $chmod a+rx $from
3218         fi
3219         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3220             exit 1
3221         fi
3222         cat >&4 <<EOF
3223 Using '$run' for remote execution,
3224 and '$from' and '$to'
3225 for remote file transfer.
3226 EOF
3227         ;;
3228 *)      run=''
3229         to=:
3230         from=:
3231         usecrosscompile="$undef"
3232         targetarch=''
3233         ;;
3234 esac
3235
3236 : see whether [:lower:] and [:upper:] are supported character classes
3237 echo " "
3238 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3239 ABYZ-abyz)
3240         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3241         up='[:upper:]'
3242         low='[:lower:]'
3243         ;;
3244 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3245         # (0xd9 and 0xe2), therefore that is a nice testing point.
3246         if test "X$up" = X -o "X$low" = X; then
3247             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3248             rs) up='[A-Z]'
3249                 low='[a-z]'
3250                 ;;
3251             esac
3252         fi
3253         if test "X$up" = X -o "X$low" = X; then
3254             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3255             rs) up='A-Z'
3256                 low='a-z'
3257                 ;;
3258             esac
3259         fi
3260         if test "X$up" = X -o "X$low" = X; then
3261             case "`echo RS | od -x 2>/dev/null`" in
3262             *D9E2*|*d9e2*)
3263                 echo "Hey, this might be EBCDIC." >&4
3264                 if test "X$up" = X -o "X$low" = X; then
3265                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3266                     rs) up='[A-IJ-RS-Z]'
3267                         low='[a-ij-rs-z]'
3268                         ;;
3269                     esac
3270                 fi
3271                 if test "X$up" = X -o "X$low" = X; then
3272                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3273                     rs) up='A-IJ-RS-Z'
3274                         low='a-ij-rs-z'
3275                         ;;
3276                     esac
3277                 fi
3278                 ;;
3279             esac
3280         fi
3281 esac
3282 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3283 rs)
3284     echo "Using $up and $low to convert case." >&4
3285     ;;
3286 *)
3287     echo "I don't know how to translate letters from upper to lower case." >&4
3288     echo "Your tr is not acting any way I know of." >&4
3289     exit 1
3290     ;;
3291 esac
3292 : set up the translation script tr, must be called with ./tr of course
3293 cat >tr <<EOSC
3294 $startsh
3295 case "\$1\$2" in
3296 '[A-Z][a-z]') exec $tr '$up' '$low';;
3297 '[a-z][A-Z]') exec $tr '$low' '$up';;
3298 esac
3299 exec $tr "\$@"
3300 EOSC
3301 chmod +x tr
3302 $eunicefix tr
3303
3304 : Try to determine whether config.sh was made on this system
3305 case "$config_sh" in
3306 '')
3307 myuname=`$uname -a 2>/dev/null`
3308 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3309 # Downcase everything to avoid ambiguity.
3310 # Remove slashes and single quotes so we can use parts of this in
3311 # directory and file names.
3312 # Remove newlines so myuname is sane to use elsewhere.
3313 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3314 # because the A-Z/a-z are not consecutive.
3315 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3316         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3317 newmyuname="$myuname"
3318 dflt=n
3319 case "$knowitall" in
3320 '')
3321         if test -f ../config.sh; then
3322                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3323                         eval "`grep myuname= ../config.sh`"
3324                 fi
3325                 if test "X$myuname" = "X$newmyuname"; then
3326                         dflt=y
3327                 fi
3328         fi
3329         ;;
3330 *) dflt=y;;
3331 esac
3332
3333 : Get old answers from old config file if Configure was run on the
3334 : same system, otherwise use the hints.
3335 hint=default
3336 cd ..
3337 if test -f config.sh; then
3338         echo " "
3339         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3340         . UU/myread
3341         case "$ans" in
3342         n*|N*) echo "OK, I'll ignore it."
3343                 mv config.sh config.sh.old
3344                 myuname="$newmyuname"
3345                 ;;
3346         *)  echo "Fetching default answers from your old config.sh file..." >&4
3347                 tmp_n="$n"
3348                 tmp_c="$c"
3349                 tmp_sh="$sh"
3350                 . ./config.sh
3351                 cp config.sh UU
3352                 n="$tmp_n"
3353                 c="$tmp_c"
3354                 : Older versions did not always set $sh.  Catch re-use of such
3355                 : an old config.sh.
3356                 case "$sh" in
3357                 '') sh="$tmp_sh" ;;
3358                 esac
3359                 hint=previous
3360                 ;;
3361         esac
3362 fi
3363 . ./UU/checkcc
3364 if test ! -f config.sh; then
3365         $cat <<EOM
3366
3367 First time through, eh?  I have some defaults handy for some systems
3368 that need some extra help getting the Configure answers right:
3369
3370 EOM
3371         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3372         dflt=''
3373         : Half the following guesses are probably wrong... If you have better
3374         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3375         : The metaconfig authors would also appreciate a copy...
3376         $test -f /irix && osname=irix
3377         $test -f /xenix && osname=sco_xenix
3378         $test -f /dynix && osname=dynix
3379         $test -f /dnix && osname=dnix
3380         $test -f /lynx.os && osname=lynxos
3381         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3382         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3383         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3384         $test -f /bin/mips && /bin/mips && osname=mips
3385         $test -d /usr/apollo/bin && osname=apollo
3386         $test -f /etc/saf/_sactab && osname=svr4
3387         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3388         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3389         $test -f /sys/utilities/MultiView && osname=amigaos
3390         if $test -d /MachTen -o -d /MachTen_Folder; then
3391                 osname=machten
3392                 if $test -x /sbin/version; then
3393                         osvers=`/sbin/version | $awk '{print $2}' |
3394                         $sed -e 's/[A-Za-z]$//'`
3395                 elif $test -x /usr/etc/version; then
3396                         osvers=`/usr/etc/version | $awk '{print $2}' |
3397                         $sed -e 's/[A-Za-z]$//'`
3398                 else
3399                         osvers="$2.$3"
3400                 fi
3401         fi
3402
3403         $test -f /sys/posix.dll &&
3404                 $test -f /usr/bin/what &&
3405                 set X `/usr/bin/what /sys/posix.dll` &&
3406                 $test "$3" = UWIN &&
3407                 osname=uwin &&
3408                 osvers="$5"
3409
3410         if $test -f $uname; then
3411                 set X $myuname
3412                 shift
3413
3414                 case "$5" in
3415                 fps*) osname=fps ;;
3416                 mips*)
3417                         case "$4" in
3418                         umips) osname=umips ;;
3419                         *) osname=mips ;;
3420                         esac;;
3421                 [23]100) osname=mips ;;
3422                 i386*)
3423                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3424                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3425                                 osname='sco'
3426                                 osvers=$tmp
3427                         elif $test -f /etc/kconfig; then
3428                                 osname=isc
3429                                 if test "$lns" = "$ln -s"; then
3430                                         osvers=4
3431                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3432                                         osvers=3
3433                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3434                                         osvers=2
3435                                 fi
3436                         fi
3437                         tmp=''
3438                         ;;
3439                 pc*)
3440                         if test -n "$DJGPP"; then
3441                                 osname=dos
3442                                 osvers=djgpp
3443                         fi
3444                         ;;
3445                 esac
3446
3447                 case "$1" in
3448                 aix) osname=aix
3449                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3450                         case "$tmp" in
3451                         # oslevel can fail with:
3452                         # oslevel: Unable to acquire lock.
3453                         *not\ found) osvers="$4"."$3" ;;
3454                         '<3240'|'<>3240') osvers=3.2.0 ;;
3455                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3456                         '=3250'|'>3250') osvers=3.2.5 ;;
3457                         *) osvers=$tmp;;
3458                         esac
3459                         ;;
3460                 bitrig) osname=bitrig
3461                         osvers="$3"
3462                         ;;
3463                 bsd386) osname=bsd386
3464                         osvers=`$uname -r`
3465                         ;;
3466                 cygwin*) osname=cygwin
3467                         osvers="$3"
3468                         ;;
3469                 *dc.osx) osname=dcosx
3470                         osvers="$3"
3471                         ;;
3472                 dnix) osname=dnix
3473                         osvers="$3"
3474                         ;;
3475                 domainos) osname=apollo
3476                         osvers="$3"
3477                         ;;
3478                 dgux)   osname=dgux
3479                         osvers="$3"
3480                         ;;
3481                 dragonfly) osname=dragonfly
3482                         osvers="$3"
3483                         ;;
3484                 dynixptx*) osname=dynixptx
3485                         osvers=`echo "$4"|sed 's/^v//'`
3486                         ;;
3487                 freebsd) osname=freebsd
3488                         osvers="$3" ;;
3489                 genix)  osname=genix ;;
3490                 gnu)    osname=gnu
3491                         osvers="$3" ;;
3492                 hp*)    osname=hpux
3493                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3494                         ;;
3495                 irix*)  osname=irix
3496                         case "$3" in
3497                         4*) osvers=4 ;;
3498                         5*) osvers=5 ;;
3499                         *)      osvers="$3" ;;
3500                         esac
3501                         ;;
3502                 linux)  osname=linux
3503                         case "$3" in
3504                         *)      osvers="$3" ;;
3505                         esac
3506                         $test -f /system/lib/libandroid.so && osname=linux-android
3507                         ;;
3508                 MiNT)   osname=mint
3509                         ;;
3510                 minix)  osname=minix
3511                         osvers=`$uname -r`
3512                         ;;
3513                 netbsd*) osname=netbsd
3514                         osvers="$3"
3515                         ;;
3516                 news-os) osvers="$3"
3517                         case "$3" in
3518                         4*) osname=newsos4 ;;
3519                         *) osname=newsos ;;
3520                         esac
3521                         ;;
3522                 nonstop-ux) osname=nonstopux ;;
3523                 openbsd) osname=openbsd
3524                         osvers="$3"
3525                         ;;
3526                 os2)    osname=os2
3527                         osvers="$4"
3528                         ;;
3529                 POSIX-BC | posix-bc ) osname=posix-bc
3530                         osvers="$3"
3531                         ;;
3532                 powerux | power_ux | powermax_os | powermaxos | \
3533                 powerunix | power_unix) osname=powerux
3534                         osvers="$3"
3535                         ;;
3536                 qnx) osname=qnx
3537                         osvers="$4"
3538                         ;;
3539                 solaris) osname=solaris
3540                         case "$3" in
3541                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3542                         *)      osvers="$3" ;;
3543                         esac
3544                         ;;
3545                 sunos) osname=sunos
3546                         case "$3" in
3547                         5*) osname=solaris
3548                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3549                         *)      osvers="$3" ;;
3550                         esac
3551                         ;;
3552                 titanos) osname=titanos
3553                         case "$3" in
3554                         1*) osvers=1 ;;
3555                         2*) osvers=2 ;;
3556                         3*) osvers=3 ;;
3557                         4*) osvers=4 ;;
3558                         *)      osvers="$3" ;;
3559                         esac
3560                         ;;
3561                 ultrix) osname=ultrix
3562                         osvers="$3"
3563                         ;;
3564                 osf1|mls+)      case "$5" in
3565                                 alpha)
3566                                         osname=dec_osf
3567                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3568                                         case "$osvers" in
3569                                         [1-9].[0-9]*) ;;
3570                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3571                                         esac
3572                                         ;;
3573                         hp*)    osname=hp_osf1  ;;
3574                         mips)   osname=mips_osf1 ;;
3575                         esac
3576                         ;;
3577                 # UnixWare 7.1.2 is known as Open UNIX 8
3578                 openunix|unixware) osname=svr5
3579                         osvers="$4"
3580                         ;;
3581                 uts)    osname=uts
3582                         osvers="$3"
3583                         ;;
3584                 vos) osvers="$3"
3585                         ;;
3586                 $2) case "$osname" in
3587                         *isc*) ;;
3588                         *freebsd*) ;;
3589                         svr*)
3590                                 : svr4.x or possibly later
3591                                 case "svr$3" in
3592                                 ${osname}*)
3593                                         osname=svr$3
3594                                         osvers=$4
3595                                         ;;
3596                                 esac
3597                                 case "$osname" in
3598                                 svr4.0)
3599                                         : Check for ESIX
3600                                         if test -f /stand/boot ; then
3601                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3602                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3603                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3604                                                         if test -n "$isesix"; then
3605                                                                 osname=esix4
3606                                                         fi
3607                                                 fi
3608                                         fi
3609                                         ;;
3610                                 esac
3611                                 ;;
3612                         *)      if test -f /etc/systemid; then
3613                                         osname=sco
3614                                         set `echo $3 | $sed 's/\./ /g'` $4
3615                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3616                                                 osvers=$1.$2.$3
3617                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3618                                                 osvers=$1.$2
3619                                         elif $test -f $src/hints/sco_$1.sh; then
3620                                                 osvers=$1
3621                                         fi
3622                                 else
3623                                         case "$osname" in
3624                                         '') : Still unknown.  Probably a generic Sys V.
3625                                                 osname="sysv"
3626                                                 osvers="$3"
3627                                                 ;;
3628                                         esac
3629                                 fi
3630                                 ;;
3631                         esac
3632                         ;;
3633                 *)      case "$osname" in
3634                         '') : Still unknown.  Probably a generic BSD.
3635                                 osname="$1"
3636                                 osvers="$3"
3637                                 ;;
3638                         esac
3639                         ;;
3640                 esac
3641         else
3642                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3643                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3644                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3645                                 osname=news_os
3646                         fi
3647                         $rm -f UU/kernel.what
3648                 elif test -d c:/. -o -n "$is_os2" ; then
3649                         set X $myuname
3650                         osname=os2
3651                         osvers="$5"
3652                 fi
3653         fi
3654
3655         case "$targetarch" in
3656         '') ;;
3657         *)  hostarch=$osname
3658             case "$targetarch" in
3659                 nto*|*-nto-*)
3660                     # Will load qnx.sh, which should change osname to nto
3661                     osname=qnx
3662                     osvers=''
3663                     ;;
3664                 *linux-android*)
3665                     # Catch arm-linux-androideabi, mipsel-linux-android,
3666                     # and i686-linux-android
3667                     osname=linux-android
3668                     osvers=''
3669                     ;;
3670                 *linux*)
3671                     # Something like arm-linux-gnueabihf is really just
3672                     # plain linux.
3673                     osname=linux
3674                     osvers=''
3675                     ;;
3676                 *solaris*|*sunos*)
3677                     osname=solaris
3678                     # XXX perhaps we should just assume
3679                     # osvers to be 2, or maybe take the value
3680                     # from targetarch. Using $run before the
3681                     # hints are run is somewhat icky.
3682                     set X `$run $uname -a 2>/dev/null`
3683                     shift
3684                     case "$3" in
3685                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3686                         *)  osvers="$3" ;;
3687                     esac
3688                     ;;
3689                 *)
3690                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3691                     osvers=''
3692                 ;;
3693             esac
3694             ;;
3695         esac
3696
3697         : Now look for a hint file osname_osvers, unless one has been
3698         : specified already.
3699         case "$hintfile" in
3700         ''|' ')
3701                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3702                 : Also try without trailing minor version numbers.
3703                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3704                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3705                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3706                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3707                 case "$file" in
3708                 '') dflt=none ;;
3709                 *)  case "$osvers" in
3710                         '') dflt=$file
3711                                 ;;
3712                         *)  if $test -f $src/hints/$file.sh ; then
3713                                         dflt=$file
3714                                 elif $test -f $src/hints/$xfile.sh ; then
3715                                         dflt=$xfile
3716                                 elif $test -f $src/hints/$xxfile.sh ; then
3717                                         dflt=$xxfile
3718                                 elif $test -f $src/hints/$xxxfile.sh ; then
3719                                         dflt=$xxxfile
3720                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3721                                         dflt=$xxxxfile
3722                                 elif $test -f "$src/hints/${osname}.sh" ; then
3723                                         dflt="${osname}"
3724                                 else
3725                                         dflt=none
3726                                 fi
3727                                 ;;
3728                         esac
3729                         ;;
3730                 esac
3731                 if $test -f Policy.sh ; then
3732                         case "$dflt" in
3733                         *Policy*) ;;
3734                         none) dflt="Policy" ;;
3735                         *) dflt="Policy $dflt" ;;
3736                         esac
3737                 fi
3738                 ;;
3739         *)
3740                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3741                 ;;
3742         esac
3743
3744         if $test -f Policy.sh ; then
3745                 $cat <<EOM
3746
3747 There's also a Policy hint file available, which should make the
3748 site-specific (policy) questions easier to answer.
3749 EOM
3750
3751         fi
3752
3753         $cat <<EOM
3754
3755 You may give one or more space-separated answers, or "none" if appropriate.
3756 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3757 previous run of Configure, you may specify it as well as or instead of
3758 OS-specific hints.  If hints are provided for your OS, you should use them:
3759 although Perl can probably be built without hints on many platforms, using
3760 hints often improve performance and may enable features that Configure can't
3761 set up on its own. If there are no hints that match your OS, specify "none";
3762 DO NOT give a wrong version or a wrong OS.
3763
3764 EOM
3765
3766         rp="Which of these apply, if any?"
3767         . UU/myread
3768         tans=$ans
3769         for file in $tans; do
3770                 if $test X$file = XPolicy -a -f Policy.sh; then
3771                         . Policy.sh
3772                         $cat Policy.sh >> UU/config.sh
3773                 elif $test -f $src/hints/$file.sh; then
3774                         . $src/hints/$file.sh
3775                         $cat $src/hints/$file.sh >> UU/config.sh
3776                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3777                         : nothing
3778                 else
3779                         : Give one chance to correct a possible typo.
3780                         echo "$file.sh does not exist"
3781                         dflt=$file
3782                         rp="hint to use instead?"
3783                         . UU/myread
3784                         for file in $ans; do
3785                                 if $test -f "$src/hints/$file.sh"; then
3786                                         . $src/hints/$file.sh
3787                                         $cat $src/hints/$file.sh >> UU/config.sh
3788                                 elif $test X$ans = X -o X$ans = Xnone ; then
3789                                         : nothing
3790                                 else
3791                                         echo "$file.sh does not exist -- ignored."
3792                                 fi
3793                         done
3794                 fi
3795         done
3796
3797         hint=recommended
3798         : Remember our hint file for later.
3799         if $test -f "$src/hints/$file.sh" ; then
3800                 hintfile="$file"
3801         else
3802                 hintfile=''
3803         fi
3804 fi
3805 cd UU
3806 ;;
3807 *)
3808         echo " "
3809         echo "Fetching default answers from $config_sh..." >&4
3810         tmp_n="$n"
3811         tmp_c="$c"
3812         cd ..
3813         cp $config_sh config.sh 2>/dev/null
3814         chmod +w config.sh
3815         . ./config.sh
3816         cd UU
3817         cp ../config.sh .
3818         n="$tmp_n"
3819         c="$tmp_c"
3820         hint=previous
3821         ;;
3822 esac
3823 . ./optdef.sh
3824
3825 : Restore computed paths
3826 for file in $loclist $trylist; do
3827         eval $file="\$_$file"
3828 done
3829
3830 cat << EOM
3831
3832 Configure uses the operating system name and version to set some defaults.
3833 The default value is probably right if the name rings a bell. Otherwise,
3834 since spelling matters for me, either accept the default or answer "none"
3835 to leave it blank.
3836
3837 EOM
3838 case "$osname" in
3839         ''|' ')
3840                 case "$hintfile" in
3841                 ''|' '|none) dflt=none ;;
3842                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3843                 esac
3844                 ;;
3845         *) dflt="$osname" ;;
3846 esac
3847 rp="Operating system name?"
3848 . ./myread
3849 case "$ans" in
3850 none)  osname='' ;;
3851 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3852 esac
3853 echo " "
3854 case "$osvers" in
3855         ''|' ')
3856                 case "$hintfile" in
3857                 ''|' '|none) dflt=none ;;
3858                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3859                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3860                         case "$dflt" in
3861                         ''|' ') dflt=none ;;
3862                         esac
3863                         ;;
3864                 esac
3865                 ;;
3866         *) dflt="$osvers" ;;
3867 esac
3868 rp="Operating system version?"
3869 . ./myread
3870 case "$ans" in
3871 none)  osvers='' ;;
3872 *) osvers="$ans" ;;
3873 esac
3874
3875
3876 . ./posthint.sh
3877
3878 : who configured the system
3879 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3880 case "$cf_by" in
3881 "")
3882         cf_by=`(logname) 2>/dev/null`
3883         case "$cf_by" in
3884         "")
3885                 cf_by=`(whoami) 2>/dev/null`
3886                 case "$cf_by" in
3887                 "") cf_by=unknown ;;
3888                 esac ;;
3889         esac ;;
3890 esac
3891
3892 : decide how portable to be.  Allow command line overrides.
3893 case "$d_portable" in
3894 "$undef") ;;
3895 *)      d_portable="$define" ;;
3896 esac
3897
3898 : set up shell script to do ~ expansion
3899 cat >filexp <<EOSS
3900 $startsh
3901 : expand filename
3902 case "\$1" in
3903  \~/*|\~)
3904         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3905         ;;
3906  \~*)
3907         if $test -f /bin/csh; then
3908                 /bin/csh -f -c "glob \$1"
3909                 failed=\$?
3910                 echo ""
3911                 exit \$failed
3912         else
3913                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3914                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3915                 if $test ! -d "\$dir"; then
3916                         me=\`basename \$0\`
3917                         echo "\$me: can't locate home directory for: \$name" >&2
3918                         exit 1
3919                 fi
3920                 case "\$1" in
3921                 */*)
3922                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3923                         ;;
3924                 *)
3925                         echo \$dir
3926                         ;;
3927                 esac
3928         fi
3929         ;;
3930 *)
3931         echo \$1
3932         ;;
3933 esac
3934 EOSS
3935 chmod +x filexp
3936 $eunicefix filexp
3937
3938 : now set up to get a file name
3939 cat <<EOS >getfile
3940 $startsh
3941 EOS
3942 cat <<'EOSC' >>getfile
3943 tilde=''
3944 fullpath=''
3945 already=''
3946 skip=''
3947 none_ok=''
3948 exp_file=''
3949 nopath_ok=''
3950 orig_rp="$rp"
3951 orig_dflt="$dflt"
3952 case "$gfpth" in
3953 '') gfpth='.' ;;
3954 esac
3955
3956 case "$fn" in
3957 *\(*)
3958         : getfile will accept an answer from the comma-separated list
3959         : enclosed in parentheses even if it does not meet other criteria.
3960         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3961         fn=`echo $fn | sed 's/(.*)//'`
3962         ;;
3963 esac
3964
3965 case "$fn" in
3966 *:*)
3967         loc_file=`expr $fn : '.*:\(.*\)'`
3968         fn=`expr $fn : '\(.*\):.*'`
3969         ;;
3970 esac
3971
3972 case "$fn" in
3973 *~*) tilde=true;;
3974 esac
3975 case "$fn" in
3976 */*) fullpath=true;;
3977 esac
3978 case "$fn" in
3979 *+*) skip=true;;
3980 esac
3981 case "$fn" in
3982 *n*) none_ok=true;;
3983 esac
3984 case "$fn" in
3985 *e*) exp_file=true;;
3986 esac
3987 case "$fn" in
3988 *p*) nopath_ok=true;;
3989 esac
3990
3991 case "$fn" in
3992 *f*) type='File';;
3993 *d*) type='Directory';;
3994 *l*) type='Locate';;
3995 esac
3996
3997 what="$type"
3998 case "$what" in
3999 Locate) what='File';;
4000 esac
4001
4002 case "$exp_file" in
4003 '')
4004         case "$d_portable" in
4005         "$define") ;;
4006         *) exp_file=true;;
4007         esac
4008         ;;
4009 esac
4010
4011 cd ..
4012 while test "$type"; do
4013         redo=''
4014         rp="$orig_rp"
4015         dflt="$orig_dflt"
4016         case "$tilde" in
4017         true) rp="$rp (~name ok)";;
4018         esac
4019         . UU/myread
4020         if test -f UU/getfile.ok && \
4021                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4022         then
4023                 value="$ans"
4024                 ansexp="$ans"
4025                 break
4026         fi
4027         case "$ans" in
4028         none)
4029                 value=''
4030                 ansexp=''
4031                 case "$none_ok" in
4032                 true) type='';;
4033                 esac
4034                 ;;
4035         *)
4036                 case "$tilde" in
4037                 '') value="$ans"
4038                         ansexp="$ans";;
4039                 *)
4040                         value=`UU/filexp $ans`
4041                         case $? in
4042                         0)
4043                                 if test "$ans" != "$value"; then
4044                                         echo "(That expands to $value on this system.)"
4045                                 fi
4046                                 ;;
4047                         *) value="$ans";;
4048                         esac
4049                         ansexp="$value"
4050                         case "$exp_file" in
4051                         '') value="$ans";;
4052                         esac
4053                         ;;
4054                 esac
4055                 case "$fullpath" in
4056                 true)
4057                         case "$ansexp" in
4058                         /*) value="$ansexp" ;;
4059                         [a-zA-Z]:/*) value="$ansexp" ;;
4060                         *)
4061                                 redo=true
4062                                 case "$already" in
4063                                 true)
4064                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4065                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4066                                         ;;
4067                                 *)
4068                                 echo "Please give a full path name, starting with slash." >&4
4069                                         case "$tilde" in
4070                                         true)
4071                                 echo "Note that using ~name is ok provided it expands well." >&4
4072                                                 already=true
4073                                                 ;;
4074                                         esac
4075                                 esac
4076                                 ;;
4077                         esac
4078                         ;;
4079                 esac
4080                 case "$redo" in
4081                 '')
4082                         case "$type" in
4083                         File)
4084                                 for fp in $gfpth; do
4085                                         if test "X$fp" = X.; then
4086                                             pf="$ansexp"
4087                                         else    
4088                                             pf="$fp/$ansexp"
4089                                         fi
4090                                         if test -f "$pf"; then
4091                                                 type=''
4092                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4093                                         then
4094                                                 echo "($value is not a plain file, but that's ok.)"
4095                                                 type=''
4096                                         fi
4097                                         if test X"$type" = X; then
4098                                             value="$pf"
4099                                             break
4100                                         fi
4101                                 done
4102                                 ;;
4103                         Directory)
4104                                 for fp in $gfpth; do
4105                                         if test "X$fp" = X.; then
4106                                             dir="$ans"
4107                                             direxp="$ansexp"
4108                                         else    
4109                                             dir="$fp/$ansexp"
4110                                             direxp="$fp/$ansexp"
4111                                         fi
4112                                         if test -d "$direxp"; then
4113                                                 type=''
4114                                                 value="$dir"
4115                                                 break
4116                                         fi
4117                                 done
4118                                 ;;
4119                         Locate)
4120                                 if test -d "$ansexp"; then
4121                                         echo "(Looking for $loc_file in directory $value.)"
4122                                         value="$value/$loc_file"
4123                                         ansexp="$ansexp/$loc_file"
4124                                 fi
4125                                 if test -f "$ansexp"; then
4126                                         type=''
4127                                 fi
4128                                 case "$nopath_ok" in
4129                                 true)   case "$value" in
4130                                         */*) ;;
4131                                         *)      echo "Assuming $value will be in people's path."
4132                                                 type=''
4133                                                 ;;
4134                                         esac
4135                                         ;;
4136                                 esac
4137                                 ;;
4138                         esac
4139
4140                         case "$skip" in
4141                         true) type='';
4142                         esac
4143
4144                         case "$type" in
4145                         '') ;;
4146                         *)
4147                                 if test "$fastread" = yes; then
4148                                         dflt=y
4149                                 else
4150                                         dflt=n
4151                                 fi
4152                                 rp="$what $value doesn't exist.  Use that name anyway?"
4153                                 . UU/myread
4154                                 dflt=''
4155                                 case "$ans" in
4156                                 y*) type='';;
4157                                 *) echo " ";;
4158                                 esac
4159                                 ;;
4160                         esac
4161                         ;;
4162                 esac
4163                 ;;
4164         esac
4165 done
4166 cd UU
4167 ans="$value"
4168 rp="$orig_rp"
4169 dflt="$orig_dflt"
4170 rm -f getfile.ok
4171 test "X$gfpthkeep" != Xy && gfpth=""
4172 EOSC
4173
4174 : determine root of directory hierarchy where package will be installed.
4175 case "$prefix" in
4176 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4177         ;;
4178 *)      dflt="$prefix"
4179         ;;
4180 esac
4181 $cat <<EOM
4182
4183 By default, $package will be installed in $dflt/bin, manual pages
4184 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4185 installation directories. Typically this is something like /usr/local.
4186 If you wish to have binaries under /usr/bin but other parts of the
4187 installation under /usr/local, that's ok: you will be prompted
4188 separately for each of the installation directories, the prefix being
4189 only used to set the defaults.
4190
4191 EOM
4192 fn=d~
4193 rp='Installation prefix to use?'
4194 . ./getfile
4195 oldprefix=''
4196 case "$prefix" in
4197 '')     ;;
4198 *)      case "$ans" in
4199         "$prefix") ;;
4200         *) oldprefix="$prefix";;
4201         esac
4202         ;;
4203 esac
4204
4205 case "$ans" in
4206 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4207         ;;
4208 *)      prefix="$ans"
4209 esac
4210
4211 case "$ansexp" in
4212 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4213         ;;
4214 *)      prefixexp="$ansexp"
4215 esac
4216
4217 : allow them to override the AFS root
4218 case "$afsroot" in
4219 '')     afsroot=/afs ;;
4220 *)      afsroot=$afsroot ;;
4221 esac
4222
4223 : is AFS running?
4224 echo " "
4225 case "$afs" in
4226 $define|true)   afs=true ;;
4227 $undef|false)   afs=false ;;
4228 *)      if $test -d $afsroot; then
4229                 afs=true
4230         else
4231                 afs=false
4232         fi
4233         ;;
4234 esac
4235 if $afs; then
4236         echo "AFS may be running... I'll be extra cautious then..." >&4
4237 else
4238         echo "AFS does not seem to be running..." >&4
4239 fi
4240
4241 : determine installation prefix for where package is to be installed.
4242 if $afs; then
4243 $cat <<EOM
4244
4245 Since you are running AFS, I need to distinguish the directory in which
4246 files will reside from the directory in which they are installed (and from
4247 which they are presumably copied to the former directory by occult means).
4248
4249 EOM
4250         case "$installprefix" in
4251         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4252         *) dflt="$installprefix";;
4253         esac
4254 else
4255 $cat <<EOM
4256
4257 In some special cases, particularly when building $package for distribution,
4258 it is convenient to distinguish the directory in which files should be
4259 installed from the directory ($prefix) in which they will
4260 eventually reside.  For most users, these two directories are the same.
4261
4262 EOM
4263         case "$installprefix" in
4264         '') dflt=$prefix ;;
4265         *) dflt=$installprefix;;
4266         esac
4267 fi
4268 fn=d~
4269 rp='What installation prefix should I use for installing files?'
4270 . ./getfile
4271 installprefix="$ans"
4272 installprefixexp="$ansexp"
4273
4274 : Perform the prefixexp/installprefixexp correction if necessary
4275 cat <<EOS >installprefix
4276 $startsh
4277 EOS
4278 cat <<'EOSC' >>installprefix
4279 : Change installation prefix, if necessary.
4280 if $test X"$prefix" != X"$installprefix"; then
4281     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4282 else
4283     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4284 fi
4285 EOSC
4286 chmod +x installprefix
4287 $eunicefix installprefix
4288
4289 : Set variables such as privlib and privlibexp from the output of ./getfile
4290 : performing the prefixexp/installprefixexp correction if necessary.
4291 cat <<EOS >setprefixvar
4292 $startsh
4293 EOS
4294 cat <<'EOSC' >>setprefixvar
4295 eval "${prefixvar}=\"\$ans\""
4296 eval "${prefixvar}exp=\"\$ansexp\""
4297 . ./installprefix
4298 EOSC
4299 chmod +x setprefixvar
4300 $eunicefix setprefixvar
4301
4302 : set up the script used to warn in case of inconsistency
4303 cat <<EOS >whoa
4304 $startsh
4305 EOS
4306 cat <<'EOSC' >>whoa
4307 dflt=y
4308 case "$hint" in
4309     recommended)
4310         case "$hintfile" in
4311         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4312                 ;;
4313         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4314                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4315                 ;;
4316         esac
4317         ;;
4318     *)  echo " "
4319         echo "*** WHOA THERE!!! ***" >&4
4320         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4321         ;;
4322 esac
4323 rp="    Keep the $hint value?"
4324 . ./myread
4325 case "$ans" in
4326 y) td=$was; tu=$was;;
4327 esac
4328 EOSC
4329
4330 : function used to set '$1' to '$val'
4331 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4332 case "$val$was" in
4333 $define$undef) . ./whoa; eval "$var=\$td";;
4334 $undef$define) . ./whoa; eval "$var=\$tu";;
4335 *) eval "$var=$val";;
4336 esac'
4337
4338 : get the patchlevel
4339 echo " "
4340 echo "Getting the current patchlevel..." >&4
4341 if $test -r $rsrc/patchlevel.h;then
4342         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4343         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4344         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4345         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4346         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4347         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4348         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4349 else
4350         revision=0
4351         patchlevel=0
4352         subversion=0
4353         api_revision=0
4354         api_version=0
4355         api_subversion=0
4356         perl_patchlevel=0
4357         $echo "(You do not have patchlevel.h.  Eek.)"
4358 fi
4359 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4360 version_patchlevel_string="version $patchlevel subversion $subversion"
4361 case "$perl_patchlevel" in
4362 0|'') ;;
4363 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4364     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4365     ;;
4366 esac
4367
4368 $echo "(You have $package $version_patchlevel_string.)"
4369
4370 case "$osname" in
4371 dos|vms)
4372         : XXX Should be a Configure test for double-dots in filenames.
4373         version=`echo $revision $patchlevel $subversion | \
4374                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4375         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4376                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4377         ;;
4378 *)
4379         version=`echo $revision $patchlevel $subversion | \
4380                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4381         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4382                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4383         ;;
4384 esac
4385 : Special case the 5.005_xx maintenance series, which used 5.005
4386 : without any subversion label as a subdirectory in $sitelib
4387 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4388         api_versionstring='5.005'
4389 fi
4390
4391 : Do we want threads support and if so, what type
4392 case "$usethreads" in
4393 $define|true|[yY]*)     dflt='y';;
4394 *)     # Catch case where user specified ithreads or 5005threads but
4395        # forgot -Dusethreads (A.D. 4/2002)
4396        case "$useithreads$use5005threads" in
4397        *$define*)       dflt='y';;
4398        *)               dflt='n';;
4399        esac
4400        ;;
4401 esac
4402 cat <<EOM
4403
4404 Perl can be built to offer a form of threading support on some systems
4405 To do so, Configure can be run with -Dusethreads.
4406
4407 Note that Perl built with threading support runs slightly slower
4408 and uses slightly more memory than plain Perl.
4409
4410 If this doesn't make any sense to you, just accept the default '$dflt'.
4411 EOM
4412 rp='Build a threading Perl?'
4413 . ./myread
4414 case "$ans" in
4415 y|Y)    val="$define" ;;
4416 *)      val="$undef" ;;
4417 esac
4418 set usethreads
4419 eval $setvar
4420
4421 if $test $patchlevel -lt 9; then
4422     case "$usethreads" in
4423     $define)
4424         : Default to ithreads unless overridden on command line or with
4425         : old config.sh
4426         dflt='y'
4427         case "$use5005threads" in
4428                 $define|true|[yY]*)
4429                         echo "5.005 threads are no longer supported"
4430                         exit 1
4431                 ;;
4432         esac
4433         case "$useithreads" in
4434                 $undef|false|[nN]*) dflt='n';;
4435         esac
4436         rp='Use the newer interpreter-based ithreads?'
4437         . ./myread
4438         case "$ans" in
4439         y|Y)    val="$define" ;;
4440         *)      val="$undef" ;;
4441         esac
4442         set useithreads
4443         eval $setvar
4444         : Now set use5005threads to the opposite value.
4445         case "$useithreads" in
4446         $define) val="$undef" ;;
4447         *) val="$define" ;;
4448         esac
4449         set use5005threads
4450         eval $setvar
4451         ;;
4452     *)
4453         useithreads="$undef"
4454         use5005threads="$undef"
4455         ;;
4456     esac
4457
4458     case "$useithreads$use5005threads" in
4459     "$define$define")
4460         $cat >&4 <<EOM
4461
4462 You cannot have both the ithreads and the 5.005 threads enabled
4463 at the same time.  Disabling the 5.005 threads since they are
4464 much less stable than the ithreads.
4465
4466 EOM
4467         use5005threads="$undef"
4468         ;;
4469     esac
4470
4471 else
4472 : perl-5.9.x and later
4473
4474     if test X"$usethreads" = "X$define"; then
4475         case "$use5005threads" in
4476             $define|true|[yY]*)
4477                 $cat >&4 <<EOM
4478
4479 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4480
4481 EOM
4482             ;;
4483         esac
4484     fi
4485
4486     use5005threads="$undef"
4487     useithreads="$usethreads"
4488 fi
4489
4490 case "$d_oldpthreads" in
4491 '')     : Configure tests would be welcome here.  For now, assume undef.
4492         val="$undef" ;;
4493 *)      val="$d_oldpthreads" ;;
4494 esac
4495 set d_oldpthreads
4496 eval $setvar
4497
4498
4499 : Look for a hint-file generated 'call-back-unit'.  If the
4500 : user has specified that a threading perl is to be built,
4501 : we may need to set or change some other defaults.
4502 if $test -f usethreads.cbu; then
4503     echo "Your platform has some specific hints regarding threaded builds, using them..."
4504     . ./usethreads.cbu
4505 else
4506     case "$usethreads" in
4507         "$define"|true|[yY]*)
4508                 $cat <<EOM
4509 (Your platform does not have any specific hints for threaded builds.
4510  Assuming POSIX threads, then.)
4511 EOM
4512         ;;
4513     esac
4514 fi
4515
4516 : Check if multiplicity is required
4517 cat <<EOM
4518
4519 Perl can be built so that multiple Perl interpreters can coexist
4520 within the same Perl executable.
4521 EOM
4522
4523 case "$useithreads" in
4524 $define)
4525         cat <<EOM
4526 This multiple interpreter support is required for interpreter-based threads.
4527 EOM
4528         val="$define"
4529         ;;
4530 *)      case "$usemultiplicity" in
4531         $define|true|[yY]*)     dflt='y';;
4532         *) dflt='n';;
4533         esac
4534         echo " "
4535         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4536         rp='Build Perl for multiplicity?'
4537         . ./myread
4538         case "$ans" in
4539         y|Y)    val="$define" ;;
4540         *)      val="$undef" ;;
4541         esac
4542         ;;
4543 esac
4544 set usemultiplicity
4545 eval $setvar
4546
4547 : Check if morebits is requested
4548 case "$usemorebits" in
4549 "$define"|true|[yY]*)
4550         use64bitint="$define"
4551         uselongdouble="$define"
4552         usemorebits="$define"
4553         ;;
4554 *)      usemorebits="$undef"
4555         ;;
4556 esac
4557
4558 : Determine the C compiler to be used
4559 echo " "
4560 case "$cc" in
4561 '') dflt=cc;;
4562 *) dflt="$cc";;
4563 esac
4564 rp="Use which C compiler?"
4565 . ./myread
4566 cc="$ans"
4567
4568 : See whether they have no cc but they do have gcc
4569 . ./trygcc
4570 if $test -f cc.cbu; then
4571     . ./cc.cbu
4572 fi
4573 . ./checkcc
4574
4575 : make some quick guesses about what we are up against
4576 echo " "
4577 $echo $n "Hmm...  $c"
4578 echo exit 1 >bsd
4579 echo exit 1 >usg
4580 echo exit 1 >v7
4581 echo exit 1 >osf1
4582 echo exit 1 >eunice
4583 echo exit 1 >xenix
4584 echo exit 1 >venix
4585 echo exit 1 >os2
4586 d_bsd="$undef"
4587 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4588 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4589 then
4590         echo "Looks kind of like an OSF/1 system, but we'll see..."
4591         echo exit 0 >osf1
4592 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4593         xxx=`./loc addbib blurfl $pth`
4594         if $test -f $xxx; then
4595         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4596                 echo exit 0 >bsd
4597                 echo exit 0 >usg
4598         else
4599                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4600                         echo "Looks kind of like an extended USG system, but we'll see..."
4601                 else
4602                         echo "Looks kind of like a USG system, but we'll see..."
4603                 fi
4604                 echo exit 0 >usg
4605         fi
4606 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4607         echo "Looks kind of like a BSD system, but we'll see..."
4608         d_bsd="$define"
4609         echo exit 0 >bsd
4610 else
4611         echo "Looks kind of like a Version 7 system, but we'll see..."
4612         echo exit 0 >v7
4613 fi
4614 case "$eunicefix" in
4615 *unixtovms*)
4616         $cat <<'EOI'
4617 There is, however, a strange, musty smell in the air that reminds me of
4618 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4619 EOI
4620         echo exit 0 >eunice
4621         d_eunice="$define"
4622 : it so happens the Eunice I know will not run shell scripts in Unix format
4623         ;;
4624 *)
4625         echo " "
4626         echo "Congratulations.  You aren't running Eunice."
4627         d_eunice="$undef"
4628         ;;
4629 esac
4630 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4631 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4632 : semicolon as a patch separator
4633 case "$p_" in
4634 :) ;;
4635 *)
4636         $cat <<'EOI'
4637 I have the feeling something is not exactly right, however...don't tell me...
4638 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4639 (Or you may be running DOS with DJGPP.)
4640 EOI
4641         echo exit 0 >os2
4642         ;;
4643 esac
4644 if test -f /xenix; then
4645         echo "Actually, this looks more like a XENIX system..."
4646         echo exit 0 >xenix
4647         d_xenix="$define"
4648 else
4649         echo " "
4650         echo "It's not Xenix..."
4651         d_xenix="$undef"
4652 fi
4653 chmod +x xenix
4654 $eunicefix xenix
4655 if test -f /venix; then
4656         echo "Actually, this looks more like a VENIX system..."
4657         echo exit 0 >venix
4658 else
4659         echo " "
4660         if ./xenix; then
4661                 : null
4662         else
4663                 echo "Nor is it Venix..."
4664         fi
4665 fi
4666 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4667 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4668 $rm -f foo
4669
4670 : Check if we are using GNU gcc and what its version is
4671 echo " "
4672 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4673 $cat >try.c <<EOM
4674 #include <stdio.h>
4675 int main() {
4676 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4677 #ifdef __VERSION__
4678         printf("%s\n", __VERSION__);
4679 #else
4680         printf("%s\n", "1");
4681 #endif
4682 #endif
4683         return(0);
4684 }
4685 EOM
4686 if $cc -o try $ccflags $ldflags try.c; then
4687         gccversion=`$run ./try`
4688         case "$gccversion" in
4689         '') echo "You are not using GNU cc." ;;
4690         *)  echo "You are using GNU cc $gccversion."
4691             ccname=gcc
4692             ;;
4693         esac
4694 else
4695         echo " "
4696         echo "*** WHOA THERE!!! ***" >&4
4697         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4698         case "$knowitall" in
4699         '')
4700         echo "    You'd better start hunting for one and let me know about it." >&4
4701                 exit 1
4702                 ;;
4703         esac
4704 fi
4705 $rm -f try try.*
4706 case "$gccversion" in
4707 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4708 esac
4709 case "$gccversion" in
4710 '') gccosandvers='' ;;
4711 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4712    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4713    gccshortvers=''
4714    case "$gccosandvers" in
4715    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4716    $osname$osvers) ;; # looking good
4717    $osname*) cat <<EOM >&4
4718
4719 *** WHOA THERE!!! ***
4720
4721     Your gcc has not been compiled for the exact release of
4722     your operating system ($gccosandvers versus $osname$osvers).
4723
4724     In general it is a good idea to keep gcc synchronized with
4725     the operating system because otherwise serious problems
4726     may ensue when trying to compile software, like Perl.
4727
4728     I'm trying to be optimistic here, though, and will continue.
4729     If later during the configuration and build icky compilation
4730     problems appear (headerfile conflicts being the most common
4731     manifestation), I suggest reinstalling the gcc to match
4732     your operating system release.
4733
4734 EOM
4735       ;;
4736    *) gccosandvers='' ;; # failed to parse, better be silent
4737    esac
4738    ;;
4739 esac
4740 case "$ccname" in
4741 '') ccname="$cc" ;;
4742 esac
4743
4744 # gcc 3.* complain about adding -Idirectories that they already know about,
4745 # so we will take those off from locincpth.
4746 case "$gccversion" in
4747 3.*)
4748     echo "main(){}">try.c
4749     for incdir in $locincpth; do
4750        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4751              grep '^c[cp]p*[01]: warning: changing search order '`
4752        if test "X$warn" != X; then
4753            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4754        fi
4755     done
4756     $rm -f try try.*
4757 esac
4758
4759 # gcc 4.9 by default does some optimizations that break perl.
4760 # see ticket 121505.
4761 #
4762 # The -fwrapv disables those optimizations (and probably others,) so
4763 # for gcc 4.9 (and later, since the optimizations probably won't go
4764 # away), add -fwrapv unless the user requests -fno-wrapv, which
4765 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4766 # which turns the overflows -fwrapv ignores into runtime errors.
4767 case "$gccversion" in
4768 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4769     case "$ccflags" in
4770     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4771     *) ccflags="$ccflags -fwrapv" ;;
4772     esac
4773 esac
4774
4775 : What should the include directory be ?
4776 : Use sysroot if set, so findhdr looks in the right place.
4777 echo " "
4778 $echo $n "Hmm...  $c"
4779 dflt="$sysroot/usr/include"
4780 incpath=''
4781 mips_type=''
4782 if $test -f /bin/mips && /bin/mips; then
4783         echo "Looks like a MIPS system..."
4784         $cat >usr.c <<'EOCP'
4785 #ifdef SYSTYPE_BSD43
4786 /bsd43
4787 #endif
4788 EOCP
4789         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4790                 dflt='/bsd43/usr/include'
4791                 incpath='/bsd43'
4792                 mips_type='BSD 4.3'
4793         else
4794                 mips_type='System V'
4795         fi
4796         $rm -f usr.c usr.out
4797         echo "and you're compiling with the $mips_type compiler and libraries."
4798         xxx_prompt=y
4799         echo "exit 0" >mips
4800 else
4801         echo "Doesn't look like a MIPS system."
4802         xxx_prompt=n
4803         echo "exit 1" >mips
4804 fi
4805 chmod +x mips
4806 $eunicefix mips
4807 case "$usrinc" in
4808 '') ;;
4809 *) dflt="$usrinc";;
4810 esac
4811 case "$xxx_prompt" in
4812 y)      fn=d/
4813         echo " "
4814         rp='Where are the include files you want to use?'
4815         . ./getfile
4816         usrinc="$ans"
4817         ;;
4818 *)      usrinc="$dflt"
4819         ;;
4820 esac
4821
4822 : see how we invoke the C preprocessor
4823 echo " "
4824 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4825 cat <<'EOT' >testcpp.c
4826 #define ABC abc
4827 #define XYZ xyz
4828 ABC.XYZ
4829 EOT
4830 cd ..
4831 if test ! -f cppstdin; then
4832         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4833                 # AIX cc -E doesn't show the absolute headerfile
4834                 # locations but we'll cheat by using the -M flag.
4835                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4836         else
4837                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4838         fi
4839 else
4840         echo "Keeping your $hint cppstdin wrapper."
4841 fi
4842 chmod 755 cppstdin
4843 wrapper=`pwd`/cppstdin
4844 ok='false'
4845 cd UU
4846
4847 if $test "X$cppstdin" != "X" && \
4848         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4850 then
4851         echo "You used to use $cppstdin $cppminus so we'll use that again."
4852         case "$cpprun" in
4853         '') echo "But let's see if we can live without a wrapper..." ;;
4854         *)
4855                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4856                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4857                 then
4858                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4859                         ok='true'
4860                 else
4861                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4862                 fi
4863                 ;;
4864         esac
4865 else
4866         case "$cppstdin" in
4867         '') ;;
4868         *)
4869                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4870                 ;;
4871         esac
4872 fi
4873
4874 if $ok; then
4875         : nothing
4876 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4877         $cc -E <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "Yup, it does."
4880         x_cpp="$cc $cppflags -E"
4881         x_minus='';
4882 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4883         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4884         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4885         echo "Yup, it does."
4886         x_cpp="$cc $cppflags -E"
4887         x_minus='-';
4888 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4889         $cc -P <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         echo "Yipee, that works!"
4892         x_cpp="$cc $cppflags -P"
4893         x_minus='';
4894 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4895         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4896         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4897         echo "At long last!"
4898         x_cpp="$cc $cppflags -P"
4899         x_minus='-';
4900 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4901         $cpp <testcpp.c >testcpp.out 2>&1; \
4902         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903         echo "It works!"
4904         x_cpp="$cpp $cppflags"
4905         x_minus='';
4906 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4907         $cpp - <testcpp.c >testcpp.out 2>&1; \
4908         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4909         echo "Hooray, it works!  I was beginning to wonder."
4910         x_cpp="$cpp $cppflags"
4911         x_minus='-';
4912 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4913         $wrapper <testcpp.c >testcpp.out 2>&1; \
4914         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4915         x_cpp="$wrapper"
4916         x_minus=''
4917         echo "Eureka!"
4918 else
4919         dflt=''
4920         rp="No dice.  I can't find a C preprocessor.  Name one:"
4921         . ./myread
4922         x_cpp="$ans"
4923         x_minus=''
4924         $x_cpp <testcpp.c >testcpp.out 2>&1
4925         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4926                 echo "OK, that will do." >&4
4927         else
4928 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4929                 exit 1
4930         fi
4931 fi
4932
4933 case "$ok" in
4934 false)
4935         cppstdin="$x_cpp"
4936         cppminus="$x_minus"
4937         cpprun="$x_cpp"
4938         cpplast="$x_minus"
4939         set X $x_cpp
4940         shift
4941         case "$1" in
4942         "$cpp")
4943                 echo "Perhaps can we force $cc -E using a wrapper..."
4944                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4945                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4946                 then
4947                         echo "Yup, we can."
4948                         cppstdin="$wrapper"
4949                         cppminus='';
4950                 else
4951                         echo "Nope, we'll have to live without it..."
4952                 fi
4953                 ;;
4954         esac
4955         case "$cpprun" in
4956         "$wrapper")
4957                 cpprun=''
4958                 cpplast=''
4959                 ;;
4960         esac
4961         ;;
4962 esac
4963
4964 case "$cppstdin" in
4965 "$wrapper"|'cppstdin') ;;
4966 *) $rm -f $wrapper;;
4967 esac
4968 $rm -f testcpp.c testcpp.out
4969
4970 : Adjust cppfilter for path component separator
4971 case "$osname" in
4972 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4973 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4974 *)   cppfilter='' ;;
4975 esac
4976
4977 : Use gcc to determine libpth and incpth
4978 # If using gcc or clang, we can get better values for libpth, incpth
4979 # and usrinc directly from the compiler.
4980 # Note that ccname for clang is also gcc.
4981 case "$ccname" in
4982     gcc)
4983         $echo 'extern int foo;' > try.c
4984         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4985         shift
4986         if $test $# -gt 0; then
4987             incpth="$incpth $*"
4988             incpth="`$echo $incpth|$sed 's/^ //'`"
4989             for i in $*; do
4990                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4991                 if $test -d $j; then
4992                     libpth="$libpth $j"
4993                 fi
4994             done
4995             libpth="`$echo $libpth|$sed 's/^ //'`"
4996             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4997                 if $test -d $xxx; then
4998                     case " $libpth " in
4999                     *" $xxx "*) ;;
5000                     *) libpth="$libpth $xxx";;
5001                     esac
5002                 fi
5003             done
5004         fi
5005         $rm -f try.c
5006         case "$usrinc" in
5007         '') for i in $incpth; do
5008                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5009                     usrinc="$i"
5010                     break
5011                 fi
5012             done
5013             ;;
5014         esac
5015
5016         case "$usecrosscompile" in
5017         $define|true|[yY]*)
5018             case "$incpth" in
5019                 '') echo "Incpth not defined." >&4; croak=y ;;
5020                 *)  echo "Using incpth '$incpth'." >&4 ;;
5021             esac
5022             case "$libpth" in
5023                 '') echo "Libpth not defined." >&4; croak=y ;;
5024                 *)  echo "Using libpth '$libpth'." >&4 ;;
5025             esac
5026             case "$usrinc" in
5027                 '') echo "Usrinc not defined." >&4; croak=y ;;
5028                 *)  echo "Using usrinc $usrinc." >&4 ;;
5029             esac
5030             case "$croak" in
5031                 y)
5032                 if test "X$sysroot" = X; then
5033                     echo "Cannot continue, aborting." >&4; exit 1
5034                 else
5035                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5036                 fi
5037                 ;;
5038             esac
5039             ;;
5040         esac
5041     ;;
5042 esac
5043
5044 : Default value for incpth is just usrinc
5045 case "$incpth" in
5046 '') incpth="$usrinc";;
5047 esac
5048
5049 : Set private lib path
5050 case "$plibpth" in
5051 '') if ./mips; then
5052         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5053     fi;;
5054 esac
5055 case "$libpth" in
5056 ' ') dlist='';;
5057 '') dlist="$loclibpth $plibpth $glibpth";;
5058 *) dlist="$libpth";;
5059 esac
5060
5061 : Now check and see which directories actually exist, avoiding duplicates
5062 for xxx in $dlist
5063 do
5064     if $test -d $xxx; then
5065                 case " $libpth " in
5066                 *" $xxx "*) ;;
5067                 *) libpth="$libpth $xxx";;
5068                 esac
5069     fi
5070 done
5071 $cat <<'EOM'
5072
5073 Some systems have incompatible or broken versions of libraries.  Among
5074 the directories listed in the question below, please remove any you
5075 know not to be holding relevant libraries, and add any that are needed.
5076 Say "none" for none.
5077
5078 EOM
5079
5080 if test "X$sysroot" != X; then
5081     $cat <<EOM
5082 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5083
5084 EOM
5085 fi
5086
5087 case "$libpth" in
5088 '') dflt='none';;
5089 *)
5090         set X $libpth
5091         shift
5092         dflt=${1+"$@"}
5093         ;;
5094 esac
5095 rp="Directories to use for library searches?"
5096 . ./myread
5097 case "$ans" in
5098 none) libpth=' ';;
5099 *) libpth="$ans";;
5100 esac
5101
5102 : compute shared library extension
5103 case "$so" in
5104 '')
5105         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5106                 dflt='sl'
5107         else
5108                 dflt='so'
5109         fi
5110         ;;
5111 *) dflt="$so";;
5112 esac
5113 $cat <<EOM
5114
5115 On some systems, shared libraries may be available.  Answer 'none' if
5116 you want to suppress searching of shared libraries for the remainder
5117 of this configuration.
5118
5119 EOM
5120 rp='What is the file extension used for shared libraries?'
5121 . ./myread
5122 so="$ans"
5123
5124 : Does target system insist that shared library basenames are unique
5125 $cat << EOM
5126
5127 Some dynamic loaders assume that the *basename* of shared library filenames
5128 are globally unique.  We'll default this to undef as we assume your system
5129 is not this weird. Set to defined if you're on one of them.
5130
5131 EOM
5132
5133 dflt='n'
5134 rp='Make shared library basenames unique?'
5135 . ./myread
5136 case "$ans" in
5137 y|Y) val="$define" ;;
5138 *)   val="$undef"  ;;
5139 esac
5140 set d_libname_unique
5141 eval $setvar
5142
5143 : Define several unixisms.
5144 : Hints files or command line option can be used to override them.
5145 : The convoluted testing is in case hints files set either the old
5146 : or the new name.
5147 case "$_exe" in
5148 '')     case "$exe_ext" in
5149         '')     ;;
5150         *)      _exe="$exe_ext" ;;
5151         esac
5152         ;;
5153 esac
5154 case "$_a" in
5155 '')     case "$lib_ext" in
5156     '') _a='.a';;
5157         *)      _a="$lib_ext" ;;
5158         esac
5159         ;;
5160 esac
5161 case "$_o" in
5162 '') case "$obj_ext" in
5163         '')     _o='.o';;
5164         *)      _o="$obj_ext";;
5165         esac
5166         ;;
5167 esac
5168 case "$p_" in
5169 '') case "$path_sep" in
5170         '')     p_=':';;
5171         *)      p_="$path_sep";;
5172         esac
5173         ;;
5174 esac
5175 exe_ext=$_exe
5176 lib_ext=$_a
5177 obj_ext=$_o
5178 path_sep=$p_
5179
5180 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5181
5182 : Which makefile gets called first.  This is used by make depend.
5183 case "$firstmakefile" in
5184 '') firstmakefile='makefile';;
5185 esac
5186
5187 : Check is we will use socks
5188 case "$usesocks" in
5189 $define|true|[yY]*)     dflt='y';;
5190 *) dflt='n';;
5191 esac
5192 cat <<EOM
5193
5194 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5195 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5196 to use the PerlIO abstraction layer, this will be implicitly selected.
5197
5198 If this doesn't make any sense to you, just accept the default '$dflt'.
5199 EOM
5200 rp='Build Perl for SOCKS?'
5201 . ./myread
5202 case "$ans" in
5203 y|Y)    val="$define" ;;
5204 *)      val="$undef" ;;
5205 esac
5206 set usesocks
5207 eval $setvar
5208
5209 : Check for uselongdouble support
5210 case "$ccflags" in
5211 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5212 esac
5213
5214 case "$uselongdouble" in
5215 $define|true|[yY]*)     dflt='y';;
5216 *) dflt='n';;
5217 esac
5218 cat <<EOM
5219
5220 Perl can be built to take advantage of long doubles which
5221 (if available) may give more accuracy and range for floating point numbers.
5222
5223 If this doesn't make any sense to you, just accept the default '$dflt'.
5224 EOM
5225 rp='Try to use long doubles if available?'
5226 . ./myread
5227 case "$ans" in
5228 y|Y)    val="$define"   ;;
5229 *)      val="$undef"    ;;
5230 esac
5231 set uselongdouble
5232 eval $setvar
5233
5234 case "$uselongdouble" in
5235 true|[yY]*) uselongdouble="$define" ;;
5236 esac
5237
5238 : Look for a hint-file generated 'call-back-unit'.  If the
5239 : user has specified that long doubles should be used,
5240 : we may need to set or change some other defaults.
5241 if $test -f uselongdouble.cbu; then
5242     echo "Your platform has some specific hints regarding long doubles, using them..."
5243     . ./uselongdouble.cbu
5244 else
5245     case "$uselongdouble" in
5246         $define)
5247                 $cat <<EOM
5248 (Your platform does not have any specific hints for long doubles.)
5249 EOM
5250         ;;
5251     esac
5252 fi
5253
5254 : Check if quadmath is requested
5255 case "$usequadmath" in
5256 "$define"|true|[yY]*) usequadmath="$define" ;;
5257 *)                    usequadmath="$undef"  ;;
5258 esac
5259
5260 : Fail if both uselongdouble and usequadmath are requested
5261 case "$usequadmath:$uselongdouble" in
5262 define:define)
5263         $cat <<EOM >&4
5264
5265 *** You requested the use of the quadmath library and use
5266 *** of long doubles.
5267 ***
5268 *** Please select one or the other.
5269 EOM
5270         exit 1
5271         ;;
5272 esac
5273
5274 : Looking for optional libraries
5275 echo " "
5276 echo "Checking for optional libraries..." >&4
5277 case "$libs" in
5278 ' '|'') dflt='';;
5279 *) dflt="$libs";;
5280 esac
5281 case "$libswanted" in
5282 '') libswanted='c_s';;
5283 esac
5284 case "$usesocks" in
5285 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5286 esac
5287 case "$usecbacktrace" in
5288 "$define") libswanted="$libswanted bfd" ;;
5289 esac
5290 case "$usequadmath" in
5291 "$define") libswanted="$libswanted quadmath" ;;
5292 esac
5293 libsfound=''
5294 libsfiles=''
5295 libsdirs=''
5296 libspath=''
5297 for thisdir in $libpth $xlibpth; do
5298   test -d $thisdir && libspath="$libspath $thisdir"
5299 done
5300 for thislib in $libswanted; do
5301         for thisdir in $libspath; do
5302             xxx=''
5303             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5304                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=shared
5307                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=shared
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/lib$thislib.$so
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=shared
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/lib$thislib$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320             fi
5321             if test ! -f "$xxx"; then
5322                 xxx=$thisdir/$thislib$_a
5323                 $test -f "$xxx" && eval $libscheck
5324                 $test -f "$xxx" && libstyle=static
5325             fi
5326             if test ! -f "$xxx"; then
5327                 xxx=$thisdir/lib${thislib}_s$_a
5328                 $test -f "$xxx" && eval $libscheck
5329                 $test -f "$xxx" && libstyle=static
5330                 $test -f "$xxx" && thislib=${thislib}_s
5331             fi
5332             if test ! -f "$xxx"; then
5333                 xxx=$thisdir/Slib$thislib$_a
5334                 $test -f "$xxx" && eval $libscheck
5335                 $test -f "$xxx" && libstyle=static
5336             fi
5337             if $test -f "$xxx"; then
5338                 case "$libstyle" in
5339                 shared) echo "Found -l$thislib (shared)." ;;
5340                 static) echo "Found -l$thislib." ;;
5341                 *)      echo "Found -l$thislib ($libstyle)." ;;
5342                 esac
5343                 case " $dflt " in
5344                 *"-l$thislib "*);;
5345                 *) dflt="$dflt -l$thislib"
5346                    libsfound="$libsfound $xxx"
5347                    yyy=`basename $xxx`
5348                    libsfiles="$libsfiles $yyy"
5349                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5350                    case " $libsdirs " in
5351                    *" $yyy "*) ;;
5352                    *) libsdirs="$libsdirs $yyy" ;;
5353                    esac
5354                    ;;
5355                 esac
5356                 break
5357             fi
5358         done
5359         if $test ! -f "$xxx"; then
5360             echo "No -l$thislib."
5361         fi
5362 done
5363 set X $dflt
5364 shift
5365 dflt="$*"
5366 case "$libs" in
5367 '') dflt="$dflt";;
5368 *) dflt="$libs";;
5369 esac
5370 case "$dflt" in
5371 ' '|'') dflt='none';;
5372 esac
5373
5374 $cat <<EOM
5375
5376 In order to compile $package on your machine, a number of libraries
5377 are usually needed.  Include any other special libraries here as well.
5378 Say "none" for none.  The default list is almost always right.
5379 EOM
5380
5381 echo " "
5382 rp="What libraries to use?"
5383 . ./myread
5384 case "$ans" in
5385 none) libs=' ';;
5386 *) libs="$ans";;
5387 esac
5388
5389 : determine optimization, if desired, or use for debug flag also
5390 case "$optimize" in
5391 ' '|$undef) dflt='none';;
5392 '') dflt='-O';;
5393 *) dflt="$optimize";;
5394 esac
5395 $cat <<EOH
5396
5397 By default, $package compiles with the -O flag to use the optimizer.
5398 Alternately, you might want to use the symbolic debugger, which uses
5399 the -g flag (on traditional Unix systems).  Either flag can be
5400 specified here.  To use neither flag, specify the word "none".
5401
5402 EOH
5403 rp="What optimizer/debugger flag should be used?"
5404 . ./myread
5405 optimize="$ans"
5406 case "$optimize" in
5407 'none') optimize=" ";;
5408 esac
5409
5410 : Check what DEBUGGING is required from the command line
5411 : -DEBUGGING      or -DDEBUGGING or
5412 : -DEBUGGING=both                       = -g + -DDEBUGGING
5413 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5414 : -DEBUGGING=none or -UDEBUGGING        =
5415 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5416 case "$EBUGGING" in
5417 '')     ;;
5418 *)      DEBUGGING=$EBUGGING ;;
5419 esac
5420
5421 case "$DEBUGGING" in
5422 -g|both|$define)
5423     case "$optimize" in
5424         *-g*) ;;
5425         *)    optimize="$optimize -g" ;;
5426     esac ;;
5427 none|$undef)
5428     case "$optimize" in
5429         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5430                 shift
5431                 optimize="$*"
5432                 ;;
5433     esac ;;
5434 esac
5435
5436 dflt=''
5437 case "$DEBUGGING" in
5438 both|$define) dflt='-DDEBUGGING'
5439 esac
5440
5441 : argument order is deliberate, as the flag will start with - which set could
5442 : think is an option
5443 checkccflag='check=$1; flag=$2; callback=$3;
5444 echo " ";
5445 echo "Checking if your compiler accepts $flag" 2>&1;
5446 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5447 echo "int main(void) { return 0; }" > gcctest.c;
5448 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5449     echo "Yes, it does." 2>&1;
5450     if $test -s gcctest.out ; then
5451         echo "But your platform does not like it:";
5452         cat gcctest.out;
5453     else
5454         case "$ccflags" in
5455         *$check*)
5456             echo "Leaving current flags $ccflags alone." 2>&1
5457             ;;
5458         *) dflt="$dflt $flag";
5459             eval $callback
5460             ;;
5461         esac
5462     fi
5463 else
5464     echo "Nope, it does not, but that is ok." 2>&1;
5465 fi
5466 '
5467
5468 : We will not override a previous value, but we might want to
5469 : augment a hint file
5470 case "$hint" in
5471 default|recommended)
5472         case "$gccversion" in
5473         1.*) dflt="$dflt -fpcc-struct-return" ;;
5474         esac
5475         case "$optimize:$DEBUGGING" in
5476         *-g*:old) dflt="$dflt -DDEBUGGING";;
5477         esac
5478         case "$gccversion" in
5479         2.*) if $test -d /etc/conf/kconfig.d &&
5480                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5481                 then
5482                         # Interactive Systems (ISC) POSIX mode.
5483                         dflt="$dflt -posix"
5484                 fi
5485                 ;;
5486         esac
5487         case "$gccversion" in
5488         1.*) ;;
5489         2.[0-8]*) ;;
5490         ?*)     set strict-aliasing -fno-strict-aliasing
5491                 eval $checkccflag
5492                 ;;
5493         esac
5494         # For gcc, adding -pipe speeds up compilations for some, but apparently
5495         # some assemblers can't read from stdin.  (It also slows down compilations
5496         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5497         case "$gccversion" in
5498         ?*)     set pipe -pipe
5499                 eval $checkccflag
5500                 ;;
5501         esac
5502
5503         # on x86_64 (at least) we require an extra library (libssp) in the
5504         # link command line. This library is not named, so I infer that it is
5505         # an implementation detail that may change. Hence the safest approach
5506         # is to add the flag to the flags passed to the compiler at link time,
5507         # as that way the compiler can do the right implementation dependant
5508         # thing. (NWC)
5509         case "$osname" in
5510         amigaos) ;; # -fstack-protector builds but doesn't work
5511         *)      case "$gccversion" in
5512                 ?*)     set stack-protector-strong -fstack-protector-strong
5513                         eval $checkccflag
5514                         case "$dflt" in
5515                         *-fstack-protector-strong*) ;; # It got added.
5516                         *) # Try the plain/older -fstack-protector.
5517                            set stack-protector -fstack-protector
5518                            eval $checkccflag
5519                            ;;
5520                         esac
5521                         ;;
5522                 esac
5523                 ;;
5524         esac
5525         ;;
5526 esac
5527
5528 case "$mips_type" in
5529 *BSD*|'') inclwanted="$locincpth $usrinc";;
5530 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5531 esac
5532 for thisincl in $inclwanted; do
5533         if $test -d $thisincl; then
5534                 if $test x$thisincl != x$usrinc; then
5535                         case "$dflt" in
5536                         *" -I$thisincl "*);;
5537                         *) dflt="$dflt -I$thisincl ";;
5538                         esac
5539                 fi
5540         fi
5541 done
5542
5543 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5544         xxx=true;
5545 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5546         xxx=true;
5547 else
5548         xxx=false;
5549 fi;
5550 if $xxx; then
5551         case "$dflt" in
5552         *$2*);;
5553         *) dflt="$dflt -D$2";;
5554         esac;
5555 fi'
5556
5557 set signal.h LANGUAGE_C; eval $inctest
5558
5559 case "$usesocks" in
5560 $define)
5561         ccflags="$ccflags -DSOCKS"
5562         ;;
5563 esac
5564
5565 case "$hint" in
5566 default|recommended) dflt="$ccflags $dflt" ;;
5567 *) dflt="$ccflags";;
5568 esac
5569
5570 case "$dflt" in
5571 ''|' ') dflt=none;;
5572 esac
5573
5574 $cat <<EOH
5575
5576 Your C compiler may want other flags.  For this question you should include
5577 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5578 but you should NOT include libraries or ld flags like -lwhatever.  If you
5579 want $package to honor its debug switch, you should include -DDEBUGGING here.
5580 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5581
5582 To use no flags, specify the word "none".
5583
5584 EOH
5585 set X $dflt
5586 shift
5587 dflt=${1+"$@"}
5588 rp="Any additional cc flags?"
5589 . ./myread
5590 case "$ans" in
5591 none) ccflags='';;
5592 *) ccflags="$ans";;
5593 esac
5594
5595 : the following weeds options from ccflags that are of no interest to cpp
5596 case "$cppflags" in
5597 '') cppflags="$ccflags" ;;
5598 *)  set X $ccflags; shift
5599     case " $cppflags " in
5600     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5601     *) cppflags="$cppflags $ccflags" ;;
5602     esac
5603     ;;
5604 esac
5605 case "$gccversion" in
5606 1.*) cppflags="$cppflags -D__GNUC__"
5607 esac
5608 case "$mips_type" in
5609 '');;
5610 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5611 esac
5612 case "$cppflags" in
5613 '');;
5614 *)
5615         echo " "
5616         echo "Let me guess what the preprocessor flags are..." >&4
5617         set X $cppflags
5618         shift
5619         cppflags=''
5620         $cat >cpp.c <<'EOM'
5621 #define BLURFL foo
5622
5623 BLURFL xx LFRULB
5624 EOM
5625         previous=''
5626         for flag in $*
5627         do
5628                 case "$flag" in
5629                 -*) ftry="$flag";;
5630                 *) ftry="$previous $flag";;
5631                 esac
5632                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5633                         >cpp1.out 2>/dev/null && \
5634                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5635                         >cpp2.out 2>/dev/null && \
5636                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5637                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5638                 then
5639                         cppflags="$cppflags $ftry"
5640                         previous=''
5641                 else
5642                         previous="$flag"
5643                 fi
5644         done
5645         set X $cppflags
5646         shift
5647         cppflags=${1+"$@"}
5648         case "$cppflags" in
5649         *-*)  echo "They appear to be: $cppflags";;
5650         esac
5651         $rm -f cpp.c cpp?.out
5652         ;;
5653 esac
5654
5655 : flags used in final linking phase
5656 case "$ldflags" in
5657 '') if ./venix; then
5658                 dflt='-i -z'
5659         else
5660                 dflt=''
5661         fi
5662         case "$ccflags" in
5663         *-posix*) dflt="$dflt -posix" ;;
5664         esac
5665         ;;
5666 *) dflt="$ldflags";;
5667 esac
5668 # See note above about -fstack-protector
5669 case "$ccflags" in
5670 *-fstack-protector-strong*)
5671         case "$dflt" in
5672         *-fstack-protector-strong*) ;; # Don't add it again
5673         *) dflt="$dflt -fstack-protector-strong" ;;
5674         esac
5675         ;;
5676 *-fstack-protector*)
5677         case "$dflt" in
5678         *-fstack-protector*) ;; # Don't add it again
5679         *) dflt="$dflt -fstack-protector" ;;
5680         esac
5681         ;;
5682 esac
5683
5684 : Try to guess additional flags to pick up local libraries.
5685 for thislibdir in $libpth; do
5686         case " $loclibpth " in
5687         *" $thislibdir "*)
5688                 case "$dflt " in
5689                 *"-L$thislibdir "*) ;;
5690                 *)  dflt="$dflt -L$thislibdir" ;;
5691                 esac
5692                 ;;
5693         esac
5694 done
5695
5696 case "$dflt" in
5697 '') dflt='none' ;;
5698 esac
5699
5700 $cat <<EOH
5701
5702 Your C linker may need flags.  For this question you should
5703 include -L/whatever and any other flags used by the C linker, but you
5704 should NOT include libraries like -lwhatever.
5705
5706 Make sure you include the appropriate -L/path flags if your C linker
5707 does not normally search all of the directories you specified above,
5708 namely
5709         $libpth
5710 To use no flags, specify the word "none".
5711
5712 EOH
5713
5714 rp="Any additional ld flags (NOT including libraries)?"
5715 . ./myread
5716 case "$ans" in
5717 none) ldflags='';;
5718 *) ldflags="$ans";;
5719 esac
5720 rmlist="$rmlist pdp11"
5721
5722 : coherency check
5723 echo " "
5724 echo "Checking your choice of C compiler and flags for coherency..." >&4
5725 $cat > try.c <<'EOF'
5726 #include <stdio.h>
5727 int main() { printf("Ok\n"); return(0); }
5728 EOF
5729 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5730 shift
5731 $cat >try.msg <<'EOM'
5732 I've tried to compile and run the following simple program:
5733
5734 EOM
5735 $cat try.c >> try.msg
5736
5737 $cat >> try.msg <<EOM
5738
5739 I used the command:
5740
5741         $*
5742         $run ./try
5743
5744 and I got the following output:
5745
5746 EOM
5747 dflt=y
5748 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5749         if $sh -c "$run ./try " >>try.msg 2>&1; then
5750                 xxx=`$run ./try`
5751                 case "$xxx" in
5752                 "Ok") dflt=n ;;
5753                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5754                 esac
5755         else
5756                 echo "The program compiled OK, but exited with status $?." >>try.msg
5757                 rp="You have a problem.  Shall I abort Configure"
5758                 dflt=y
5759         fi
5760 else
5761         echo "I can't compile the test program." >>try.msg
5762         rp="You have a BIG problem.  Shall I abort Configure"
5763         dflt=y
5764 fi
5765 case "$dflt" in
5766 y)
5767         $cat try.msg >&4
5768         case "$knowitall" in
5769         '')
5770                 echo "(The supplied flags or libraries might be incorrect.)"
5771                 ;;
5772         *) dflt=n;;
5773         esac
5774         echo " "
5775         . ./myread
5776         case "$ans" in
5777         n*|N*) ;;
5778         *)      echo "Ok.  Stopping Configure." >&4
5779                 exit 1
5780                 ;;
5781         esac
5782         ;;
5783 n) echo "OK, that should do.";;
5784 esac
5785 $rm_try gcctest gcctest.out
5786
5787 : define a shorthand compile call
5788 compile='
5789 mc_file=$1;
5790 shift;
5791 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5792 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5793 exit 1;
5794 fi;
5795 esac;
5796 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5797 : define a shorthand compile call for compilations that should be ok.
5798 compile_ok='
5799 mc_file=$1;
5800 shift;
5801 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5802
5803 : stub, used only to satisfy other units
5804 i_stdlib='define'
5805
5806 : check for lengths of integral types
5807 echo " "
5808 case "$intsize" in
5809 '')
5810         echo "Checking to see how big your integers are..." >&4
5811         $cat >try.c <<EOCP
5812 #include <stdio.h>
5813 #$i_stdlib I_STDLIB
5814 #ifdef I_STDLIB
5815 #include <stdlib.h>
5816 #endif
5817 int main()
5818 {
5819         printf("intsize=%d;\n", (int)sizeof(int));
5820         printf("longsize=%d;\n", (int)sizeof(long));
5821         printf("shortsize=%d;\n", (int)sizeof(short));
5822         exit(0);
5823 }
5824 EOCP
5825         set try
5826         if eval $compile_ok && $run ./try > /dev/null; then
5827                 eval `$run ./try`
5828                 echo "Your integers are $intsize bytes long."
5829                 echo "Your long integers are $longsize bytes long."
5830                 echo "Your short integers are $shortsize bytes long."
5831         else
5832                 $cat >&4 <<EOM
5833 !
5834 Help! I can't compile and run the intsize test program: please enlighten me!
5835 (This is probably a misconfiguration in your system or libraries, and
5836 you really ought to fix it.  Still, I'll try anyway.)
5837 !
5838 EOM
5839                 dflt=4
5840                 rp="What is the size of an integer (in bytes)?"
5841                 . ./myread
5842                 intsize="$ans"
5843                 dflt=$intsize
5844                 rp="What is the size of a long integer (in bytes)?"
5845                 . ./myread
5846                 longsize="$ans"
5847                 dflt=2
5848                 rp="What is the size of a short integer (in bytes)?"
5849                 . ./myread
5850                 shortsize="$ans"
5851         fi
5852         ;;
5853 esac
5854 $rm_try
5855
5856 : check for long long
5857 echo " "
5858 echo "Checking to see if you have long long..." >&4
5859 echo 'int main() { long long x = 7; return 0; }' > try.c
5860 set try
5861 if eval $compile; then
5862         val="$define"
5863         echo "You have long long."
5864 else
5865         val="$undef"
5866         echo "You do not have long long."
5867 fi
5868 $rm_try
5869 set d_longlong
5870 eval $setvar
5871
5872 : check for length of long long
5873 case "${d_longlong}${longlongsize}" in
5874 $define)
5875         echo " "
5876         echo "Checking to see how big your long longs are..." >&4
5877         $cat >try.c <<'EOCP'
5878 #include <stdio.h>
5879 int main()
5880 {
5881     printf("%d\n", (int)sizeof(long long));
5882     return(0);
5883 }
5884 EOCP
5885         set try
5886         if eval $compile_ok; then
5887                 longlongsize=`$run ./try`
5888                 echo "Your long longs are $longlongsize bytes long."
5889         else
5890                 dflt='8'
5891                 echo " "
5892                 echo "(I can't seem to compile the test program.  Guessing...)"
5893                 rp="What is the size of a long long (in bytes)?"
5894                 . ./myread
5895                 longlongsize="$ans"
5896         fi
5897         if $test "X$longsize" = "X$longlongsize"; then
5898                 echo "(That isn't any different from an ordinary long.)"
5899         fi
5900         ;;
5901 esac
5902 $rm_try
5903
5904 : determine filename position in cpp output
5905 echo " "
5906 echo "Computing filename position in cpp output for #include directives..." >&4
5907 case "$osname" in
5908 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5909 esac
5910 case "$fieldn" in
5911 '')
5912 case "$osname" in
5913 vos) testaccess=-e ;;
5914 *)   testaccess=-r ;;
5915 esac
5916 echo '#include <stdio.h>' > foo.c
5917 $cat >fieldn <<EOF
5918 $startsh
5919 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5920 $grep '^[       ]*#.*stdio\.h' | \
5921 while read cline; do
5922         pos=1
5923         set \$cline
5924         while $test \$# -gt 0; do
5925                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5926                         echo "\$pos"
5927                         exit 0
5928                 fi
5929                 shift
5930                 pos=\`expr \$pos + 1\`
5931         done
5932 done
5933 EOF
5934 chmod +x fieldn
5935 fieldn=`./fieldn`
5936 $rm -f foo.c fieldn
5937 ;;
5938 esac
5939 case $fieldn in
5940 '') pos='???';;
5941 1) pos=first;;
5942 2) pos=second;;
5943 3) pos=third;;
5944 *) pos="${fieldn}th";;
5945 esac
5946 echo "Your cpp writes the filename in the $pos field of the line."
5947
5948 : locate header file
5949 $cat >findhdr <<EOF
5950 $startsh
5951 wanted=\$1
5952 name=''
5953 for usrincdir in $incpth
5954 do
5955         if test -f \$usrincdir/\$wanted; then
5956                 echo "\$usrincdir/\$wanted"
5957                 exit 0
5958         fi
5959 done
5960 awkprg='{ print \$$fieldn }'
5961 echo "#include <\$wanted>" > foo\$\$.c
5962 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5963 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5964 while read cline; do
5965         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5966         case "\$name" in
5967         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5968         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5969         *) exit 2;;
5970         esac;
5971 done;
5972 #
5973 # status = 0: grep returned 0 lines, case statement not executed
5974 # status = 1: headerfile found
5975 # status = 2: while loop executed, no headerfile found
5976 #
5977 status=\$?
5978 $rm -f foo\$\$.c;
5979 if test \$status -eq 1; then
5980         exit 0;
5981 fi
5982 exit 1
5983 EOF
5984 chmod +x findhdr
5985
5986 : define an alternate in-header-list? function
5987 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5988 cont=true; xxf="echo \"<\$1> found.\" >&4";
5989 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5990 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5991 esac;
5992 case $# in 4) instead=instead;; *) instead="at last";; esac;
5993 while $test "$cont"; do
5994         xxx=`./findhdr $1`
5995         var=$2; eval "was=\$$2";
5996         if $test "$xxx" && $test -r "$xxx";
5997         then eval $xxf;
5998         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5999                 cont="";
6000         else eval $xxnf;
6001         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6002         set $yyy; shift; shift; yyy=$@;
6003         case $# in 0) cont="";;
6004         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6005                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6006         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6007                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6008         esac;
6009 done;
6010 while $test "$yyy";
6011 do set $yyy; var=$2; eval "was=\$$2";
6012         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6013         set $yyy; shift; shift; yyy=$@;
6014 done'
6015
6016 : see if inttypes.h is available
6017 : we want a real compile instead of Inhdr because some systems
6018 : have an inttypes.h which includes non-existent headers
6019 echo " "
6020 $cat >try.c <<EOCP
6021 #include <inttypes.h>
6022 int main() {
6023         static int32_t foo32 = 0x12345678;
6024 }
6025 EOCP
6026 set try
6027 if eval $compile; then
6028         echo "<inttypes.h> found." >&4
6029         val="$define"
6030 else
6031         echo "<inttypes.h> NOT found." >&4
6032         val="$undef"
6033 fi
6034 $rm_try
6035 set i_inttypes
6036 eval $setvar
6037
6038 : check for int64_t
6039 echo " "
6040 echo "Checking to see if you have int64_t..." >&4
6041 $cat >try.c <<EOCP
6042 #include <sys/types.h>
6043 #$i_inttypes I_INTTYPES
6044 #ifdef I_INTTYPES
6045 #include <inttypes.h>
6046 #endif
6047 int main() { int64_t x = 7; }
6048 EOCP
6049 set try
6050 if eval $compile; then
6051         val="$define"
6052         echo "You have int64_t."
6053 else
6054         val="$undef"
6055         echo "You do not have int64_t."
6056 fi
6057 $rm_try
6058 set d_int64_t
6059 eval $setvar
6060
6061 : Check if 64bit ints have a quad type
6062 echo " "
6063 echo "Checking which 64-bit integer type we could use..." >&4
6064
6065 case "$intsize" in
6066 8) val=int
6067    set quadtype
6068    eval $setvar
6069    val='"unsigned int"'
6070    set uquadtype
6071    eval $setvar
6072    quadkind=1
6073    ;;
6074 *) case "$longsize" in
6075    8) val=long
6076       set quadtype
6077       eval $setvar
6078       val='"unsigned long"'
6079       set uquadtype
6080       eval $setvar
6081       quadkind=2
6082       ;;
6083    *) case "$d_longlong:$longlongsize" in
6084       define:8)
6085         val='"long long"'
6086         set quadtype
6087         eval $setvar
6088         val='"unsigned long long"'
6089         set uquadtype
6090         eval $setvar
6091         quadkind=3
6092         ;;
6093       *) case "$d_int64_t" in
6094          define)
6095            val=int64_t
6096            set quadtype
6097            eval $setvar
6098            val=uint64_t
6099            set uquadtype
6100            eval $setvar
6101            quadkind=4
6102            ;;
6103          esac
6104          ;;
6105       esac
6106       ;;
6107    esac
6108    ;;
6109 esac
6110
6111 case "$quadtype" in
6112 '')     echo "Alas, no 64-bit integer types in sight." >&4
6113         d_quad="$undef"
6114         ;;
6115 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6116         d_quad="$define"
6117         ;;
6118 esac
6119
6120 : Do we want 64bit support
6121 case "$uselonglong" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6126 EOM
6127         use64bitint="$define"
6128         ;;
6129 esac
6130 case "$use64bits" in
6131 "$define"|true|[yY]*)
6132         cat <<EOM >&4
6133
6134 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6135 EOM
6136         use64bitint="$define"
6137         ;;
6138 esac
6139 case "$use64bitints" in
6140 "$define"|true|[yY]*)
6141         cat <<EOM >&4
6142
6143 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6144 EOM
6145         use64bitint="$define"
6146         ;;
6147 esac
6148 case "$use64bitsint" in
6149 "$define"|true|[yY]*)
6150         cat <<EOM >&4
6151
6152 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6153 EOM
6154         use64bitint="$define"
6155         ;;
6156 esac
6157 case "$uselonglongs" in
6158 "$define"|true|[yY]*)
6159         cat <<EOM >&4
6160
6161 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6162 EOM
6163         use64bitint="$define"
6164         ;;
6165 esac
6166 case "$use64bitsall" in
6167 "$define"|true|[yY]*)
6168         cat <<EOM >&4
6169
6170 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6171 EOM
6172         use64bitall="$define"
6173         ;;
6174 esac
6175
6176 case "$ccflags" in
6177 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6178 esac
6179 case "$use64bitall" in
6180 "$define"|true|[yY]*) use64bitint="$define" ;;
6181 esac
6182
6183 case "$longsize" in
6184 8) cat <<EOM
6185
6186 You have natively 64-bit long integers.
6187 EOM
6188    val="$define"
6189    ;;
6190 *) case "$use64bitint" in
6191    "$define"|true|[yY]*) dflt='y';;
6192    *) dflt='n';;
6193    esac
6194    case "$d_quad" in
6195    "$define") ;;
6196    *) dflt='n' ;;
6197    esac
6198    cat <<EOM
6199
6200 Perl can be built to take advantage of 64-bit integer types
6201 on some systems.  To do so, Configure can be run with -Duse64bitint.
6202 Choosing this option will most probably introduce binary incompatibilities.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 (The default has been chosen based on your configuration.)
6206 EOM
6207    rp='Try to use 64-bit integers, if available?'
6208    . ./myread
6209    case "$ans" in
6210    [yY]*) val="$define" ;;
6211    *)     val="$undef"  ;;
6212    esac
6213    ;;
6214 esac
6215 set use64bitint
6216 eval $setvar
6217
6218 case "$use64bitall" in
6219 "$define"|true|[yY]*) dflt='y' ;;
6220 *) case "$longsize" in
6221    8) dflt='y' ;;
6222    *) dflt='n' ;;
6223    esac
6224    ;;
6225 esac
6226 cat <<EOM
6227
6228 You may also choose to try maximal 64-bitness.  It means using as much
6229 64-bitness as possible on the platform.  This in turn means even more
6230 binary incompatibilities.  On the other hand, your platform may not
6231 have any more 64-bitness available than what you already have chosen.
6232
6233 If this doesn't make any sense to you, just accept the default '$dflt'.
6234 (The default has been chosen based on your configuration.)
6235 EOM
6236 rp='Try to use maximal 64-bit support, if available?'
6237 . ./myread
6238 case "$ans" in
6239 [yY]*) val="$define" ;;
6240 *)     val="$undef"  ;;
6241 esac
6242 set use64bitall
6243 eval $setvar
6244 case "$use64bitall" in
6245 "$define")
6246         case "$use64bitint" in
6247         "$undef")
6248                 cat <<EOM
6249
6250 Since you have chosen a maximally 64-bit build, I'm also turning on
6251 the use of 64-bit integers.
6252 EOM
6253                 use64bitint="$define" ;;
6254         esac
6255         ;;
6256 esac
6257
6258 : Look for a hint-file generated 'call-back-unit'.  If the
6259 : user has specified that a 64-bit perl is to be built,
6260 : we may need to set or change some other defaults.
6261 if $test -f use64bitint.cbu; then
6262         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6263         . ./use64bitint.cbu
6264 fi
6265 case "$use64bitint" in
6266 "$define"|true|[yY]*)
6267         : This test was common to all the OpenBSD forks, and seems harmless for
6268         : other platforms:
6269         echo " "
6270         echo "Checking if your C library has broken 64-bit functions..." >&4
6271         cat >try.c <<EOCP
6272 #include <stdio.h>
6273 typedef $uquadtype myULL;
6274 int main (void)
6275 {
6276     struct {
6277         double d;
6278         myULL  u;
6279     } *p, test[] = {
6280         {4294967303.15, 4294967303ULL},
6281         {4294967294.2,  4294967294ULL},
6282         {4294967295.7,  4294967295ULL},
6283         {0.0, 0ULL}
6284     };
6285     for (p = test; p->u; p++) {
6286         myULL x = (myULL)p->d;
6287         if (x != p->u) {
6288             printf("buggy\n");
6289             return 0;
6290         }
6291     }
6292     printf("ok\n");
6293     return 0;
6294 }
6295 EOCP
6296         set try
6297         if eval $compile_ok; then
6298             libcquad=`$run ./try`
6299             echo "Your C library's 64-bit functions are $libcquad."
6300         else
6301             echo "(I can't seem to compile the test program.)"
6302             echo "Assuming that your C library's 64-bit functions are ok."
6303             libcquad="ok"
6304         fi
6305         $rm_try
6306
6307         case "$libcquad" in
6308             buggy*)
6309                 cat >&4 <<EOM
6310
6311 *** You have a C library with broken 64-bit functions.
6312 *** 64-bit support does not work reliably in this configuration.
6313 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6314 *** Cannot continue, aborting.
6315
6316 EOM
6317                 exit 1
6318                 ;;
6319         esac
6320         case "$longsize" in
6321         4) case "$archname64" in
6322            '') archname64=64int ;;
6323            esac
6324            ;;
6325         esac
6326         ;;
6327 esac
6328
6329 : Look for a hint-file generated 'call-back-unit'.  If the
6330 : user has specified that a maximally 64-bit perl is to be built,
6331 : we may need to set or change some other defaults.
6332 if $test -f use64bitall.cbu; then
6333         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6334         . ./use64bitall.cbu
6335 fi
6336 case "$use64bitall" in
6337 "$define"|true|[yY]*)
6338         case "$longsize" in
6339         4) case "$archname64" in
6340            ''|64int) archname64=64all ;;
6341            esac
6342            ;;
6343         esac
6344         ;;
6345 esac
6346
6347 case "$d_quad:$use64bitint" in
6348 $undef:$define)
6349         cat >&4 <<EOF
6350
6351 *** You have chosen to use 64-bit integers,
6352 *** but none can be found.
6353 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6354 *** Cannot continue, aborting.
6355
6356 EOF
6357         exit 1
6358         ;;
6359 esac
6360
6361 : Check if we are using the GNU C library
6362 echo " "
6363 echo "Checking for GNU C Library..." >&4
6364 cat >try.c <<'EOCP'
6365 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6366    alone are insufficient to distinguish different versions, such as
6367    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6368    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6369 */
6370 #include <stdio.h>
6371 int main(void)
6372 {
6373 #ifdef __GLIBC__
6374 #   ifdef __GLIBC_MINOR__
6375 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6376 #           include <gnu/libc-version.h>
6377             printf("%s\n",  gnu_get_libc_version());
6378 #       else
6379             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6380 #       endif
6381 #   else
6382         printf("%d\n",  __GLIBC__);
6383 #   endif
6384     return 0;
6385 #else
6386     return 1;
6387 #endif
6388 }
6389 EOCP
6390 set try
6391 if eval $compile_ok && $run ./try > glibc.ver; then
6392         val="$define"
6393         gnulibc_version=`$cat glibc.ver`
6394         echo "You are using the GNU C Library version $gnulibc_version"
6395 else
6396         val="$undef"
6397         gnulibc_version=''
6398         echo "You are not using the GNU C Library"
6399 fi
6400 $rm_try glibc.ver
6401 set d_gnulibc
6402 eval $setvar
6403
6404 : see if nm is to be used to determine whether a symbol is defined or not
6405 case "$usenm" in
6406 '')
6407         dflt=''
6408         case "$d_gnulibc" in
6409         "$define")
6410                 echo " "
6411                 echo "nm probably won't work on the GNU C Library." >&4
6412                 dflt=n
6413                 ;;
6414         esac
6415         case "$dflt" in
6416         '')
6417                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6418                         echo " "
6419                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6420                         echo "'nm' won't be sufficient on this system." >&4
6421                         dflt=n
6422                 fi
6423                 ;;
6424         esac
6425         case "$dflt" in
6426         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6427                 if $test $dflt -gt 20; then
6428                         dflt=y
6429                 else
6430                         dflt=n
6431                 fi
6432                 ;;
6433         esac
6434         ;;
6435 *)
6436         case "$usenm" in
6437         true|$define) dflt=y;;
6438         *) dflt=n;;
6439         esac
6440         ;;
6441 esac
6442 $cat <<EOM
6443
6444 I can use $nm to extract the symbols from your C libraries. This
6445 is a time consuming task which may generate huge output on the disk (up
6446 to 3 megabytes) but that should make the symbols extraction faster. The
6447 alternative is to skip the 'nm' extraction part and to compile a small
6448 test program instead to determine whether each symbol is present. If
6449 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6450 this may be the best solution.
6451
6452 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6453
6454 EOM
6455 rp="Shall I use $nm to extract C symbols from the libraries?"
6456 . ./myread
6457 case "$ans" in
6458 [Nn]*) usenm=false;;
6459 *) usenm=true;;
6460 esac
6461
6462 runnm=$usenm
6463 case "$reuseval" in
6464 true) runnm=false;;
6465 esac
6466
6467 : nm options which may be necessary
6468 case "$nm_opt" in
6469 '') if $test -f /mach_boot; then
6470                 nm_opt=''       # Mach
6471         elif $test -d /usr/ccs/lib; then
6472                 nm_opt='-p'     # Solaris (and SunOS?)
6473         elif $test -f /dgux; then
6474                 nm_opt='-p'     # DG-UX
6475         elif $test -f /lib64/rld; then
6476                 nm_opt='-p'     # 64-bit Irix
6477         else
6478                 nm_opt=''
6479         fi;;
6480 esac
6481
6482 : nm options which may be necessary for shared libraries but illegal
6483 : for archive libraries.  Thank you, Linux.
6484 case "$nm_so_opt" in
6485 '')     case "$myuname" in
6486         *linux*|gnu*)
6487                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6488                         nm_so_opt='--dynamic'
6489                 fi
6490                 ;;
6491         esac
6492         ;;
6493 esac
6494
6495 : Figure out where the libc is located
6496 case "$runnm" in
6497 true)
6498 : get list of predefined functions in a handy place
6499 echo " "
6500 case "$libc" in
6501 '') libc=unknown
6502         case "$libs" in
6503         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6504         esac
6505         ;;
6506 esac
6507 case "$libs" in
6508 '') ;;
6509 *)  for thislib in $libs; do
6510         case "$thislib" in
6511         -lc|-lc_s)
6512                 : Handle C library specially below.
6513                 ;;
6514         -l*)
6515                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6516                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6519                         :
6520                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6521                         :
6522                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6523                         :
6524                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6525                         :
6526                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6527                         :
6528                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6529                         :
6530                 else
6531                         try=''
6532                 fi
6533                 libnames="$libnames $try"
6534                 ;;
6535         *) libnames="$libnames $thislib" ;;
6536         esac
6537         done
6538         ;;
6539 esac
6540 xxx=normal
6541 case "$libc" in
6542 unknown)
6543         set /lib/libc.$so
6544         for xxx in $libpth; do
6545                 $test -r $1 || set $xxx/libc.$so
6546                 : The messy sed command sorts on library version numbers.
6547                 $test -r $1 || \
6548                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6549                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6550                                 h
6551                                 s/[0-9][0-9]*/0000&/g
6552                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6553                                 G
6554                                 s/\n/ /' | \
6555                          $sort | $sed -e 's/^.* //'`
6556                 eval set \$$#
6557         done
6558         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6559         $test -r $1 || set $sysroot/lib/libsys_s$_a
6560         ;;
6561 *)
6562         set blurfl
6563         ;;
6564 esac
6565 if $test -r "$1"; then
6566         echo "Your (shared) C library seems to be in $1."
6567         libc="$1"
6568 elif $test -r /lib/libc && $test -r /lib/clib; then
6569         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6570         xxx=apollo
6571         libc='/lib/clib /lib/libc'
6572         if $test -r /lib/syslib; then
6573                 echo "(Your math library is in /lib/syslib.)"
6574                 libc="$libc /lib/syslib"
6575         fi
6576 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6577         echo "Your C library seems to be in $libc, as you said before."
6578 elif $test -r $incpath/usr/lib/libc$_a; then
6579         libc=$incpath/usr/lib/libc$_a;
6580         echo "Your C library seems to be in $libc.  That's fine."
6581 elif $test -r /lib/libc$_a; then
6582         libc=/lib/libc$_a;
6583         echo "Your C library seems to be in $libc.  You're normal."
6584 else
6585         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6586                 :
6587         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6588                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6589         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6590                 :
6591         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6592                 :
6593         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6594                 :
6595         else
6596                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6597         fi
6598         if $test -r "$tans"; then
6599                 echo "Your C library seems to be in $tans, of all places."
6600                 libc=$tans
6601         else
6602                 libc='blurfl'
6603         fi
6604 fi
6605 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6606         dflt="$libc"
6607         cat <<EOM
6608
6609 If the guess above is wrong (which it might be if you're using a strange
6610 compiler, or your machine supports multiple models), you can override it here.
6611
6612 EOM
6613 else
6614         dflt=''
6615         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6616         cat >&4 <<EOM
6617 I can't seem to find your C library.  I've looked in the following places:
6618
6619 EOM
6620         $sed 's/^/      /' libpath
6621         cat <<EOM
6622
6623 None of these seems to contain your C library. I need to get its name...
6624
6625 EOM
6626 fi
6627 fn=f
6628 rp='Where is your C library?'
6629 . ./getfile
6630 libc="$ans"
6631
6632 echo " "
6633 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6634 set X `cat libnames`
6635 shift
6636 xxx=files
6637 case $# in 1) xxx=file; esac
6638 echo "Extracting names from the following $xxx for later perusal:" >&4
6639 echo " "
6640 $sed 's/^/      /' libnames >&4
6641 echo " "
6642 $echo $n "This may take a while...$c" >&4
6643
6644 for file in $*; do
6645         case $file in
6646         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6647         *) $nm $nm_opt $file 2>/dev/null;;
6648         esac
6649 done >libc.tmp
6650
6651 $echo $n ".$c"
6652 $grep fprintf libc.tmp > libc.ptf
6653 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6654 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6655 xxx='[ADTSIWi]'
6656 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6681                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6698         eval $xscan;\
6699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6700                 eval $xrun
6701 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6702         eval $xscan;\
6703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6704                 eval $xrun
6705 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6706         eval $xscan;\
6707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6708                 eval $xrun
6709 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6710         eval $xscan;\
6711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6712                 eval $xrun
6713 else
6714         $nm -p $* 2>/dev/null >libc.tmp
6715         $grep fprintf libc.tmp > libc.ptf
6716         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6717                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6718         then
6719                 nm_opt='-p'
6720                 eval $xrun
6721         else
6722                 echo " "
6723                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6724                 com=''
6725                 if $ar t $libc > libc.tmp && \
6726                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6727                 then
6728                         for thisname in $libnames $libc; do
6729                                 $ar t $thisname >>libc.tmp
6730                         done
6731                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6732                         echo "Ok." >&4
6733                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6734                         for thisname in $libnames $libc; do
6735                                 $ar tv $thisname >>libc.tmp
6736                                 emximp -o tmp.imp $thisname \
6737                                     2>/dev/null && \
6738                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6739                                     < tmp.imp >>libc.tmp
6740                                 $rm -f tmp.imp
6741                         done
6742                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6743                         echo "Ok." >&4
6744                 else
6745                         echo "$ar didn't seem to work right." >&4
6746                         echo "Maybe this is a Cray...trying bld instead..." >&4
6747                         if  bld t $libc | \
6748                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6749                                 $test -s libc.list
6750                         then
6751                                 for thisname in $libnames; do
6752                                         bld t $libnames | \
6753                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6754                                         $ar t $thisname >>libc.tmp
6755                                 done
6756                                 echo "Ok." >&4
6757                         else
6758                                 echo "That didn't work either.  Giving up." >&4
6759                                 exit 1
6760                         fi
6761                 fi
6762         fi
6763 fi
6764 nm_extract="$com"
6765 case "$PASE" in
6766 define)
6767     echo " "
6768     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6769     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6770     ;;
6771 *)  if $test -f /lib/syscalls.exp; then
6772         echo " "
6773         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6774         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6775                 /lib/syscalls.exp >>libc.list
6776     fi
6777     ;;
6778 esac
6779 ;;
6780 esac
6781 $rm -f libnames libpath
6782
6783 : Check if we are using C++
6784 echo " "
6785 echo "Checking for C++..." >&4
6786 $cat >try.c <<'EOCP'
6787 #include <stdio.h>
6788 int main(void)
6789 {
6790 #ifdef __cplusplus
6791     return 0;
6792 #else
6793     return 1;
6794 #endif
6795 }
6796 EOCP
6797 set try
6798 if eval $compile_ok && $run ./try; then
6799         val="$define"
6800         echo "You are using a C++ compiler."
6801 else
6802         val="$undef"
6803         echo "You are not using a C++ compiler."
6804 fi
6805 $rm_try cplusplus$$
6806 set d_cplusplus
6807 eval $setvar
6808
6809 : is a C symbol defined?
6810 csym='tlook=$1;
6811 case "$3" in
6812 -v) tf=libc.tmp; tdc="";;
6813 -a) tf=libc.tmp; tdc="[]";;
6814 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6815 esac;
6816 case "$d_cplusplus" in
6817     $define)    extern_C="extern \"C\"" ;;
6818     *)          extern_C="extern"       ;;
6819 esac;
6820 tx=yes;
6821 case "$reuseval-$4" in
6822 true-) ;;
6823 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6824 esac;
6825 case "$tx" in
6826 yes)
6827         tval=false;
6828         if $test "$runnm" = true; then
6829                 if $contains $tlook $tf >/dev/null 2>&1; then
6830                         tval=true;
6831                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6832                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6833                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6834                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6835                         $rm_try;
6836                 fi;
6837         else
6838                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6839                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6840                 $rm_try;
6841         fi;
6842         ;;
6843 *)
6844         case "$tval" in
6845         $define) tval=true;;
6846         *) tval=false;;
6847         esac;
6848         ;;
6849 esac;
6850 eval "$2=$tval"'
6851
6852 : define an is-in-libc? function
6853 inlibc='echo " "; td=$define; tu=$undef;
6854 sym=$1; var=$2; eval "was=\$$2";
6855 tx=yes;
6856 case "$reuseval$was" in
6857 true) ;;
6858 true*) tx=no;;
6859 esac;
6860 case "$tx" in
6861 yes)
6862         set $sym tres -f;
6863         eval $csym;
6864         case "$tres" in
6865         true)
6866                 echo "$sym() found." >&4;
6867                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6868         *)
6869                 echo "$sym() NOT found." >&4;
6870                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6871         esac;;
6872 *)
6873         case "$was" in
6874         $define) echo "$sym() found." >&4;;
6875         *) echo "$sym() NOT found." >&4;;
6876         esac;;
6877 esac'
6878
6879 : check for length of double
6880 echo " "
6881 case "$doublesize" in
6882 '')
6883         echo "Checking to see how big your double precision numbers are..." >&4
6884         $cat >try.c <<EOCP
6885 #include <stdio.h>
6886 #$i_stdlib I_STDLIB
6887 #ifdef I_STDLIB
6888 #include <stdlib.h>
6889 #endif
6890 int main()
6891 {
6892     printf("%d\n", (int)sizeof(double));
6893     exit(0);
6894 }
6895 EOCP
6896         set try
6897         if eval $compile_ok; then
6898                 doublesize=`$run ./try`
6899                 echo "Your double is $doublesize bytes long."
6900         else
6901                 dflt='8'
6902                 echo "(I can't seem to compile the test program.  Guessing...)"
6903                 rp="What is the size of a double precision number (in bytes)?"
6904                 . ./myread
6905                 doublesize="$ans"
6906         fi
6907         ;;
6908 esac
6909 $rm_try
6910
6911 : check for long doubles
6912 echo " "
6913 echo "Checking to see if you have long double..." >&4
6914 echo 'int main() { long double x = 7.0; }' > try.c
6915 set try
6916 if eval $compile; then
6917         val="$define"
6918         echo "You have long double."
6919 else
6920         val="$undef"
6921         echo "You do not have long double."
6922 fi
6923 $rm_try
6924 set d_longdbl
6925 eval $setvar
6926
6927 : see if ldexpl exists
6928 set ldexpl d_ldexpl
6929 eval $inlibc
6930
6931 : check for length of long double
6932 case "${d_longdbl}${longdblsize}" in
6933 $define)
6934         echo " "
6935         echo "Checking to see how big your long doubles are..." >&4
6936         $cat >try.c <<'EOCP'
6937 #include <stdio.h>
6938 int main()
6939 {
6940         printf("%d\n", sizeof(long double));
6941 }
6942 EOCP
6943         set try
6944         set try
6945         if eval $compile; then
6946                 longdblsize=`$run ./try`
6947                 echo "Your long doubles are $longdblsize bytes long."
6948         else
6949                 dflt='8'
6950                 echo " "
6951                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6952                 rp="What is the size of a long double (in bytes)?"
6953                 . ./myread
6954                 longdblsize="$ans"
6955         fi
6956         if $test "X$doublesize" = "X$longdblsize"; then
6957                 echo "That isn't any different from an ordinary double."
6958                 echo "I'll keep your setting anyway, but you may see some"
6959                 echo "harmless compilation warnings."
6960         fi
6961         ;;
6962 esac
6963 $rm_try
6964
6965 $echo "Checking the kind of long doubles you have..." >&4
6966 case "$d_longdbl" in
6967 define)
6968 $cat <<EOP >try.c
6969 #$i_stdlib I_STDLIB
6970 #define LONGDBLSIZE $longdblsize
6971 #define DOUBLESIZE $doublesize
6972 #include <float.h>
6973 #ifdef I_STDLIB
6974 #include <stdlib.h>
6975 #endif
6976 #include <stdio.h>
6977 static const long double d = -0.1L;
6978 int main() {
6979   unsigned const char* b = (unsigned const char*)(&d);
6980 #if DOUBLESIZE == LONGDBLSIZE
6981   printf("0\n"); /* if it floats like double */
6982   exit(0);
6983 #endif
6984 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6985   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6986     /* IEEE 754 128-bit little-endian */
6987     printf("1\n");
6988     exit(0);
6989   }
6990   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6991     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6992     printf("2\n");
6993     exit(0);
6994   }
6995 #endif
6996 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6997  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6998  * cannot be trusted. */
6999 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7000   if (b[0] == 0xCD && b[9] == 0xBF) {
7001     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7002      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7003      * Also known as "extended precision". */
7004     printf("3\n");
7005     exit(0);
7006   }
7007   if (b[0] == 0xBF && b[9] == 0xCD) {
7008     /* Is there ever big-endian 80-bit, really?
7009      *
7010      * The Motorola 68881 had another "extended precision" format:
7011      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7012      * for total of 96 bits of bytes.  The zero bits were unused.
7013      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7014      * If it ever becomes relevant, this format should be allocated
7015      * a new doublekind code since it's quite different from the Intel x87.
7016      */
7017     printf("4\n");
7018     exit(0);
7019   }
7020 #endif
7021 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7022   /* software "double double", the 106 is 53+53.
7023    * but irix thinks it is 107. */
7024   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7025     /* double double 128-bit fully little-endian,
7026      * little-endian doubles in little-endian order,
7027      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7028     printf("5\n");
7029     exit(0);
7030   }
7031   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7032     /* double double 128-bit fully big-endian,
7033      * big-endian doubles in big-endian order,
7034      * e.g. PPC/Power and MIPS:
7035      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7036     printf("6\n");
7037     exit(0);
7038   }
7039   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7040     /* double double 128-bit mixed endian.
7041      * little-endian doubles in big-endian order,
7042      * e.g. ppc64el,
7043      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7044     printf("7\n");
7045     exit(0);
7046   }
7047   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7048     /* double double 128-bit mixed endian,
7049      * big-endian doubles in little-endian order,
7050      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7051     printf("8\n");
7052     exit(0);
7053   }
7054 #endif
7055 /* We are largely making this up because it may well be
7056  * that the VAX format H was never made available to C,
7057  * only to Fortran. */
7058 #if LONGDBLSIZE == 16 && defined(__vax__)
7059   if (b[0] == 0xFD && b[15] == 0x99) {
7060     /* VAX format H, PDP-11 mixed endian. */
7061     printf("9\n");
7062     exit(0);
7063   }
7064 #endif
7065   printf("-1\n"); /* unknown */
7066   exit(0);
7067 }
7068 EOP
7069 set try
7070 if eval $compile; then
7071     longdblkind=`$run ./try`
7072 else
7073     longdblkind=-1
7074 fi
7075 ;;
7076 *) longdblkind=0 ;;
7077 esac
7078 case "$longdblkind" in
7079 0) echo "Your long doubles are doubles." >&4 ;;
7080 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7081 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7082 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7083 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7084 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7085 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7086 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7087 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7088 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7089 *) echo "Cannot figure out your long double." >&4 ;;
7090 esac
7091 d_long_double_style_ieee=$undef
7092 d_long_double_style_ieee_std=$undef
7093 d_long_double_style_ieee_extended=$undef
7094 d_long_double_style_ieee_doubledouble=$undef
7095 d_long_double_style_vax=$undef
7096 case "$longdblkind" in
7097 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7098 esac
7099 case "$longdblkind" in
7100 1|2) d_long_double_style_ieee_std=$define ;;
7101 esac
7102 case "$longdblkind" in
7103 3|4) d_long_double_style_ieee_extended=$define ;;
7104 esac
7105 case "$longdblkind" in
7106 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7107 esac
7108 case "$longdblkind" in
7109 9) d_long_double_style_vax=$define ;;
7110 esac
7111 $rm_try
7112
7113 : determine the architecture name
7114 echo " "
7115 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7116         tarch=`arch`"-$osname"
7117 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7118         if uname -m > tmparch 2>&1 ; then
7119                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7120                         -e 's/$/'"-$osname/" tmparch`
7121         else
7122                 tarch="$osname"
7123         fi
7124         $rm -f tmparch
7125 else
7126         tarch="$osname"
7127 fi
7128 case "$myarchname" in
7129 ''|"$tarch") ;;
7130 *)
7131         echo "(Your architecture name used to be $myarchname.)"
7132         archname=''
7133         ;;
7134 esac
7135 case "$targetarch" in
7136 '') ;;
7137 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7138 esac
7139 myarchname="$tarch"
7140 case "$archname" in
7141 '') dflt="$tarch";;
7142 *) dflt="$archname";;
7143 esac
7144 rp='What is your architecture name'
7145 . ./myread
7146 archname="$ans"
7147
7148 : optionally add API version to the architecture for versioned archlibs
7149 case "$useversionedarchname" in
7150 $define|true|[yY]*) dflt='y';;
7151 *)                  dflt='n';;
7152 esac
7153 rp='Add the Perl API version to your archname?'
7154 . ./myread
7155 case "$ans" in
7156 y|Y)    useversionedarchname="$define" ;;
7157 *)      useversionedarchname="$undef" ;;
7158 esac
7159 case "$useversionedarchname" in
7160 $define)
7161         case "$archname" in
7162         *-$api_versionstring)
7163                 echo "...and architecture name already has -$api_versionstring" >&4
7164                 ;;
7165         *)
7166                 archname="$archname-$api_versionstring"
7167                 echo "...setting architecture name to $archname." >&4
7168                 ;;
7169         esac
7170         ;;
7171 esac
7172
7173 case "$usethreads" in
7174 $define)
7175         echo "Threads selected." >&4
7176         case "$archname" in
7177         *-thread*) echo "...and architecture name already has -thread." >&4
7178                 ;;
7179         *)      archname="$archname-thread"
7180                 echo "...setting architecture name to $archname." >&4
7181                 ;;
7182         esac
7183         ;;
7184 esac
7185 case "$usemultiplicity" in
7186 $define)
7187         echo "Multiplicity selected." >&4
7188         case "$archname" in
7189         *-multi*) echo "...and architecture name already has -multi." >&4
7190                 ;;
7191         *)      archname="$archname-multi"
7192                 echo "...setting architecture name to $archname." >&4
7193                 ;;
7194         esac
7195         ;;
7196 esac
7197 case "$use64bitint$use64bitall" in
7198 *"$define"*)
7199         case "$archname64" in
7200         '')
7201                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7202                 ;;
7203         *)
7204                 case "$use64bitint" in
7205                 "$define") echo "64 bit integers selected." >&4 ;;
7206                 esac
7207                 case "$use64bitall" in
7208                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7209                 esac
7210                 case "$archname" in
7211                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7212                         ;;
7213                 *)      archname="$archname-$archname64"
7214                         echo "...setting architecture name to $archname." >&4
7215                         ;;
7216                 esac
7217                 ;;
7218         esac
7219 esac
7220 case "$uselongdouble" in
7221 $define)
7222         echo "Long doubles selected." >&4
7223         case "$longdblsize" in
7224         $doublesize)
7225                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7226                 ;;
7227         *)
7228                 case "$archname" in
7229                 *-ld*) echo "...and architecture name already has -ld." >&4
7230                         ;;
7231                 *)      archname="$archname-ld"
7232                         echo "...setting architecture name to $archname." >&4
7233                         ;;
7234                 esac
7235                 ;;
7236         esac
7237         ;;
7238 esac
7239 case "$usequadmath" in
7240 $define)
7241         echo "quadmath selected." >&4
7242         case "$archname" in
7243         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7244                 ;;
7245         *)      archname="$archname-quadmath"
7246                 echo "...setting architecture name to $archname." >&4
7247                 ;;
7248         esac
7249         ;;
7250 esac
7251 if $test -f archname.cbu; then
7252         echo "Your platform has some specific hints for architecture name, using them..."
7253         . ./archname.cbu
7254 fi
7255
7256 : set the prefixit variable, to compute a suitable default value
7257 prefixit='case "$3" in
7258 ""|none)
7259         case "$oldprefix" in
7260         "") eval "$1=\"\$$2\"";;
7261         *)
7262                 case "$3" in
7263                 "") eval "$1=";;
7264                 none)
7265                         eval "tp=\"\$$2\"";
7266                         case "$tp" in
7267                         ""|" "|none) eval "$1=\"\$$2\"";;
7268                         *) eval "$1=";;
7269                         esac;;
7270                 esac;;
7271         esac;;
7272 *)
7273         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7274         case "$tp" in
7275         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7276         /*-$oldprefix/*|\~*-$oldprefix/*)
7277                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7278         *) eval "$1=\"\$$2\"";;
7279         esac;;
7280 esac'
7281
7282 : determine installation style
7283 : For now, try to deduce it from prefix unless it is already set.
7284 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7285 case "$installstyle" in
7286 '')     case "$prefix" in
7287                 *perl*) dflt='lib';;
7288                 *) dflt='lib/perl5' ;;
7289         esac
7290         ;;
7291 *)      dflt="$installstyle" ;;
7292 esac
7293 : Probably not worth prompting for this since we prompt for all
7294 : the directories individually, and the prompt would be too long and
7295 : confusing anyway.
7296 installstyle=$dflt
7297
7298 : determine where public executables go
7299 echo " "
7300 set dflt bin bin
7301 eval $prefixit
7302 fn=d~
7303 rp='Pathname where the public executables will reside?'
7304 . ./getfile
7305 if $test "X$ansexp" != "X$binexp"; then
7306         installbin=''
7307 fi
7308 prefixvar=bin
7309 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7310 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7311 :     this via initialinstalllocation
7312 . ./setprefixvar
7313
7314 case "$userelocatableinc" in
7315 $define|true|[yY]*)     dflt='y' ;;
7316 *)                      dflt='n' ;;
7317 esac
7318 cat <<EOM
7319
7320 Would you like to build Perl so that the installation is relocatable, so that
7321 library paths in @INC are determined relative to the path of the perl binary?
7322 This is not advised for system Perl installs, or if you need to run setid
7323 scripts or scripts under taint mode.
7324
7325 If this doesn't make any sense to you, just accept the default '$dflt'.
7326 EOM
7327 rp='Use relocatable @INC?'
7328 . ./myread
7329 case "$ans" in
7330 y|Y)    val="$define" ;;
7331 *)      val="$undef"  ;;
7332 esac
7333 set userelocatableinc
7334 eval $setvar
7335
7336 initialinstalllocation="$binexp"
7337 : Default prefix is now "up one level from where the binaries are"
7338 case "$userelocatableinc" in
7339 $define|true|[yY]*)
7340     bin=".../"
7341     binexp=".../"
7342     prefix=".../.."
7343     prefixexp=".../.."
7344     installprefixexp=".../.."
7345     ;;
7346 esac
7347
7348 : determine where private library files go
7349 : Usual default is /usr/local/lib/perl5/$version.
7350 : Also allow things like /opt/perl/lib/$version, since
7351 : /opt/perl/lib/perl5... would be redundant.
7352 : The default "style" setting is made in installstyle.U
7353 case "$installstyle" in
7354 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7355 *)       set dflt privlib lib/$version ;;
7356 esac
7357 eval $prefixit
7358 $cat <<EOM
7359
7360 There are some auxiliary files for $package that need to be put into a
7361 private library directory that is accessible by everyone.
7362
7363 EOM
7364 fn=$binexp
7365 fn=d~+
7366 rp='Pathname where the private library files will reside?'
7367 . ./getfile
7368 prefixvar=privlib
7369 . ./setprefixvar
7370
7371 : set the prefixup variable, to restore leading tilda escape
7372 prefixup='case "$prefixexp" in
7373 "$prefix") ;;
7374 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7375 esac'
7376
7377 : determine where public architecture dependent libraries go
7378 set archlib archlib
7379 eval $prefixit
7380 : privlib default is /usr/local/lib/$package/$version
7381 : archlib default is /usr/local/lib/$package/$version/$archname
7382 : privlib may have an optional trailing /share.
7383 tdflt=`echo $privlib | $sed 's,/share$,,'`
7384 tdflt=$tdflt/$archname
7385 case "$archlib" in
7386 '')     dflt=$tdflt
7387         ;;
7388 *)      dflt="$archlib"
7389     ;;
7390 esac
7391 $cat <<EOM
7392
7393 $spackage contains architecture-dependent library files.  If you are
7394 sharing libraries in a heterogeneous environment, you might store
7395 these files in a separate location.  Otherwise, you can just include
7396 them with the rest of the public library files.
7397
7398 EOM
7399 fn=$binexp
7400 fn=d+~
7401 rp='Where do you want to put the public architecture-dependent libraries?'
7402 . ./getfile
7403 prefixvar=archlib
7404 . ./setprefixvar
7405 if $test X"$archlib" = X"$privlib"; then
7406         d_archlib="$undef"
7407 else
7408         d_archlib="$define"
7409 fi
7410
7411 : see if setuid scripts can be secure
7412 $cat <<EOM
7413
7414 Some kernels have a bug that prevents setuid #! scripts from being
7415 secure.  Some sites have disabled setuid #! scripts because of this.
7416
7417 First let's decide if your kernel supports secure setuid #! scripts.
7418 (If setuid #! scripts would be secure but have been disabled anyway,
7419 don't say that they are secure if asked.)
7420
7421 EOM
7422
7423 val="$undef"
7424 if $test -d /dev/fd; then
7425         echo "#!$ls" >reflect
7426         chmod +x,u+s reflect
7427         ./reflect >flect 2>&1
7428         if $contains "/dev/fd" flect >/dev/null; then
7429                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7430                 val="$define"
7431         else
7432                 $cat <<EOM
7433 If you are not sure if they are secure, I can check but I'll need a
7434 username and password different from the one you are using right now.
7435 If you don't have such a username or don't want me to test, simply
7436 enter 'none'.
7437
7438 EOM
7439                 rp='Other username to test security of setuid scripts with?'
7440                 dflt='none'
7441                 . ./myread
7442                 case "$ans" in
7443                 n|none)
7444                         case "$d_suidsafe" in
7445                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7446                                 dflt=n;;
7447                         "$undef")
7448                                 echo "Well, the $hint value is *not* secure." >&4
7449                                 dflt=n;;
7450                         *)      echo "Well, the $hint value *is* secure." >&4
7451                                 dflt=y;;
7452                         esac
7453                         ;;
7454                 *)
7455                         $rm -f reflect flect
7456                         echo "#!$ls" >reflect
7457                         chmod +x,u+s reflect
7458                         echo >flect
7459                         chmod a+w flect
7460                         echo '"su" will (probably) prompt you for '"$ans's password."
7461                         su $ans -c './reflect >flect'
7462                         if $contains "/dev/fd" flect >/dev/null; then
7463                                 echo "Okay, it looks like setuid scripts are secure." >&4
7464                                 dflt=y
7465                         else
7466                                 echo "I don't think setuid scripts are secure." >&4
7467                                 dflt=n
7468                         fi
7469                         ;;
7470                 esac
7471                 rp='Does your kernel have *secure* setuid scripts?'
7472                 . ./myread
7473                 case "$ans" in
7474                 [yY]*)  val="$define";;
7475                 *)      val="$undef";;
7476                 esac
7477         fi
7478 else
7479         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7480         echo "(That's for file descriptors, not floppy disks.)"
7481         val="$undef"
7482 fi
7483 set d_suidsafe
7484 eval $setvar
7485
7486 $rm -f reflect flect
7487
7488 : now see if they want to do setuid emulation
7489 if $test $patchlevel -lt 11; then
7490 echo " "
7491 val="$undef"
7492 case "$d_suidsafe" in
7493 "$define")
7494         val="$undef"
7495         echo "No need to emulate SUID scripts since they are secure here." >&4
7496         ;;
7497 *)
7498         $cat <<EOM
7499 Some systems have disabled setuid scripts, especially systems where
7500 setuid scripts cannot be secure.  On systems where setuid scripts have
7501 been disabled, the setuid/setgid bits on scripts are currently
7502 useless.  It is possible for $package to detect those bits and emulate
7503 setuid/setgid in a secure fashion.  This emulation will only work if
7504 setuid scripts have been disabled in your kernel.
7505
7506 EOM
7507         case "$d_dosuid" in
7508         "$define") dflt=y ;;
7509         *) dflt=n ;;
7510         esac
7511         rp="Do you want to do setuid/setgid emulation?"
7512         . ./myread
7513         case "$ans" in
7514         [yY]*)  val="$define";;
7515         *)      val="$undef";;
7516         esac
7517         ;;
7518 esac
7519 set d_dosuid
7520 eval $setvar
7521 else
7522     case "$d_dosuid" in
7523         "$define")
7524         cat >&4 <<EOH
7525
7526 SUID emulation has been removed for 5.12
7527 Please re-run Configure without -Dd_dosuid
7528
7529 EOH
7530         exit 1;
7531         ;;
7532     esac
7533     d_dosuid=undef
7534 fi
7535
7536 : Find perl5.005 or later.
7537 echo "Looking for a previously installed perl5.005 or later... "
7538 case "$perl5" in
7539 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7540                 : Check if this perl is recent and can load a simple module
7541                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7542                         perl5=$tdir/perl
7543                         break;
7544                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7545                         perl5=$tdir/perl5
7546                         break;
7547                 fi
7548         done
7549         ;;
7550 *)      perl5="$perl5"
7551         ;;
7552 esac
7553 case "$perl5" in
7554 '')     echo "None found.  That's ok.";;
7555 *)      echo "Using $perl5." ;;
7556 esac
7557
7558 : Set the siteprefix variables
7559 $cat <<EOM
7560
7561 After $package is installed, you may wish to install various
7562 add-on modules and utilities.  Typically, these add-ons will
7563 be installed under $prefix with the rest
7564 of this package.  However, you may wish to install such add-ons
7565 elsewhere under a different prefix.
7566
7567 If you do not wish to put everything under a single prefix, that's
7568 ok.  You will be prompted for the individual locations; this siteprefix
7569 is only used to suggest the defaults.
7570
7571 The default should be fine for most people.
7572
7573 EOM
7574 fn=d~+
7575 rp='Installation prefix to use for add-on modules and utilities?'
7576 : XXX Here might be another good place for an installstyle setting.
7577 case "$siteprefix" in
7578 '') dflt=$prefix ;;
7579 *)  dflt=$siteprefix ;;
7580 esac
7581 . ./getfile
7582 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7583 oldsiteprefix=''
7584 case "$siteprefix" in
7585 '') ;;
7586 *)      case "$ans" in
7587         "$prefix") ;;
7588         *) oldsiteprefix="$prefix";;
7589         esac
7590         ;;
7591 esac
7592 siteprefix="$ans"
7593 siteprefixexp="$ansexp"
7594
7595 : determine where site specific libraries go.
7596 : Usual default is /usr/local/lib/perl5/site_perl/$version
7597 : The default "style" setting is made in installstyle.U
7598 : XXX No longer works with Prefixit stuff.
7599 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7600 case "$sitelib" in
7601 '') case "$installstyle" in
7602         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7603         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7604         esac
7605         ;;
7606 *)      dflt="$sitelib"
7607         ;;
7608 esac
7609 $cat <<EOM
7610
7611 The installation process will create a directory for
7612 site-specific extensions and modules.  Most users find it convenient
7613 to place all site-specific files in this directory rather than in the
7614 main distribution directory.
7615
7616 EOM
7617 fn=d~+
7618 rp='Pathname for the site-specific library files?'
7619 . ./getfile
7620 prefixvar=sitelib
7621 . ./setprefixvar
7622 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7623
7624 : Determine list of previous versions to include in @INC
7625 $cat > getverlist <<EOPL
7626 #!$perl5 -w
7627 use File::Basename;
7628 \$api_versionstring = "$api_versionstring";
7629 \$version = "$version";
7630 \$stem = "$sitelib_stem";
7631 \$archname = "$archname";
7632 EOPL
7633         $cat >> getverlist <<'EOPL'
7634 # The list found is store twice for each entry: the original name, and
7635 # the binary broken down version as pack "sss", so sorting is easy and
7636 # unambiguous. This will work for all versions that have a maximum of
7637 # three digit groups, separate by '.'s or '_'s. Names are extended with
7638 # ".0.0" to ensure at least three elements for the pack.
7639 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7640
7641 # Can't have leading @ because metaconfig interprets it as a command!
7642 ;@inc_version_list=();
7643 # XXX Redo to do opendir/readdir?
7644 if (-d $stem) {
7645     chdir($stem);
7646     ;@candidates = map {
7647         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7648     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7649 }
7650 else {
7651     ;@candidates = ();
7652 }
7653
7654 ($pversion, $aversion, $vsn5005) = map {
7655     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7656 foreach $d (@candidates) {
7657     if ($d->[1] lt $pversion) {
7658         if ($d->[1] ge $aversion) {
7659             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7660         }
7661         elsif ($d->[1] ge $vsn5005) {
7662             unshift(@inc_version_list, grep { -d } $d->[0]);
7663         }
7664     }
7665     else {
7666         # Skip newer version.  I.e. don't look in
7667         # 5.7.0 if we're installing 5.6.1.
7668     }
7669 }
7670
7671 if (@inc_version_list) {
7672     print join(' ', @inc_version_list);
7673 }
7674 else {
7675     # Blank space to preserve value for next Configure run.
7676     print " ";
7677 }
7678 EOPL
7679 chmod +x getverlist
7680 case "$inc_version_list" in
7681 '')     if test -x "$perl5$exe_ext"; then
7682                 dflt=`$perl5 getverlist`
7683         else
7684                 dflt='none'
7685         fi
7686         ;;
7687 $undef) dflt='none' ;;
7688 *)  eval dflt=\"$inc_version_list\" ;;
7689 esac
7690 case "$dflt" in
7691 ''|' ') dflt=none ;;
7692 esac
7693 case "$dflt" in
7694 5.005) dflt=none ;;
7695 esac
7696 $cat <<EOM
7697
7698 In order to ease the process of upgrading, this version of perl
7699 can be configured to use modules built and installed with earlier
7700 versions of perl that were installed under $prefix.  Specify here
7701 the list of earlier versions that this version of perl should check.
7702 If Configure detected no earlier versions of perl installed under
7703 $prefix, then the list will be empty.  Answer 'none' to tell perl
7704 to not search earlier versions.
7705
7706 The default should almost always be sensible, so if you're not sure,
7707 just accept the default.
7708 EOM
7709
7710 rp='List of earlier versions to include in @INC?'
7711 . ./myread
7712 case "$ans" in
7713 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7714 *) inc_version_list="$ans" ;;
7715 esac
7716 case "$inc_version_list" in
7717 ''|' ')
7718         inc_version_list_init='0'
7719         d_inc_version_list="$undef"
7720         ;;
7721 *)      inc_version_list_init=`echo $inc_version_list |
7722                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7723         d_inc_version_list="$define"
7724         ;;
7725 esac
7726 $rm -f getverlist
7727
7728 : see if malloc/malloc.h has to be included
7729 set malloc/malloc.h i_mallocmalloc
7730 eval $inhdr
7731
7732 : see if this is a malloc.h system
7733 : we want a real compile instead of Inhdr because some systems have a
7734 : malloc.h that just gives a compile error saying to use stdlib.h instead
7735 echo " "
7736 $cat >try.c <<EOCP
7737 #include <stdlib.h>
7738 #include <malloc.h>
7739 #$i_mallocmalloc I_MALLOCMALLOC
7740 #ifdef I_MALLOCMALLOC
7741 # include <malloc/malloc.h>
7742 #endif
7743
7744 int main () { return 0; }
7745 EOCP
7746 set try
7747 if eval $compile; then
7748     echo "<malloc.h> found." >&4
7749     val="$define"
7750 else
7751     echo "<malloc.h> NOT found." >&4
7752     val="$undef"
7753 fi
7754 $rm_try
7755 set i_malloc
7756 eval $setvar
7757
7758 : check for length of pointer
7759 echo " "
7760 case "$ptrsize" in
7761 '')
7762         echo "Checking to see how big your pointers are..." >&4
7763         $cat >try.c <<EOCP
7764 #include <stdio.h>
7765 #$i_stdlib I_STDLIB
7766 #ifdef I_STDLIB
7767 #include <stdlib.h>
7768 #endif
7769 int main()
7770 {
7771     printf("%d\n", (int)sizeof(void *));
7772     exit(0);
7773 }
7774 EOCP
7775         set try
7776         if eval $compile_ok; then
7777                 ptrsize=`$run ./try`
7778                 echo "Your pointers are $ptrsize bytes long."
7779         else
7780                 dflt='4'
7781                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7782                 rp="What is the size of a pointer (in bytes)?"
7783                 . ./myread
7784                 ptrsize="$ans"
7785         fi
7786         ;;
7787 esac
7788 $rm_try
7789 case "$use64bitall" in
7790 "$define"|true|[yY]*)
7791         case "$ptrsize" in
7792         4)      cat <<EOM >&4
7793
7794 *** You have chosen a maximally 64-bit build,
7795 *** but your pointers are only 4 bytes wide.
7796 *** Please rerun Configure without -Duse64bitall.
7797 EOM
7798                 case "$d_quad" in
7799                 define)
7800                         cat <<EOM >&4
7801 *** Since you have quads, you could possibly try with -Duse64bitint.
7802 EOM
7803                         ;;
7804                 esac
7805                 cat <<EOM >&4
7806 *** Cannot continue, aborting.
7807
7808 EOM
7809
7810                 exit 1
7811                 ;;
7812         esac
7813         ;;
7814 esac
7815
7816 : determine whether to use malloc wrapping
7817 echo " "
7818 case "$usemallocwrap" in
7819 [yY]*|true|$define)     dflt='y' ;;
7820 [nN]*|false|$undef)     dflt='n' ;;
7821 *)      case "$usedevel" in
7822         [yY]*|true|$define)     dflt='y' ;;
7823         *) dflt='n' ;;
7824         esac
7825         ;;
7826 esac
7827 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7828 . ./myread
7829 usemallocwrap="$ans"
7830 case "$ans" in
7831 y*|true)
7832         usemallocwrap="$define" ;;
7833 *)
7834         usemallocwrap="$undef" ;;
7835 esac
7836
7837 : determine which malloc to compile in
7838 echo " "
7839 case "$usemymalloc" in
7840 [yY]*|true|$define)     dflt='y' ;;
7841 [nN]*|false|$undef)     dflt='n' ;;
7842 *)      case "$ptrsize" in
7843         4) dflt='y' ;;
7844         *) dflt='n' ;;
7845         esac
7846         if test "$useithreads" = "$define"; then dflt='n'; fi
7847         ;;
7848 esac
7849 rp="Do you wish to attempt to use the malloc that comes with $package?"
7850 . ./myread
7851 usemymalloc="$ans"
7852 case "$ans" in
7853 y*|true)
7854         usemymalloc='y'
7855         mallocsrc='malloc.c'
7856         mallocobj="malloc$_o"
7857         d_mymalloc="$define"
7858         case "$libs" in
7859         *-lmalloc*)
7860                 : Remove malloc from list of libraries to use
7861                 echo "Removing unneeded -lmalloc from library list" >&4
7862                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7863                 shift
7864                 libs="$*"
7865                 echo "libs = $libs" >&4
7866                 ;;
7867         esac
7868         ;;
7869 *)
7870         usemymalloc='n'
7871         mallocsrc=''
7872         mallocobj=''
7873         d_mymalloc="$undef"
7874         ;;
7875 esac
7876
7877 : compute the return types of malloc and free
7878 echo " "
7879 $cat >malloc.c <<END
7880 #$i_malloc I_MALLOC
7881 #$i_stdlib I_STDLIB
7882 #include <stdio.h>
7883 #include <sys/types.h>
7884 #ifdef I_MALLOC
7885 #include <malloc.h>
7886 #endif
7887 #ifdef I_STDLIB
7888 #include <stdlib.h>
7889 #endif
7890 #ifdef TRY_MALLOC
7891 void *malloc();
7892 #endif
7893 #ifdef TRY_FREE
7894 void free();
7895 #endif
7896 END
7897 case "$malloctype" in
7898 '')
7899         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7900                 malloctype='void *'
7901         else
7902                 malloctype='char *'
7903         fi
7904         ;;
7905 esac
7906 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7907
7908 case "$freetype" in
7909 '')
7910         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7911                 freetype='void'
7912         else
7913                 freetype='int'
7914         fi
7915         ;;
7916 esac
7917 echo "Your system uses $freetype free(), it would seem." >&4
7918 $rm -f malloc.[co]
7919 : determine where site specific architecture-dependent libraries go.
7920 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7921 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7922 : sitelib may have an optional trailing /share.
7923 case "$sitearch" in
7924 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7925         dflt="$dflt/$archname"
7926         ;;
7927 *)      dflt="$sitearch"
7928         ;;
7929 esac
7930 set sitearch sitearch none
7931 eval $prefixit
7932 $cat <<EOM
7933
7934 The installation process will also create a directory for
7935 architecture-dependent site-specific extensions and modules.
7936
7937 EOM
7938 fn=d~+
7939 rp='Pathname for the site-specific architecture-dependent library files?'
7940 . ./getfile
7941 prefixvar=sitearch
7942 . ./setprefixvar
7943 if $test X"$sitearch" = X"$sitelib"; then
7944         d_sitearch="$undef"
7945 else
7946         d_sitearch="$define"
7947 fi
7948
7949 : Set the vendorprefix variables
7950 $cat <<EOM
7951
7952 The installation process will also create a directory for
7953 vendor-supplied add-ons.  Vendors who supply perl with their system
7954 may find it convenient to place all vendor-supplied files in this
7955 directory rather than in the main distribution directory.  This will
7956 ease upgrades between binary-compatible maintenance versions of perl.
7957
7958 Of course you may also use these directories in whatever way you see
7959 fit.  For example, you might use them to access modules shared over a
7960 company-wide network.
7961
7962 The default answer should be fine for most people.
7963 This causes further questions about vendor add-ons to be skipped
7964 and no vendor-specific directories will be configured for perl.
7965
7966 EOM
7967 rp='Do you want to configure vendor-specific add-on directories?'
7968 case "$usevendorprefix" in
7969 define|true|[yY]*) dflt=y ;;
7970 *)      : User may have set vendorprefix directly on Configure command line.
7971         case "$vendorprefix" in
7972         ''|' ') dflt=n ;;
7973         *)      dflt=y ;;
7974         esac
7975         ;;
7976 esac
7977 . ./myread
7978 case "$ans" in
7979 [yY]*)  fn=d~+
7980         rp='Installation prefix to use for vendor-supplied add-ons?'
7981         case "$vendorprefix" in
7982         '') dflt="$prefix" ;;
7983         *)  dflt=$vendorprefix ;;
7984         esac
7985         . ./getfile
7986         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7987         oldvendorprefix=''
7988         case "$vendorprefix" in
7989         '') ;;
7990         *)      case "$ans" in
7991                 "$prefix") ;;
7992                 *) oldvendorprefix="$prefix";;
7993                 esac
7994                 ;;
7995         esac
7996         usevendorprefix="$define"
7997         vendorprefix="$ans"
7998         vendorprefixexp="$ansexp"
7999         ;;
8000 *)      usevendorprefix="$undef"
8001         vendorprefix=''
8002         vendorprefixexp=''
8003         ;;
8004 esac
8005
8006 : Set the vendorlib variables
8007 case "$vendorprefix" in
8008 '')     d_vendorlib="$undef"
8009         vendorlib=''
8010         vendorlibexp=''
8011         ;;
8012 *)      d_vendorlib="$define"
8013         : determine where vendor-supplied modules go.
8014         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8015         case "$vendorlib" in
8016         '')
8017                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8018                 case "$installstyle" in
8019                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8020                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8021                 esac
8022                 ;;
8023         *)      dflt="$vendorlib"
8024                 ;;
8025         esac
8026         fn=d~+
8027         rp='Pathname for the vendor-supplied library files?'
8028         . ./getfile
8029         vendorlib="$ans"
8030         vendorlibexp="$ansexp"
8031         ;;
8032 esac
8033 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8034 prefixvar=vendorlib
8035 . ./installprefix
8036
8037 : Set the vendorarch variables
8038 case "$vendorprefix" in
8039 '')     d_vendorarch="$undef"
8040         vendorarch=''
8041         vendorarchexp=''
8042         ;;
8043 *)      d_vendorarch="$define"
8044         : determine where vendor-supplied architecture-dependent libraries go.
8045         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8046         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8047         : vendorlib may have an optional trailing /share.
8048         case "$vendorarch" in
8049         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8050                 dflt="$dflt/$archname"
8051                 ;;
8052         *)      dflt="$vendorarch" ;;
8053         esac
8054         fn=d~+
8055         rp='Pathname for vendor-supplied architecture-dependent files?'
8056         . ./getfile
8057         vendorarch="$ans"
8058         vendorarchexp="$ansexp"
8059         ;;
8060 esac
8061 prefixvar=vendorarch
8062 . ./installprefix
8063 if $test X"$vendorarch" = X"$vendorlib"; then
8064         d_vendorarch="$undef"
8065 else
8066         d_vendorarch="$define"
8067 fi
8068
8069 : Final catch-all directories to search
8070 $cat <<EOM
8071
8072 Lastly, you can have perl look in other directories for extensions and
8073 modules in addition to those already specified.
8074 These directories will be searched after
8075         $sitearch
8076         $sitelib
8077 EOM
8078 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8079 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8080 echo ' '
8081 case "$otherlibdirs" in
8082 ''|' ') dflt='none' ;;
8083 *)      dflt="$otherlibdirs" ;;
8084 esac
8085 $cat <<EOM
8086 Enter a colon-separated set of extra paths to include in perl's @INC
8087 search path, or enter 'none' for no extra paths.
8088
8089 EOM
8090
8091 rp='Colon-separated list of additional directories for perl to search?'
8092 . ./myread
8093 case "$ans" in
8094 ' '|''|none)    otherlibdirs=' ' ;;
8095 *)      otherlibdirs="$ans" ;;
8096 esac
8097 case "$otherlibdirs" in
8098 ' ') val=$undef ;;
8099 *)      val=$define ;;
8100 esac
8101 set d_perl_otherlibdirs
8102 eval $setvar
8103
8104 : DTrace support
8105 dflt_dtrace='/usr/sbin/dtrace'
8106 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8107
8108 cat <<EOM
8109
8110 Perl can be built to support DTrace on platforms that support it.
8111 DTrace is a diagnosis and performance analysis tool from Sun.
8112
8113 If this doesn't make any sense to you, just accept the default.
8114 EOM
8115
8116 while $test 1 ; do
8117         case "$usedtrace" in
8118         $define|true|[yY]*)
8119                 dflt='y'
8120                 ;;
8121         $undef|false|[nN]*)
8122                 dflt='n'
8123                 dflt_dtrace=""
8124                 ;;
8125         ?*)
8126                 dflt='y'
8127                 dflt_dtrace=$usedtrace
8128                 ;;
8129         *)
8130                 dflt='n'
8131                 ;;
8132         esac
8133
8134         rp='Support DTrace if available?'
8135         . ./myread
8136         case "$ans" in
8137         y|Y)    val="$define" ;;
8138         *)      val="$undef" ;;
8139         esac
8140         set usedtrace
8141         eval $setvar
8142
8143         test "X$usedtrace" != "X$define" && break
8144
8145         echo " "
8146         rp='Where is the dtrace executable?'
8147         dflt=$dflt_dtrace
8148         . ./getfile
8149         val="$ans"
8150         set dtrace
8151         eval $setvar
8152
8153         if $test -f $dtrace
8154         then
8155                 if $dtrace -h -s ../perldtrace.d \
8156                         -o perldtrace.tmp >/dev/null 2>&1 \
8157                         && rm -f perldtrace.tmp
8158                 then
8159                         echo " "
8160                         echo "Good: your $dtrace knows about the -h flag."
8161                 else
8162                         cat >&2 <<EOM
8163
8164 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8165 ***
8166 *** Your installed dtrace doesn't support the -h switch to compile a D
8167 *** program into a C header. Can't continue.
8168
8169 EOM
8170                         exit 1
8171                 fi
8172                 break;
8173         fi
8174
8175         case "$fastread" in
8176         yes)
8177                 cat >&2 <<EOM
8178
8179 *** $me:  Fatal Error:  $dtrace not found.
8180 *** Can't continue.
8181
8182 EOM
8183                 exit 1
8184                 ;;
8185         *)
8186                 echo "*** $dtrace was not found."
8187                 echo " "
8188                 ;;
8189         esac
8190 done
8191
8192 : See if we want extra modules installed
8193 echo " "
8194 case "$extras" in
8195 '') dflt='n';;
8196 *) dflt='y';;
8197 esac
8198 cat <<EOM
8199 Perl can be built with extra modules or bundles of modules which
8200 will be fetched from the CPAN and installed alongside Perl.
8201
8202 Notice that you will need access to the CPAN; either via the Internet,
8203 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8204 be asked later to configure the CPAN.pm module which will in turn do
8205 the installation of the rest of the extra modules or bundles.)
8206
8207 Notice also that if the modules require any external software such as
8208 libraries and headers (the libz library and the zlib.h header for the
8209 Compress::Zlib module, for example) you MUST have any such software
8210 already installed, this configuration process will NOT install such
8211 things for you.
8212
8213 If this doesn't make any sense to you, just accept the default '$dflt'.
8214 EOM
8215 rp='Install any extra modules (y or n)?'
8216 . ./myread
8217 case "$ans" in
8218 y|Y)
8219         cat <<EOM
8220
8221 Please list any extra modules or bundles to be installed from CPAN,
8222 with spaces between the names.  The names can be in any format the
8223 'install' command of CPAN.pm will understand.  (Answer 'none',
8224 without the quotes, to install no extra modules or bundles.)
8225 EOM
8226         rp='Extras?'
8227         dflt="$extras"
8228         . ./myread
8229         extras="$ans"
8230 esac
8231 case "$extras" in
8232 ''|'none')
8233         val=''
8234         $rm -f ../extras.lst
8235         ;;
8236 *)      echo "(Saving the list of extras for later...)"
8237         echo "$extras" > ../extras.lst
8238         val="'$extras'"
8239         ;;
8240 esac
8241 set extras
8242 eval $setvar
8243 echo " "
8244
8245 : determine where html pages for programs go
8246 set html1dir html1dir none
8247 eval $prefixit
8248 $cat <<EOM
8249
8250 If you wish to install html files for programs in $spackage, indicate
8251 the appropriate directory here.  To skip installing html files,
8252 answer "none".
8253 EOM
8254 case "$html1dir" in
8255 ''|none|$undef|' ') dflt=none ;;
8256 *) dflt=$html1dir ;;
8257 esac
8258 fn=dn+~
8259 rp="Directory for the main $spackage html pages?"
8260 . ./getfile
8261 prefixvar=html1dir
8262 . ./setprefixvar
8263 : Use ' ' for none so value is preserved next time through Configure
8264 $test X"$html1dir" = "X" && html1dir=' '
8265
8266 : determine where html pages for libraries and modules go
8267 set html3dir html3dir none
8268 eval $prefixit
8269 $cat <<EOM
8270
8271 If you wish to install html files for modules associated with $spackage,
8272 indicate the appropriate directory here.  To skip installing html files,
8273 answer "none".
8274 EOM
8275 : There is no obvious default.  If they have specified html1dir, then
8276 : try to key off that, possibly changing .../html1 into .../html3.
8277 case "$html3dir" in
8278 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8279 *) dflt=$html3dir ;;
8280 esac
8281 fn=dn+~
8282 rp="Directory for the $spackage module html pages?"
8283 . ./getfile
8284 prefixvar=html3dir
8285 . ./setprefixvar
8286 : Use ' ' for none so value is preserved next time through Configure
8287 $test X"$html3dir" = "X" && html3dir=' '
8288
8289 : determine whether to install perl also as /usr/bin/perl
8290
8291 echo " "
8292 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8293         $cat <<EOM
8294 Many scripts expect perl to be installed as /usr/bin/perl.
8295
8296 If you want to, I can install the perl you are about to compile
8297 as /usr/bin/perl (in addition to $bin/perl).
8298 EOM
8299         if test -f /usr/bin/perl; then
8300             $cat <<EOM
8301
8302 However, please note that because you already have a /usr/bin/perl,
8303 overwriting that with a new Perl would very probably cause problems.
8304 Therefore I'm assuming you don't want to do that (unless you insist).
8305
8306 EOM
8307             case "$installusrbinperl" in
8308             "$define"|[yY]*)    dflt='y';;
8309             *)                  dflt='n';;
8310             esac
8311         else
8312             $cat <<EOM
8313
8314 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8315
8316 EOM
8317             case "$installusrbinperl" in
8318             "$undef"|[nN]*)     dflt='n';;
8319             *)                  dflt='y';;
8320             esac
8321         fi
8322         rp="Do you want to install perl as /usr/bin/perl?"
8323         . ./myread
8324         case "$ans" in
8325         [yY]*)  val="$define";;
8326         *)      val="$undef" ;;
8327         esac
8328 else
8329         val="$undef"
8330 fi
8331 set installusrbinperl
8332 eval $setvar
8333
8334 : see if dlopen exists
8335 xxx_runnm="$runnm"
8336 xxx_ccflags="$ccflags"
8337 runnm=false
8338 : with g++ one needs -shared to get is-in-libc to work for dlopen
8339 case "$gccversion" in
8340 '')     ;;
8341 *Clang*)        ;;
8342 *)      case "$d_cplusplus" in
8343         "$define") ccflags="$ccflags -shared" ;;
8344         esac
8345         ;;
8346 esac
8347 set dlopen d_dlopen
8348 eval $inlibc
8349 runnm="$xxx_runnm"
8350 ccflags="$xxx_ccflags"
8351
8352 : see if this is a unistd.h system
8353 set unistd.h i_unistd
8354 eval $inhdr
8355
8356 : determine which dynamic loading, if any, to compile in
8357 echo " "
8358 dldir="ext/DynaLoader"
8359 case "$usedl" in
8360     $define|y|true)
8361         dflt='y'
8362         usedl="$define"
8363         ;;
8364     $undef|n|false)
8365         dflt='n'
8366         usedl="$undef"
8367         ;;
8368     *)
8369         dflt='n'
8370         case "$d_dlopen" in
8371             $define) dflt='y' ;;
8372         esac
8373         : Does a dl_xxx.xs file exist for this operating system
8374         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8375         ;;
8376 esac
8377 rp="Do you wish to use dynamic loading?"
8378 . ./myread
8379 usedl="$ans"
8380 bin_ELF="$undef"
8381 case "$ans" in
8382     y*) usedl="$define"
8383         case "$dlsrc" in
8384             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8385                     dflt="$dldir/dl_${osname}.xs"
8386                 elif $test "$d_dlopen" = "$define" ; then
8387                     dflt="$dldir/dl_dlopen.xs"
8388                 else
8389                     dflt=''
8390                 fi
8391                 ;;
8392             *)  dflt="$dldir/$dlsrc"
8393                 ;;
8394         esac
8395         echo "The following dynamic loading files are available:"
8396         : Can not go over to $dldir because getfile has path hard-coded in.
8397         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8398         rp="Source file to use for dynamic loading"
8399         fn="fne"
8400         gfpth="$src"
8401         . ./getfile
8402         usedl="$define"
8403         : emulate basename
8404         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8405
8406         $cat << EOM
8407
8408 Some systems may require passing special flags to $cc -c to
8409 compile modules that will be used to create a shared library.
8410 To use no flags, say "none".
8411
8412 EOM
8413         case "$cccdlflags" in
8414             '') case "$gccversion" in
8415                 '') case "$osname" in
8416                         hpux)   dflt='+z' ;;
8417                         irix*)  dflt='-KPIC' ;;
8418                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8419                         sunos)  dflt='-pic' ;;
8420                         *)      dflt='none' ;;
8421                     esac
8422                     ;;
8423                 *)  case "$osname" in
8424                         darwin) dflt='none' ;;
8425                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8426                         *)      dflt='-fpic' ;;
8427                     esac ;;
8428                 esac ;;
8429             ' ') dflt='none' ;;
8430             *)   dflt="$cccdlflags" ;;
8431         esac
8432
8433         case "$dflt" in
8434             none) dflt='' ;;
8435         esac
8436
8437         # If -Dsysroot was specified, now's the time to add it
8438         # to cccdlflags
8439         if test "X$sysroot" != X; then
8440             case "$gccversion" in
8441                 '') ;;
8442                 *)  case "$dflt" in
8443                         *sysroot*) ;;
8444                         'undef'|*)
8445                             dflt="$dflt --sysroot=$sysroot" ;;
8446                     esac
8447                     ;;
8448             esac
8449         fi
8450
8451         case "$dflt" in
8452             '') dflt='none';;
8453         esac
8454
8455         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8456         . ./myread
8457         case "$ans" in
8458             none) cccdlflags=' ' ;;
8459             *)    cccdlflags="$ans" ;;
8460         esac
8461
8462         cat << EOM
8463
8464 Some systems use ld to create libraries that can be dynamically loaded,
8465 while other systems (such as those using ELF) use $cc.
8466
8467 EOM
8468
8469 : Determine if this is ELF
8470         $cat >try.c <<EOM
8471 /* Test for whether ELF binaries are produced */
8472 #include <fcntl.h>
8473 #$i_stdlib I_STDLIB
8474 #ifdef I_STDLIB
8475 #include <stdlib.h>
8476 #endif
8477 #$i_unistd I_UNISTD
8478 #ifdef I_UNISTD
8479 #include <unistd.h>
8480 #endif
8481 int main() {
8482     char b[4];
8483     int i = open("a.out",O_RDONLY);
8484     if(i == -1)
8485         exit(1); /* fail */
8486     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8487         exit(0); /* succeed (yes, it is ELF) */
8488     exit(1); /* fail */
8489 }
8490 EOM
8491         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8492             bin_ELF="$define"
8493         fi
8494         $rm_try
8495
8496         case "$ld" in
8497             '') if $test $bin_ELF = "$define"; then
8498                     cat <<EOM
8499 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8500 EOM
8501                     dflt="$cc"
8502                 else
8503                     echo "I'll use ld to build dynamic libraries."
8504                     dflt='ld'
8505                 fi
8506                 ;;
8507             *)  dflt="$ld"
8508                 ;;
8509         esac
8510
8511         rp="What command should be used to create dynamic libraries?"
8512         . ./myread
8513         ld="$ans"
8514
8515         cat << EOM
8516
8517 Some systems may require passing special flags to $ld to create a
8518 library that can be dynamically loaded.  If your ld flags include
8519 -L/other/path options to locate libraries outside your loader's normal
8520 search path, you may need to specify those -L options here as well.  To
8521 use no flags, say "none".
8522
8523 EOM
8524         case "$lddlflags" in
8525             '') case "$osname" in
8526                     haiku) dflt='-shared' ;;
8527                     hpux) dflt='-b';
8528                           case "$gccversion" in
8529                               '') dflt="$dflt +vnocompatwarnings" ;;
8530                           esac
8531                           ;;
8532                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8533                     solaris) # See [perl #66604].
8534                             # On Solaris 11, gcc -m64 on amd64
8535                             # appears not to understand -G.  gcc versions at
8536                             # least as old as 3.4.3 support -shared, so just
8537                             # use that with Solaris 11 and later, but keep
8538                             # the old behavior for older Solaris versions.
8539                             case "$gccversion" in
8540                                 '') dflt='-G' ;;
8541                                 *)  case "$osvers" in
8542                                         2.?|2.10) dflt='-G' ;;
8543                                         *) dflt='-shared' ;;
8544                                     esac
8545                                     ;;
8546                             esac
8547                             ;;
8548                     sunos) dflt='-assert nodefinitions' ;;
8549                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8550                     *)     dflt='none' ;;
8551                 esac
8552                 ;;
8553             *) dflt="$lddlflags" ;;
8554         esac
8555
8556         : Only do this for gcc, since, for example, qcc has no concept
8557         : of --sysroot.
8558         if $test "X$sysroot" != X; then
8559             case "$gccversion" in
8560                 '') ;;
8561                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8562             esac
8563         fi
8564
8565         : Try to guess additional flags to pick up local libraries.
8566         : Be careful not to append to a plain 'none'
8567         case "$dflt" in
8568             none) dflt='' ;;
8569         esac
8570         for thisflag in $ldflags; do
8571             case "$thisflag" in
8572                 -L*|-R*|-Wl,-R*)
8573                     case " $dflt " in
8574                         *" $thisflag "*) ;;
8575                         *) dflt="$dflt $thisflag" ;;
8576                     esac
8577                     ;;
8578             esac
8579         done
8580
8581         case "$dflt" in
8582             ''|' ') dflt='none' ;;
8583         esac
8584
8585         case "$ldflags" in
8586             *-fstack-protector-strong*)
8587                 case "$dflt" in
8588                     *-fstack-protector-strong*) ;; # Don't add it again
8589                     *) dflt="$dflt -fstack-protector-strong" ;;
8590                 esac
8591                 ;;
8592             *-fstack-protector*)
8593                 case "$dflt" in
8594                     *-fstack-protector*) ;; # Don't add it again
8595                     *) dflt="$dflt -fstack-protector" ;;
8596                 esac
8597                 ;;
8598         esac
8599
8600         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8601         . ./myread
8602         case "$ans" in
8603             none) lddlflags=' ' ;;
8604             *) lddlflags="$ans" ;;
8605         esac
8606
8607         cat <<EOM
8608
8609 Some systems may require passing special flags to $cc to indicate that
8610 the resulting executable will use dynamic linking.  To use no flags,
8611 say "none".
8612
8613 EOM
8614         case "$ccdlflags" in
8615             '') case "$osname" in
8616                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8617                     sunos)             dflt='none'   ;;
8618                     *)                 dflt='none'   ;;
8619                 esac ;;
8620             ' ') dflt='none' ;;
8621             *)   dflt="$ccdlflags" ;;
8622         esac
8623         rp="Any special flags to pass to $cc to use dynamic linking?"
8624         . ./myread
8625         case "$ans" in
8626             none) ccdlflags=' ' ;;
8627             *)    ccdlflags="$ans" ;;
8628         esac
8629         ;;
8630
8631     *)  usedl="$undef"
8632         ld='ld'
8633         dlsrc='dl_none.xs'
8634         lddlflags=''
8635         ccdlflags=''
8636         ;;
8637 esac
8638
8639 ld_can_script="$undef"
8640 case "$bin_ELF$usedl" in
8641     $define$define)
8642         # Abuse try.h and a.out names for neat cleanup
8643         $cat >try.c <<EOM
8644 void foo() {}
8645 void bar() {}
8646 EOM
8647         $cat >try.h <<EOM
8648 LIBTEST_42 {
8649  global:
8650   foo;
8651  local: *;
8652  };
8653 EOM
8654         if $cc $cccdlflags $ccdlflags $ccflags \
8655                $ldflags $lddlflags -o a.out try.c \
8656                -Wl,--version-script=try.h >/dev/null 2>&1 \
8657            &&  $test -s a.out ; then
8658             echo "ld supports scripting" >&4
8659             ld_can_script="$define"
8660         else
8661             echo "ld does not support scripting" >&4
8662         fi
8663         $rm_try
8664         ;;
8665 esac
8666
8667 : Do we want a shared libperl?
8668 also=''
8669 case "$usedl" in
8670 $undef)
8671         # No dynamic loading being used, so don't bother even to prompt.
8672         useshrplib='false'
8673         ;;
8674 *)      case "$useshrplib" in
8675         '')     case "$osname" in
8676                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8677                         dflt=y
8678                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8679                         ;;
8680                 *)      dflt=n
8681                         ;;
8682                 esac
8683                 ;;
8684         $define|true|[Yy]*)
8685                 dflt=y
8686                 ;;
8687         *)      dflt=n
8688                 ;;
8689         esac
8690         $cat << EOM
8691
8692 The perl executable is normally obtained by linking perlmain.c with
8693 libperl${_a}, any static extensions (usually just DynaLoader), and
8694 any other libraries needed on this system (such as -lm, etc.).  Since
8695 your system supports dynamic loading, it is probably possible to build
8696 a shared libperl.$so.  If you will have more than one executable linked
8697 to libperl.$so, this will significantly reduce the size of each
8698 executable, but it may have a noticeable effect on performance.  The
8699 default is probably sensible for your system.
8700 $also
8701
8702 EOM
8703         rp="Build a shared libperl.$so (y/n)"
8704         . ./myread
8705         case "$ans" in
8706         true|$define|[Yy]*)
8707                 useshrplib='true'  ;;
8708         *)      useshrplib='false' ;;
8709         esac
8710         ;;
8711 esac
8712
8713 case "$useshrplib" in
8714 true)
8715         case "$userelocatableinc" in
8716         true|define)
8717                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8718                 echo "See INSTALL for an explanation why that won't work." >&4
8719                 exit 4
8720                 ;;
8721         esac
8722         case "$libperl" in
8723         '')
8724                 # Figure out a good name for libperl.so.  Since it gets stored in
8725                 # a version-specific architecture-dependent library, the version
8726                 # number isn't really that important, except for making cc/ld happy.
8727                 #
8728                 # A name such as libperl.so.10.1
8729                 majmin="libperl.$so.$patchlevel.$subversion"
8730                 # A name such as libperl.so.100
8731                 majonly=`echo $patchlevel $subversion |
8732                         $awk '{printf "%d%02d", $1, $2}'`
8733                 majonly=libperl.$so.$majonly
8734                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8735                 # rely on figuring it out from the naming of libc.
8736                 case "${osname}${osvers}" in
8737                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8738                         dflt=libperl.$so
8739                         ;;
8740                 cygwin*) # ld links now against the dll directly
8741                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8742                         majonly=`echo $patchlevel $subversion |
8743                                 $awk '{printf "%03d%03d", $1, $2}'`
8744                         majonly=cygperl5.$majonly.$so
8745                         dflt=$majmin
8746                         ;;
8747                 *)      # Try to guess based on whether libc has major.minor.
8748                         case "$libc" in
8749                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8750                         *libc.$so.[0-9]*) dflt=$majonly ;;
8751                         *)      dflt=libperl.$so ;;
8752                         esac
8753                         ;;
8754                 esac
8755                 ;;
8756         *)      dflt=$libperl
8757                 ;;
8758         esac
8759         cat << EOM
8760
8761 I need to select a good name for the shared libperl.  If your system uses
8762 library names with major and minor numbers, then you might want something
8763 like $majmin.  Alternatively, if your system uses a single version
8764 number for shared libraries, then you might want to use $majonly.
8765 Or, your system might be quite happy with a simple libperl.$so.
8766
8767 Since the shared libperl will get installed into a version-specific
8768 architecture-dependent directory, the version number of the shared perl
8769 library probably isn't important, so the default should be o.k.
8770
8771 EOM
8772         rp='What name do you want to give to the shared libperl?'
8773         . ./myread
8774         libperl=$ans
8775         echo "Ok, I'll use $libperl"
8776         ;;
8777 *)
8778         libperl="libperl${_a}"
8779         ;;
8780 esac
8781
8782 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8783 case "$shrpdir" in
8784 '') ;;
8785 *)      $cat >&4 <<EOM
8786 WARNING:  Use of the shrpdir variable for the installation location of
8787 the shared $libperl is not supported.  It was never documented and
8788 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8789 know of any problems this may cause.
8790
8791 EOM
8792         case "$shrpdir" in
8793         "$archlibexp/CORE")
8794                 $cat >&4 <<EOM
8795 But your current setting of $shrpdir is
8796 the default anyway, so it's harmless.
8797 EOM
8798                 ;;
8799         *)
8800                 $cat >&4 <<EOM
8801 Further, your current attempted setting of $shrpdir
8802 conflicts with the value of $archlibexp/CORE
8803 that installperl will use.
8804 EOM
8805                 ;;
8806         esac
8807         ;;
8808 esac
8809
8810 # How will the perl executable find the installed shared $libperl?
8811 # Add $xxx to ccdlflags.
8812 # If we can't figure out a command-line option, use $shrpenv to
8813 # set env LD_RUN_PATH.  The main perl makefile uses this.
8814 shrpdir=$archlibexp/CORE
8815 xxx=''
8816 tmp_shrpenv=''
8817 if "$useshrplib"; then
8818     case "$osname" in
8819         aix)
8820                 # We'll set it in Makefile.SH...
8821                 ;;
8822         solaris)
8823                 xxx="-R $shrpdir"
8824                 ;;
8825         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8826                 xxx="-Wl,-R$shrpdir"
8827                 ;;
8828         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8829                 xxx="-Wl,-rpath,$shrpdir"
8830                 ;;
8831         hpux*)
8832                 # hpux doesn't like the default, either.
8833                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8834                 ;;
8835         cygwin)
8836                 # cygwin needs only ldlibpth
8837                 ;;
8838         *)
8839                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8840                 ;;
8841         esac
8842         case "$xxx" in
8843         '') ;;
8844         *)
8845                 # Only add $xxx if it isn't already in ccdlflags.
8846                 case " $ccdlflags " in
8847                 *" $xxx "*)     ;;
8848                 *)      ccdlflags="$ccdlflags $xxx"
8849                         cat <<EOM >&4
8850
8851 Adding $xxx to the flags
8852 passed to $ld so that the perl executable will find the
8853 installed shared $libperl.
8854
8855 EOM
8856                         ;;
8857                 esac
8858                 ;;
8859         esac
8860 fi
8861 # Fix ccdlflags in AIX for building external extensions.
8862 # (For building Perl itself bare -bE:perl.exp is needed,
8863 #  Makefile.SH takes care of this.)
8864 case "$osname" in
8865 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8866 esac
8867 # Respect a hint or command-line value.
8868 case "$shrpenv" in
8869 '') shrpenv="$tmp_shrpenv" ;;
8870 esac
8871 case "$ldlibpthname" in
8872 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8873 none)   ldlibpthname='' ;;
8874 esac
8875
8876 : determine where manual pages are on this system
8877 echo " "
8878 case "$sysman" in
8879 '')
8880         syspath='/usr/share/man/man1 /usr/man/man1'
8881         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8882         syspath="$syspath /usr/man/u_man/man1"
8883         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8884         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8885         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8886         sysman=`./loc . /usr/man/man1 $syspath`
8887         ;;
8888 esac
8889 if $test -d "$sysman"; then
8890         echo "System manual is in $sysman." >&4
8891 else
8892         echo "Could not find manual pages in source form." >&4
8893 fi
8894
8895 : determine where manual pages go
8896 set man1dir man1dir none
8897 eval $prefixit
8898 $cat <<EOM
8899
8900 $spackage has manual pages available in source form.
8901 EOM
8902 case "$nroff" in
8903 nroff)
8904         echo "However, you don't have nroff, so they're probably useless to you."
8905         case "$man1dir" in
8906         '') man1dir="none";;
8907         esac;;
8908 esac
8909 echo "If you don't want the manual sources installed, answer 'none'."
8910 case "$man1dir" in
8911 ' ') dflt=none
8912         ;;
8913 '')
8914         lookpath="$prefixexp/share/man/man1"
8915         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8916         lookpath="$lookpath $prefixexp/man/p_man/man1"
8917         lookpath="$lookpath $prefixexp/man/u_man/man1"
8918         lookpath="$lookpath $prefixexp/man/man.1"
8919         case "$sysman" in
8920         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8921         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8922         esac
8923         set dflt
8924         eval $prefixup
8925         ;;
8926 *)  dflt="$man1dir"
8927         ;;
8928 esac
8929 echo " "
8930 fn=dn+~
8931 rp="Where do the main $spackage manual pages (source) go?"
8932 . ./getfile
8933 if $test "X$man1direxp" != "X$ansexp"; then
8934         installman1dir=''
8935 fi
8936 prefixvar=man1dir
8937 . ./setprefixvar
8938
8939 case "$man1dir" in
8940 '')     man1dir=' '
8941         installman1dir='';;
8942 esac
8943
8944 : What suffix to use on installed man pages
8945
8946 case "$man1dir" in
8947 ' ')
8948         man1ext='0'
8949         ;;
8950 *)
8951         rp="What suffix should be used for the main $spackage man pages?"
8952         case "$man1ext" in
8953         '')     case "$man1dir" in
8954                 *1)  dflt=1 ;;
8955                 *1p) dflt=1p ;;
8956                 *1pm) dflt=1pm ;;
8957                 *l) dflt=l;;
8958                 *n) dflt=n;;
8959                 *o) dflt=o;;
8960                 *p) dflt=p;;
8961                 *C) dflt=C;;
8962                 *L) dflt=L;;
8963                 *L1) dflt=L1;;
8964                 *) dflt=1;;
8965                 esac
8966                 ;;
8967         *)      dflt="$man1ext";;
8968         esac
8969         . ./myread
8970         man1ext="$ans"
8971         ;;
8972 esac
8973
8974 : see if we can have long filenames
8975 echo " "
8976 first=123456789abcdef
8977 $rm -f $first
8978 if (echo hi >$first) 2>/dev/null; then
8979         if $test -f 123456789abcde; then
8980                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8981                 val="$undef"
8982         else
8983                 echo 'You can have filenames longer than 14 characters.'>&4
8984                 val="$define"
8985         fi
8986 else
8987         $cat <<'EOM'
8988 You can't have filenames longer than 14 chars.
8989 You can't even think about them!
8990 EOM
8991         val="$undef"
8992 fi
8993 set d_flexfnam
8994 eval $setvar
8995 $rm -rf 123456789abcde*
8996
8997 : determine where library module manual pages go
8998 set man3dir man3dir none
8999 eval $prefixit
9000 $cat <<EOM
9001
9002 $spackage has manual pages for many of the library modules.
9003 EOM
9004
9005 case "$nroff" in
9006 nroff)
9007         $cat <<'EOM'
9008 However, you don't have nroff, so they're probably useless to you.
9009 EOM
9010         case "$man3dir" in
9011         '') man3dir="none";;
9012         esac;;
9013 esac
9014
9015 case "$d_flexfnam" in
9016 undef)
9017         $cat <<'EOM'
9018 However, your system can't handle the long file names like File::Basename.3.
9019 EOM
9020         case "$man3dir" in
9021         '') man3dir="none";;
9022         esac;;
9023 esac
9024
9025 echo "If you don't want the manual sources installed, answer 'none'."
9026 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9027 case "$man3dir" in
9028 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9029         if $test -d "$privlib/man/man3"; then
9030                 cat <<EOM >&4
9031
9032 WARNING:  Previous versions of perl installed man3 pages into
9033 $privlib/man/man3.  This version will suggest a
9034 new default of $dflt.
9035 EOM
9036                 tdflt=$dflt
9037                 dflt='n'
9038                 rp='Do you wish to preserve the old behavior?(y/n)'
9039                 . ./myread
9040                 case "$ans" in
9041                 y*) dflt="$privlib/man/man3" ;;
9042                 *)  dflt=$tdflt ;;
9043                 esac
9044     fi
9045         ;;
9046 *)      dflt="$man3dir" ;;
9047 esac
9048 case "$dflt" in
9049 ' ') dflt=none ;;
9050 esac
9051 echo " "
9052 fn=dn+~
9053 rp="Where do the $package library man pages (source) go?"
9054 . ./getfile
9055 prefixvar=man3dir
9056 . ./setprefixvar
9057
9058 case "$man3dir" in
9059 '')     man3dir=' '
9060         installman3dir='';;
9061 esac
9062
9063 : What suffix to use on installed man pages
9064 case "$man3dir" in
9065 ' ')
9066         man3ext='0'
9067         ;;
9068 *)
9069         rp="What suffix should be used for the $package library man pages?"
9070         case "$man3ext" in
9071         '')     case "$man3dir" in
9072                 *3)  dflt=3 ;;
9073                 *3p) dflt=3p ;;
9074                 *3pm) dflt=3pm ;;
9075                 *l) dflt=l;;
9076                 *n) dflt=n;;
9077                 *o) dflt=o;;
9078                 *p) dflt=p;;
9079                 *C) dflt=C;;
9080                 *L) dflt=L;;
9081                 *L3) dflt=L3;;
9082                 *) dflt=3;;
9083                 esac
9084                 ;;
9085         *)      dflt="$man3ext";;
9086         esac
9087         . ./myread
9088         man3ext="$ans"
9089         ;;
9090 esac
9091
9092 : see if we have to deal with yellow pages, now NIS.
9093 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9094         case "$hostcat" in
9095         nidump*) ;;
9096         *)
9097                 case "$hostcat" in
9098                 *ypcat*) dflt=y;;
9099                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9100                                 dflt=y
9101                         else
9102                                 dflt=n
9103                         fi;;
9104                 *) dflt=n;;
9105                 esac
9106                 echo " "
9107                 rp='Are you getting the hosts file via yellow pages?'
9108                 . ./myread
9109                 case "$ans" in
9110                 y*) hostcat='ypcat hosts';;
9111                 *) hostcat='cat /etc/hosts';;
9112                 esac
9113                 ;;
9114         esac
9115 fi
9116 case "$hostcat" in
9117 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9118 esac
9119 case "$groupcat" in
9120 '') test -f /etc/group && groupcat='cat /etc/group';;
9121 esac
9122 case "$passcat" in
9123 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9124 esac
9125
9126 : now get the host name
9127 echo " "
9128 echo "Figuring out host name..." >&4
9129 case "$myhostname" in
9130 '') cont=true
9131         echo 'Maybe "hostname" will work...'
9132         if tans=`sh -c hostname 2>&1` ; then
9133                 myhostname=$tans
9134                 phostname=hostname
9135                 cont=''
9136         fi
9137         ;;
9138 *) cont='';;
9139 esac
9140 if $test "$cont"; then
9141         if ./xenix; then
9142                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9143                 if tans=`cat /etc/systemid 2>&1` ; then
9144                         myhostname=$tans
9145                         phostname='cat /etc/systemid'
9146                         echo "Whadyaknow.  Xenix always was a bit strange..."
9147                         cont=''
9148                 fi
9149         elif $test -r /etc/systemid; then
9150                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9151         fi
9152 fi
9153 if $test "$cont"; then
9154         echo 'No, maybe "uuname -l" will work...'
9155         if tans=`sh -c 'uuname -l' 2>&1` ; then
9156                 myhostname=$tans
9157                 phostname='uuname -l'
9158         else
9159                 echo 'Strange.  Maybe "uname -n" will work...'
9160                 if tans=`sh -c 'uname -n' 2>&1` ; then
9161                         myhostname=$tans
9162                         phostname='uname -n'
9163                 else
9164                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9165                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9166                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9167                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9168                         else
9169                                 case "$myhostname" in
9170                                 '') echo "Does this machine have an identity crisis or something?"
9171                                         phostname='';;
9172                                 *)
9173                                         echo "Well, you said $myhostname before..."
9174                                         phostname='echo $myhostname';;
9175                                 esac
9176                         fi
9177                 fi
9178         fi
9179 fi
9180 case "$myhostname" in
9181 '') myhostname=noname ;;
9182 esac
9183 : you do not want to know about this
9184 set $myhostname
9185 myhostname=$1
9186
9187 : verify guess
9188 if $test "$myhostname" ; then
9189         dflt=y
9190         rp='Your host name appears to be "'$myhostname'".'" Right?"
9191         . ./myread
9192         case "$ans" in
9193         y*) ;;
9194         *) myhostname='';;
9195         esac
9196 fi
9197
9198 : bad guess or no guess
9199 while $test "X$myhostname" = X ; do
9200         dflt=''
9201         rp="Please type the (one word) name of your host:"
9202         . ./myread
9203         myhostname="$ans"
9204 done
9205
9206 : translate upper to lower if necessary
9207 case "$myhostname" in
9208 *[A-Z]*)
9209         echo "(Normalizing case in your host name)"
9210         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9211         ;;
9212 esac
9213
9214 case "$myhostname" in
9215 *.*)
9216         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9217         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9218         echo "(Trimming domain name from host name--host name is now $myhostname)"
9219         ;;
9220 *) case "$mydomain" in
9221         '')
9222                 {
9223                         test "X$hostcat" = "Xypcat hosts" &&
9224                         ypmatch "$myhostname" hosts 2>/dev/null |\
9225                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9226                         $test -s hosts
9227                 } || {
9228                         test "X$hostcat" != "X" &&
9229                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9230                                         /[       ]$myhostname[  . ]/p" > hosts
9231                 }
9232                 tmp_re="[       . ]"
9233                 if $test -f hosts; then
9234                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9235                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9236                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9237                                 hosts | $sort | $uniq | \
9238                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9239                         case `$echo X$dflt` in
9240                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9241                                 dflt=.
9242                                 ;;
9243                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9244                                 ;;
9245                         esac
9246                 else
9247                         echo "(I cannot locate a hosts database anywhere)"
9248                         dflt=.
9249                 fi
9250                 case "$dflt" in
9251                 .)
9252                         tans=`./loc resolv.conf X /etc /usr/etc`
9253                         if $test -f "$tans"; then
9254                                 echo "(Attempting domain name extraction from $tans)"
9255                                 dflt=.`$sed -n -e 's/   / /g' \
9256                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9257                                   -e 1q 2>/dev/null`
9258                                 case "$dflt" in
9259                                 .) dflt=.`$sed -n -e 's/        / /g' \
9260                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9261                                      -e 1q 2>/dev/null`
9262                                         ;;
9263                                 esac
9264                         fi
9265                         ;;
9266                 esac
9267                 case "$dflt" in
9268                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9269                         dflt=.`sh -c domainname 2>/dev/null`
9270                         case "$dflt" in
9271                         '') dflt='.';;
9272                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9273                         esac
9274                         ;;
9275                 esac
9276                 case "$dflt$osname" in
9277                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9278                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9279                         ;;
9280                 esac
9281                 case "$dflt" in
9282                 .) echo "(Lost all hope -- silly guess then)"
9283                         dflt='.nonet'
9284                         ;;
9285                 esac
9286                 $rm -f hosts
9287                 ;;
9288         *) dflt="$mydomain";;
9289         esac;;
9290 esac
9291 echo " "
9292 rp="What is your domain name?"
9293 . ./myread
9294 tans="$ans"
9295 case "$ans" in
9296 '') ;;
9297 .*) ;;
9298 *) tans=".$tans";;
9299 esac
9300 mydomain="$tans"
9301
9302 : translate upper to lower if necessary
9303 case "$mydomain" in
9304 *[A-Z]*)
9305         echo "(Normalizing case in your domain name)"
9306         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9307         ;;
9308 esac
9309
9310 : a little sanity check here
9311 case "$phostname" in
9312 '') ;;
9313 *)
9314         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9315         $myhostname$mydomain|$myhostname) ;;
9316         *)
9317                 case "$phostname" in
9318                 sed*)
9319                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9320                         ;;
9321                 *)
9322                         echo "(That doesn't agree with your $phostname command, by the way.)"
9323                         ;;
9324                 esac
9325         ;;
9326         esac
9327         ;;
9328 esac
9329
9330 : determine the e-mail address of the user who is running us
9331 $cat <<EOM
9332
9333 I need to get your e-mail address in Internet format if possible, i.e.
9334 something like user@host.domain. Please answer accurately since I have
9335 no easy means to double check it. The default value provided below
9336 is most probably close to reality but may not be valid from outside
9337 your organization...
9338
9339 EOM
9340 cont=x
9341 while test "$cont"; do
9342         case "$MAILDOMAIN" in
9343         '')
9344                 if $test -s /etc/mailname; then
9345                         maildomain=`$cat /etc/mailname`
9346                 else
9347                         maildomain="$myhostname$mydomain"
9348                 fi
9349                 ;;
9350         *)  maildomain="$MAILDOMAIN";;
9351         esac
9352         case "$cf_email" in
9353         '') dflt="$cf_by@$maildomain";;
9354         *)  dflt="$cf_email";;
9355         esac
9356         rp='What is your e-mail address?'
9357         . ./myread
9358         cf_email="$ans"
9359         case "$cf_email" in
9360         *@*.*) cont='' ;;
9361         *)
9362                 rp='Address does not look like an Internet one.  Use it anyway?'
9363                 case "$fastread" in
9364                 yes) dflt=y ;;
9365                 *) dflt=n ;;
9366                 esac
9367                 . ./myread
9368                 case "$ans" in
9369                 y*) cont='' ;;
9370                 *) echo " " ;;
9371                 esac
9372                 ;;
9373         esac
9374 done
9375
9376 : Ask e-mail of administrator
9377 $cat <<EOM
9378
9379 If you or somebody else will be maintaining perl at your site, please
9380 fill in the correct e-mail address here so that they may be contacted
9381 if necessary. Currently, the "perlbug" program included with perl
9382 will send mail to this address in addition to perlbug@perl.org. You may
9383 enter "none" for no administrator.
9384
9385 EOM
9386 case "$perladmin" in
9387 '') dflt="$cf_email";;
9388 *) dflt="$perladmin";;
9389 esac
9390 rp='Perl administrator e-mail address'
9391 . ./myread
9392 perladmin="$ans"
9393
9394 : determine whether to use a version number suffix for installed binaries
9395 echo " "
9396 $cat <<EOM
9397 Do you want to use a version number suffix for installed binaries? This
9398 will install 'perl$version' instead of 'perl', and likewise for other
9399 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9400 to be installed side-by-side. Unless you are a developer, you probably
9401 do *not* want to do this.
9402 EOM
9403 case "$versiononly" in
9404 "$define"|[Yy]*|true) dflt='y' ;;
9405 *) dflt='n';
9406 esac
9407 rp="Do you want to use a version number suffix for installed binaries?"
9408 . ./myread
9409 case "$ans" in
9410 [yY]*)  val="$define";;
9411 *)      val="$undef" ;;
9412 esac
9413 set versiononly
9414 eval $setvar
9415
9416 case "$versiononly" in
9417 "$define") inc_version_list=''
9418            inc_version_list_init=0
9419            ;;
9420 esac
9421
9422 : figure out how to guarantee perl startup
9423 : XXX Note that this currently takes advantage of the bug that binexp ignores
9424 :     the Configure -Dinstallprefix setting, which in turn means that under
9425 :     relocatable @INC, initialinstalllocation is what binexp started as.
9426 case "$startperl" in
9427 '')
9428         case "$sharpbang" in
9429         *!)
9430                 $cat <<EOH
9431
9432 I can use the #! construct to start perl on your system. This will
9433 make startup of perl scripts faster, but may cause problems if you
9434 want to share those scripts and perl is not in a standard place
9435 ($initialinstalllocation/perl) on all your platforms. The alternative
9436 is to force a shell by starting the script with a single ':' character.
9437
9438 EOH
9439                 case "$versiononly" in
9440                 "$define")      dflt="$initialinstalllocation/perl$version";;
9441                 *)              dflt="$initialinstalllocation/perl";;
9442                 esac
9443                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9444                 . ./myread
9445                 case "$ans" in
9446                 none)   startperl=": # use perl";;
9447                 *)      startperl="#!$ans"
9448                         if $test 30 -lt `echo "$ans" | wc -c`; then
9449                                 $cat >&4 <<EOM
9450
9451 WARNING:  Some systems limit the #! command to 32 characters.
9452 If you experience difficulty running Perl scripts with #!, try
9453 installing Perl in a directory with a shorter pathname.
9454
9455 EOM
9456                         fi ;;
9457                 esac
9458                 ;;
9459         *) startperl=": # use perl"
9460                 ;;
9461         esac
9462         ;;
9463 esac
9464 echo "I'll use $startperl to start perl scripts."
9465
9466 : figure best path for perl in scripts
9467 case "$perlpath" in
9468 '')
9469         case "$versiononly" in
9470         "$define")      perlpath="$initialinstalllocation/perl$version";;
9471         *)              perlpath="$initialinstalllocation/perl";;
9472         esac
9473         case "$startperl" in
9474         *!*) ;;
9475         *)
9476                 $cat <<EOH
9477
9478 I will use the "eval 'exec'" idiom to start Perl on your system.
9479 I can use the full path of your Perl binary for this purpose, but
9480 doing so may cause problems if you want to share those scripts and
9481 Perl is not always in a standard place ($initialinstalllocation/perl).
9482
9483 EOH
9484                 dflt="$initialinstalllocation/perl"
9485                 rp="What path shall I use in \"eval 'exec'\"?"
9486                 . ./myread
9487                 perlpath="$ans"
9488                 ;;
9489         esac
9490         ;;
9491 esac
9492 case "$startperl" in
9493 *!*)    ;;
9494 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9495 esac
9496
9497 : determine where public executable scripts go
9498 set scriptdir scriptdir
9499 eval $prefixit
9500 case "$scriptdir" in
9501 '')
9502         dflt="$bin"
9503         : guess some guesses
9504         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9505         $test -d /usr/share/bin     && dflt=/usr/share/bin
9506         $test -d /usr/local/script  && dflt=/usr/local/script
9507         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9508         $test -d $prefixexp/script  && dflt=$prefixexp/script
9509         set dflt
9510         eval $prefixup
9511         ;;
9512 *)  dflt="$scriptdir"
9513         ;;
9514 esac
9515 $cat <<EOM
9516
9517 Some installations have a separate directory just for executable scripts so
9518 that they can mount it across multiple architectures but keep the scripts in
9519 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9520 Or you might just lump your scripts in with all your other executables.
9521
9522 EOM
9523 fn=d~
9524 rp='Where do you keep publicly executable scripts?'
9525 . ./getfile
9526 if $test "X$ansexp" != "X$scriptdirexp"; then
9527         installscript=''
9528 fi
9529 installscriptdir=''
9530 prefixvar=scriptdir
9531 . ./setprefixvar
9532 : A little fix up for an irregularly named variable.
9533 installscript="$installscriptdir"
9534
9535 : determine where add-on public executables go
9536 case "$sitebin" in
9537 '')     dflt=$siteprefix/bin ;;
9538 *)      dflt=$sitebin ;;
9539 esac
9540 fn=d~
9541 rp='Pathname where the add-on public executables should be installed?'
9542 . ./getfile
9543 prefixvar=sitebin
9544 . ./setprefixvar
9545
9546 : determine where add-on html pages go
9547 : There is no standard location, so try to copy the previously-selected
9548 : directory structure for the core html pages.
9549 case "$sitehtml1dir" in
9550 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9551 *)     dflt=$sitehtml1dir ;;
9552 esac
9553 case "$dflt" in
9554 ''|' ') dflt=none ;;
9555 esac
9556 fn=dn+~
9557 rp='Pathname where the site-specific html pages should be installed?'
9558 . ./getfile
9559 prefixvar=sitehtml1dir
9560 . ./setprefixvar
9561
9562 : determine where add-on library html pages go
9563 : There is no standard location, so try to copy the previously-selected
9564 : directory structure for the core html pages.
9565 case "$sitehtml3dir" in
9566 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)     dflt=$sitehtml3dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific library html pages should be installed?'
9574 . ./getfile
9575 prefixvar=sitehtml3dir
9576 . ./setprefixvar
9577
9578 : determine where add-on manual pages go
9579 case "$siteman1dir" in
9580 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9581 *)      dflt=$siteman1dir ;;
9582 esac
9583 case "$dflt" in
9584 ''|' ') dflt=none ;;
9585 esac
9586 fn=dn+~
9587 rp='Pathname where the site-specific manual pages should be installed?'
9588 . ./getfile
9589 prefixvar=siteman1dir
9590 . ./setprefixvar
9591
9592 : determine where add-on library man pages go
9593 case "$siteman3dir" in
9594 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9595 *)      dflt=$siteman3dir ;;
9596 esac
9597 case "$dflt" in
9598 ''|' ') dflt=none ;;
9599 esac
9600 fn=dn+~
9601 rp='Pathname where the site-specific library manual pages should be installed?'
9602 . ./getfile
9603 prefixvar=siteman3dir
9604 . ./setprefixvar
9605
9606 : determine where add-on public executable scripts go
9607 case "$sitescript" in
9608 '')     dflt=$siteprefix/script
9609         $test -d $dflt || dflt=$sitebin ;;
9610 *)  dflt="$sitescript" ;;
9611 esac
9612 fn=d~+
9613 rp='Pathname where add-on public executable scripts should be installed?'
9614 . ./getfile
9615 prefixvar=sitescript
9616 . ./setprefixvar
9617
9618 : see if backtrace exists
9619 set backtrace d_backtrace
9620 eval $inlibc
9621
9622 : Check if C backtrace is actually supported.
9623 case "$usecbacktrace" in
9624   "") usecbacktrace=$undef ;;
9625   [yY]*|true|$define)
9626     case "$d_backtrace" in
9627       [yY]*|true|$define)
9628         ;;
9629       *)
9630         echo "This system does not support backtrace" >&4
9631         usecbacktrace=$undef
9632         ;;
9633       esac
9634     ;;
9635   esac
9636
9637 : Check if faststdio is requested and available
9638 case "$usefaststdio" in
9639 $define|true|[yY]*|'')
9640         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9641         case "$xversion" in
9642         [68])   dflt='y' ;;
9643         *)      dflt='n' ;;
9644         esac
9645         ;;
9646 *) dflt='n';;
9647 esac
9648 cat <<EOM
9649
9650 Perl can be built to use 'fast stdio', which means using the stdio
9651 library but also directly manipulating the stdio buffers to enable
9652 faster I/O.  Using stdio is better for backward compatibility (especially
9653 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9654 interface has been preferred instead of stdio.
9655
9656 If this doesn't make any sense to you, just accept the default '$dflt'.
9657 EOM
9658 rp='Use the "fast stdio" if available?'
9659 . ./myread
9660 case "$ans" in
9661 y|Y)    val="$define" ;;
9662 *)      val="$undef" ;;
9663 esac
9664 set usefaststdio
9665 eval $setvar
9666
9667 : define an is-a-typedef? function
9668 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9669 case "$inclist" in
9670 "") inclist="sys/types.h";;
9671 esac;
9672 eval "varval=\$$var";
9673 case "$varval" in
9674 "")
9675         $rm -f temp.c;
9676         for inc in $inclist; do
9677                 echo "#include <$inc>" >>temp.c;
9678         done;
9679         echo "#ifdef $type" >> temp.c;
9680         echo "printf(\"We have $type\");" >> temp.c;
9681         echo "#endif" >> temp.c;
9682         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9683         if $contains $type temp.E >/dev/null 2>&1; then
9684                 eval "$var=\$type";
9685         else
9686                 eval "$var=\$def";
9687         fi;
9688         $rm -f temp.?;;
9689 *) eval "$var=\$varval";;
9690 esac'
9691
9692 : define an is-a-typedef? function that prompts if the type is not available.
9693 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9694 case "$inclist" in
9695 "") inclist="sys/types.h";;
9696 esac;
9697 eval "varval=\$$var";
9698 case "$varval" in
9699 "")
9700         $rm -f temp.c;
9701         for inc in $inclist; do
9702                 echo "#include <$inc>" >>temp.c;
9703         done;
9704         echo "#ifdef $type" >> temp.c;
9705         echo "printf(\"We have $type\");" >> temp.c;
9706         echo "#endif" >> temp.c;
9707         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9708         echo " " ;
9709         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9710         if $contains $type temp.E >/dev/null 2>&1; then
9711                 echo "$type found." >&4;
9712                 eval "$var=\$type";
9713         else
9714                 echo "$type NOT found." >&4;
9715                 dflt="$def";
9716                 . ./myread ;
9717                 eval "$var=\$ans";
9718         fi;
9719         $rm -f temp.?;;
9720 *) eval "$var=\$varval";;
9721 esac'
9722
9723 : see what type lseek is declared as in the kernel
9724 rp="What is the type used for lseek's offset on this system?"
9725 set off_t lseektype long stdio.h sys/types.h
9726 eval $typedef_ask
9727
9728 echo " "
9729 echo "Checking to see how big your file offsets are..." >&4
9730 $cat >try.c <<EOCP
9731 #include <sys/types.h>
9732 #include <stdio.h>
9733 int main()
9734 {
9735     printf("%d\n", (int)sizeof($lseektype));
9736     return(0);
9737 }
9738 EOCP
9739 set try
9740 if eval $compile_ok; then
9741         lseeksize=`$run ./try`
9742         echo "Your file offsets are $lseeksize bytes long."
9743 else
9744         dflt=$longsize
9745         echo " "
9746         echo "(I can't seem to compile the test program.  Guessing...)"
9747         rp="What is the size of your file offsets (in bytes)?"
9748         . ./myread
9749         lseeksize="$ans"
9750 fi
9751 $rm_try
9752
9753 : see what type file positions are declared as in the library
9754 rp="What is the type for file position used by fsetpos()?"
9755 set fpos_t fpostype long stdio.h sys/types.h
9756 eval $typedef_ask
9757
9758 : Check size for Fpos_t
9759 echo " "
9760 case "$fpostype" in
9761 *_t) zzz="$fpostype"    ;;
9762 *)   zzz="fpos_t"       ;;
9763 esac
9764 echo "Checking the size of $zzz..." >&4
9765 cat > try.c <<EOCP
9766 #include <sys/types.h>
9767 #include <stdio.h>
9768 #$i_stdlib I_STDLIB
9769 #ifdef I_STDLIB
9770 #include <stdlib.h>
9771 #endif
9772 int main() {
9773     printf("%d\n", (int)sizeof($fpostype));
9774     exit(0);
9775 }
9776 EOCP
9777 set try
9778 if eval $compile_ok; then
9779         yyy=`$run ./try`
9780         case "$yyy" in
9781         '')     fpossize=4
9782                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9783                 ;;
9784         *)      fpossize=$yyy
9785                 echo "Your $zzz is $fpossize bytes long."
9786                 ;;
9787         esac
9788 else
9789         dflt="$longsize"
9790         echo " " >&4
9791         echo "(I can't compile the test program.  Guessing...)" >&4
9792         rp="What is the size of your file positions (in bytes)?"
9793         . ./myread
9794         fpossize="$ans"
9795 fi
9796
9797 : Check for large file support
9798 # Backward compatibility (uselfs is deprecated).
9799 case "$uselfs" in
9800 "$define"|true|[yY]*)
9801         cat <<EOM >&4
9802
9803 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9804 EOM
9805         uselargefiles="$define"
9806         ;;
9807 esac
9808
9809 case "$lseeksize:$fpossize" in
9810 8:8) cat <<EOM
9811
9812 You can have files larger than 2 gigabytes.
9813 EOM
9814    val="$define" ;;
9815 *)    case "$uselargefiles" in
9816    "$undef"|false|[nN]*) dflt='n' ;;
9817    *)   dflt='y' ;;
9818    esac
9819    cat <<EOM
9820
9821 Perl can be built to understand large files (files larger than 2 gigabytes)
9822 on some systems.  To do so, Configure can be run with -Duselargefiles.
9823
9824 If this doesn't make any sense to you, just accept the default '$dflt'.
9825 EOM
9826    rp='Try to understand large files, if available?'
9827    . ./myread
9828    case "$ans" in
9829    y|Y) val="$define" ;;
9830    *)   val="$undef"  ;;
9831    esac
9832    ;;
9833 esac
9834 set uselargefiles
9835 eval $setvar
9836 : Look for a hint-file generated 'call-back-unit'.  If the
9837 : user has specified that a large files perl is to be built,
9838 : we may need to set or change some other defaults.
9839 if $test -f uselargefiles.cbu; then
9840         echo "Your platform has some specific hints regarding large file builds, using them..."
9841         . ./uselargefiles.cbu
9842 fi
9843 case "$uselargefiles" in
9844 "$define")
9845         if $test -f uselargefiles.cbu; then
9846                 echo " "
9847                 echo "Rechecking to see how big your file offsets are..." >&4
9848                 $cat >try.c <<EOCP
9849 #include <sys/types.h>
9850 #include <stdio.h>
9851 int main()
9852 {
9853     printf("%d\n", (int)sizeof($lseektype));
9854     return(0);
9855 }
9856 EOCP
9857                 set try
9858                 if eval $compile_ok; then
9859                         lseeksize=`$run ./try`
9860                         $echo "Your file offsets are now $lseeksize bytes long."
9861                 else
9862                         dflt="$lseeksize"
9863                         echo " "
9864                         echo "(I can't seem to compile the test program.  Guessing...)"
9865                         rp="What is the size of your file offsets (in bytes)?"
9866                         . ./myread
9867                         lseeksize="$ans"
9868                 fi
9869                 case "$fpostype" in
9870                 *_t) zzz="$fpostype"    ;;
9871                 *)   zzz="fpos_t"       ;;
9872                 esac
9873                 $echo $n "Rechecking the size of $zzz...$c" >&4
9874                 $cat > try.c <<EOCP
9875 #include <sys/types.h>
9876 #include <stdio.h>
9877 #$i_stdlib I_STDLIB
9878 #ifdef I_STDLIB
9879 #include <stdlib.h>
9880 #endif
9881 int main() {
9882     printf("%d\n", (int)sizeof($fpostype));
9883     return(0);
9884 }
9885 EOCP
9886                 set try
9887                 if eval $compile_ok; then
9888                         yyy=`$run ./try`
9889                         dflt="$lseeksize"
9890                         case "$yyy" in
9891                         '')     echo " "
9892                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9893                                 ;;
9894                         *)      fpossize=$yyy
9895                                 echo " $fpossize bytes." >&4
9896                                 ;;
9897                         esac
9898                 else
9899                         dflt="$fpossize"
9900                         echo " "
9901                         echo "(I can't compile the test program.  Guessing...)" >&4
9902                         rp="What is the size of your file positions (in bytes)?"
9903                         . ./myread
9904                         fpossize="$ans"
9905                 fi
9906                 $rm_try
9907         fi
9908         ;;
9909 esac
9910
9911 : Check if we want perlio
9912 useperlio="$define"
9913
9914 : Set the vendorbin variables
9915 case "$vendorprefix" in
9916 '')     d_vendorbin="$undef"
9917         vendorbin=''
9918         vendorbinexp=''
9919         ;;
9920 *)      d_vendorbin="$define"
9921         : determine where vendor-supplied executables go.
9922         case "$vendorbin" in
9923         '') dflt=$vendorprefix/bin ;;
9924         *)      dflt="$vendorbin" ;;
9925         esac
9926         fn=d~+
9927         rp='Pathname for the vendor-supplied executables directory?'
9928         . ./getfile
9929         vendorbin="$ans"
9930         vendorbinexp="$ansexp"
9931         ;;
9932 esac
9933 prefixvar=vendorbin
9934 . ./installprefix
9935
9936 : Set the vendorhtml1dir variables
9937 case "$vendorprefix" in
9938 '')     vendorhtml1dir=''
9939         vendorhtml1direxp=''
9940         ;;
9941 *)      : determine where vendor-supplied html pages go.
9942         : There is no standard location, so try to copy the previously-selected
9943         : directory structure for the core html pages.
9944         : XXX Better default suggestions would be welcome.
9945         case "$vendorhtml1dir" in
9946         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9947         *)      dflt=$vendorhtml1dir ;;
9948         esac
9949         case "$dflt" in
9950         ''|' ') dflt=none ;;
9951         esac
9952         fn=dn+~
9953         rp='Pathname for the vendor-supplied html pages?'
9954         . ./getfile
9955         vendorhtml1dir="$ans"
9956         vendorhtml1direxp="$ansexp"
9957         ;;
9958 esac
9959 : Use ' ' for none so value is preserved next time through Configure
9960 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9961 prefixvar=vendorhtml1dir
9962 . ./installprefix
9963
9964 : Set the vendorhtml3dir variables
9965 case "$vendorprefix" in
9966 '')     vendorhtml3dir=''
9967         vendorhtml3direxp=''
9968         ;;
9969 *)      : determine where vendor-supplied module html pages go.
9970         : There is no standard location, so try to copy the previously-selected
9971         : directory structure for the core html pages.
9972         : XXX Better default suggestions would be welcome.
9973         case "$vendorhtml3dir" in
9974         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9975         *)      dflt=$vendorhtml3dir ;;
9976         esac
9977         case "$dflt" in
9978         ''|' ') dflt=none ;;
9979         esac
9980         fn=dn+~
9981         rp='Pathname for the vendor-supplied html pages?'
9982         . ./getfile
9983         vendorhtml3dir="$ans"
9984         vendorhtml3direxp="$ansexp"
9985         ;;
9986 esac
9987 : Use ' ' for none so value is preserved next time through Configure
9988 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9989 prefixvar=vendorhtml3dir
9990 . ./installprefix
9991
9992 : Set the vendorman1dir variables
9993 case "$vendorprefix" in
9994 '')     vendorman1dir=''
9995         vendorman1direxp=''
9996         ;;
9997 *)      : determine where vendor-supplied manual pages go.
9998         case "$vendorman1dir" in
9999         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10000         *)      dflt=$vendorman1dir ;;
10001         esac
10002         case "$dflt" in
10003         ''|' ') dflt=none ;;
10004         esac
10005         fn=nd~+
10006         rp='Pathname for the vendor-supplied manual section 1 pages?'
10007         . ./getfile
10008         vendorman1dir="$ans"
10009         vendorman1direxp="$ansexp"
10010         ;;
10011 esac
10012 : Use ' ' for none so value is preserved next time through Configure
10013 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10014 prefixvar=vendorman1dir
10015 . ./installprefix
10016
10017 : Set the vendorman3dir variables
10018 case "$vendorprefix" in
10019 '')     vendorman3dir=''
10020         vendorman3direxp=''
10021         ;;
10022 *)      : determine where vendor-supplied module manual pages go.
10023         case "$vendorman3dir" in
10024         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10025         *)      dflt=$vendorman3dir ;;
10026         esac
10027         case "$dflt" in
10028         ''|' ') dflt=none ;;
10029         esac
10030         fn=nd~+
10031         rp='Pathname for the vendor-supplied manual section 3 pages?'
10032         . ./getfile
10033         vendorman3dir="$ans"
10034         vendorman3direxp="$ansexp"
10035         ;;
10036 esac
10037 : Use ' ' for none so value is preserved next time through Configure
10038 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10039 prefixvar=vendorman3dir
10040 . ./installprefix
10041
10042 : Set the vendorscript variables
10043 case "$vendorprefix" in
10044 '')     d_vendorscript="$undef"
10045         vendorscript=''
10046         vendorscriptexp=''
10047         ;;
10048 *)      d_vendorscript="$define"
10049         : determine where vendor-supplied scripts go.
10050         case "$vendorscript" in
10051         '')     dflt=$vendorprefix/script
10052                 $test -d $dflt || dflt=$vendorbin ;;
10053         *)  dflt="$vendorscript" ;;
10054         esac
10055         $cat <<EOM
10056
10057 The installation process will create a directory for
10058 vendor-supplied scripts.
10059
10060 EOM
10061         fn=d~+
10062         rp='Pathname for the vendor-supplied scripts directory?'
10063         . ./getfile
10064         vendorscript="$ans"
10065         vendorscriptexp="$ansexp"
10066         ;;
10067 esac
10068 prefixvar=vendorscript
10069 . ./installprefix
10070
10071 : see if qgcvt exists
10072 set qgcvt d_qgcvt
10073 eval $inlibc
10074
10075 : Check what kind of doubles your system has
10076 $echo "Checking the kind of doubles you have..." >&4
10077 $cat >try.c <<EOP
10078 #$i_stdlib I_STDLIB
10079 #define DOUBLESIZE $doublesize
10080 #ifdef I_STDLIB
10081 #include <stdlib.h>
10082 #endif
10083 #include <stdio.h>
10084 static const double d = -0.1;
10085 int main() {
10086   unsigned const char* b = (unsigned const char*)(&d);
10087 #if DOUBLESIZE == 4
10088   if (b[0] == 0xCD && b[3] == 0xBD) {
10089     /* IEEE 754 32-bit little-endian */
10090     printf("1\n");
10091     exit(0);
10092   }
10093   if (b[0] == 0xBD && b[3] == 0xCD) {
10094     /* IEEE 754 32-bit big-endian */
10095     printf("2\n");
10096     exit(0);
10097   }
10098   if (b[0] == 0xCC && b[3] == 0xCC) {
10099     /* VAX format F, 32-bit PDP-style mixed endian. */
10100     printf("9\n");
10101     exit(0);
10102   }
10103   if (b[0] == 0xC0 && b[3] == 0x9A) {
10104     /* IBM single 32-bit */
10105     printf("12\n");
10106     exit(0);
10107   }
10108 #endif
10109 #if DOUBLESIZE == 8
10110   if (b[0] == 0x9A && b[7] == 0xBF) {
10111     /* IEEE 754 64-bit little-endian */
10112     printf("3\n");
10113     exit(0);
10114   }
10115   if (b[0] == 0xBF && b[7] == 0x9A) {
10116     /* IEEE 754 64-bit big-endian */
10117     printf("4\n");
10118     exit(0);
10119   }
10120   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10121    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10122     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10123     * 99 99 b9 bf 9a 99 99 99 */
10124     printf("7\n");
10125     exit(0);
10126   }
10127   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10128    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10129     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10130     * 99 99 99 9a bf b9 99 99 */
10131     printf("8\n");
10132     exit(0);
10133   }
10134   if (b[0] == 0xCC && b[7] == 0xCC) {
10135    /* VAX format D, 64-bit PDP-style mixed endian. */
10136     printf("10\n");
10137     exit(0);
10138   }
10139   if (b[0] == 0xD9 && b[7] == 0x99) {
10140    /* VAX format G, 64-bit PDP-style mixed endian. */
10141     printf("11\n");
10142     exit(0);
10143   }
10144   if (b[0] == 0xC0 && b[7] == 0x9A) {
10145     /* IBM double 64-bit */
10146     printf("13\n");
10147     exit(0);
10148   }
10149   if (b[0] == 0xBF && b[7] == 0xCD) {
10150     /* CRAY single 64-bit */
10151     printf("14\n");
10152     exit(0);
10153   }
10154 #endif
10155 #if DOUBLESIZE == 16
10156   if (b[0] == 0x9A && b[15] == 0xBF) {
10157     /* IEEE 754 128-bit little-endian */
10158     printf("5\n");
10159     exit(0);
10160   }
10161   if (b[0] == 0xBF && b[15] == 0x9A) {
10162     /* IEEE 754 128-bit big-endian */
10163     printf("6\n");
10164     exit(0);
10165   }
10166 #endif
10167   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10168    * Whether those environments can still build Perl is debatable. */
10169   printf("-1\n"); /* unknown */
10170   exit(0);
10171 }
10172 EOP
10173 set try
10174 if eval $compile; then
10175     doublekind=`$run ./try`
10176 else
10177     doublekind=-1
10178 fi
10179 case "$doublekind" in
10180 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10181 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10182 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10183 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10184 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10185 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10186 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10187 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10188 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10189 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10190 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10191 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10192 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10193 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10194 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10195 esac
10196 d_double_style_ieee=$undef
10197 d_double_style_vax=$undef
10198 d_double_style_ibm=$undef
10199 d_double_style_cray=$undef
10200 case "$doublekind" in
10201 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10202 9|10|11) d_double_style_vax=$define ;;
10203 12|13) d_double_style_ibm=$define ;;
10204 14) d_double_style_cray=$define ;;
10205 esac
10206 case "$d_double_style_ieee" in
10207 $define)
10208     d_double_has_inf=$define
10209     d_double_has_nan=$define
10210     d_double_has_negative_zero=$define
10211     d_double_has_subnormals=$define
10212     ;;
10213 *)
10214     d_double_has_inf=$undef
10215     d_double_has_nan=$undef
10216     d_double_has_negative_zero=$undef
10217     d_double_has_subnormals=$undef
10218     ;;
10219 esac
10220 $rm_try
10221
10222 : Check print/scan long double stuff
10223 echo " "
10224
10225 if $test X"$d_longdbl" = X"$define"; then
10226
10227 echo "Checking how to print long doubles..." >&4
10228
10229 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10230         $cat >try.c <<'EOCP'
10231 #include <sys/types.h>
10232 #include <stdio.h>
10233 int main() {
10234   double d = 123.456;
10235   printf("%.3f\n", d);
10236 }
10237 EOCP
10238         set try
10239         if eval $compile; then
10240                 yyy=`$run ./try`
10241                 case "$yyy" in
10242                 123.456)
10243                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10244                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10245                         echo "We will use %f."
10246                         ;;
10247                 esac
10248         fi
10249 fi
10250
10251 if $test X"$sPRIfldbl" = X; then
10252         $cat >try.c <<'EOCP'
10253 #include <sys/types.h>
10254 #include <stdio.h>
10255 int main() {
10256   long double d = 123.456;
10257   printf("%.3Lf\n", d);
10258 }
10259 EOCP
10260         set try
10261         if eval $compile; then
10262                 yyy=`$run ./try`
10263                 case "$yyy" in
10264                 123.456)
10265                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10266                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10267                         echo "We will use %Lf."
10268                         ;;
10269                 esac
10270         fi
10271 fi
10272
10273 if $test X"$sPRIfldbl" = X; then
10274         $cat >try.c <<'EOCP'
10275 #include <sys/types.h>
10276 #include <stdio.h>
10277 int main() {
10278   long double d = 123.456;
10279   printf("%.3llf\n", d);
10280 }
10281 EOCP
10282         set try
10283         if eval $compile; then
10284                 yyy=`$run ./try`
10285                 case "$yyy" in
10286                 123.456)
10287                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10288                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10289                         echo "We will use %llf."
10290                         ;;
10291                 esac
10292         fi
10293 fi
10294
10295 if $test X"$sPRIfldbl" = X; then
10296         $cat >try.c <<'EOCP'
10297 #include <sys/types.h>
10298 #include <stdio.h>
10299 int main() {
10300   long double d = 123.456;
10301   printf("%.3lf\n", d);
10302 }
10303 EOCP
10304         set try
10305         if eval $compile; then
10306                 yyy=`$run ./try`
10307                 case "$yyy" in
10308                 123.456)
10309                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10310                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10311                         echo "We will use %lf."
10312                         ;;
10313                 esac
10314         fi
10315 fi
10316
10317 if $test X"$sPRIfldbl" = X; then
10318         echo "Cannot figure out how to print long doubles." >&4
10319 else
10320         sSCNfldbl=$sPRIfldbl    # expect consistency
10321 fi
10322
10323 $rm_try
10324
10325 fi # d_longdbl
10326
10327 case "$sPRIfldbl" in
10328 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10329         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10330         d_SCNfldbl="$undef";
10331         ;;
10332 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10333         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10334         d_SCNfldbl="$define";
10335         ;;
10336 esac
10337
10338 : Before committing on uselongdouble, see whether that looks sane.
10339 if $test "$uselongdouble" = "$define"; then
10340     message=""
10341     echo " "
10342     echo "Checking if your long double math functions work right..." >&4
10343     $cat > try.c <<EOF
10344 #include <math.h>
10345 #include <stdio.h>
10346 int main() {
10347   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10348 }
10349 EOF
10350     case "$osname:$gccversion" in
10351     aix:)       saveccflags="$ccflags"
10352                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10353     esac
10354     set try
10355     if eval $compile_ok; then
10356       yyy=`$run ./try`
10357     fi
10358     case "$yyy" in
10359     3) echo "Your long double math functions are working correctly." >&4 ;;
10360     *) echo "Your long double math functions are broken, not using long doubles." >&4
10361        uselongdouble=$undef
10362        ;;
10363     esac
10364     $rm_try
10365     case "$osname:$gccversion" in
10366     aix:)       ccflags="$saveccflags" ;; # restore
10367     esac
10368 fi
10369
10370 : Check how to convert floats to strings.
10371
10372 if test "X$d_Gconvert" = X; then
10373
10374 echo " "
10375 echo "Checking for an efficient way to convert floats to strings."
10376 echo " " > try.c
10377 case "$uselongdouble" in
10378 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10379 esac
10380 case "$d_longdbl" in
10381 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10382 esac
10383 case "$d_PRIgldbl" in
10384 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10385 esac
10386 $cat >>try.c <<EOP
10387 #ifdef TRY_gconvert
10388 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10389 const char *myname = "gconvert";
10390 #endif
10391 #ifdef TRY_gcvt
10392 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10393 const char *myname = "gcvt";
10394 #endif
10395 #ifdef TRY_qgcvt
10396 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10397 const char *myname = "qgcvt";
10398 #define DOUBLETYPE long double
10399 #endif
10400 #ifdef TRY_sprintf
10401 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10402 #ifdef HAS_PRIgldbl
10403 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10404 #else
10405 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10406 #endif
10407 #else
10408 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10409 #endif
10410 const char *myname = "sprintf";
10411 #endif
10412
10413 #ifndef DOUBLETYPE
10414 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10415 #define DOUBLETYPE long double
10416 #else
10417 #define DOUBLETYPE double
10418 #endif
10419 #endif
10420
10421 #include <stdio.h>
10422
10423 #$i_stdlib I_STDLIB
10424 #ifdef I_STDLIB
10425 #include <stdlib.h>
10426 #endif
10427 #include <string.h>
10428
10429 void checkit(const char *expect, char *got)
10430 {
10431     if (strcmp(expect, got)) {
10432                 printf("%s oddity:  Expected %s, got %s\n",
10433                         myname, expect, got);
10434                 exit(1);
10435         }
10436 }
10437
10438 int main()
10439 {
10440         char buf[64];
10441         buf[63] = '\0';
10442
10443         /* This must be 1st test on (which?) platform */
10444         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10445         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10446         checkit("0.1", buf);
10447
10448         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10449         checkit("0.01", buf);
10450
10451         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10452         checkit("0.001", buf);
10453
10454         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10455         checkit("0.0001", buf);
10456
10457         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10458         if (strlen(buf) > 5)
10459             checkit("9e-005", buf); /* for Microsoft ?? */
10460         else
10461             checkit("9e-05", buf);
10462
10463         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10464         checkit("1", buf);
10465
10466         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10467         checkit("1.1", buf);
10468
10469         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10470         checkit("1.01", buf);
10471
10472         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10473         checkit("1.001", buf);
10474
10475         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10476         checkit("1.0001", buf);
10477
10478         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10479         checkit("1.00001", buf);
10480
10481         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10482         checkit("1.000001", buf);
10483
10484         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10485         checkit("0", buf);
10486
10487         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10488         checkit("-1", buf);
10489
10490         /* Some Linux gcvt's give 1.e+5 here. */
10491         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10492         checkit("100000", buf);
10493
10494         /* Some Linux gcvt's give -1.e+5 here. */
10495         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10496         checkit("-100000", buf);
10497
10498         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10499         checkit("123.456", buf);
10500
10501         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10502         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10503         /* 34 should be enough to scare even long double
10504          * places into using the e notation. */
10505         if (strlen(buf) > 5)
10506             checkit("1e+034", buf); /* for Microsoft */
10507         else
10508             checkit("1e+34", buf);
10509
10510         /* For Perl, if you add additional tests here, also add them to
10511          * t/base/num.t for benefit of platforms not using Configure or
10512          * overriding d_Gconvert */
10513
10514         exit(0);
10515 }
10516 EOP
10517 : first add preferred functions to our list
10518 xxx_list=""
10519 for xxx_convert in $gconvert_preference; do
10520     case $xxx_convert in
10521     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10522     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10523     esac
10524 done
10525 : then add any others
10526 for xxx_convert in gconvert gcvt sprintf; do
10527     case "$xxx_list" in
10528     *$xxx_convert*) ;;
10529     *) xxx_list="$xxx_list $xxx_convert" ;;
10530     esac
10531 done
10532
10533 case "$d_longdbl$uselongdouble" in
10534 "$define$define")
10535     : again, add preferred functions to our list first
10536     xxx_ld_list=""
10537     for xxx_convert in $gconvert_ld_preference; do
10538         case $xxx_convert in
10539         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10540         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10541         esac
10542     done
10543     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10544     for xxx_convert in qgcvt sprintf $xxx_list; do
10545         case "$xxx_ld_list" in
10546         $xxx_convert*|*" $xxx_convert"*) ;;
10547         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10548         esac
10549     done
10550     : if sprintf cannot do long doubles, move it to the end
10551     if test "$d_PRIgldbl" != "$define"; then
10552         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10553     fi
10554     : if no qgcvt, remove it
10555     if test "$d_qgcvt" != "$define"; then
10556         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10557     fi
10558     : use the ld_list
10559     xxx_list="$xxx_ld_list"
10560     ;;
10561 esac
10562
10563 for xxx_convert in $xxx_list; do
10564         echo "Trying $xxx_convert..."
10565         $rm -f try try$_o core
10566         set try -DTRY_$xxx_convert
10567         if eval $compile; then
10568                 echo "$xxx_convert() found." >&4
10569                 if $run ./try; then
10570                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10571                         break;
10572                 else
10573                         echo "...But $xxx_convert didn't work as I expected."
10574                         xxx_convert=''
10575                 fi
10576         else
10577                 echo "$xxx_convert NOT found." >&4
10578                 xxx_convert=''
10579         fi
10580 done
10581
10582 if test X$xxx_convert = X; then
10583     echo "*** WHOA THERE!!! ***" >&4
10584     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10585     xxx_convert=sprintf
10586 fi
10587
10588 case "$xxx_convert" in
10589 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10590 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10591 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10592 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10593    "$define$define$define")
10594       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10595    "$define$define$undef")
10596       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10597    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10598    esac
10599    ;;
10600 esac
10601
10602 fi
10603 $rm_try
10604
10605 : see if _fwalk exists
10606 set fwalk d__fwalk
10607 eval $inlibc
10608
10609 : see if accept4 exists
10610 set accept4 d_accept4
10611 eval $inlibc
10612
10613 : Initialize h_fcntl
10614 h_fcntl=false
10615
10616 : Initialize h_sysfile
10617 h_sysfile=false
10618
10619 : access call always available on UNIX
10620 set access d_access
10621 eval $inlibc
10622
10623 : locate the flags for 'access()'
10624 case "$d_access" in
10625 "$define")
10626         echo " "
10627         $cat >access.c <<EOCP
10628 #include <sys/types.h>
10629 #ifdef I_FCNTL
10630 #include <fcntl.h>
10631 #endif
10632 #ifdef I_SYS_FILE
10633 #include <sys/file.h>
10634 #endif
10635 #ifdef I_UNISTD
10636 #include <unistd.h>
10637 #endif
10638 #$i_stdlib I_STDLIB
10639 #ifdef I_STDLIB
10640 #include <stdlib.h>
10641 #endif
10642 int main() {
10643         exit(R_OK);
10644 }
10645 EOCP
10646         : check sys/file.h first, no particular reason here
10647         if $test `./findhdr sys/file.h` && \
10648                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10649                 h_sysfile=true;
10650                 echo "<sys/file.h> defines the *_OK access constants." >&4
10651         elif $test `./findhdr fcntl.h` && \
10652                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10653                 h_fcntl=true;
10654                 echo "<fcntl.h> defines the *_OK access constants." >&4
10655         elif $test `./findhdr unistd.h` && \
10656                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10657                 echo "<unistd.h> defines the *_OK access constants." >&4
10658         else
10659                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10660         fi
10661         ;;
10662 esac
10663 $rm -f access*
10664
10665 : see if accessx exists
10666 set accessx d_accessx
10667 eval $inlibc
10668
10669 : see if acosh exists
10670 set acosh d_acosh
10671 eval $inlibc
10672
10673 : see if aintl exists
10674 set aintl d_aintl
10675 eval $inlibc
10676
10677 : see if alarm exists
10678 set alarm d_alarm
10679 eval $inlibc
10680
10681 : see if 64bit time functions exists
10682
10683 set ctime64 d_ctime64
10684 eval $inlibc
10685
10686 set localtime64 d_localtime64
10687 eval $inlibc
10688
10689 set gmtime64 d_gmtime64
10690 eval $inlibc
10691
10692 set mktime64 d_mktime64
10693 eval $inlibc
10694
10695 set difftime64 d_difftime64
10696 eval $inlibc
10697
10698 set asctime64 d_asctime64
10699 eval $inlibc
10700
10701 : see if POSIX threads are available
10702 set pthread.h i_pthread
10703 eval $inhdr
10704
10705 : define a function to check prototypes
10706 $cat > protochk <<EOSH
10707 $startsh
10708 cc="$cc"
10709 optimize="$optimize"
10710 ccflags="$ccflags"
10711 define="$define"
10712 rm_try="$rm_try"
10713 usethreads=$usethreads
10714 i_pthread=$i_pthread
10715 pthread_h_first=$pthread_h_first
10716 EOSH
10717
10718 $cat >> protochk <<'EOSH'
10719
10720 $rm_try
10721 foo="$1"
10722 shift
10723 while test $# -ge 2; do
10724         case "$1" in
10725                 $define) echo "#include <$2>" >> try.c ;;
10726                 literal) echo "$2" >> try.c ;;
10727         esac
10728     # Extra magic for the benefit of systems that need pthread.h
10729     # to be included early to correctly detect threadsafe functions.
10730     # Such functions must guarantee themselves, though, that the usethreads
10731     # and i_pthread have been defined, before calling protochk.
10732     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10733         echo "#include <pthread.h>" >> try.c
10734         pthread_h_done=yes
10735     fi
10736     shift 2
10737 done
10738 cat >> try.c <<'EOCP'
10739 #define _(args) args
10740 EOCP
10741 echo "$foo" >> try.c
10742 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10743 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10744 status=$?
10745 $rm_try
10746 exit $status
10747 EOSH
10748 chmod +x protochk
10749 $eunicefix protochk
10750
10751 : Define hasproto macro for Configure internal use
10752 hasproto='varname=$1; func=$2; shift; shift;
10753 while $test $# -ge 2; do
10754         case "$1" in
10755         $define) echo "#include <$2>";;
10756         literal) echo "$2" ;;
10757         esac ;
10758     shift 2;
10759 done > try.c;
10760 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10761 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10762         echo "$func() prototype found.";
10763         val="$define";
10764 else
10765         echo "$func() prototype NOT found.";
10766         val="$undef";
10767 fi;
10768 set $varname;
10769 eval $setvar;
10770 $rm_try tryout.c'
10771
10772 : see if sys/types.h has to be included
10773 set sys/types.h i_systypes
10774 eval $inhdr
10775
10776 : see if sys/select.h has to be included
10777 set sys/select.h i_sysselct
10778 eval $inhdr
10779
10780 : Define hasfield macro for Configure internal use
10781 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10782 while $test $# -ge 2; do
10783         case "$1" in
10784         $define) echo "#include <$2>";;
10785         esac ;
10786     shift 2;
10787 done > try.c;
10788 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10789 set try;
10790 if eval $compile; then
10791         val="$define";
10792 else
10793         val="$undef";
10794 fi;
10795 set $varname;
10796 eval $setvar;
10797 $rm_try'
10798
10799 : see if we should include sys/time.h
10800 echo " "
10801 i_time='define'
10802 if test "X$timeincl" = X; then
10803         echo "Testing to see if we should include <sys/time.h>." >&4
10804         $echo $n "I'm now running the test program...$c"
10805         $cat >try.c <<EOCP
10806 #include <sys/types.h>
10807 #include <time.h>
10808 #ifdef I_SYSTIME
10809 #ifdef SYSTIMEKERNEL
10810 #define KERNEL
10811 #endif
10812 #include <sys/time.h>
10813 #endif
10814 #ifdef I_SYSSELECT
10815 #include <sys/select.h>
10816 #endif
10817 #$i_stdlib I_STDLIB
10818 #ifdef I_STDLIB
10819 #include <stdlib.h>
10820 #endif
10821 int main()
10822 {
10823         struct tm foo;
10824 #ifdef S_TIMEVAL
10825         struct timeval bar;
10826 #endif
10827 #ifdef S_TIMEZONE
10828         struct timezone tzp;
10829 #endif
10830         if (foo.tm_sec == foo.tm_sec)
10831                 exit(0);
10832 #ifdef S_TIMEVAL
10833         if (bar.tv_sec == bar.tv_sec)
10834                 exit(0);
10835 #endif
10836         exit(1);
10837 }
10838 EOCP
10839         flags=''
10840         for s_timezone in '-DS_TIMEZONE' ''; do
10841         sysselect=''
10842         for s_timeval in '-DS_TIMEVAL' ''; do
10843         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10844         for i_systime in '-DI_SYSTIME' ''; do
10845                 case "$flags" in
10846                 '') $echo $n ".$c"
10847                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10848                         if eval $compile; then
10849                                 set X $i_systime $i_systimek $sysselect $s_timeval
10850                                 shift
10851                                 flags="$*"
10852                                 echo " "
10853                                 $echo $n "Succeeded with $flags$c"
10854                         fi
10855                         ;;
10856                 esac
10857         done
10858         done
10859         done
10860         done
10861         timeincl=''
10862         echo " "
10863         case "$flags" in
10864         *SYSTIMEKERNEL*) i_systimek="$define"
10865                 timeincl=`./findhdr sys/time.h`
10866                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10867         *) i_systimek="$undef";;
10868         esac
10869         case "$flags" in
10870         *I_SYSTIME*) i_systime="$define"
10871                 timeincl=`./findhdr sys/time.h`" $timeincl"
10872                 echo "We'll include <sys/time.h>." >&4;;
10873         *) i_systime="$undef";;
10874         esac
10875         $rm_try
10876 fi
10877 : see if struct tm knows about tm_zone
10878 case "$i_systime$i_time" in
10879 *$define*)
10880         echo " "
10881         echo "Checking to see if your struct tm has tm_zone field..." >&4
10882         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10883         eval $hasfield
10884         ;;
10885 *)      val="$undef"
10886         set d_tm_tm_zone
10887         eval $setvar
10888         ;;
10889 esac
10890 case "$d_tm_tm_zone" in
10891 "$define")      echo "Yes, it does."   ;;
10892 *)              echo "No, it doesn't." ;;
10893 esac
10894 : see if struct tm knows about tm_gmtoff
10895 case "$i_systime$i_time" in
10896 *$define*)
10897         echo " "
10898         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10899         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10900         eval $hasfield
10901         ;;
10902 *)      val="$undef"
10903         set d_tm_tm_gmtoff
10904         eval $setvar
10905         ;;
10906 esac
10907 case "$d_tm_tm_gmtoff" in
10908 "$define")      echo "Yes, it does."   ;;
10909 *)              echo "No, it doesn't." ;;
10910 esac
10911
10912 : see if asctime_r exists
10913 set asctime_r d_asctime_r
10914 eval $inlibc
10915 case "$d_asctime_r" in
10916 "$define")
10917         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10918         case "$d_asctime_r_proto:$usethreads" in
10919         ":define")      d_asctime_r_proto=define
10920                 set d_asctime_r_proto asctime_r $hdrs
10921                 eval $hasproto ;;
10922         *)      ;;
10923         esac
10924         case "$d_asctime_r_proto" in
10925         define)
10926         case "$asctime_r_proto" in
10927         ''|0) try='char* asctime_r(const struct tm*, char*);'
10928         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10929         esac
10930         case "$asctime_r_proto" in
10931         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10932         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10933         esac
10934         case "$asctime_r_proto" in
10935         ''|0) try='int asctime_r(const struct tm*, char*);'
10936         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10937         esac
10938         case "$asctime_r_proto" in
10939         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10940         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10941         esac
10942         case "$asctime_r_proto" in
10943         ''|0)   d_asctime_r=undef
10944                 asctime_r_proto=0
10945                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10946         * )     case "$asctime_r_proto" in
10947                 REENTRANT_PROTO*) ;;
10948                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10949                 esac
10950                 echo "Prototype: $try" ;;
10951         esac
10952         ;;
10953         *)      case "$usethreads" in
10954                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10955                 esac
10956                 d_asctime_r=undef
10957                 asctime_r_proto=0
10958                 ;;
10959         esac
10960         ;;
10961 *)      asctime_r_proto=0
10962         ;;
10963 esac
10964
10965 : see if asinh exists
10966 set asinh d_asinh
10967 eval $inlibc
10968
10969 : see if atanh exists
10970 set atanh d_atanh
10971 eval $inlibc
10972
10973 : see if atolf exists
10974 set atolf d_atolf
10975 eval $inlibc
10976
10977 : see if atoll exists
10978 set atoll d_atoll
10979 eval $inlibc
10980
10981 : Look for GCC-style attribute format
10982 case "$d_attribute_format" in
10983 '')
10984 echo " "
10985 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10986 $cat >attrib.c <<'EOCP'
10987 #include <stdio.h>
10988 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10989 EOCP
10990 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10991         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10992                 echo "Your C compiler doesn't support __attribute__((format))."
10993                 val="$undef"
10994         else
10995                 echo "Your C compiler supports __attribute__((format))."
10996                 val="$define"
10997         fi
10998 else
10999         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11000         val="$undef"
11001 fi
11002 ;;
11003 *) val="$d_attribute_format" ;;
11004 esac
11005 set d_attribute_format
11006 eval $setvar
11007 $rm -f attrib*
11008
11009 : Look for GCC-style attribute format with null format allowed
11010 case "$d_printf_format_null" in
11011 '') case "$d_attribute_format" in
11012     $define)
11013         echo " "
11014         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11015 $cat >attrib.c <<EOCP
11016 #include <stdio.h>
11017 #$i_stdlib I_STDLIB
11018 #ifdef I_STDLIB
11019 #include <stdlib.h>
11020 #endif
11021 #$i_inttypes I_INTTYPES
11022 #ifdef I_INTTYPES
11023 #include <inttypes.h>
11024 #endif
11025 #ifndef INTPTR_MAX
11026 #define intptr_t int
11027 #endif
11028 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11029 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11030 int main () { exit(null_printf(NULL)); }
11031 EOCP
11032         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11033             : run the executable in case it produces a run-time warning
11034             if $run ./attrib >>attrib.out 2>&1; then
11035                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11036                     echo "Your C compiler doesn't allow __printf__ format to be null."
11037                     val="$undef"
11038                 else
11039                     echo "Your C compiler allows __printf__ format to be null."
11040                     val="$define"
11041                 fi
11042             else
11043             echo "Your C compiler executable failed with __printf__ format null."
11044             val="$undef"
11045         fi
11046     else
11047         echo "Your C compiler fails with __printf__ format null."
11048         val="$undef"
11049     fi
11050     ;;
11051     *)  val="$undef" ;;
11052     esac
11053 ;;
11054 *)  val="$d_printf_format_null" ;;
11055 esac
11056 set d_printf_format_null
11057 eval $setvar
11058 $rm -f attrib*
11059
11060 : Look for GCC-style attribute malloc
11061 case "$d_attribute_malloc" in
11062 '')
11063 echo " "
11064 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11065 $cat >attrib.c <<'EOCP'
11066 #include <stdio.h>
11067 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11068 EOCP
11069 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11070         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11071                 echo "Your C compiler doesn't support __attribute__((malloc))."
11072                 val="$undef"
11073         else
11074                 echo "Your C compiler supports __attribute__((malloc))."
11075                 val="$define"
11076         fi
11077 else
11078         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11079         val="$undef"
11080 fi
11081 ;;
11082 *) val="$d_attribute_malloc" ;;
11083 esac
11084 set d_attribute_malloc
11085 eval $setvar
11086 $rm -f attrib*
11087
11088 : Look for GCC-style attribute nonnull
11089 case "$d_attribute_nonnull" in
11090 '')
11091 echo " "
11092 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11093 $cat >attrib.c <<'EOCP'
11094 #include <stdio.h>
11095 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11096 EOCP
11097 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11098         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11099                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11100                 val="$undef"
11101         else
11102                 echo "Your C compiler supports __attribute__((nonnull))."
11103                 val="$define"
11104         fi
11105 else
11106         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11107         val="$undef"
11108 fi
11109 ;;
11110 *) val="$d_attribute_nonnull" ;;
11111 esac
11112 set d_attribute_nonnull
11113 eval $setvar
11114 $rm -f attrib*
11115
11116 : Look for GCC-style attribute noreturn
11117 case "$d_attribute_noreturn" in
11118 '')
11119 echo " "
11120 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11121 $cat >attrib.c <<'EOCP'
11122 #include <stdio.h>
11123 void fall_over_dead( void ) __attribute__((noreturn));
11124 EOCP
11125 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11126         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11127                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11128                 val="$undef"
11129         else
11130                 echo "Your C compiler supports __attribute__((noreturn))."
11131                 val="$define"
11132         fi
11133 else
11134         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11135         val="$undef"
11136 fi
11137 ;;
11138 *) val="$d_attribute_noreturn" ;;
11139 esac
11140 set d_attribute_noreturn
11141 eval $setvar
11142 $rm -f attrib*
11143
11144 : Look for GCC-style attribute pure
11145 case "$d_attribute_pure" in
11146 '')
11147 echo " "
11148 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11149 $cat >attrib.c <<'EOCP'
11150 #include <stdio.h>
11151 int square( int n ) __attribute__((pure));
11152 EOCP
11153 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11154         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11155                 echo "Your C compiler doesn't support __attribute__((pure))."
11156                 val="$undef"
11157         else
11158                 echo "Your C compiler supports __attribute__((pure))."
11159                 val="$define"
11160         fi
11161 else
11162         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11163         val="$undef"
11164 fi
11165 ;;
11166 *) val="$d_attribute_pure" ;;
11167 esac
11168 set d_attribute_pure
11169 eval $setvar
11170 $rm -f attrib*
11171
11172 : Look for GCC-style attribute unused
11173 case "$d_attribute_unused" in
11174 '')
11175 echo " "
11176 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11177 $cat >attrib.c <<'EOCP'
11178 #include <stdio.h>
11179 int do_something( int dummy __attribute__((unused)), int n );
11180 EOCP
11181 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11182         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11183                 echo "Your C compiler doesn't support __attribute__((unused))."
11184                 val="$undef"
11185         else
11186                 echo "Your C compiler supports __attribute__((unused))."
11187                 val="$define"
11188         fi
11189 else
11190         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11191         val="$undef"
11192 fi
11193 ;;
11194 *) val="$d_attribute_unused" ;;
11195 esac
11196 set d_attribute_unused
11197 eval $setvar
11198 $rm -f attrib*
11199
11200 : Look for GCC-style attribute deprecated
11201 case "$d_attribute_deprecated" in
11202 '')
11203 echo " "
11204 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11205 $cat >attrib.c <<'EOCP'
11206 #include <stdio.h>
11207 int I_am_deprecated(void) __attribute__((deprecated));
11208 EOCP
11209 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11210         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11211                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11212                 val="$undef"
11213         else
11214                 echo "Your C compiler supports __attribute__((deprecated))."
11215                 val="$define"
11216         fi
11217 else
11218         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11219         val="$undef"
11220 fi
11221 ;;
11222 *) val="$d_attribute_deprecated" ;;
11223 esac
11224 set d_attribute_deprecated
11225 eval $setvar
11226 $rm -f attrib*
11227
11228 : Look for GCC-style attribute warn_unused_result
11229 case "$d_attribute_warn_unused_result" in
11230 '')
11231 echo " "
11232 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11233 $cat >attrib.c <<'EOCP'
11234 #include <stdio.h>
11235 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11236 EOCP
11237 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11238         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11239                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11240                 val="$undef"
11241         else
11242                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11243                 val="$define"
11244         fi
11245 else
11246         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11247         val="$undef"
11248 fi
11249 ;;
11250 *) val="$d_attribute_warn_unused_result" ;;
11251 esac
11252 set d_attribute_warn_unused_result
11253 eval $setvar
11254 $rm -f attrib*
11255
11256 : Look for GCC-style attribute always_inline
11257 case "$d_attribute_always_inline" in
11258 '')
11259 echo " "
11260 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11261 $cat >attrib.c <<'EOCP'
11262 #include <stdio.h>
11263 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11264 EOCP
11265 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11266         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11267                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11268                 val="$undef"
11269         else
11270                 echo "Your C compiler supports __attribute__((always_inline))."
11271                 val="$define"
11272         fi
11273 else
11274         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11275         val="$undef"
11276 fi
11277 ;;
11278 *) val="$d_attribute_always_inline" ;;
11279 esac
11280 set d_attribute_always_inline
11281 eval $setvar
11282 $rm -f attrib*
11283
11284 : see if getpgrp exists
11285 set getpgrp d_getpgrp
11286 eval $inlibc
11287
11288 case "$d_getpgrp" in
11289 "$define")
11290         echo " "
11291         echo "Checking to see which flavor of getpgrp is in use..."
11292         $cat >try.c <<EOP
11293 #include <stdio.h>
11294 #$i_unistd I_UNISTD
11295 #include <sys/types.h>
11296 #ifdef I_UNISTD
11297 #  include <unistd.h>
11298 #endif
11299 #$i_stdlib I_STDLIB
11300 #ifdef I_STDLIB
11301 #include <stdlib.h>
11302 #endif
11303 int main()
11304 {
11305         if (getuid() == 0) {
11306                 printf("(I see you are running Configure as super-user...)\n");
11307                 setuid(1);
11308         }
11309 #ifdef TRY_BSD_PGRP
11310         if (getpgrp(1) == 0)
11311                 exit(0);
11312 #else
11313         if (getpgrp() > 0)
11314                 exit(0);
11315 #endif
11316         exit(1);
11317 }
11318 EOP
11319         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11320                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11321                 val="$define"
11322         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11323                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11324                 val="$undef"
11325         else
11326                 echo "I can't seem to compile and run the test program."
11327                 if ./usg; then
11328                         xxx="a USG one, i.e. you use getpgrp()."
11329                 else
11330                         # SVR4 systems can appear rather BSD-ish.
11331                         case "$i_unistd" in
11332                         $undef)
11333                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11334                                 val="$define"
11335                                 ;;
11336                         $define)
11337                                 xxx="probably a USG one, i.e. you use getpgrp()."
11338                                 val="$undef"
11339                                 ;;
11340                         esac
11341                 fi
11342                 echo "Assuming your getpgrp is $xxx" >&4
11343         fi
11344         ;;
11345 *) val="$undef";;
11346 esac
11347 set d_bsdgetpgrp
11348 eval $setvar
11349 $rm_try
11350
11351 : see if setpgrp exists
11352 set setpgrp d_setpgrp
11353 eval $inlibc
11354
11355 case "$d_setpgrp" in
11356 "$define")
11357         echo " "
11358         echo "Checking to see which flavor of setpgrp is in use..."
11359         $cat >try.c <<EOP
11360 #include <stdio.h>
11361 #$i_unistd I_UNISTD
11362 #include <sys/types.h>
11363 #ifdef I_UNISTD
11364 #  include <unistd.h>
11365 #endif
11366 #$i_stdlib I_STDLIB
11367 #ifdef I_STDLIB
11368 #include <stdlib.h>
11369 #endif
11370 int main()
11371 {
11372         if (getuid() == 0) {
11373                 printf("(I see you are running Configure as super-user...)\n");
11374                 setuid(1);
11375         }
11376 #ifdef TRY_BSD_PGRP
11377         if (-1 == setpgrp(1, 1))
11378                 exit(0);
11379 #else
11380         if (setpgrp() != -1)
11381                 exit(0);
11382 #endif
11383         exit(1);
11384 }
11385 EOP
11386         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11387                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11388                 val="$define"
11389         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11390                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11391                 val="$undef"
11392         else
11393                 echo "(I can't seem to compile and run the test program.)"
11394                 if ./usg; then
11395                         xxx="a USG one, i.e. you use setpgrp()."
11396                 else
11397                         # SVR4 systems can appear rather BSD-ish.
11398                         case "$i_unistd" in
11399                         $undef)
11400                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11401                                 val="$define"
11402                                 ;;
11403                         $define)
11404                                 xxx="probably a USG one, i.e. you use setpgrp()."
11405                                 val="$undef"
11406                                 ;;
11407                         esac
11408                 fi
11409                 echo "Assuming your setpgrp is $xxx" >&4
11410         fi
11411         ;;
11412 *) val="$undef";;
11413 esac
11414 set d_bsdsetpgrp
11415 eval $setvar
11416 $rm_try
11417
11418 : Look for GCC-style __builtin_add_overflow
11419 case "$d_builtin_add_overflow" in
11420 '')
11421     echo " "
11422     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11423     $cat >try.c <<'EOCP'
11424 int main(void) {
11425     const unsigned int uint_max = ~0u;
11426     int target_int = 0;
11427     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11428         return 1;
11429     }
11430     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11431         return 1;
11432     }
11433     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11434         return 1;
11435     }
11436     return 0;
11437 }
11438 EOCP
11439     set try
11440     if eval $compile && $run ./try; then
11441         echo "Your C compiler supports __builtin_add_overflow."
11442         val="$define"
11443     else
11444         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11445         val="$undef"
11446     fi
11447     ;;
11448 *) val="$d_builtin_add_overflow" ;;
11449 esac
11450
11451 set d_builtin_add_overflow
11452 eval $setvar
11453 $rm_try
11454
11455 : Look for GCC-style __builtin_sub_overflow
11456 case "$d_builtin_sub_overflow" in
11457 '')
11458     echo " "
11459     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11460     $cat >try.c <<'EOCP'
11461 int main(void) {
11462     const unsigned int uint_max = ~0u;
11463     int target_int = 0;
11464     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11465         return 1;
11466     }
11467     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11468         return 1;
11469     }
11470     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11471         return 1;
11472     }
11473     return 0;
11474 }
11475 EOCP
11476     set try
11477     if eval $compile && $run ./try; then
11478         echo "Your C compiler supports __builtin_sub_overflow."
11479         val="$define"
11480     else
11481         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11482         val="$undef"
11483     fi
11484     ;;
11485 *) val="$d_builtin_sub_overflow" ;;
11486 esac
11487
11488 set d_builtin_sub_overflow
11489 eval $setvar
11490 $rm_try
11491
11492 : Look for GCC-style __builtin_mul_overflow
11493 case "$d_builtin_mul_overflow" in
11494 '')
11495     echo " "
11496     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11497     $cat >try.c <<'EOCP'
11498 int main(void) {
11499     const unsigned int uint_max = ~0u;
11500     int target_int = 0;
11501     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11502         return 1;
11503     }
11504     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11505         return 1;
11506     }
11507     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11508         return 1;
11509     }
11510     return 0;
11511 }
11512 EOCP
11513     set try
11514     if eval $compile && $run ./try; then
11515         echo "Your C compiler supports __builtin_mul_overflow."
11516         val="$define"
11517     else
11518         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11519         val="$undef"
11520     fi
11521     ;;
11522 *) val="$d_builtin_mul_overflow" ;;
11523 esac
11524
11525 set d_builtin_mul_overflow
11526 eval $setvar
11527 $rm_try
11528
11529 : Look for GCC-style __builtin_choose_expr
11530 case "$d_builtin_choose_expr" in
11531 '')
11532     echo " "
11533     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11534     $cat >try.c <<'EOCP'
11535 #include <assert.h>
11536 #include <stdlib.h>
11537 #include <stdio.h>
11538
11539 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11540
11541 int main(void) {
11542     assert( SYRINX(1) == 2112 );
11543     assert( SYRINX(1) != 5150 );
11544     assert( SYRINX(0) == 5150 );
11545     assert( SYRINX(0) != 2112 );
11546     puts( "All good!" );
11547     exit(0);
11548 }
11549
11550 EOCP
11551     set try
11552     if eval $compile && $run ./try; then
11553         echo "Your C compiler supports __builtin_choose_expr."
11554         val="$define"
11555     else
11556         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11557         val="$undef"
11558     fi
11559 ;;
11560 *) val="$d_builtin_choose_expr" ;;
11561 esac
11562
11563 set d_builtin_choose_expr
11564 eval $setvar
11565 $rm_try
11566
11567 : Look for GCC-style __builtin_expect
11568 case "$d_builtin_expect" in
11569 '')
11570     echo " "
11571     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11572     $cat >try.c <<'EOCP'
11573 int main(void) {
11574     int n = 50;
11575     if ( __builtin_expect(n, 0) ) n = 1;
11576     /* Remember shell exit code truth is 0, C truth is non-zero */
11577     return !(n == 1);
11578 }
11579 EOCP
11580     set try
11581     if eval $compile && $run ./try; then
11582         echo "Your C compiler supports __builtin_expect."
11583         val="$define"
11584     else
11585         echo "Your C compiler doesn't seem to understand __builtin_expect."
11586         val="$undef"
11587     fi
11588     ;;
11589 *) val="$d_builtin_expect" ;;
11590 esac
11591
11592 set d_builtin_expect
11593 eval $setvar
11594 $rm_try
11595
11596 : see if the Compiler supports C99 variadic macros
11597 echo "Checking for C99 variadic macros." >&4
11598 $cat >try.c <<EOCP
11599 #include <stdio.h>
11600 #include <stdarg.h>
11601
11602 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11603
11604 int main() {
11605   char buf[20];
11606   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11607   puts(buf);
11608   return 0;
11609 }
11610 EOCP
11611 set try
11612 if eval $compile && $run ./try 2>&1 >/dev/null; then
11613     case "`$run ./try`" in
11614         "123 456 789")
11615         echo "You have C99 variadic macros." >&4
11616         d_c99_variadic_macros="$define"
11617         ;;
11618         *)
11619         echo "You don't have functional C99 variadic macros." >&4
11620         d_c99_variadic_macros="$undef"
11621         ;;
11622     esac
11623 else
11624     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11625     d_c99_variadic_macros="$undef"
11626 fi
11627 $rm_try
11628
11629 : see if signal is declared as pointer to function returning int or void
11630 echo " "
11631 xxx=`./findhdr signal.h`
11632 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11633 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11634         echo "You have int (*signal())() instead of void." >&4
11635         val="$undef"
11636 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11637         echo "You have void (*signal())()." >&4
11638         val="$define"
11639 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11640         echo "You have int (*signal())() instead of void." >&4
11641         val="$undef"
11642 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11643         echo "You have void (*signal())()." >&4
11644         val="$define"
11645 else
11646         case "$d_voidsig" in
11647         '')
11648         echo "I can't determine whether signal handler returns void or int..." >&4
11649                 dflt=void
11650                 rp="What type does your signal handler return?"
11651                 . ./myread
11652                 case "$ans" in
11653                 v*) val="$define";;
11654                 *) val="$undef";;
11655                 esac;;
11656         "$define")
11657                 echo "As you already told me, signal handler returns void." >&4
11658                 val="$define"
11659                 ;;
11660         *)      echo "As you already told me, signal handler returns int." >&4
11661                 val="$undef"
11662                 ;;
11663         esac
11664 fi
11665 set d_voidsig
11666 eval $setvar
11667 case "$d_voidsig" in
11668 "$define") signal_t="void";;
11669 *) signal_t="int";;
11670 esac
11671 $rm -f $$.tmp
11672
11673 : check for ability to cast large floats to 32-bit ints.
11674 echo " "
11675 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11676 if $test "$intsize" -ge 4; then
11677         xxx=int
11678 else
11679         xxx=long
11680 fi
11681 $cat >try.c <<EOCP
11682 #include <stdio.h>
11683 #$i_stdlib I_STDLIB
11684 #ifdef I_STDLIB
11685 #include <stdlib.h>
11686 #endif
11687 #include <sys/types.h>
11688 #include <signal.h>
11689 $signal_t blech(int s) { exit(3); }
11690 int main()
11691 {
11692         $xxx i32;
11693         double f, g;
11694         int result = 0;
11695         char str[16];
11696         signal(SIGFPE, blech);
11697
11698         /* Don't let compiler optimize the test away.  Store the number
11699            in a writable string for gcc to pass to sscanf under HP-UX.
11700         */
11701         sprintf(str, "2147483647");
11702         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11703         g = 10 * f;
11704         i32  = ($xxx) g;
11705
11706         /* x86 processors will probably give 0x8000 0000, which is a
11707            sign change.  We don't want that.  We want to mimic SPARC
11708            behavior here, which is to preserve the sign and give
11709            back 0x7fff ffff.
11710         */
11711         if (i32 != ($xxx) f)
11712                 result |= 1;
11713         exit(result);
11714 }
11715 EOCP
11716 set try
11717 if eval $compile_ok; then
11718         $run ./try 2>/dev/null
11719         yyy=$?
11720 else
11721         echo "(I can't seem to compile the test program--assuming it can't)"
11722         yyy=1
11723 fi
11724 case "$yyy" in
11725 0)      val="$define"
11726         echo "Yup, it can."
11727         ;;
11728 *)      val="$undef"
11729         echo "Nope, it can't."
11730         ;;
11731 esac
11732 set d_casti32
11733 eval $setvar
11734 $rm_try
11735
11736 : check for ability to cast negative floats to unsigned
11737 echo " "
11738 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11739 $cat >try.c <<EOCP
11740 #include <stdio.h>
11741 #$i_stdlib I_STDLIB
11742 #ifdef I_STDLIB
11743 #include <stdlib.h>
11744 #endif
11745 #include <sys/types.h>
11746 #include <signal.h>
11747 $signal_t blech(int s) { exit(7); }
11748 $signal_t blech_in_list(int s) { exit(4); }
11749 unsigned long dummy_long(unsigned long p) { return p; }
11750 unsigned int dummy_int(unsigned int p) { return p; }
11751 unsigned short dummy_short(unsigned short p) { return p; }
11752 int main()
11753 {
11754         double f;
11755         unsigned long along;
11756         unsigned int aint;
11757         unsigned short ashort;
11758         int result = 0;
11759         char str[16];
11760
11761         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11762            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11763            optimized the whole file away
11764         */
11765         /* Store the number in a writable string for gcc to pass to
11766            sscanf under HP-UX.
11767         */
11768         sprintf(str, "-123");
11769         sscanf(str, "%lf", &f);  /* f = -123.; */
11770
11771         signal(SIGFPE, blech);
11772         along = (unsigned long)f;
11773         aint = (unsigned int)f;
11774         ashort = (unsigned short)f;
11775         if (along != (unsigned long)-123)
11776                 result |= 1;
11777         if (aint != (unsigned int)-123)
11778                 result |= 1;
11779         if (ashort != (unsigned short)-123)
11780                 result |= 1;
11781         sprintf(str, "1073741824.");
11782         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11783         f = f + f;
11784         along = 0;
11785         along = (unsigned long)f;
11786         if (along != 0x80000000)
11787                 result |= 2;
11788         f -= 1.;
11789         along = 0;
11790         along = (unsigned long)f;
11791         if (along != 0x7fffffff)
11792                 result |= 1;
11793         f += 2.;
11794         along = 0;
11795         along = (unsigned long)f;
11796         if (along != 0x80000001)
11797                 result |= 2;
11798         if (result)
11799                 exit(result);
11800         signal(SIGFPE, blech_in_list);
11801         sprintf(str, "123.");
11802         sscanf(str, "%lf", &f);  /* f = 123.; */
11803         along = dummy_long((unsigned long)f);
11804         aint = dummy_int((unsigned int)f);
11805         ashort = dummy_short((unsigned short)f);
11806         if (along != (unsigned long)123)
11807                 result |= 4;
11808         if (aint != (unsigned int)123)
11809                 result |= 4;
11810         if (ashort != (unsigned short)123)
11811                 result |= 4;
11812         exit(result);
11813
11814 }
11815 EOCP
11816 set try
11817 if eval $compile_ok; then
11818         $run ./try 2>/dev/null
11819         castflags=$?
11820 else
11821         echo "(I can't seem to compile the test program--assuming it can't)"
11822         castflags=7
11823 fi
11824 case "$castflags" in
11825 0)      val="$define"
11826         echo "Yup, it can."
11827         ;;
11828 *)      val="$undef"
11829         echo "Nope, it can't."
11830         ;;
11831 esac
11832 set d_castneg
11833 eval $setvar
11834 $rm_try
11835
11836 : see if cbrt exists
11837 set cbrt d_cbrt
11838 eval $inlibc
11839
11840 : see if chown exists
11841 set chown d_chown
11842 eval $inlibc
11843
11844 : see if chroot exists
11845 set chroot d_chroot
11846 eval $inlibc
11847
11848 : see if chsize exists
11849 set chsize d_chsize
11850 eval $inlibc
11851
11852 : see if class exists
11853 set class d_class
11854 eval $inlibc
11855
11856 : see if clearenv exists
11857 set clearenv d_clearenv
11858 eval $inlibc
11859
11860 : Define hasstruct macro for Configure internal use
11861 hasstruct='varname=$1; struct=$2; shift; shift;
11862 while $test $# -ge 2; do
11863         case "$1" in
11864         $define) echo "#include <$2>";;
11865         esac ;
11866     shift 2;
11867 done > try.c;
11868 echo "int main () { struct $struct foo; }" >> try.c;
11869 set try;
11870 if eval $compile; then
11871         val="$define";
11872 else
11873         val="$undef";
11874 fi;
11875 set $varname;
11876 eval $setvar;
11877 $rm_try'
11878
11879 : see whether socket exists
11880 socketlib=''
11881 sockethdr=''
11882 echo " "
11883 $echo $n "Hmm... $c" >&4
11884 if set socket val -f d_socket; eval $csym; $val; then
11885     echo "Looks like you have Berkeley networking support." >&4
11886     d_socket="$define"
11887     if set setsockopt val -f; eval $csym; $val; then
11888         d_oldsock="$undef"
11889     else
11890         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11891         d_oldsock="$define"
11892     fi
11893 else
11894     if $contains socklib libc.list >/dev/null 2>&1; then
11895         echo "Looks like you have Berkeley networking support." >&4
11896         d_socket="$define"
11897         : we will have to assume that it supports the 4.2 BSD interface
11898         d_oldsock="$undef"
11899     else
11900         echo "You don't have Berkeley networking in libc$_a..." >&4
11901         if test "X$d_socket" = "X$define"; then
11902             echo "...but you seem to believe that you have sockets." >&4
11903         else
11904             for net in net socket
11905             do
11906                 if test -f $sysroot/usr/lib/lib$net$_a; then
11907                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11908                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11909                     if $contains socket libc.list >/dev/null 2>&1; then
11910                         d_socket="$define"
11911                         socketlib="-l$net"
11912                         case "$net" in
11913                         net)
11914                             echo "...but the Wollongong group seems to have hacked it in." >&4
11915                             sockethdr="-I$sysroot/usr/netinclude"
11916                             ;;
11917                         esac
11918                         echo "Found Berkeley sockets interface in lib$net." >&4
11919                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11920                             d_oldsock="$undef"
11921                         else
11922                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11923                             d_oldsock="$define"
11924                         fi
11925                         break
11926                     fi
11927                 fi
11928             done
11929             if test "X$d_socket" != "X$define"; then
11930                echo "or anywhere else I see." >&4
11931                d_socket="$undef"
11932                d_oldsock="$undef"
11933             fi
11934         fi
11935     fi
11936 fi
11937
11938 : see if socketpair exists
11939 set socketpair d_sockpair
11940 eval $inlibc
11941
11942
11943 echo "Checking the availability sa_len in the sock struct ..." >&4
11944 $cat >try.c <<EOF
11945 #include <sys/types.h>
11946 #include <sys/socket.h>
11947 int main() {
11948 struct sockaddr sa;
11949 return (sa.sa_len);
11950 }
11951 EOF
11952 val="$undef"
11953 set try; if eval $compile; then
11954     val="$define"
11955 fi
11956 set d_sockaddr_sa_len; eval $setvar
11957 $rm_try
11958
11959 echo "Checking the availability struct sockaddr_in6 ..." >&4
11960 $cat >try.c <<EOF
11961 #include <sys/types.h>
11962 #include <sys/socket.h>
11963 #include <netinet/in.h>
11964 int main() {
11965 struct sockaddr_in6 sin6;
11966 return (sin6.sin6_family);
11967 }
11968 EOF
11969 val="$undef"
11970 set try; if eval $compile; then
11971     val="$define"
11972 fi
11973 set d_sockaddr_in6; eval $setvar
11974 $rm_try
11975
11976 echo "Checking the availability struct sockaddr_storage ..." >&4
11977 $cat >try.c <<EOF
11978 #include <sys/types.h>
11979 #include <sys/socket.h>
11980 #include <netinet/in.h>
11981 int main() {
11982 struct sockaddr_storage sastor;
11983 return (sastor.ss_family);
11984 }
11985 EOF
11986 val="$undef"
11987 set try; if eval $compile; then
11988     val="$define"
11989 fi
11990 set d_sockaddr_storage; eval $setvar
11991 $rm_try
11992
11993 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11994 $cat >try.c <<EOF
11995 #include <sys/types.h>
11996 #include <sys/socket.h>
11997 #include <netinet/in.h>
11998 int main() {
11999 struct sockaddr_in6 sin6;
12000 return (sin6.sin6_scope_id);
12001 }
12002 EOF
12003 val="$undef"
12004 set try; if eval $compile; then
12005     val="$define"
12006 fi
12007 set d_sin6_scope_id; eval $setvar
12008 $rm_try
12009
12010 echo "Checking the availability struct ip_mreq ..." >&4
12011 $cat >try.c <<EOF
12012 #include <sys/types.h>
12013 #include <sys/socket.h>
12014 #include <netinet/in.h>
12015 int main() {
12016 struct ip_mreq mreq;
12017 return (mreq.imr_multiaddr.s_addr);
12018 }
12019 EOF
12020 val="$undef"
12021 set try; if eval $compile; then
12022        val="$define"
12023 fi
12024 set d_ip_mreq; eval $setvar
12025 $rm_try
12026
12027 echo "Checking the availability struct ip_mreq_source ..." >&4
12028 $cat >try.c <<EOF
12029 #include <sys/types.h>
12030 #include <sys/socket.h>
12031 #include <netinet/in.h>
12032 int main() {
12033 struct ip_mreq_source mreq;
12034 return (mreq.imr_multiaddr.s_addr);
12035 }
12036 EOF
12037 val="$undef"
12038 set try; if eval $compile; then
12039        val="$define"
12040 fi
12041 set d_ip_mreq_source; eval $setvar
12042 $rm_try
12043
12044 echo "Checking the availability struct ipv6_mreq ..." >&4
12045 $cat >try.c <<EOF
12046 #include <sys/types.h>
12047 #include <sys/socket.h>
12048 #include <netinet/in.h>
12049 int main() {
12050 struct ipv6_mreq mreq;
12051 return (mreq.ipv6mr_interface);
12052 }
12053 EOF
12054 val="$undef"
12055 set try; if eval $compile; then
12056     val="$define"
12057 fi
12058 set d_ipv6_mreq; eval $setvar
12059 $rm_try
12060
12061 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12062 $cat >try.c <<EOF
12063 #include <sys/types.h>
12064 #include <sys/socket.h>
12065 #include <netinet/in.h>
12066 int main() {
12067 struct ipv6_mreq_source mreq;
12068 return (mreq.imr_multiaddr.s_addr);
12069 }
12070 EOF
12071 val="$undef"
12072 set try; if eval $compile; then
12073        val="$define"
12074 fi
12075 set d_ipv6_mreq_source; eval $setvar
12076 $rm_try
12077
12078 echo "Checking the availability of certain socket constants..." >&4
12079 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12080     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12081     $cat >try.c <<EOF
12082 #include <sys/types.h>
12083 #include <sys/socket.h>
12084 int main() {
12085     int i = $ENUM;
12086 }
12087 EOF
12088     val="$undef"
12089     set try; if eval $compile; then
12090         val="$define"
12091     fi
12092     set d_${enum}; eval $setvar
12093     $rm_try
12094 done
12095
12096 : see if this is a sys/uio.h system
12097 set sys/uio.h i_sysuio
12098 eval $inhdr
12099
12100 : Check for cmsghdr support
12101 echo " "
12102 echo "Checking to see if your system supports struct cmsghdr..." >&4
12103 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12104 eval $hasstruct
12105 case "$d_cmsghdr_s" in
12106 "$define")      echo "Yes, it does."   ;;
12107 *)              echo "No, it doesn't." ;;
12108 esac
12109
12110 : see if copysign exists
12111 set copysign d_copysign
12112 eval $inlibc
12113
12114 : see if copysignl exists
12115 set copysignl d_copysignl
12116 eval $inlibc
12117
12118 : see if crypt exists
12119 echo " "
12120 set crypt d_crypt
12121 eval $inlibc
12122 case "$d_crypt" in
12123 $define) cryptlib='' ;;
12124 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12125                 echo 'crypt() found.' >&4
12126                 val="$define"
12127                 cryptlib=''
12128         else
12129                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12130                 if $test -z "$cryptlib"; then
12131                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12132                 else
12133                         cryptlib=-lcrypt
12134                 fi
12135                 if $test -z "$cryptlib"; then
12136                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12137                 else
12138                         cryptlib=-lcrypt
12139                 fi
12140                 if $test -z "$cryptlib"; then
12141                         cryptlib=`./loc libcrypt$_a "" $libpth`
12142                 else
12143                         cryptlib=-lcrypt
12144                 fi
12145                 if $test -z "$cryptlib"; then
12146                         echo 'crypt() NOT found.' >&4
12147                         val="$undef"
12148                 else
12149                         val="$define"
12150                 fi
12151         fi
12152         set d_crypt
12153         eval $setvar
12154         ;;
12155 esac
12156
12157 : see if this is a crypt.h system
12158 set crypt.h i_crypt
12159 eval $inhdr
12160
12161 : see if crypt_r exists
12162 set crypt_r d_crypt_r
12163 eval $inlibc
12164 case "$d_crypt_r" in
12165 "$define")
12166         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12167         case "$d_crypt_r_proto:$usethreads" in
12168         ":define")      d_crypt_r_proto=define
12169                 set d_crypt_r_proto crypt_r $hdrs
12170                 eval $hasproto ;;
12171         *)      ;;
12172         esac
12173         case "$d_crypt_r_proto" in
12174         define)
12175         case "$crypt_r_proto" in
12176         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12177         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12178         esac
12179         case "$crypt_r_proto" in
12180         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12181         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12182         esac
12183         case "$crypt_r_proto" in
12184         ''|0)   d_crypt_r=undef
12185                 crypt_r_proto=0
12186                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12187         * )     case "$crypt_r_proto" in
12188                 REENTRANT_PROTO*) ;;
12189                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12190                 esac
12191                 echo "Prototype: $try" ;;
12192         esac
12193         ;;
12194         *)      case "$usethreads" in
12195                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12196                 esac
12197                 d_crypt_r=undef
12198                 crypt_r_proto=0
12199                 ;;
12200         esac
12201         ;;
12202 *)      crypt_r_proto=0
12203         ;;
12204 esac
12205
12206 : get csh whereabouts
12207 case "$csh" in
12208 'csh') val="$undef" ;;
12209 *) val="$define" ;;
12210 esac
12211 set d_csh
12212 eval $setvar
12213 : Respect a hint or command line value for full_csh.
12214 case "$full_csh" in
12215 '') full_csh=$csh ;;
12216 esac
12217
12218 : see if ctermid exists
12219 set ctermid d_ctermid
12220 eval $inlibc
12221
12222 : see if ctermid_r exists
12223 set ctermid_r d_ctermid_r
12224 eval $inlibc
12225 case "$d_ctermid_r" in
12226 "$define")
12227         hdrs="$i_systypes sys/types.h define stdio.h "
12228         case "$d_ctermid_r_proto:$usethreads" in
12229         ":define")      d_ctermid_r_proto=define
12230                 set d_ctermid_r_proto ctermid_r $hdrs
12231                 eval $hasproto ;;
12232         *)      ;;
12233         esac
12234         case "$d_ctermid_r_proto" in
12235         define)
12236         case "$ctermid_r_proto" in
12237         ''|0) try='char* ctermid_r(char*);'
12238         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12239         esac
12240         case "$ctermid_r_proto" in
12241         ''|0)   d_ctermid_r=undef
12242                 ctermid_r_proto=0
12243                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12244         * )     case "$ctermid_r_proto" in
12245                 REENTRANT_PROTO*) ;;
12246                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12247                 esac
12248                 echo "Prototype: $try" ;;
12249         esac
12250         ;;
12251         *)      case "$usethreads" in
12252                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12253                 esac
12254                 d_ctermid_r=undef
12255                 ctermid_r_proto=0
12256                 ;;
12257         esac
12258         ;;
12259 *)      ctermid_r_proto=0
12260         ;;
12261 esac
12262
12263 : see if ctime_r exists
12264 set ctime_r d_ctime_r
12265 eval $inlibc
12266 case "$d_ctime_r" in
12267 "$define")
12268         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12269         case "$d_ctime_r_proto:$usethreads" in
12270         ":define")      d_ctime_r_proto=define
12271                 set d_ctime_r_proto ctime_r $hdrs
12272                 eval $hasproto ;;
12273         *)      ;;
12274         esac
12275         case "$d_ctime_r_proto" in
12276         define)
12277         case "$ctime_r_proto" in
12278         ''|0) try='char* ctime_r(const time_t*, char*);'
12279         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12280         esac
12281         case "$ctime_r_proto" in
12282         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12283         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12284         esac
12285         case "$ctime_r_proto" in
12286         ''|0) try='int ctime_r(const time_t*, char*);'
12287         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12288         esac
12289         case "$ctime_r_proto" in
12290         ''|0) try='int ctime_r(const time_t*, char*, int);'
12291         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12292         esac
12293         case "$ctime_r_proto" in
12294         ''|0)   d_ctime_r=undef
12295                 ctime_r_proto=0
12296                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12297         * )     case "$ctime_r_proto" in
12298                 REENTRANT_PROTO*) ;;
12299                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12300                 esac
12301                 echo "Prototype: $try" ;;
12302         esac
12303         ;;
12304         *)      case "$usethreads" in
12305                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12306                 esac
12307                 d_ctime_r=undef
12308                 ctime_r_proto=0
12309                 ;;
12310         esac
12311         ;;
12312 *)      ctime_r_proto=0
12313         ;;
12314 esac
12315
12316 : see if cuserid exists
12317 set cuserid d_cuserid
12318 eval $inlibc
12319
12320 : see if dbm.h is available
12321 : see if dbmclose exists
12322 set dbmclose d_dbmclose
12323 eval $inlibc
12324
12325 case "$d_dbmclose" in
12326 $define)
12327         set dbm.h i_dbm
12328         eval $inhdr
12329         case "$i_dbm" in
12330         $define)
12331                 val="$undef"
12332                 set i_rpcsvcdbm
12333                 eval $setvar
12334                 ;;
12335         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12336                 eval $inhdr
12337                 ;;
12338         esac
12339         ;;
12340 *)      echo "We won't be including <dbm.h>"
12341         val="$undef"
12342         set i_dbm
12343         eval $setvar
12344         val="$undef"
12345         set i_rpcsvcdbm
12346         eval $setvar
12347         ;;
12348 esac
12349
12350 : see if prototype for dbminit is available
12351 echo " "
12352 set d_dbminitproto dbminit $i_dbm dbm.h
12353 eval $hasproto
12354
12355 : see if difftime exists
12356 set difftime d_difftime
12357 eval $inlibc
12358
12359 : see if this is a dirent system
12360 echo " "
12361 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12362         val="$define"
12363         echo "<dirent.h> found." >&4
12364 else
12365         val="$undef"
12366         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12367                 echo "<sys/dir.h> found." >&4
12368                 echo " "
12369         else
12370                 xinc=`./findhdr sys/ndir.h`
12371         fi
12372         echo "<dirent.h> NOT found." >&4
12373 fi
12374 set i_dirent
12375 eval $setvar
12376
12377 : Look for type of directory structure.
12378 echo " "
12379 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12380
12381 case "$direntrytype" in
12382 ''|' ')
12383         case "$i_dirent" in
12384         $define) guess1='struct dirent' ;;
12385         *) guess1='struct direct'  ;;
12386         esac
12387         ;;
12388 *)      guess1="$direntrytype"
12389         ;;
12390 esac
12391
12392 case "$guess1" in
12393 'struct dirent') guess2='struct direct' ;;
12394 *) guess2='struct dirent' ;;
12395 esac
12396
12397 if $contains "$guess1" try.c >/dev/null 2>&1; then
12398         direntrytype="$guess1"
12399         echo "Your directory entries are $direntrytype." >&4
12400 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12401         direntrytype="$guess2"
12402         echo "Your directory entries seem to be $direntrytype." >&4
12403 else
12404         echo "I don't recognize your system's directory entries." >&4
12405         rp="What type is used for directory entries on this system?"
12406         dflt="$guess1"
12407         . ./myread
12408         direntrytype="$ans"
12409 fi
12410 $rm_try
12411
12412 : see if the directory entry stores field length
12413 echo " "
12414 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12415 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12416         echo "Good, your directory entry keeps length information in d_namlen." >&4
12417         val="$define"
12418 else
12419         echo "Your directory entry does not know about the d_namlen field." >&4
12420         val="$undef"
12421 fi
12422 set d_dirnamlen
12423 eval $setvar
12424 $rm_try
12425
12426 : Look for DIR.dd_fd
12427 case "$i_dirent" in
12428 "$define")
12429     echo "Checking to see if DIR has a dd_fd member variable" >&4
12430     $cat >try.c <<EOCP
12431 #$i_stdlib I_STDLIB
12432 #ifdef I_STDLIB
12433 #include <stdlib.h>
12434 #endif
12435 #include <dirent.h>
12436
12437 int main() {
12438     DIR dir;
12439     dir.dd_fd = 1;
12440     return 0;
12441 }
12442 EOCP
12443     val=$undef
12444     set try
12445     if eval $compile; then
12446         echo "Yes, it does."
12447         val="$define"
12448     else
12449         echo "No, it does not."
12450         val="$undef"
12451     fi
12452     ;;
12453 *)
12454     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12455     val="$undef"
12456     ;;
12457 esac
12458 set d_dir_dd_fd
12459 eval $setvar
12460 $rm_try
12461
12462 : see if this is an sysdir system
12463 set sys/dir.h i_sysdir
12464 eval $inhdr
12465
12466 : see if this is an sysndir system
12467 set sys/ndir.h i_sysndir
12468 eval $inhdr
12469
12470 : Look for dirfd
12471 echo " "
12472 $cat >dirfd.c <<EOM
12473 #include <stdio.h>
12474 #$i_stdlib I_STDLIB
12475 #ifdef I_STDLIB
12476 #include <stdlib.h>
12477 #endif
12478 #$i_dirent I_DIRENT             /**/
12479 #$i_sysdir I_SYS_DIR            /**/
12480 #$i_sysndir I_SYS_NDIR          /**/
12481 #$i_systypes I_SYS_TYPES        /**/
12482 #if defined(I_SYS_TYPES)
12483 #include <sys/types.h>
12484 #endif
12485 #if defined(I_DIRENT)
12486 #include <dirent.h>
12487 #else
12488 #ifdef I_SYS_NDIR
12489 #include <sys/ndir.h>
12490 #else
12491 #ifdef I_SYS_DIR
12492 #include <sys/dir.h>
12493 #endif
12494 #endif
12495 #endif
12496 int main() {
12497         DIR *dirp = opendir(".");
12498         if (dirfd(dirp) >= 0)
12499                 exit(0);
12500         else
12501                 exit(1);
12502 }
12503 EOM
12504 val=$undef
12505 set dirfd
12506 if eval $compile; then
12507         val="$define"
12508 fi
12509 case "$val" in
12510 $define)        echo "dirfd() found." >&4       ;;
12511 *)              echo "dirfd() NOT found." >&4   ;;
12512 esac
12513 set d_dirfd
12514 eval $setvar
12515 $rm -f dirfd*
12516
12517 : see if dladdr exists
12518 set dladdr d_dladdr
12519 eval $inlibc
12520
12521 : see if dlerror exists
12522 xxx_runnm="$runnm"
12523 runnm=false
12524 set dlerror d_dlerror
12525 eval $inlibc
12526 runnm="$xxx_runnm"
12527
12528 : see if dlfcn is available
12529 set dlfcn.h i_dlfcn
12530 eval $inhdr
12531
12532 : Check what extension to use for shared libs
12533 case "$usedl" in
12534 $define|y|true)
12535         $cat << EOM
12536
12537 On a few systems, the dynamically loaded modules that perl generates and uses
12538 will need a different extension than shared libs. The default will probably
12539 be appropriate.
12540
12541 EOM
12542         case "$dlext" in
12543         '')     dflt="$so" ;;
12544         *)      dflt="$dlext" ;;
12545         esac
12546         rp='What is the extension of dynamically loaded modules'
12547         . ./myread
12548         dlext="$ans"
12549         ;;
12550 *)
12551         dlext="none"
12552         ;;
12553 esac
12554
12555 : Check if dlsym need a leading underscore
12556 echo " "
12557 val="$undef"
12558
12559 case "$dlsrc" in
12560 dl_dlopen.xs)
12561         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12562         $cat >dyna.c <<'EOM'
12563 fred () { }
12564 EOM
12565
12566 $cat >fred.c<<EOM
12567
12568 #include <stdio.h>
12569 #$i_stdlib I_STDLIB
12570 #ifdef I_STDLIB
12571 #include <stdlib.h>
12572 #endif
12573 #$i_dlfcn I_DLFCN
12574 #ifdef I_DLFCN
12575 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12576 #else
12577 #include <sys/types.h>
12578 #include <nlist.h>
12579 #include <link.h>
12580 #endif
12581
12582 extern int fred() ;
12583
12584 int main()
12585 {
12586     void * handle ;
12587     void * symbol ;
12588 #ifndef RTLD_LAZY
12589     int mode = 1 ;
12590 #else
12591     int mode = RTLD_LAZY ;
12592 #endif
12593     handle = dlopen("./dyna.$dlext", mode) ;
12594     if (handle == NULL) {
12595         printf ("1\n") ;
12596         fflush (stdout) ;
12597         exit(0);
12598     }
12599     symbol = dlsym(handle, "fred") ;
12600     if (symbol == NULL) {
12601         /* try putting a leading underscore */
12602         symbol = dlsym(handle, "_fred") ;
12603         if (symbol == NULL) {
12604             printf ("2\n") ;
12605             fflush (stdout) ;
12606             exit(0);
12607         }
12608         printf ("3\n") ;
12609     }
12610     else
12611         printf ("4\n") ;
12612     fflush (stdout) ;
12613     exit(0);
12614 }
12615 EOM
12616         : Call the object file tmp-dyna.o in case dlext=o.
12617         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12618                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12619                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12620                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12621                 xxx=`$run ./fred`
12622                 case $xxx in
12623                 1)      echo "Test program failed using dlopen." >&4
12624                         echo "Perhaps you should not use dynamic loading." >&4;;
12625                 2)      echo "Test program failed using dlsym." >&4
12626                         echo "Perhaps you should not use dynamic loading." >&4;;
12627                 3)      echo "dlsym needs a leading underscore" >&4
12628                         val="$define" ;;
12629                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12630                 esac
12631         else
12632                 echo "I can't compile and run the test program." >&4
12633                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12634         fi
12635         ;;
12636 esac
12637
12638 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12639
12640 set d_dlsymun
12641 eval $setvar
12642
12643 : see if drand48_r exists
12644 set drand48_r d_drand48_r
12645 eval $inlibc
12646 case "$d_drand48_r" in
12647 "$define")
12648         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12649         case "$d_drand48_r_proto:$usethreads" in
12650         ":define")      d_drand48_r_proto=define
12651                 set d_drand48_r_proto drand48_r $hdrs
12652                 eval $hasproto ;;
12653         *)      ;;
12654         esac
12655         case "$d_drand48_r_proto" in
12656         define)
12657         case "$drand48_r_proto" in
12658         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12659         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12660         esac
12661         case "$drand48_r_proto" in
12662         ''|0)   d_drand48_r=undef
12663                 drand48_r_proto=0
12664                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12665         * )     case "$drand48_r_proto" in
12666                 REENTRANT_PROTO*) ;;
12667                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12668                 esac
12669                 echo "Prototype: $try" ;;
12670         esac
12671         ;;
12672         *)      case "$usethreads" in
12673                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12674                 esac
12675                 d_drand48_r=undef
12676                 drand48_r_proto=0
12677                 ;;
12678         esac
12679         ;;
12680 *)      drand48_r_proto=0
12681         ;;
12682 esac
12683
12684 : see if prototype for drand48 is available
12685 echo " "
12686 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12687 eval $hasproto
12688
12689 : see if dup2 exists
12690 set dup2 d_dup2
12691 eval $inlibc
12692
12693 : see if dup3 exists
12694 set dup3 d_dup3
12695 eval $inlibc
12696
12697 : see if this is an xlocale.h system
12698 set xlocale.h i_xlocale
12699 eval $inhdr
12700
12701 : see if newlocale exists
12702 set newlocale d_newlocale
12703 eval $inlibc
12704
12705 : see if freelocale exists
12706 set freelocale d_freelocale
12707 eval $inlibc
12708
12709 : see if uselocale exists
12710 set uselocale d_uselocale
12711 eval $inlibc
12712
12713 : see if duplocale exists
12714 set duplocale d_duplocale
12715 eval $inlibc
12716
12717 : see if querylocale exists
12718 set querylocale d_querylocale
12719 eval $inlibc
12720
12721 : see if eaccess exists
12722 set eaccess d_eaccess
12723 eval $inlibc
12724
12725 : see if endgrent exists
12726 set endgrent d_endgrent
12727 eval $inlibc
12728
12729 : see if this is an grp system
12730 set grp.h i_grp
12731 eval $inhdr
12732
12733 case "$i_grp" in
12734 $define)
12735         xxx=`./findhdr grp.h`
12736         $cppstdin $cppflags $cppminus < $xxx >$$.h
12737
12738         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12739                 val="$define"
12740         else
12741                 val="$undef"
12742         fi
12743         set d_grpasswd
12744         eval $setvar
12745
12746         $rm -f $$.h
12747         ;;
12748 *)
12749         val="$undef";
12750         set d_grpasswd; eval $setvar
12751         ;;
12752 esac
12753
12754 : see if endgrent_r exists
12755 set endgrent_r d_endgrent_r
12756 eval $inlibc
12757 case "$d_endgrent_r" in
12758 "$define")
12759         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12760         case "$d_endgrent_r_proto:$usethreads" in
12761         ":define")      d_endgrent_r_proto=define
12762                 set d_endgrent_r_proto endgrent_r $hdrs
12763                 eval $hasproto ;;
12764         *)      ;;
12765         esac
12766         case "$d_endgrent_r_proto" in
12767         define)
12768         case "$endgrent_r_proto" in
12769         ''|0) try='int endgrent_r(FILE**);'
12770         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12771         esac
12772         case "$endgrent_r_proto" in
12773         ''|0) try='void endgrent_r(FILE**);'
12774         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12775         esac
12776         case "$endgrent_r_proto" in
12777         ''|0)   d_endgrent_r=undef
12778                 endgrent_r_proto=0
12779                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12780         * )     case "$endgrent_r_proto" in
12781                 REENTRANT_PROTO*) ;;
12782                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12783                 esac
12784                 echo "Prototype: $try" ;;
12785         esac
12786         ;;
12787         *)      case "$usethreads" in
12788                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12789                 esac
12790                 d_endgrent_r=undef
12791                 endgrent_r_proto=0
12792                 ;;
12793         esac
12794         ;;
12795 *)      endgrent_r_proto=0
12796         ;;
12797 esac
12798
12799 : see if endhostent exists
12800 set endhostent d_endhent
12801 eval $inlibc
12802
12803 : see if this is a netdb.h system
12804 set netdb.h i_netdb
12805 eval $inhdr
12806
12807 : see if endhostent_r exists
12808 set endhostent_r d_endhostent_r
12809 eval $inlibc
12810 case "$d_endhostent_r" in
12811 "$define")
12812         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12813         case "$d_endhostent_r_proto:$usethreads" in
12814         ":define")      d_endhostent_r_proto=define
12815                 set d_endhostent_r_proto endhostent_r $hdrs
12816                 eval $hasproto ;;
12817         *)      ;;
12818         esac
12819         case "$d_endhostent_r_proto" in
12820         define)
12821         case "$endhostent_r_proto" in
12822         ''|0) try='int endhostent_r(struct hostent_data*);'
12823         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12824         esac
12825         case "$endhostent_r_proto" in
12826         ''|0) try='void endhostent_r(struct hostent_data*);'
12827         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12828         esac
12829         case "$endhostent_r_proto" in
12830         ''|0)   d_endhostent_r=undef
12831                 endhostent_r_proto=0
12832                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12833         * )     case "$endhostent_r_proto" in
12834                 REENTRANT_PROTO*) ;;
12835                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12836                 esac
12837                 echo "Prototype: $try" ;;
12838         esac
12839         ;;
12840         *)      case "$usethreads" in
12841                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12842                 esac
12843                 d_endhostent_r=undef
12844                 endhostent_r_proto=0
12845                 ;;
12846         esac
12847         ;;
12848 *)      endhostent_r_proto=0
12849         ;;
12850 esac
12851
12852 : see if endnetent exists
12853 set endnetent d_endnent
12854 eval $inlibc
12855
12856 : see if endnetent_r exists
12857 set endnetent_r d_endnetent_r
12858 eval $inlibc
12859 case "$d_endnetent_r" in
12860 "$define")
12861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12862         case "$d_endnetent_r_proto:$usethreads" in
12863         ":define")      d_endnetent_r_proto=define
12864                 set d_endnetent_r_proto endnetent_r $hdrs
12865                 eval $hasproto ;;
12866         *)      ;;
12867         esac
12868         case "$d_endnetent_r_proto" in
12869         define)
12870         case "$endnetent_r_proto" in
12871         ''|0) try='int endnetent_r(struct netent_data*);'
12872         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12873         esac
12874         case "$endnetent_r_proto" in
12875         ''|0) try='void endnetent_r(struct netent_data*);'
12876         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12877         esac
12878         case "$endnetent_r_proto" in
12879         ''|0)   d_endnetent_r=undef
12880                 endnetent_r_proto=0
12881                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12882         * )     case "$endnetent_r_proto" in
12883                 REENTRANT_PROTO*) ;;
12884                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12885                 esac
12886                 echo "Prototype: $try" ;;
12887         esac
12888         ;;
12889         *)      case "$usethreads" in
12890                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12891                 esac
12892                 d_endnetent_r=undef
12893                 endnetent_r_proto=0
12894                 ;;
12895         esac
12896         ;;
12897 *)      endnetent_r_proto=0
12898         ;;
12899 esac
12900
12901 : see if endprotoent exists
12902 set endprotoent d_endpent
12903 eval $inlibc
12904
12905 : see if endprotoent_r exists
12906 set endprotoent_r d_endprotoent_r
12907 eval $inlibc
12908 case "$d_endprotoent_r" in
12909 "$define")
12910         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12911         case "$d_endprotoent_r_proto:$usethreads" in
12912         ":define")      d_endprotoent_r_proto=define
12913                 set d_endprotoent_r_proto endprotoent_r $hdrs
12914                 eval $hasproto ;;
12915         *)      ;;
12916         esac
12917         case "$d_endprotoent_r_proto" in
12918         define)
12919         case "$endprotoent_r_proto" in
12920         ''|0) try='int endprotoent_r(struct protoent_data*);'
12921         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12922         esac
12923         case "$endprotoent_r_proto" in
12924         ''|0) try='void endprotoent_r(struct protoent_data*);'
12925         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12926         esac
12927         case "$endprotoent_r_proto" in
12928         ''|0)   d_endprotoent_r=undef
12929                 endprotoent_r_proto=0
12930                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12931         * )     case "$endprotoent_r_proto" in
12932                 REENTRANT_PROTO*) ;;
12933                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12934                 esac
12935                 echo "Prototype: $try" ;;
12936         esac
12937         ;;
12938         *)      case "$usethreads" in
12939                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12940                 esac
12941                 d_endprotoent_r=undef
12942                 endprotoent_r_proto=0
12943                 ;;
12944         esac
12945         ;;
12946 *)      endprotoent_r_proto=0
12947         ;;
12948 esac
12949
12950 : see if endpwent exists
12951 set endpwent d_endpwent
12952 eval $inlibc
12953
12954 : see if this is a pwd.h system
12955 set pwd.h i_pwd
12956 eval $inhdr
12957
12958 case "$i_pwd" in
12959 $define)
12960         xxx=`./findhdr pwd.h`
12961         $cppstdin $cppflags $cppminus < $xxx >$$.h
12962
12963         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12964                 val="$define"
12965         else
12966                 val="$undef"
12967         fi
12968         set d_pwquota
12969         eval $setvar
12970
12971         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12972                 val="$define"
12973         else
12974                 val="$undef"
12975         fi
12976         set d_pwage
12977         eval $setvar
12978
12979         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12980                 val="$define"
12981         else
12982                 val="$undef"
12983         fi
12984         set d_pwchange
12985         eval $setvar
12986
12987         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12988                 val="$define"
12989         else
12990                 val="$undef"
12991         fi
12992         set d_pwclass
12993         eval $setvar
12994
12995         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12996                 val="$define"
12997         else
12998                 val="$undef"
12999         fi
13000         set d_pwexpire
13001         eval $setvar
13002
13003         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13004                 val="$define"
13005         else
13006                 val="$undef"
13007         fi
13008         set d_pwcomment
13009         eval $setvar
13010
13011         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13012                 val="$define"
13013         else
13014                 val="$undef"
13015         fi
13016         set d_pwgecos
13017         eval $setvar
13018
13019         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13020                 val="$define"
13021         else
13022                 val="$undef"
13023         fi
13024         set d_pwpasswd
13025         eval $setvar
13026
13027         $rm -f $$.h
13028         ;;
13029 *)
13030         val="$undef";
13031         set d_pwquota; eval $setvar
13032         set d_pwage; eval $setvar
13033         set d_pwchange; eval $setvar
13034         set d_pwclass; eval $setvar
13035         set d_pwexpire; eval $setvar
13036         set d_pwcomment; eval $setvar
13037         set d_pwgecos; eval $setvar
13038         set d_pwpasswd; eval $setvar
13039         ;;
13040 esac
13041
13042 : see if endpwent_r exists
13043 set endpwent_r d_endpwent_r
13044 eval $inlibc
13045 case "$d_endpwent_r" in
13046 "$define")
13047         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13048         case "$d_endpwent_r_proto:$usethreads" in
13049         ":define")      d_endpwent_r_proto=define
13050                 set d_endpwent_r_proto endpwent_r $hdrs
13051                 eval $hasproto ;;
13052         *)      ;;
13053         esac
13054         case "$d_endpwent_r_proto" in
13055         define)
13056         case "$endpwent_r_proto" in
13057         ''|0) try='int endpwent_r(FILE**);'
13058         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13059         esac
13060         case "$endpwent_r_proto" in
13061         ''|0) try='void endpwent_r(FILE**);'
13062         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13063         esac
13064         case "$endpwent_r_proto" in
13065         ''|0)   d_endpwent_r=undef
13066                 endpwent_r_proto=0
13067                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13068         * )     case "$endpwent_r_proto" in
13069                 REENTRANT_PROTO*) ;;
13070                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13071                 esac
13072                 echo "Prototype: $try" ;;
13073         esac
13074         ;;
13075         *)      case "$usethreads" in
13076                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13077                 esac
13078                 d_endpwent_r=undef
13079                 endpwent_r_proto=0
13080                 ;;
13081         esac
13082         ;;
13083 *)      endpwent_r_proto=0
13084         ;;
13085 esac
13086
13087 : see if endservent exists
13088 set endservent d_endsent
13089 eval $inlibc
13090
13091 : see if endservent_r exists
13092 set endservent_r d_endservent_r
13093 eval $inlibc
13094 case "$d_endservent_r" in
13095 "$define")
13096         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13097         case "$d_endservent_r_proto:$usethreads" in
13098         ":define")      d_endservent_r_proto=define
13099                 set d_endservent_r_proto endservent_r $hdrs
13100                 eval $hasproto ;;
13101         *)      ;;
13102         esac
13103         case "$d_endservent_r_proto" in
13104         define)
13105         case "$endservent_r_proto" in
13106         ''|0) try='int endservent_r(struct servent_data*);'
13107         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13108         esac
13109         case "$endservent_r_proto" in
13110         ''|0) try='void endservent_r(struct servent_data*);'
13111         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13112         esac
13113         case "$endservent_r_proto" in
13114         ''|0)   d_endservent_r=undef
13115                 endservent_r_proto=0
13116                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13117         * )     case "$endservent_r_proto" in
13118                 REENTRANT_PROTO*) ;;
13119                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13120                 esac
13121                 echo "Prototype: $try" ;;
13122         esac
13123         ;;
13124         *)      case "$usethreads" in
13125                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13126                 esac
13127                 d_endservent_r=undef
13128                 endservent_r_proto=0
13129                 ;;
13130         esac
13131         ;;
13132 *)      endservent_r_proto=0
13133         ;;
13134 esac
13135
13136 : Locate the flags for 'open()'
13137 echo " "
13138 $cat >try.c <<EOCP
13139 #include <sys/types.h>
13140 #ifdef I_FCNTL
13141 #include <fcntl.h>
13142 #endif
13143 #ifdef I_SYS_FILE
13144 #include <sys/file.h>
13145 #endif
13146 #$i_stdlib I_STDLIB
13147 #ifdef I_STDLIB
13148 #include <stdlib.h>
13149 #endif
13150 int main() {
13151         if(O_RDONLY);
13152 #ifdef O_TRUNC
13153         exit(0);
13154 #else
13155         exit(1);
13156 #endif
13157 }
13158 EOCP
13159 : check sys/file.h first to get FREAD on Sun
13160 if $test `./findhdr sys/file.h` && \
13161                 set try -DI_SYS_FILE && eval $compile; then
13162         h_sysfile=true;
13163         echo "<sys/file.h> defines the O_* constants..." >&4
13164         if $run ./try; then
13165                 echo "and you have the 3 argument form of open()." >&4
13166                 val="$define"
13167         else
13168                 echo "but not the 3 argument form of open().  Oh, well." >&4
13169                 val="$undef"
13170         fi
13171 elif $test `./findhdr fcntl.h` && \
13172                 set try -DI_FCNTL && eval $compile; then
13173         h_fcntl=true;
13174         echo "<fcntl.h> defines the O_* constants..." >&4
13175         if $run ./try; then
13176                 echo "and you have the 3 argument form of open()." >&4
13177                 val="$define"
13178         else
13179                 echo "but not the 3 argument form of open().  Oh, well." >&4
13180                 val="$undef"
13181         fi
13182 else
13183         val="$undef"
13184         echo "I can't find the O_* constant definitions!  You got problems." >&4
13185 fi
13186 set d_open3
13187 eval $setvar
13188 $rm_try
13189
13190 : see if this is a sys/file.h system
13191 val=''
13192 set sys/file.h val
13193 eval $inhdr
13194
13195 : do we need to include sys/file.h ?
13196 case "$val" in
13197 "$define")
13198         echo " "
13199         if $h_sysfile; then
13200                 val="$define"
13201                 echo "We'll be including <sys/file.h>." >&4
13202         else
13203                 val="$undef"
13204                 echo "We won't be including <sys/file.h>." >&4
13205         fi
13206         ;;
13207 *)
13208         h_sysfile=false
13209         ;;
13210 esac
13211 set i_sysfile
13212 eval $setvar
13213
13214 : see if fcntl.h is there
13215 val=''
13216 set fcntl.h val
13217 eval $inhdr
13218
13219 : see if we can include fcntl.h
13220 case "$val" in
13221 "$define")
13222         echo " "
13223         if $h_fcntl; then
13224                 val="$define"
13225                 echo "We'll be including <fcntl.h>." >&4
13226         else
13227                 val="$undef"
13228                 if $h_sysfile; then
13229         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13230                 else
13231                         echo "We won't be including <fcntl.h>." >&4
13232                 fi
13233         fi
13234         ;;
13235 *)
13236         h_fcntl=false
13237         val="$undef"
13238         ;;
13239 esac
13240 set i_fcntl
13241 eval $setvar
13242
13243 : see if fork exists
13244 set fork d_fork
13245 eval $inlibc
13246
13247 : see if pipe exists
13248 set pipe d_pipe
13249 eval $inlibc
13250
13251 : check for non-blocking I/O stuff
13252 case "$h_sysfile" in
13253 true) echo "#include <sys/file.h>" > head.c;;
13254 *)
13255        case "$h_fcntl" in
13256        true) echo "#include <fcntl.h>" > head.c;;
13257        *) echo "#include <sys/fcntl.h>" > head.c;;
13258        esac
13259        ;;
13260 esac
13261 echo " "
13262 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13263 case "$o_nonblock" in
13264 '')
13265         $cat head.c > try.c
13266         $cat >>try.c <<EOCP
13267 #include <stdio.h>
13268 #$i_stdlib I_STDLIB
13269 #ifdef I_STDLIB
13270 #include <stdlib.h>
13271 #endif
13272 #$i_fcntl I_FCNTL
13273 #ifdef I_FCNTL
13274 #include <fcntl.h>
13275 #endif
13276 int main() {
13277 #ifdef O_NONBLOCK
13278         printf("O_NONBLOCK\n");
13279         exit(0);
13280 #endif
13281 #ifdef O_NDELAY
13282         printf("O_NDELAY\n");
13283         exit(0);
13284 #endif
13285 #ifdef FNDELAY
13286         printf("FNDELAY\n");
13287         exit(0);
13288 #endif
13289         exit(0);
13290 }
13291 EOCP
13292         set try
13293         if eval $compile_ok; then
13294                 o_nonblock=`$run ./try`
13295                 case "$o_nonblock" in
13296                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13297                 *) echo "Seems like we can use $o_nonblock.";;
13298                 esac
13299         else
13300                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13301         fi
13302         ;;
13303 *) echo "Using $hint value $o_nonblock.";;
13304 esac
13305 $rm_try
13306
13307 echo " "
13308 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13309 case "$eagain" in
13310 '')
13311         case "$d_fork:$d_pipe:$d_alarm" in
13312         define:define:define)
13313         $cat head.c > try.c
13314         $cat >>try.c <<EOCP
13315 #include <errno.h>
13316 #include <sys/types.h>
13317 #include <signal.h>
13318 #include <stdio.h>
13319 #$i_stdlib I_STDLIB
13320 #ifdef I_STDLIB
13321 #include <stdlib.h>
13322 #endif
13323 #$i_fcntl I_FCNTL
13324 #ifdef I_FCNTL
13325 #include <fcntl.h>
13326 #endif
13327 #define MY_O_NONBLOCK $o_nonblock
13328 #ifndef errno  /* XXX need better Configure test */
13329 extern int errno;
13330 #endif
13331 #$i_unistd I_UNISTD
13332 #ifdef I_UNISTD
13333 #include <unistd.h>
13334 #endif
13335 #include <string.h>
13336 $signal_t blech(int x) { exit(3); }
13337 EOCP
13338         $cat >> try.c <<'EOCP'
13339 int main()
13340 {
13341         int pd[2];
13342         int pu[2];
13343         char buf[1];
13344         char string[100];
13345         int ret;
13346
13347         ret = pipe(pd); /* Down: child -> parent */
13348         if (ret != 0)
13349                 exit(3);
13350         ret = pipe(pu); /* Up: parent -> child */
13351         if (ret != 0)
13352                 exit(3);
13353         if (0 != fork()) {
13354                 close(pd[1]);   /* Parent reads from pd[0] */
13355                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13356 #ifdef F_SETFL
13357                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13358                         exit(1);
13359 #else
13360                 exit(4);
13361 #endif
13362                 signal(SIGALRM, blech);
13363                 alarm(5);
13364                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13365                         exit(2);
13366                 sprintf(string, "%d\n", ret);
13367                 ret = write(2, string, strlen(string));
13368                 if (ret != strlen(string))
13369                         exit(3);
13370                 alarm(0);
13371 #ifdef EAGAIN
13372                 if (errno == EAGAIN) {
13373                         printf("EAGAIN\n");
13374                         goto ok;
13375                 }
13376 #endif
13377 #ifdef EWOULDBLOCK
13378                 if (errno == EWOULDBLOCK)
13379                         printf("EWOULDBLOCK\n");
13380 #endif
13381         ok:
13382                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13383                 if (ret != 1)
13384                         exit(3);
13385                 sleep(2);                               /* Give it time to close our pipe */
13386                 alarm(5);
13387                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13388                 alarm(0);
13389                 sprintf(string, "%d\n", ret);
13390                 ret = write(4, string, strlen(string));
13391                 if (ret != strlen(string))
13392                         exit(3);
13393                 exit(0);
13394         }
13395
13396         close(pd[0]);                   /* We write to pd[1] */
13397         close(pu[1]);                   /* We read from pu[0] */
13398         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13399         if (ret != 1)
13400                 exit(3);
13401         close(pd[1]);                   /* Pipe pd is now fully closed! */
13402         exit(0);                                /* Bye bye, thank you for playing! */
13403 }
13404 EOCP
13405         set try
13406         if eval $compile_ok; then
13407                 echo "$startsh" >mtry
13408                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13409                 chmod +x mtry
13410                 $run ./mtry >/dev/null 2>&1
13411                 case $? in
13412                 0) eagain=`$cat try.out`;;
13413                 1) echo "Could not perform non-blocking setting!";;
13414                 2) echo "I did a successful read() for something that was not there!";;
13415                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13416                 4) echo "Could not find F_SETFL!";;
13417                 *) echo "Something terribly wrong happened during testing.";;
13418                 esac
13419                 rd_nodata=`$cat try.ret`
13420                 echo "A read() system call with no data present returns $rd_nodata."
13421                 case "$rd_nodata" in
13422                 0|-1) ;;
13423                 *)
13424                         echo "(That's peculiar, fixing that to be -1.)"
13425                         rd_nodata=-1
13426                         ;;
13427                 esac
13428                 case "$eagain" in
13429                 '')
13430                         echo "Forcing errno EAGAIN on read() with no data available."
13431                         eagain=EAGAIN
13432                         ;;
13433                 *)
13434                         echo "Your read() sets errno to $eagain when no data is available."
13435                         ;;
13436                 esac
13437                 status=`$cat try.err`
13438                 case "$status" in
13439                 0) echo "And it correctly returns 0 to signal EOF.";;
13440                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13441                 *) echo "However, your read() returns '$status' on EOF??";;
13442                 esac
13443                 val="$define"
13444                 if test "$status" = "$rd_nodata"; then
13445                         echo "WARNING: you can't distinguish between EOF and no data!"
13446                         val="$undef"
13447                 fi
13448         else
13449                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13450                 eagain=EAGAIN
13451         fi
13452         ;;
13453         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13454                 eagain=EAGAIN
13455                 val="$define"
13456                 ;;
13457         esac
13458         set d_eofnblk
13459         eval $setvar
13460         ;;
13461 *)
13462         echo "Using $hint value $eagain."
13463         echo "Your read() returns $rd_nodata when no data is present."
13464         case "$d_eofnblk" in
13465         "$define") echo "And you can see EOF because read() returns 0.";;
13466         "$undef") echo "But you can't see EOF status from read() returned value.";;
13467         *)
13468                 echo "(Assuming you can't see EOF status from read anyway.)"
13469                 d_eofnblk=$undef
13470                 ;;
13471         esac
13472         ;;
13473 esac
13474 $rm_try head.c mtry
13475
13476 : see if erf exists
13477 set erf d_erf
13478 eval $inlibc
13479
13480 : see if erfc exists
13481 set erfc d_erfc
13482 eval $inlibc
13483
13484 : see if exp2 exists
13485 set exp2 d_exp2
13486 eval $inlibc
13487
13488 : see if expm1 exists
13489 set expm1 d_expm1
13490 eval $inlibc
13491
13492 : see if _ptr and _cnt from stdio act std
13493 echo " "
13494
13495 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13496         echo "(Looks like you have stdio.h from BSD.)"
13497         case "$stdio_ptr" in
13498         '') stdio_ptr='((fp)->_p)'
13499                 ptr_lval=$define
13500                 ;;
13501         *)      ptr_lval=$d_stdio_ptr_lval;;
13502         esac
13503         case "$stdio_cnt" in
13504         '') stdio_cnt='((fp)->_r)'
13505                 cnt_lval=$define
13506                 ;;
13507         *)      cnt_lval=$d_stdio_cnt_lval;;
13508         esac
13509         case "$stdio_base" in
13510         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13511         esac
13512         case "$stdio_bufsiz" in
13513         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13514         esac
13515 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13516         echo "(Looks like you have stdio.h from Linux.)"
13517         case "$stdio_ptr" in
13518         '') stdio_ptr='((fp)->_IO_read_ptr)'
13519                 ptr_lval=$define
13520                 ;;
13521         *)      ptr_lval=$d_stdio_ptr_lval;;
13522         esac
13523         case "$stdio_cnt" in
13524         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13525                 cnt_lval=$undef
13526                 ;;
13527         *)      cnt_lval=$d_stdio_cnt_lval;;
13528         esac
13529         case "$stdio_base" in
13530         '') stdio_base='((fp)->_IO_read_base)';;
13531         esac
13532         case "$stdio_bufsiz" in
13533         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13534         esac
13535 else
13536         case "$stdio_ptr" in
13537         '') stdio_ptr='((fp)->_ptr)'
13538                 ptr_lval=$define
13539                 ;;
13540         *)      ptr_lval=$d_stdio_ptr_lval;;
13541         esac
13542         case "$stdio_cnt" in
13543         '') stdio_cnt='((fp)->_cnt)'
13544                 cnt_lval=$define
13545                 ;;
13546         *)      cnt_lval=$d_stdio_cnt_lval;;
13547         esac
13548         case "$stdio_base" in
13549         '') stdio_base='((fp)->_base)';;
13550         esac
13551         case "$stdio_bufsiz" in
13552         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13553         esac
13554 fi
13555
13556 : test whether _ptr and _cnt really work
13557 echo "Checking how std your stdio is..." >&4
13558 $cat >try.c <<EOP
13559 #include <stdio.h>
13560 #$i_stdlib I_STDLIB
13561 #ifdef I_STDLIB
13562 #include <stdlib.h>
13563 #endif
13564 #define FILE_ptr(fp)    $stdio_ptr
13565 #define FILE_cnt(fp)    $stdio_cnt
13566 int main() {
13567         FILE *fp = fopen("try.c", "r");
13568         char c = getc(fp);
13569         if (
13570                 18 <= FILE_cnt(fp) &&
13571                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13572         )
13573                 exit(0);
13574         exit(1);
13575 }
13576 EOP
13577 val="$undef"
13578 set try
13579 if eval $compile && $to try.c; then
13580         if $run ./try; then
13581                 echo "Your stdio acts pretty std."
13582                 val="$define"
13583         else
13584                 echo "Your stdio isn't very std."
13585         fi
13586 else
13587         echo "Your stdio doesn't appear very std."
13588 fi
13589 $rm_try
13590
13591 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13592 # direct buffer manipulation no longer works.  The Configure tests
13593 # should be changed to correctly detect this, but until then,
13594 # the following check should at least let perl compile and run.
13595 # (This quick fix should be updated before 5.8.1.)
13596 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13597 # A. Dougherty, June 3, 2002.
13598 case "$d_gnulibc" in
13599 $define)
13600         case "$gnulibc_version" in
13601         2.[01]*)  ;;
13602         2.2) ;;
13603         2.2.[0-9]) ;;
13604         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13605                 val="$undef"
13606                 ;;
13607         esac
13608         ;;
13609 esac
13610 set d_stdstdio
13611 eval $setvar
13612
13613 : Can _ptr be used as an lvalue?
13614 case "$d_stdstdio$ptr_lval" in
13615 $define$define) val=$define ;;
13616 *) val=$undef ;;
13617 esac
13618 set d_stdio_ptr_lval
13619 eval $setvar
13620
13621 : Can _cnt be used as an lvalue?
13622 case "$d_stdstdio$cnt_lval" in
13623 $define$define) val=$define ;;
13624 *) val=$undef ;;
13625 esac
13626 set d_stdio_cnt_lval
13627 eval $setvar
13628
13629
13630 : test whether setting _ptr sets _cnt as a side effect
13631 d_stdio_ptr_lval_sets_cnt="$undef"
13632 d_stdio_ptr_lval_nochange_cnt="$undef"
13633 case "$d_stdio_ptr_lval$d_stdstdio" in
13634 $define$define)
13635         echo "Checking to see what happens if we set the stdio ptr..." >&4
13636 $cat >try.c <<EOP
13637 #include <stdio.h>
13638 /* Can we scream? */
13639 /* Eat dust sed :-) */
13640 /* In the buffer space, no one can hear you scream. */
13641 #$i_stdlib I_STDLIB
13642 #ifdef I_STDLIB
13643 #include <stdlib.h>
13644 #endif
13645 #define FILE_ptr(fp)    $stdio_ptr
13646 #define FILE_cnt(fp)    $stdio_cnt
13647 #include <sys/types.h>
13648 int main() {
13649         FILE *fp = fopen("try.c", "r");
13650         int c;
13651         char *ptr;
13652         size_t cnt;
13653         if (!fp) {
13654             puts("Fail even to read");
13655             exit(1);
13656         }
13657         c = getc(fp); /* Read away the first # */
13658         if (c == EOF) {
13659             puts("Fail even to read");
13660             exit(1);
13661         }
13662         if (!(
13663                 18 <= FILE_cnt(fp) &&
13664                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13665         )) {
13666                 puts("Fail even to read");
13667                 exit (1);
13668         }
13669         ptr = (char*) FILE_ptr(fp);
13670         cnt = (size_t)FILE_cnt(fp);
13671
13672         FILE_ptr(fp) += 42;
13673
13674         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13675                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13676                 exit (1);
13677         }
13678         if (FILE_cnt(fp) <= 20) {
13679                 printf ("Fail (<20 chars to test)");
13680                 exit (1);
13681         }
13682         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13683                 puts("Fail compare");
13684                 exit (1);
13685         }
13686         if (cnt == FILE_cnt(fp)) {
13687                 puts("Pass_unchanged");
13688                 exit (0);
13689         }
13690         if (FILE_cnt(fp) == (cnt - 42)) {
13691                 puts("Pass_changed");
13692                 exit (0);
13693         }
13694         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13695         return 1;
13696
13697 }
13698 EOP
13699         set try
13700         if eval $compile && $to try.c; then
13701                 case `$run ./try` in
13702                 Pass_changed)
13703                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13704                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13705                 Pass_unchanged)
13706                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13707                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13708                 Fail*)
13709                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13710                 *)
13711                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13712         esac
13713         else
13714                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13715         fi
13716         $rm_try
13717         ;;
13718 esac
13719
13720 : see if _base is also standard
13721 val="$undef"
13722 case "$d_stdstdio" in
13723 $define)
13724         $cat >try.c <<EOP
13725 #include <stdio.h>
13726 #$i_stdlib I_STDLIB
13727 #ifdef I_STDLIB
13728 #include <stdlib.h>
13729 #endif
13730 #define FILE_base(fp)   $stdio_base
13731 #define FILE_bufsiz(fp) $stdio_bufsiz
13732 int main() {
13733         FILE *fp = fopen("try.c", "r");
13734         char c = getc(fp);
13735         if (
13736                 19 <= FILE_bufsiz(fp) &&
13737                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13738         )
13739                 exit(0);
13740         exit(1);
13741 }
13742 EOP
13743         set try
13744         if eval $compile && $to try.c; then
13745                 if $run ./try; then
13746                         echo "And its _base field acts std."
13747                         val="$define"
13748                 else
13749                         echo "But its _base field isn't std."
13750                 fi
13751         else
13752                 echo "However, it seems to be lacking the _base field."
13753         fi
13754         $rm_try
13755         ;;
13756 esac
13757 set d_stdiobase
13758 eval $setvar
13759
13760 : see if fast_stdio exists
13761 val="$undef"
13762 case "$d_stdstdio:$d_stdio_ptr_lval" in
13763 "$define:$define")
13764         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13765         *$define*)
13766                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13767                 val="$define"
13768                 ;;
13769         esac
13770         ;;
13771 esac
13772 set d_faststdio
13773 eval $setvar
13774
13775 : see if fchdir exists
13776 set fchdir d_fchdir
13777 eval $inlibc
13778
13779 : see if fchmod exists
13780 set fchmod d_fchmod
13781 eval $inlibc
13782
13783 : check for openat, unlinkat, renameat, linkat, fchmodat
13784 set openat d_openat
13785 eval $inlibc
13786
13787 set unlinkat d_unlinkat
13788 eval $inlibc
13789
13790 set renameat d_renameat
13791 eval $inlibc
13792
13793 set linkat d_linkat
13794 eval $inlibc
13795
13796 set fchmodat d_fchmodat
13797 eval $inlibc
13798
13799 : see if fchown exists
13800 set fchown d_fchown
13801 eval $inlibc
13802
13803 : see if this is an fcntl system
13804 set fcntl d_fcntl
13805 eval $inlibc
13806
13807 : See if fcntl-based locking works.
13808 echo " "
13809 $cat >try.c <<EOCP
13810 #$i_stdlib I_STDLIB
13811 #ifdef I_STDLIB
13812 #include <stdlib.h>
13813 #endif
13814 #include <unistd.h>
13815 #include <fcntl.h>
13816 #include <signal.h>
13817 $signal_t blech(int x) { exit(3); }
13818 int main() {
13819 #if defined(F_SETLK) && defined(F_SETLKW)
13820      struct flock flock;
13821      int retval, fd;
13822      fd = open("try.c", O_RDONLY);
13823      flock.l_type = F_RDLCK;
13824      flock.l_whence = SEEK_SET;
13825      flock.l_start = flock.l_len = 0;
13826      signal(SIGALRM, blech);
13827      alarm(10);
13828      retval = fcntl(fd, F_SETLK, &flock);
13829      close(fd);
13830      (retval < 0 ? exit(2) : exit(0));
13831 #else
13832      exit(2);
13833 #endif
13834 }
13835 EOCP
13836 echo "Checking if fcntl-based file locking works... "
13837 case "$d_fcntl" in
13838 "$define")
13839         set try
13840         if eval $compile_ok; then
13841                 if $run ./try; then
13842                         echo "Yes, it seems to work."
13843                         val="$define"
13844                 else
13845                         echo "Nope, it didn't work."
13846                         val="$undef"
13847                         case "$?" in
13848                         3) $cat >&4 <<EOM
13849 ***
13850 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13851 *** This is (almost) impossible.
13852 *** If your NFS lock daemons are not feeling well, something like
13853 *** this may happen, please investigate.  Cannot continue, aborting.
13854 ***
13855 EOM
13856                                 exit 1
13857                                 ;;
13858                         esac
13859                 fi
13860         else
13861                 echo "I'm unable to compile the test program, so I'll assume not."
13862                 val="$undef"
13863         fi
13864         ;;
13865 *) val="$undef";
13866         echo "Nope, since you don't even have fcntl()."
13867         ;;
13868 esac
13869 set d_fcntl_can_lock
13870 eval $setvar
13871 $rm_try
13872
13873 : check for fd_set items
13874 $cat <<EOM
13875
13876 Checking to see how well your C compiler handles fd_set and friends ...
13877 EOM
13878 $cat >try.c <<EOCP
13879 #$i_stdlib I_STDLIB
13880 #ifdef I_STDLIB
13881 #include <stdlib.h>
13882 #endif
13883 #$i_systime I_SYS_TIME
13884 #$i_sysselct I_SYS_SELECT
13885 #$d_socket HAS_SOCKET
13886 #include <sys/types.h>
13887 #ifdef HAS_SOCKET
13888 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13889 #endif
13890 #ifdef I_SYS_TIME
13891 #include <sys/time.h>
13892 #endif
13893 #ifdef I_SYS_SELECT
13894 #include <sys/select.h>
13895 #endif
13896 int main() {
13897         fd_set fds;
13898
13899 #ifdef TRYBITS
13900         if(fds.fds_bits);
13901 #endif
13902
13903 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13904         exit(0);
13905 #else
13906         exit(1);
13907 #endif
13908 }
13909 EOCP
13910 set try -DTRYBITS
13911 if eval $compile; then
13912         d_fds_bits="$define"
13913         d_fd_set="$define"
13914         echo "Well, your system knows about the normal fd_set typedef..." >&4
13915         if $run ./try; then
13916                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13917                 d_fd_macros="$define"
13918         else
13919                 $cat >&4 <<'EOM'
13920 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13921 EOM
13922                 d_fd_macros="$undef"
13923         fi
13924 else
13925         $cat <<'EOM'
13926 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13927 EOM
13928         set try
13929         if eval $compile; then
13930                 d_fds_bits="$undef"
13931                 d_fd_set="$define"
13932                 echo "Well, your system has some sort of fd_set available..." >&4
13933                 if $run ./try; then
13934                         echo "and you have the normal fd_set macros." >&4
13935                         d_fd_macros="$define"
13936                 else
13937                         $cat <<'EOM'
13938 but not the normal fd_set macros!  Gross!  More work for me...
13939 EOM
13940                         d_fd_macros="$undef"
13941                 fi
13942         else
13943         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13944                 d_fd_set="$undef"
13945                 d_fds_bits="$undef"
13946                 d_fd_macros="$undef"
13947         fi
13948 fi
13949 $rm_try
13950
13951 : see if fdclose exists
13952 set fdclose d_fdclose
13953 eval $inlibc
13954
13955 : see if fdim exists
13956 set fdim d_fdim
13957 eval $inlibc
13958
13959 : see if fegetround exists
13960 set fegetround d_fegetround
13961 eval $inlibc
13962
13963 : see if fgetpos exists
13964 set fgetpos d_fgetpos
13965 eval $inlibc
13966
13967 : see if finite exists
13968 set finite d_finite
13969 eval $inlibc
13970
13971 : see if finitel exists
13972 set finitel d_finitel
13973 eval $inlibc
13974
13975 : see if flock exists
13976 set flock d_flock
13977 eval $inlibc
13978
13979 : see if prototype for flock is available
13980 echo " "
13981 set d_flockproto flock $i_sysfile sys/file.h
13982 eval $hasproto
13983
13984 : see if fma exists
13985 set fma d_fma
13986 eval $inlibc
13987
13988 : see if fmax exists
13989 set fmax d_fmax
13990 eval $inlibc
13991
13992 : see if fmin exists
13993 set fmin d_fmin
13994 eval $inlibc
13995
13996 : see if fp_class exists
13997 set fp_class d_fp_class
13998 eval $inlibc
13999
14000 : check for fpclassify
14001 echo "Checking to see if you have fpclassify..." >&4
14002 $cat >try.c <<EOCP
14003 #include <math.h>
14004 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14005 EOCP
14006 set try
14007 if eval $compile; then
14008         val="$define"
14009         echo "You have fpclassify."
14010 else
14011         val="$undef"
14012         echo "You do not have fpclassify."
14013 fi
14014 $rm_try
14015 set d_fpclassify
14016 eval $setvar
14017
14018 : see if fp_classify exists
14019 set fp_classify d_fp_classify
14020 eval $inlibc
14021
14022 : see if fp_classl exists
14023 set fp_classl d_fp_classl
14024 eval $inlibc
14025
14026 : see if pathconf exists
14027 set pathconf d_pathconf
14028 eval $inlibc
14029
14030 : see if fpathconf exists
14031 set fpathconf d_fpathconf
14032 eval $inlibc
14033
14034 : see if fpclass exists
14035 set fpclass d_fpclass
14036 eval $inlibc
14037
14038 : see if fpclassl exists
14039 set fpclassl d_fpclassl
14040 eval $inlibc
14041
14042 : see if fpgetround exists
14043 set fpgetround d_fpgetround
14044 eval $inlibc
14045
14046 : check for fpos64_t
14047 echo " "
14048 echo "Checking to see if you have fpos64_t..." >&4
14049 $cat >try.c <<EOCP
14050 #include <stdio.h>
14051 int main() { fpos64_t x = 7; }
14052 EOCP
14053 set try
14054 if eval $compile; then
14055         val="$define"
14056         echo "You have fpos64_t."
14057 else
14058         val="$undef"
14059         echo "You do not have fpos64_t."
14060         case "$fpossize" in
14061         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14062         esac
14063 fi
14064 $rm_try
14065 set d_fpos64_t
14066 eval $setvar
14067
14068 : see if frexpl exists
14069 set frexpl d_frexpl
14070 eval $inlibc
14071
14072 : see if this is a sys/param system
14073 set sys/param.h i_sysparam
14074 eval $inhdr
14075
14076 : see if this is a sys/mount.h system
14077 set sys/mount.h i_sysmount
14078 eval $inhdr
14079
14080 : Check for fs_data_s
14081 echo " "
14082 echo "Checking to see if your system supports struct fs_data..." >&4
14083 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14084 eval $hasstruct
14085 case "$d_fs_data_s" in
14086 "$define")      echo "Yes, it does."   ;;
14087 *)              echo "No, it doesn't." ;;
14088 esac
14089
14090 : see if fseeko exists
14091 set fseeko d_fseeko
14092 eval $inlibc
14093 case "$longsize" in
14094 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14095 esac
14096
14097 : see if fsetpos exists
14098 set fsetpos d_fsetpos
14099 eval $inlibc
14100
14101 : see if fstatfs exists
14102 set fstatfs d_fstatfs
14103 eval $inlibc
14104
14105 : see if statvfs exists
14106 set statvfs d_statvfs
14107 eval $inlibc
14108
14109 : see if fstatvfs exists
14110 set fstatvfs d_fstatvfs
14111 eval $inlibc
14112
14113 : see if fsync exists
14114 set fsync d_fsync
14115 eval $inlibc
14116
14117 : see if ftello exists
14118 set ftello d_ftello
14119 eval $inlibc
14120 case "$longsize" in
14121 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14122 esac
14123
14124 : check for a working futimes
14125 d_futimes="$undef"
14126 echo " "
14127 echo "Checking if you have a working futimes()" >&4
14128 $cat >try.c <<EOCP
14129 #include <stdio.h>
14130 #include <stdlib.h>
14131 #include <sys/time.h>
14132 #include <errno.h>
14133 #include <fcntl.h>
14134 #include <stdlib.h>
14135
14136 int main ()
14137 {
14138     int fd, rv;
14139     fd = open ("try.c", O_RDWR);
14140     if (-1 == fd) exit (1);
14141     rv = futimes (fd, NULL);
14142     exit (rv == -1 ? errno : 0);
14143 }
14144 EOCP
14145 set try
14146 if eval $compile; then
14147     `$run ./try`
14148     rc=$?
14149     case "$rc" in
14150         0)  echo "Yes, you have" >&4
14151             d_futimes="$define"
14152             ;;
14153         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14154             ;;
14155     esac
14156 else
14157     echo "No, it does not (probably harmless)" >&4
14158 fi
14159 $rm_try
14160
14161 : look for gai_strerror
14162 echo " "
14163 $cat >try.c <<'EOCP'
14164 #include <sys/types.h>
14165 #include <sys/socket.h>
14166 #include <netdb.h>
14167 int main ()
14168 {
14169     return (gai_strerror (0) ? 0 : 1);
14170     }
14171 EOCP
14172 set try
14173 val="$undef"
14174 if eval $compile; then
14175     `$run ./try`
14176     case "$?" in
14177         0)  echo "A working gai_strerror() found." >&4
14178             val="$define" ;;
14179         *)  echo "gai_strerror() found, but it doesn't work" >&4
14180             ;;
14181         esac
14182 else
14183     echo "gai_strerror() NOT found." >&4
14184     fi
14185 set d_gai_strerror
14186 eval $setvar
14187 $rm_try
14188
14189 : see if ndbm.h is available
14190 set ndbm.h i_ndbm
14191 eval $inhdr
14192 : Compatibility location for RedHat 7.1
14193 set gdbm/ndbm.h i_gdbmndbm
14194 eval $inhdr
14195 : Compatibility location for Debian 4.0
14196 set gdbm-ndbm.h i_gdbm_ndbm
14197 eval $inhdr
14198
14199 val="$undef"
14200 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14201         : see if dbm_open exists
14202         set dbm_open d_dbm_open
14203         eval $inlibc
14204         case "$d_dbm_open" in
14205         $undef)
14206                 i_ndbm="$undef"
14207                 i_gdbmndbm="$undef"
14208                 i_gdbm_ndbm="$undef"
14209                 echo "We won't be including <ndbm.h>"
14210                 val="$undef"
14211                 ;;
14212         *) val="$define"
14213            ;;
14214         esac
14215 fi
14216 set d_ndbm
14217 eval $setvar
14218
14219 ndbm_hdr_protochk='name=$1; hdr=$2;
14220 eval "ihdr=\$""i_$name";
14221 val="$undef";
14222 if $test "$ihdr" = "$define"; then
14223         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14224         case "$d_cplusplus" in
14225         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14226         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14227         esac;
14228         case "$val" in
14229         $define) $echo "Your <$hdr> seems to have prototypes";;
14230         *) $echo "Your <$hdr> does not seem to have prototypes";;
14231         esac;
14232 fi;
14233 set "d_${name}_h_uses_prototypes";
14234 eval $setvar'
14235
14236 set ndbm ndbm.h
14237 eval $ndbm_hdr_protochk
14238 set gdbmndbm gdbm/ndbm.h
14239 eval $ndbm_hdr_protochk
14240 set gdbm_ndbm gdbm-ndbm.h
14241 eval $ndbm_hdr_protochk
14242
14243 : see if getaddrinfo exists
14244 set getaddrinfo d_getaddrinfo
14245 eval $inlibc
14246
14247 : see if getcwd exists
14248 set getcwd d_getcwd
14249 eval $inlibc
14250
14251 : see if getespwnam exists
14252 set getespwnam d_getespwnam
14253 eval $inlibc
14254
14255 : see if getfsstat exists
14256 set getfsstat d_getfsstat
14257 eval $inlibc
14258
14259 : see if getgrent exists
14260 set getgrent d_getgrent
14261 eval $inlibc
14262
14263 : see if getgrent_r exists
14264 set getgrent_r d_getgrent_r
14265 eval $inlibc
14266 case "$d_getgrent_r" in
14267 "$define")
14268         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14269         case "$d_getgrent_r_proto:$usethreads" in
14270         ":define")      d_getgrent_r_proto=define
14271                 set d_getgrent_r_proto getgrent_r $hdrs
14272                 eval $hasproto ;;
14273         *)      ;;
14274         esac
14275         case "$d_getgrent_r_proto" in
14276         define)
14277         case "$getgrent_r_proto" in
14278         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14279         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14280         esac
14281         case "$getgrent_r_proto" in
14282         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14283         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14284         esac
14285         case "$getgrent_r_proto" in
14286         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14287         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14288         esac
14289         case "$getgrent_r_proto" in
14290         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14291         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14292         esac
14293         case "$getgrent_r_proto" in
14294         ''|0) try='int getgrent_r(struct group*, char*, int);'
14295         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14296         esac
14297         case "$getgrent_r_proto" in
14298         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14299         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14300         esac
14301         case "$getgrent_r_proto" in
14302         ''|0)   d_getgrent_r=undef
14303                 getgrent_r_proto=0
14304                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14305         * )     case "$getgrent_r_proto" in
14306                 REENTRANT_PROTO*) ;;
14307                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14308                 esac
14309                 echo "Prototype: $try" ;;
14310         esac
14311         ;;
14312         *)      case "$usethreads" in
14313                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14314                 esac
14315                 d_getgrent_r=undef
14316                 getgrent_r_proto=0
14317                 ;;
14318         esac
14319         ;;
14320 *)      getgrent_r_proto=0
14321         ;;
14322 esac
14323
14324 : see if getgrgid_r exists
14325 set getgrgid_r d_getgrgid_r
14326 eval $inlibc
14327 case "$d_getgrgid_r" in
14328 "$define")
14329         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14330         case "$d_getgrgid_r_proto:$usethreads" in
14331         ":define")      d_getgrgid_r_proto=define
14332                 set d_getgrgid_r_proto getgrgid_r $hdrs
14333                 eval $hasproto ;;
14334         *)      ;;
14335         esac
14336         case "$d_getgrgid_r_proto" in
14337         define)
14338         case "$getgrgid_r_proto" in
14339         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14340         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14341         esac
14342         case "$getgrgid_r_proto" in
14343         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14344         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14345         esac
14346         case "$getgrgid_r_proto" in
14347         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14348         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14349         esac
14350         case "$getgrgid_r_proto" in
14351         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14352         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14353         esac
14354         case "$getgrgid_r_proto" in
14355         ''|0)   d_getgrgid_r=undef
14356                 getgrgid_r_proto=0
14357                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14358         * )     case "$getgrgid_r_proto" in
14359                 REENTRANT_PROTO*) ;;
14360                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14361                 esac
14362                 echo "Prototype: $try" ;;
14363         esac
14364         ;;
14365         *)      case "$usethreads" in
14366                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14367                 esac
14368                 d_getgrgid_r=undef
14369                 getgrgid_r_proto=0
14370                 ;;
14371         esac
14372         ;;
14373 *)      getgrgid_r_proto=0
14374         ;;
14375 esac
14376
14377 : see if getgrnam_r exists
14378 set getgrnam_r d_getgrnam_r
14379 eval $inlibc
14380 case "$d_getgrnam_r" in
14381 "$define")
14382         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14383         case "$d_getgrnam_r_proto:$usethreads" in
14384         ":define")      d_getgrnam_r_proto=define
14385                 set d_getgrnam_r_proto getgrnam_r $hdrs
14386                 eval $hasproto ;;
14387         *)      ;;
14388         esac
14389         case "$d_getgrnam_r_proto" in
14390         define)
14391         case "$getgrnam_r_proto" in
14392         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14393         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14394         esac
14395         case "$getgrnam_r_proto" in
14396         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14397         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14398         esac
14399         case "$getgrnam_r_proto" in
14400         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14401         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14402         esac
14403         case "$getgrnam_r_proto" in
14404         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14405         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14406         esac
14407         case "$getgrnam_r_proto" in
14408         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14409         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14410         esac
14411         case "$getgrnam_r_proto" in
14412         ''|0)   d_getgrnam_r=undef
14413                 getgrnam_r_proto=0
14414                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14415         * )     case "$getgrnam_r_proto" in
14416                 REENTRANT_PROTO*) ;;
14417                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14418                 esac
14419                 echo "Prototype: $try" ;;
14420         esac
14421         ;;
14422         *)      case "$usethreads" in
14423                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14424                 esac
14425                 d_getgrnam_r=undef
14426                 getgrnam_r_proto=0
14427                 ;;
14428         esac
14429         ;;
14430 *)      getgrnam_r_proto=0
14431         ;;
14432 esac
14433
14434 : see if gethostbyaddr exists
14435 set gethostbyaddr d_gethbyaddr
14436 eval $inlibc
14437
14438 : see if gethostbyname exists
14439 set gethostbyname d_gethbyname
14440 eval $inlibc
14441
14442 : see if gethostent exists
14443 set gethostent d_gethent
14444 eval $inlibc
14445
14446 : see how we will look up host name
14447 echo " "
14448 call=''
14449 if set gethostname val -f d_gethname; eval $csym; $val; then
14450         echo 'gethostname() found.' >&4
14451         d_gethname="$define"
14452         call=gethostname
14453 fi
14454 if set uname val -f d_uname; eval $csym; $val; then
14455         if ./xenix; then
14456                 $cat <<'EOM'
14457 uname() was found, but you're running xenix, and older versions of xenix
14458 have a broken uname(). If you don't really know whether your xenix is old
14459 enough to have a broken system call, use the default answer.
14460
14461 EOM
14462                 dflt=y
14463                 case "$d_uname" in
14464                 "$define") dflt=n;;
14465                 esac
14466                 rp='Is your uname() broken?'
14467                 . ./myread
14468                 case "$ans" in
14469                 n*) d_uname="$define"; call=uname;;
14470                 esac
14471         else
14472                 echo 'uname() found.' >&4
14473                 d_uname="$define"
14474                 case "$call" in
14475                 '') call=uname ;;
14476                 esac
14477         fi
14478 fi
14479 case "$d_gethname" in
14480 '') d_gethname="$undef";;
14481 esac
14482 case "$d_uname" in
14483 '') d_uname="$undef";;
14484 esac
14485 case "$d_uname$d_gethname" in
14486 *define*)
14487         dflt=n
14488         cat <<EOM
14489
14490 Every now and then someone has a $call() that lies about the hostname
14491 but can't be fixed for political or economic reasons.  If you wish, I can
14492 pretend $call() isn't there and maybe compute hostname at run-time
14493 thanks to the '$phostname' command.
14494
14495 EOM
14496         rp="Shall I ignore $call() from now on?"
14497         . ./myread
14498         case "$ans" in
14499         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14500         esac;;
14501 esac
14502 case "$phostname" in
14503 '') aphostname='';;
14504 *) case "$aphostname" in
14505         /*) ;;
14506         *) set X $phostname
14507                 shift
14508                 file=$1
14509                 shift
14510                 file=`./loc $file $file $pth`
14511                 aphostname=`echo $file $*`
14512                 ;;
14513         esac
14514         ;;
14515 esac
14516 case "$d_uname$d_gethname" in
14517 *define*) ;;
14518 *)
14519         case "$phostname" in
14520         '')
14521                 echo "There will be no way for $package to get your hostname." >&4;;
14522         *)
14523         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14524                 ;;
14525         esac;;
14526 esac
14527 case "$d_phostname" in
14528 '') d_phostname="$undef";;
14529 esac
14530
14531 : see if gethostbyaddr_r exists
14532 set gethostbyaddr_r d_gethostbyaddr_r
14533 eval $inlibc
14534 case "$d_gethostbyaddr_r" in
14535 "$define")
14536         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14537         case "$d_gethostbyaddr_r_proto:$usethreads" in
14538         ":define")      d_gethostbyaddr_r_proto=define
14539                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14540                 eval $hasproto ;;
14541         *)      ;;
14542         esac
14543         case "$d_gethostbyaddr_r_proto" in
14544         define)
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14547         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14548         esac
14549         case "$gethostbyaddr_r_proto" in
14550         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14551         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14552         esac
14553         case "$gethostbyaddr_r_proto" in
14554         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14555         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14556         esac
14557         case "$gethostbyaddr_r_proto" in
14558         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14559         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14560         esac
14561         case "$gethostbyaddr_r_proto" in
14562         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14563         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14564         esac
14565         case "$gethostbyaddr_r_proto" in
14566         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14567         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14568         esac
14569         case "$gethostbyaddr_r_proto" in
14570         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14571         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14572         esac
14573         case "$gethostbyaddr_r_proto" in
14574         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14575         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14576         esac
14577         case "$gethostbyaddr_r_proto" in
14578         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14579         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14580         esac
14581         case "$gethostbyaddr_r_proto" in
14582         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14583         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14584         esac
14585         case "$gethostbyaddr_r_proto" in
14586         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14587         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14588         esac
14589         case "$gethostbyaddr_r_proto" in
14590         ''|0)   d_gethostbyaddr_r=undef
14591                 gethostbyaddr_r_proto=0
14592                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14593         * )     case "$gethostbyaddr_r_proto" in
14594                 REENTRANT_PROTO*) ;;
14595                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14596                 esac
14597                 echo "Prototype: $try" ;;
14598         esac
14599         ;;
14600         *)      case "$usethreads" in
14601                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14602                 esac
14603                 d_gethostbyaddr_r=undef
14604                 gethostbyaddr_r_proto=0
14605                 ;;
14606         esac
14607         ;;
14608 *)      gethostbyaddr_r_proto=0
14609         ;;
14610 esac
14611
14612 : see if gethostbyname_r exists
14613 set gethostbyname_r d_gethostbyname_r
14614 eval $inlibc
14615 case "$d_gethostbyname_r" in
14616 "$define")
14617         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14618         case "$d_gethostbyname_r_proto:$usethreads" in
14619         ":define")      d_gethostbyname_r_proto=define
14620                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14621                 eval $hasproto ;;
14622         *)      ;;
14623         esac
14624         case "$d_gethostbyname_r_proto" in
14625         define)
14626         case "$gethostbyname_r_proto" in
14627         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14628         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14629         esac
14630         case "$gethostbyname_r_proto" in
14631         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14632         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14633         esac
14634         case "$gethostbyname_r_proto" in
14635         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14636         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14637         esac
14638         case "$gethostbyname_r_proto" in
14639         ''|0)   d_gethostbyname_r=undef
14640                 gethostbyname_r_proto=0
14641                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14642         * )     case "$gethostbyname_r_proto" in
14643                 REENTRANT_PROTO*) ;;
14644                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14645                 esac
14646                 echo "Prototype: $try" ;;
14647         esac
14648         ;;
14649         *)      case "$usethreads" in
14650                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14651                 esac
14652                 d_gethostbyname_r=undef
14653                 gethostbyname_r_proto=0
14654                 ;;
14655         esac
14656         ;;
14657 *)      gethostbyname_r_proto=0
14658         ;;
14659 esac
14660
14661 : see if gethostent_r exists
14662 set gethostent_r d_gethostent_r
14663 eval $inlibc
14664 case "$d_gethostent_r" in
14665 "$define")
14666         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14667         case "$d_gethostent_r_proto:$usethreads" in
14668         ":define")      d_gethostent_r_proto=define
14669                 set d_gethostent_r_proto gethostent_r $hdrs
14670                 eval $hasproto ;;
14671         *)      ;;
14672         esac
14673         case "$d_gethostent_r_proto" in
14674         define)
14675         case "$gethostent_r_proto" in
14676         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14677         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14678         esac
14679         case "$gethostent_r_proto" in
14680         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14681         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14682         esac
14683         case "$gethostent_r_proto" in
14684         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14685         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14686         esac
14687         case "$gethostent_r_proto" in
14688         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14689         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14690         esac
14691         case "$gethostent_r_proto" in
14692         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14693         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14694         esac
14695         case "$gethostent_r_proto" in
14696         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14697         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14698         esac
14699         case "$gethostent_r_proto" in
14700         ''|0)   d_gethostent_r=undef
14701                 gethostent_r_proto=0
14702                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14703         * )     case "$gethostent_r_proto" in
14704                 REENTRANT_PROTO*) ;;
14705                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14706                 esac
14707                 echo "Prototype: $try" ;;
14708         esac
14709         ;;
14710         *)      case "$usethreads" in
14711                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14712                 esac
14713                 d_gethostent_r=undef
14714                 gethostent_r_proto=0
14715                 ;;
14716         esac
14717         ;;
14718 *)      gethostent_r_proto=0
14719         ;;
14720 esac
14721
14722 : see if prototypes for various gethostxxx netdb.h functions are available
14723 echo " "
14724 set d_gethostprotos gethostent $i_netdb netdb.h
14725 eval $hasproto
14726
14727 : see if getitimer exists
14728 set getitimer d_getitimer
14729 eval $inlibc
14730
14731 : see if getlogin exists
14732 set getlogin d_getlogin
14733 eval $inlibc
14734
14735 : see if getlogin_r exists
14736 set getlogin_r d_getlogin_r
14737 eval $inlibc
14738 case "$d_getlogin_r" in
14739 "$define")
14740         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14741         case "$d_getlogin_r_proto:$usethreads" in
14742         ":define")      d_getlogin_r_proto=define
14743                 set d_getlogin_r_proto getlogin_r $hdrs
14744                 eval $hasproto ;;
14745         *)      ;;
14746         esac
14747         case "$d_getlogin_r_proto" in
14748         define)
14749         case "$getlogin_r_proto" in
14750         ''|0) try='int getlogin_r(char*, size_t);'
14751         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14752         esac
14753         case "$getlogin_r_proto" in
14754         ''|0) try='int getlogin_r(char*, int);'
14755         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14756         esac
14757         case "$getlogin_r_proto" in
14758         ''|0) try='char* getlogin_r(char*, size_t);'
14759         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14760         esac
14761         case "$getlogin_r_proto" in
14762         ''|0) try='char* getlogin_r(char*, int);'
14763         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14764         esac
14765         case "$getlogin_r_proto" in
14766         ''|0)   d_getlogin_r=undef
14767                 getlogin_r_proto=0
14768                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14769         * )     case "$getlogin_r_proto" in
14770                 REENTRANT_PROTO*) ;;
14771                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14772                 esac
14773                 echo "Prototype: $try" ;;
14774         esac
14775         ;;
14776         *)      case "$usethreads" in
14777                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14778                 esac
14779                 d_getlogin_r=undef
14780                 getlogin_r_proto=0
14781                 ;;
14782         esac
14783         ;;
14784 *)      getlogin_r_proto=0
14785         ;;
14786 esac
14787
14788 : see if getmnt exists
14789 set getmnt d_getmnt
14790 eval $inlibc
14791
14792 : see if getmntent exists
14793 set getmntent d_getmntent
14794 eval $inlibc
14795
14796 : see if getnameinfo exists
14797 set getnameinfo d_getnameinfo
14798 eval $inlibc
14799
14800 : see if getnetbyaddr exists
14801 set getnetbyaddr d_getnbyaddr
14802 eval $inlibc
14803
14804 : see if getnetbyname exists
14805 set getnetbyname d_getnbyname
14806 eval $inlibc
14807
14808 : see if getnetent exists
14809 set getnetent d_getnent
14810 eval $inlibc
14811
14812 : see if getnetbyaddr_r exists
14813 set getnetbyaddr_r d_getnetbyaddr_r
14814 eval $inlibc
14815 case "$d_getnetbyaddr_r" in
14816 "$define")
14817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14818         case "$d_getnetbyaddr_r_proto:$usethreads" in
14819         ":define")      d_getnetbyaddr_r_proto=define
14820                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14821                 eval $hasproto ;;
14822         *)      ;;
14823         esac
14824         case "$d_getnetbyaddr_r_proto" in
14825         define)
14826         case "$getnetbyaddr_r_proto" in
14827         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14828         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14829         esac
14830         case "$getnetbyaddr_r_proto" in
14831         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14832         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14833         esac
14834         case "$getnetbyaddr_r_proto" in
14835         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14836         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14837         esac
14838         case "$getnetbyaddr_r_proto" in
14839         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14840         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14841         esac
14842         case "$getnetbyaddr_r_proto" in
14843         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14844         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14845         esac
14846         case "$getnetbyaddr_r_proto" in
14847         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14848         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14849         esac
14850         case "$getnetbyaddr_r_proto" in
14851         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14852         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14853         esac
14854         case "$getnetbyaddr_r_proto" in
14855         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14856         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14857         esac
14858         case "$getnetbyaddr_r_proto" in
14859         ''|0)   d_getnetbyaddr_r=undef
14860                 getnetbyaddr_r_proto=0
14861                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14862         * )     case "$getnetbyaddr_r_proto" in
14863                 REENTRANT_PROTO*) ;;
14864                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14865                 esac
14866                 echo "Prototype: $try" ;;
14867         esac
14868         ;;
14869         *)      case "$usethreads" in
14870                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14871                 esac
14872                 d_getnetbyaddr_r=undef
14873                 getnetbyaddr_r_proto=0
14874                 ;;
14875         esac
14876         ;;
14877 *)      getnetbyaddr_r_proto=0
14878         ;;
14879 esac
14880
14881 : see if getnetbyname_r exists
14882 set getnetbyname_r d_getnetbyname_r
14883 eval $inlibc
14884 case "$d_getnetbyname_r" in
14885 "$define")
14886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14887         case "$d_getnetbyname_r_proto:$usethreads" in
14888         ":define")      d_getnetbyname_r_proto=define
14889                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14890                 eval $hasproto ;;
14891         *)      ;;
14892         esac
14893         case "$d_getnetbyname_r_proto" in
14894         define)
14895         case "$getnetbyname_r_proto" in
14896         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14897         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14898         esac
14899         case "$getnetbyname_r_proto" in
14900         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14901         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14902         esac
14903         case "$getnetbyname_r_proto" in
14904         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14905         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14906         esac
14907         case "$getnetbyname_r_proto" in
14908         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14909         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14910         esac
14911         case "$getnetbyname_r_proto" in
14912         ''|0)   d_getnetbyname_r=undef
14913                 getnetbyname_r_proto=0
14914                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14915         * )     case "$getnetbyname_r_proto" in
14916                 REENTRANT_PROTO*) ;;
14917                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14918                 esac
14919                 echo "Prototype: $try" ;;
14920         esac
14921         ;;
14922         *)      case "$usethreads" in
14923                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14924                 esac
14925                 d_getnetbyname_r=undef
14926                 getnetbyname_r_proto=0
14927                 ;;
14928         esac
14929         ;;
14930 *)      getnetbyname_r_proto=0
14931         ;;
14932 esac
14933
14934 : see if getnetent_r exists
14935 set getnetent_r d_getnetent_r
14936 eval $inlibc
14937 case "$d_getnetent_r" in
14938 "$define")
14939         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14940         case "$d_getnetent_r_proto:$usethreads" in
14941         ":define")      d_getnetent_r_proto=define
14942                 set d_getnetent_r_proto getnetent_r $hdrs
14943                 eval $hasproto ;;
14944         *)      ;;
14945         esac
14946         case "$d_getnetent_r_proto" in
14947         define)
14948         case "$getnetent_r_proto" in
14949         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14950         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14951         esac
14952         case "$getnetent_r_proto" in
14953         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14954         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14955         esac
14956         case "$getnetent_r_proto" in
14957         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14958         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14959         esac
14960         case "$getnetent_r_proto" in
14961         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14962         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14963         esac
14964         case "$getnetent_r_proto" in
14965         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14966         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14967         esac
14968         case "$getnetent_r_proto" in
14969         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14970         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14971         esac
14972         case "$getnetent_r_proto" in
14973         ''|0)   d_getnetent_r=undef
14974                 getnetent_r_proto=0
14975                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14976         * )     case "$getnetent_r_proto" in
14977                 REENTRANT_PROTO*) ;;
14978                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14979                 esac
14980                 echo "Prototype: $try" ;;
14981         esac
14982         ;;
14983         *)      case "$usethreads" in
14984                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14985                 esac
14986                 d_getnetent_r=undef
14987                 getnetent_r_proto=0
14988                 ;;
14989         esac
14990         ;;
14991 *)      getnetent_r_proto=0
14992         ;;
14993 esac
14994
14995 : see if prototypes for various getnetxxx netdb.h functions are available
14996 echo " "
14997 set d_getnetprotos getnetent $i_netdb netdb.h
14998 eval $hasproto
14999
15000 : see if getpagesize exists
15001 set getpagesize d_getpagsz
15002 eval $inlibc
15003
15004 : Optional checks for getprotobyname and getprotobynumber
15005
15006 : see if getprotobyname exists
15007 set getprotobyname d_getpbyname
15008 eval $inlibc
15009
15010 : see if getprotobynumber exists
15011 set getprotobynumber d_getpbynumber
15012 eval $inlibc
15013
15014 : see if getprotoent exists
15015 set getprotoent d_getpent
15016 eval $inlibc
15017
15018 : see if getpgid exists
15019 set getpgid d_getpgid
15020 eval $inlibc
15021
15022 : see if getpgrp2 exists
15023 set getpgrp2 d_getpgrp2
15024 eval $inlibc
15025
15026 : see if getppid exists
15027 set getppid d_getppid
15028 eval $inlibc
15029
15030 : see if getpriority exists
15031 set getpriority d_getprior
15032 eval $inlibc
15033
15034 : see if getprotobyname_r exists
15035 set getprotobyname_r d_getprotobyname_r
15036 eval $inlibc
15037 case "$d_getprotobyname_r" in
15038 "$define")
15039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15040         case "$d_getprotobyname_r_proto:$usethreads" in
15041         ":define")      d_getprotobyname_r_proto=define
15042                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15043                 eval $hasproto ;;
15044         *)      ;;
15045         esac
15046         case "$d_getprotobyname_r_proto" in
15047         define)
15048         case "$getprotobyname_r_proto" in
15049         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15050         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15051         esac
15052         case "$getprotobyname_r_proto" in
15053         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15054         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15055         esac
15056         case "$getprotobyname_r_proto" in
15057         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15058         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15059         esac
15060         case "$getprotobyname_r_proto" in
15061         ''|0)   d_getprotobyname_r=undef
15062                 getprotobyname_r_proto=0
15063                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15064         * )     case "$getprotobyname_r_proto" in
15065                 REENTRANT_PROTO*) ;;
15066                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15067                 esac
15068                 echo "Prototype: $try" ;;
15069         esac
15070         ;;
15071         *)      case "$usethreads" in
15072                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15073                 esac
15074                 d_getprotobyname_r=undef
15075                 getprotobyname_r_proto=0
15076                 ;;
15077         esac
15078         ;;
15079 *)      getprotobyname_r_proto=0
15080         ;;
15081 esac
15082
15083 : see if getprotobynumber_r exists
15084 set getprotobynumber_r d_getprotobynumber_r
15085 eval $inlibc
15086 case "$d_getprotobynumber_r" in
15087 "$define")
15088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15089         case "$d_getprotobynumber_r_proto:$usethreads" in
15090         ":define")      d_getprotobynumber_r_proto=define
15091                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15092                 eval $hasproto ;;
15093         *)      ;;
15094         esac
15095         case "$d_getprotobynumber_r_proto" in
15096         define)
15097         case "$getprotobynumber_r_proto" in
15098         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15099         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15100         esac
15101         case "$getprotobynumber_r_proto" in
15102         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15103         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15104         esac
15105         case "$getprotobynumber_r_proto" in
15106         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15107         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15108         esac
15109         case "$getprotobynumber_r_proto" in
15110         ''|0)   d_getprotobynumber_r=undef
15111                 getprotobynumber_r_proto=0
15112                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15113         * )     case "$getprotobynumber_r_proto" in
15114                 REENTRANT_PROTO*) ;;
15115                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15116                 esac
15117                 echo "Prototype: $try" ;;
15118         esac
15119         ;;
15120         *)      case "$usethreads" in
15121                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15122                 esac
15123                 d_getprotobynumber_r=undef
15124                 getprotobynumber_r_proto=0
15125                 ;;
15126         esac
15127         ;;
15128 *)      getprotobynumber_r_proto=0
15129         ;;
15130 esac
15131
15132 : see if getprotoent_r exists
15133 set getprotoent_r d_getprotoent_r
15134 eval $inlibc
15135 case "$d_getprotoent_r" in
15136 "$define")
15137         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15138         case "$d_getprotoent_r_proto:$usethreads" in
15139         ":define")      d_getprotoent_r_proto=define
15140                 set d_getprotoent_r_proto getprotoent_r $hdrs
15141                 eval $hasproto ;;
15142         *)      ;;
15143         esac
15144         case "$d_getprotoent_r_proto" in
15145         define)
15146         case "$getprotoent_r_proto" in
15147         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15148         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15149         esac
15150         case "$getprotoent_r_proto" in
15151         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15152         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15153         esac
15154         case "$getprotoent_r_proto" in
15155         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15156         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15157         esac
15158         case "$getprotoent_r_proto" in
15159         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15160         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15161         esac
15162         case "$getprotoent_r_proto" in
15163         ''|0)   d_getprotoent_r=undef
15164                 getprotoent_r_proto=0
15165                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15166         * )     case "$getprotoent_r_proto" in
15167                 REENTRANT_PROTO*) ;;
15168                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15169                 esac
15170                 echo "Prototype: $try" ;;
15171         esac
15172         ;;
15173         *)      case "$usethreads" in
15174                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15175                 esac
15176                 d_getprotoent_r=undef
15177                 getprotoent_r_proto=0
15178                 ;;
15179         esac
15180         ;;
15181 *)      getprotoent_r_proto=0
15182         ;;
15183 esac
15184
15185 : see if prototypes for various getprotoxxx netdb.h functions are available
15186 echo " "
15187 set d_getprotoprotos getprotoent $i_netdb netdb.h
15188 eval $hasproto
15189
15190 : see if getprpwnam exists
15191 set getprpwnam d_getprpwnam
15192 eval $inlibc
15193
15194 : see if getpwent exists
15195 set getpwent d_getpwent
15196 eval $inlibc
15197
15198 : see if getpwent_r exists
15199 set getpwent_r d_getpwent_r
15200 eval $inlibc
15201 case "$d_getpwent_r" in
15202 "$define")
15203         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15204         case "$d_getpwent_r_proto:$usethreads" in
15205         ":define")      d_getpwent_r_proto=define
15206                 set d_getpwent_r_proto getpwent_r $hdrs
15207                 eval $hasproto ;;
15208         *)      ;;
15209         esac
15210         case "$d_getpwent_r_proto" in
15211         define)
15212         case "$getpwent_r_proto" in
15213         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15214         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15215         esac
15216         case "$getpwent_r_proto" in
15217         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15218         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15219         esac
15220         case "$getpwent_r_proto" in
15221         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15222         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15223         esac
15224         case "$getpwent_r_proto" in
15225         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15226         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15227         esac
15228         case "$getpwent_r_proto" in
15229         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15230         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15231         esac
15232         case "$getpwent_r_proto" in
15233         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15234         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15235         esac
15236         case "$getpwent_r_proto" in
15237         ''|0)   d_getpwent_r=undef
15238                 getpwent_r_proto=0
15239                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15240         * )     case "$getpwent_r_proto" in
15241                 REENTRANT_PROTO*) ;;
15242                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15243                 esac
15244                 echo "Prototype: $try" ;;
15245         esac
15246         ;;
15247         *)      case "$usethreads" in
15248                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15249                 esac
15250                 d_getpwent_r=undef
15251                 getpwent_r_proto=0
15252                 ;;
15253         esac
15254         ;;
15255 *)      getpwent_r_proto=0
15256         ;;
15257 esac
15258
15259 : see if getpwnam_r exists
15260 set getpwnam_r d_getpwnam_r
15261 eval $inlibc
15262 case "$d_getpwnam_r" in
15263 "$define")
15264         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15265         case "$d_getpwnam_r_proto:$usethreads" in
15266         ":define")      d_getpwnam_r_proto=define
15267                 set d_getpwnam_r_proto getpwnam_r $hdrs
15268                 eval $hasproto ;;
15269         *)      ;;
15270         esac
15271         case "$d_getpwnam_r_proto" in
15272         define)
15273         case "$getpwnam_r_proto" in
15274         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15275         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15276         esac
15277         case "$getpwnam_r_proto" in
15278         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15279         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15280         esac
15281         case "$getpwnam_r_proto" in
15282         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15283         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15284         esac
15285         case "$getpwnam_r_proto" in
15286         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15287         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15288         esac
15289         case "$getpwnam_r_proto" in
15290         ''|0)   d_getpwnam_r=undef
15291                 getpwnam_r_proto=0
15292                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15293         * )     case "$getpwnam_r_proto" in
15294                 REENTRANT_PROTO*) ;;
15295                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15296                 esac
15297                 echo "Prototype: $try" ;;
15298         esac
15299         ;;
15300         *)      case "$usethreads" in
15301                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15302                 esac
15303                 d_getpwnam_r=undef
15304                 getpwnam_r_proto=0
15305                 ;;
15306         esac
15307         ;;
15308 *)      getpwnam_r_proto=0
15309         ;;
15310 esac
15311
15312 : see if getpwuid_r exists
15313 set getpwuid_r d_getpwuid_r
15314 eval $inlibc
15315 case "$d_getpwuid_r" in
15316 "$define")
15317         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15318         case "$d_getpwuid_r_proto:$usethreads" in
15319         ":define")      d_getpwuid_r_proto=define
15320                 set d_getpwuid_r_proto getpwuid_r $hdrs
15321                 eval $hasproto ;;
15322         *)      ;;
15323         esac
15324         case "$d_getpwuid_r_proto" in
15325         define)
15326         case "$getpwuid_r_proto" in
15327         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15328         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15329         esac
15330         case "$getpwuid_r_proto" in
15331         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15332         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15333         esac
15334         case "$getpwuid_r_proto" in
15335         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15336         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15337         esac
15338         case "$getpwuid_r_proto" in
15339         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15340         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15341         esac
15342         case "$getpwuid_r_proto" in
15343         ''|0)   d_getpwuid_r=undef
15344                 getpwuid_r_proto=0
15345                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15346         * )     case "$getpwuid_r_proto" in
15347                 REENTRANT_PROTO*) ;;
15348                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15349                 esac
15350                 echo "Prototype: $try" ;;
15351         esac
15352         ;;
15353         *)      case "$usethreads" in
15354                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15355                 esac
15356                 d_getpwuid_r=undef
15357                 getpwuid_r_proto=0
15358                 ;;
15359         esac
15360         ;;
15361 *)      getpwuid_r_proto=0
15362         ;;
15363 esac
15364
15365 : Optional checks for getsbyname and getsbyport
15366
15367 : see if getservbyname exists
15368 set getservbyname d_getsbyname
15369 eval $inlibc
15370
15371 : see if getservbyport exists
15372 set getservbyport d_getsbyport
15373 eval $inlibc
15374
15375 : see if getservent exists
15376 set getservent d_getsent
15377 eval $inlibc
15378
15379 : see if getservbyname_r exists
15380 set getservbyname_r d_getservbyname_r
15381 eval $inlibc
15382 case "$d_getservbyname_r" in
15383 "$define")
15384         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15385         case "$d_getservbyname_r_proto:$usethreads" in
15386         ":define")      d_getservbyname_r_proto=define
15387                 set d_getservbyname_r_proto getservbyname_r $hdrs
15388                 eval $hasproto ;;
15389         *)      ;;
15390         esac
15391         case "$d_getservbyname_r_proto" in
15392         define)
15393         case "$getservbyname_r_proto" in
15394         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15395         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15396         esac
15397         case "$getservbyname_r_proto" in
15398         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15399         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15400         esac
15401         case "$getservbyname_r_proto" in
15402         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15403         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15404         esac
15405         case "$getservbyname_r_proto" in
15406         ''|0)   d_getservbyname_r=undef
15407                 getservbyname_r_proto=0
15408                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15409         * )     case "$getservbyname_r_proto" in
15410                 REENTRANT_PROTO*) ;;
15411                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15412                 esac
15413                 echo "Prototype: $try" ;;
15414         esac
15415         ;;
15416         *)      case "$usethreads" in
15417                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15418                 esac
15419                 d_getservbyname_r=undef
15420                 getservbyname_r_proto=0
15421                 ;;
15422         esac
15423         ;;
15424 *)      getservbyname_r_proto=0
15425         ;;
15426 esac
15427
15428 : see if getservbyport_r exists
15429 set getservbyport_r d_getservbyport_r
15430 eval $inlibc
15431 case "$d_getservbyport_r" in
15432 "$define")
15433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15434         case "$d_getservbyport_r_proto:$usethreads" in
15435         ":define")      d_getservbyport_r_proto=define
15436                 set d_getservbyport_r_proto getservbyport_r $hdrs
15437                 eval $hasproto ;;
15438         *)      ;;
15439         esac
15440         case "$d_getservbyport_r_proto" in
15441         define)
15442         case "$getservbyport_r_proto" in
15443         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15444         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15445         esac
15446         case "$getservbyport_r_proto" in
15447         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15448         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15449         esac
15450         case "$getservbyport_r_proto" in
15451         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15452         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15453         esac
15454         case "$getservbyport_r_proto" in
15455         ''|0)   d_getservbyport_r=undef
15456                 getservbyport_r_proto=0
15457                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15458         * )     case "$getservbyport_r_proto" in
15459                 REENTRANT_PROTO*) ;;
15460                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15461                 esac
15462                 echo "Prototype: $try" ;;
15463         esac
15464         ;;
15465         *)      case "$usethreads" in
15466                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15467                 esac
15468                 d_getservbyport_r=undef
15469                 getservbyport_r_proto=0
15470                 ;;
15471         esac
15472         ;;
15473 *)      getservbyport_r_proto=0
15474         ;;
15475 esac
15476
15477 : see if getservent_r exists
15478 set getservent_r d_getservent_r
15479 eval $inlibc
15480 case "$d_getservent_r" in
15481 "$define")
15482         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15483         case "$d_getservent_r_proto:$usethreads" in
15484         ":define")      d_getservent_r_proto=define
15485                 set d_getservent_r_proto getservent_r $hdrs
15486                 eval $hasproto ;;
15487         *)      ;;
15488         esac
15489         case "$d_getservent_r_proto" in
15490         define)
15491         case "$getservent_r_proto" in
15492         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15493         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15494         esac
15495         case "$getservent_r_proto" in
15496         ''|0) try='int getservent_r(struct servent*, char*, int);'
15497         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15498         esac
15499         case "$getservent_r_proto" in
15500         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15501         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15502         esac
15503         case "$getservent_r_proto" in
15504         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15505         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15506         esac
15507         case "$getservent_r_proto" in
15508         ''|0)   d_getservent_r=undef
15509                 getservent_r_proto=0
15510                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15511         * )     case "$getservent_r_proto" in
15512                 REENTRANT_PROTO*) ;;
15513                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15514                 esac
15515                 echo "Prototype: $try" ;;
15516         esac
15517         ;;
15518         *)      case "$usethreads" in
15519                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15520                 esac
15521                 d_getservent_r=undef
15522                 getservent_r_proto=0
15523                 ;;
15524         esac
15525         ;;
15526 *)      getservent_r_proto=0
15527         ;;
15528 esac
15529
15530 : see if prototypes for various getservxxx netdb.h functions are available
15531 echo " "
15532 set d_getservprotos getservent $i_netdb netdb.h
15533 eval $hasproto
15534
15535 : see if getspnam exists
15536 set getspnam d_getspnam
15537 eval $inlibc
15538
15539 : see if this is a shadow.h system
15540 set shadow.h i_shadow
15541 eval $inhdr
15542
15543 : see if getspnam_r exists
15544 set getspnam_r d_getspnam_r
15545 eval $inlibc
15546 case "$d_getspnam_r" in
15547 "$define")
15548         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15549         case "$d_getspnam_r_proto:$usethreads" in
15550         ":define")      d_getspnam_r_proto=define
15551                 set d_getspnam_r_proto getspnam_r $hdrs
15552                 eval $hasproto ;;
15553         *)      ;;
15554         esac
15555         case "$d_getspnam_r_proto" in
15556         define)
15557         case "$getspnam_r_proto" in
15558         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15559         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15560         esac
15561         case "$getspnam_r_proto" in
15562         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15563         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15564         esac
15565         case "$getspnam_r_proto" in
15566         ''|0)   d_getspnam_r=undef
15567                 getspnam_r_proto=0
15568                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15569         * )     case "$getspnam_r_proto" in
15570                 REENTRANT_PROTO*) ;;
15571                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15572                 esac
15573                 echo "Prototype: $try" ;;
15574         esac
15575         ;;
15576         *)      case "$usethreads" in
15577                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15578                 esac
15579                 d_getspnam_r=undef
15580                 getspnam_r_proto=0
15581                 ;;
15582         esac
15583         ;;
15584 *)      getspnam_r_proto=0
15585         ;;
15586 esac
15587
15588 : see if gettimeofday or ftime exists
15589 set gettimeofday d_gettimeod
15590 eval $inlibc
15591 case "$d_gettimeod" in
15592 "$undef")
15593         set ftime d_ftime 
15594         eval $inlibc
15595         ;;
15596 *)
15597         val="$undef"; set d_ftime; eval $setvar
15598         ;;
15599 esac
15600 case "$d_gettimeod$d_ftime" in
15601 "$undef$undef")
15602         echo " "
15603         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15604         ;;
15605 esac
15606
15607 : see if gmtime_r exists
15608 set gmtime_r d_gmtime_r
15609 eval $inlibc
15610 case "$d_gmtime_r" in
15611 "$define")
15612         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15613         case "$d_gmtime_r_proto:$usethreads" in
15614         ":define")      d_gmtime_r_proto=define
15615                 set d_gmtime_r_proto gmtime_r $hdrs
15616                 eval $hasproto ;;
15617         *)      ;;
15618         esac
15619         case "$d_gmtime_r_proto" in
15620         define)
15621         case "$gmtime_r_proto" in
15622         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15623         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15624         esac
15625         case "$gmtime_r_proto" in
15626         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15627         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15628         esac
15629         case "$gmtime_r_proto" in
15630         ''|0)   d_gmtime_r=undef
15631                 gmtime_r_proto=0
15632                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15633         * )     case "$gmtime_r_proto" in
15634                 REENTRANT_PROTO*) ;;
15635                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15636                 esac
15637                 echo "Prototype: $try" ;;
15638         esac
15639         ;;
15640         *)      case "$usethreads" in
15641                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15642                 esac
15643                 d_gmtime_r=undef
15644                 gmtime_r_proto=0
15645                 ;;
15646         esac
15647         ;;
15648 *)      gmtime_r_proto=0
15649         ;;
15650 esac
15651
15652 : see if hasmntopt exists
15653 set hasmntopt d_hasmntopt
15654 eval $inlibc
15655
15656 : see if this is a netinet/in.h or sys/in.h system
15657 set netinet/in.h i_niin sys/in.h i_sysin
15658 eval $inhdr
15659
15660 : see if arpa/inet.h has to be included
15661 set arpa/inet.h i_arpainet
15662 eval $inhdr
15663
15664 : see if htonl --and friends-- exists
15665 val=''
15666 set htonl val
15667 eval $inlibc
15668
15669 : Maybe they are macros.
15670 case "$val" in
15671 $undef)
15672         $cat >htonl.c <<EOM
15673 #include <stdio.h>
15674 #include <sys/types.h>
15675 #$i_niin I_NETINET_IN
15676 #$i_sysin I_SYS_IN
15677 #$i_arpainet I_ARPA_INET
15678 #ifdef I_NETINET_IN
15679 #include <netinet/in.h>
15680 #endif
15681 #ifdef I_SYS_IN
15682 #include <sys/in.h>
15683 #endif
15684 #ifdef I_ARPA_INET
15685 #include <arpa/inet.h>
15686 #endif
15687 #ifdef htonl
15688 printf("Defined as a macro.");
15689 #endif
15690 EOM
15691         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15692         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15693                 val="$define"
15694                 echo "But it seems to be defined as a macro." >&4
15695         fi
15696         $rm -f htonl.?
15697         ;;
15698 esac
15699 set d_htonl
15700 eval $setvar
15701
15702 : see if hypot exists
15703 set hypot d_hypot
15704 eval $inlibc
15705
15706 : see if ilogb exists
15707 set ilogb d_ilogb
15708 eval $inlibc
15709
15710 : see if ilogbl exists
15711 set ilogbl d_ilogbl
15712 eval $inlibc
15713
15714 : check whether inet_aton exists
15715 set inet_aton d_inetaton
15716 eval $inlibc
15717
15718 : see if inet_ntop exists
15719 set inet_ntop d_inetntop
15720 eval $inlibc
15721
15722 : see if inet_pton exists
15723 set inet_pton d_inetpton
15724 eval $inlibc
15725
15726 : Look for isascii
15727 echo " "
15728 $cat >isascii.c <<EOCP
15729 #include <stdio.h>
15730 #include <ctype.h>
15731 #$i_stdlib I_STDLIB
15732 #ifdef I_STDLIB
15733 #include <stdlib.h>
15734 #endif
15735 int main() {
15736         int c = 'A';
15737         if (isascii(c))
15738                 exit(0);
15739         else
15740                 exit(1);
15741 }
15742 EOCP
15743 set isascii
15744 if eval $compile; then
15745         echo "isascii() found." >&4
15746         val="$define"
15747 else
15748         echo "isascii() NOT found." >&4
15749         val="$undef"
15750 fi
15751 set d_isascii
15752 eval $setvar
15753 $rm -f isascii*
15754
15755 : Look for isblank
15756 echo " "
15757 $cat >isblank.c <<'EOCP'
15758 #include <stdio.h>
15759 #include <ctype.h>
15760 int main() {
15761         int c = ' ';
15762         if (isblank(c))
15763                 return 0 ;
15764         else
15765                 return 1 ;
15766 }
15767 EOCP
15768 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15769         echo "isblank() found." >&4
15770         val="$define"
15771 else
15772         echo "isblank() NOT found." >&4
15773         val="$undef"
15774 fi
15775 set d_isblank
15776 eval $setvar
15777 $rm -f isblank*
15778
15779 : check for isfinite
15780 echo "Checking to see if you have isfinite..." >&4
15781 $cat >try.c <<EOCP
15782 #include <math.h>
15783 int main() { return isfinite(0.0); }
15784 EOCP
15785 set try
15786 if eval $compile; then
15787         val="$define"
15788         echo "You have isfinite."
15789 else
15790         val="$undef"
15791         echo "You do not have isfinite."
15792 fi
15793 $rm_try
15794 set d_isfinite
15795 eval $setvar
15796
15797 : see if isfinitel exists
15798 set isfinitel d_isfinitel
15799 eval $inlibc
15800
15801 : check for isinf
15802 echo "Checking to see if you have isinf..." >&4
15803 $cat >try.c <<EOCP
15804 #include <math.h>
15805 int main() { return isinf(0.0); }
15806 EOCP
15807 set try
15808 if eval $compile; then
15809         val="$define"
15810         echo "You have isinf."
15811 else
15812         val="$undef"
15813         echo "You do not have isinf."
15814 fi
15815 $rm_try
15816 set d_isinf
15817 eval $setvar
15818
15819 : see if isinfl exists
15820 set isinfl d_isinfl
15821 eval $inlibc
15822
15823 : check for isless
15824 echo "Checking to see if you have isless..." >&4
15825 $cat >try.c <<EOCP
15826 #include <math.h>
15827 int main() { return isless(2.0, 1.0); }
15828 EOCP
15829 set try
15830 if eval $compile; then
15831         val="$define"
15832         echo "You have isless."
15833 else
15834         val="$undef"
15835         echo "You do not have isless."
15836 fi
15837 $rm_try
15838 set d_isless
15839 eval $setvar
15840
15841 : check for isnan
15842 echo "Checking to see if you have isnan..." >&4
15843 $cat >try.c <<EOCP
15844 #include <math.h>
15845 int main() { return isnan(0.0); }
15846 EOCP
15847 set try
15848 if eval $compile; then
15849         val="$define"
15850         echo "You have isnan."
15851 else
15852         val="$undef"
15853         echo "You do not have isnan."
15854 fi
15855 $rm_try
15856 set d_isnan
15857 eval $setvar
15858
15859 : see if isnanl exists
15860 set isnanl d_isnanl
15861 eval $inlibc
15862
15863 : check for isnormal
15864 echo "Checking to see if you have isnormal..." >&4
15865 $cat >try.c <<EOCP
15866 #include <math.h>
15867 int main() { return isnormal(0.0); }
15868 EOCP
15869 set try
15870 if eval $compile; then
15871         val="$define"
15872         echo "You have isnormal."
15873 else
15874         val="$undef"
15875         echo "You do not have isnormal."
15876 fi
15877 $rm_try
15878 set d_isnormal
15879 eval $setvar
15880
15881 : see if j0 exists
15882 set j0 d_j0
15883 eval $inlibc
15884
15885 : see if j0l exists
15886 set j0l d_j0l
15887 eval $inlibc
15888
15889 : see if killpg exists
15890 set killpg d_killpg
15891 eval $inlibc
15892
15893 : see if localeconv exists
15894 set localeconv d_locconv
15895 eval $inlibc
15896
15897 : see if libc has the POSIX.1-2008 currency locale rules
15898 case "$d_locconv:$d_lc_monetary_2008" in
15899 $define:)
15900         $cat >try.c <<EOCP
15901 #include <locale.h>
15902 int main() {
15903         struct lconv *lc = localeconv();
15904         char int_p_cs_precedes = lc->int_p_cs_precedes;
15905         return 0;
15906 }
15907 EOCP
15908         set try
15909         if eval $compile; then
15910                 d_lc_monetary_2008="$define"
15911         else
15912                 d_lc_monetary_2008="$undef"
15913         fi;
15914         $rm_try
15915         ;;
15916 esac
15917
15918 : see if lchown exists
15919 echo " "
15920 $cat > try.c <<EOCP
15921 #include <pwd.h>
15922 #include <stdio.h>
15923 #include <stdlib.h>
15924 #$i_unistd      I_UNISTD
15925 #ifdef I_UNISTD
15926 #  include <unistd.h>
15927 #endif
15928 int main(int argc, char *argv[])
15929 {
15930    if (lchown("./try.c", -1, getgid()) == -1) {
15931        exit(EXIT_FAILURE);
15932    }
15933    exit(EXIT_SUCCESS);
15934 }
15935 EOCP
15936 set try
15937 if eval $compile && ./try; then
15938     $echo "lchown() found." >&4
15939     val="$define"
15940 else
15941     $echo "lchown() NOT found." >&4
15942     val="$undef"
15943 fi
15944 set d_lchown
15945 eval $setvar
15946 $rm_try
15947
15948 : See if number of significant digits in a double precision number is known
15949 echo " "
15950 $cat >ldbl_dig.c <<EOM
15951 #include <limits.h>
15952 #include <float.h>
15953 #ifdef LDBL_DIG
15954 printf("Contains LDBL_DIG");
15955 #endif
15956 EOM
15957 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15958 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15959         echo "LDBL_DIG found." >&4
15960         val="$define"
15961 else
15962         echo "LDBL_DIG NOT found." >&4
15963         val="$undef"
15964 fi
15965 $rm -f ldbl_dig.?
15966 set d_ldbl_dig
15967 eval $setvar
15968
15969 : see if lgamma exists
15970 set lgamma d_lgamma
15971 eval $inlibc
15972
15973 : see if lgamma_r exists
15974 set lgamma_r d_lgamma_r
15975 eval $inlibc
15976
15977 : check to see if math.h defines _LIB_VERSION
15978 d_libm_lib_version="$undef"
15979 echo " "
15980 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15981 $cat >try.c <<EOCP
15982 #include <unistd.h>
15983 #include <math.h>
15984 int main (int argc, char *argv[])
15985 {
15986     printf ("%d\n", _LIB_VERSION);
15987     return (0);
15988     } /* main */
15989 EOCP
15990 set try
15991 if eval $compile; then
15992     foo=`$run ./try`
15993     echo "Yes, it does ($foo)" >&4
15994     d_libm_lib_version="$define"
15995 else
15996     echo "No, it does not (probably harmless)" >&4
15997     fi
15998 $rm_try
15999
16000 : see if link exists
16001 set link d_link
16002 eval $inlibc
16003
16004 : see if llrint exists
16005 set llrint d_llrint
16006 eval $inlibc
16007
16008 : see if llrintl exists
16009 set llrintl d_llrintl
16010 eval $inlibc
16011
16012 : see if llround exists
16013 set llround d_llround
16014 eval $inlibc
16015
16016 : see if llroundl exists
16017 set llroundl d_llroundl
16018 eval $inlibc
16019
16020 : see if localeconv_l exists
16021 set localeconv_l d_localeconv_l
16022 eval $inlibc
16023
16024 : see if localtime_r exists
16025 set localtime_r d_localtime_r
16026 eval $inlibc
16027 case "$d_localtime_r" in
16028 "$define")
16029         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16030         case "$d_localtime_r_proto:$usethreads" in
16031         ":define")      d_localtime_r_proto=define
16032                 set d_localtime_r_proto localtime_r $hdrs
16033                 eval $hasproto ;;
16034         *)      ;;
16035         esac
16036         case "$d_localtime_r_proto" in
16037         define)
16038         case "$localtime_r_proto" in
16039         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16040         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16041         esac
16042         case "$localtime_r_proto" in
16043         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16044         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16045         esac
16046         case "$localtime_r_proto" in
16047         ''|0)   d_localtime_r=undef
16048                 localtime_r_proto=0
16049                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16050         * )     case "$localtime_r_proto" in
16051                 REENTRANT_PROTO*) ;;
16052                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16053                 esac
16054                 echo "Prototype: $try" ;;
16055         esac
16056         ;;
16057         *)      case "$usethreads" in
16058                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16059                 esac
16060                 d_localtime_r=undef
16061                 localtime_r_proto=0
16062                 ;;
16063         esac
16064         ;;
16065 *)      localtime_r_proto=0
16066         ;;
16067 esac
16068
16069 : see if localtime_r calls tzset
16070 case "$localtime_r_proto" in
16071 REENTRANT_PROTO*)
16072         $cat >try.c <<EOCP
16073 /*  Does our libc's localtime_r call tzset ?
16074  *  return 0 if so, 1 otherwise.
16075  */
16076 #$i_systypes    I_SYS_TYPES
16077 #$i_unistd      I_UNISTD
16078 #$i_time        I_TIME
16079 #$i_stdlib      I_STDLIB
16080 #$i_malloc      I_MALLOC
16081 #ifdef I_SYS_TYPES
16082 #  include <sys/types.h>
16083 #endif
16084 #ifdef I_UNISTD
16085 #  include <unistd.h>
16086 #endif
16087 #ifdef I_TIME
16088 #  include <time.h>
16089 #endif
16090 #ifdef I_STDLIB
16091 #include <stdlib.h>
16092 #endif
16093 #include <string.h>
16094 #ifdef I_MALLOC
16095 #  include <malloc.h>
16096 #endif
16097 int main()
16098 {
16099     time_t t = time(0L);
16100     char w_tz[]="TZ" "=GMT+5",
16101          e_tz[]="TZ" "=GMT-5",
16102         *tz_e = (char*)malloc(16),
16103         *tz_w = (char*)malloc(16);
16104     struct tm tm_e, tm_w;
16105     memset(&tm_e,'\0',sizeof(struct tm));
16106     memset(&tm_w,'\0',sizeof(struct tm));
16107     strcpy(tz_e,e_tz);
16108     strcpy(tz_w,w_tz);
16109
16110     putenv(tz_e);
16111     localtime_r(&t, &tm_e);
16112
16113     putenv(tz_w);
16114     localtime_r(&t, &tm_w);
16115
16116     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16117         return 1;
16118     return 0;
16119 }
16120 EOCP
16121         set try
16122         if eval $compile; then
16123             if $run ./try; then
16124                 d_localtime_r_needs_tzset=undef;
16125             else
16126                 d_localtime_r_needs_tzset=define;
16127             fi;
16128         else
16129             d_localtime_r_needs_tzset=undef;
16130         fi;
16131      ;;
16132   *)
16133      d_localtime_r_needs_tzset=undef;
16134      ;;
16135 esac
16136 $rm_try
16137
16138 : see if lockf exists
16139 set lockf d_lockf
16140 eval $inlibc
16141
16142 : see if log1p exists
16143 set log1p d_log1p
16144 eval $inlibc
16145
16146 : see if log2 exists
16147 set log2 d_log2
16148 eval $inlibc
16149
16150 : see if logb exists
16151 set logb d_logb
16152 eval $inlibc
16153
16154 : see if lrint exists
16155 set lrint d_lrint
16156 eval $inlibc
16157
16158 : see if lrintl exists
16159 set lrintl d_lrintl
16160 eval $inlibc
16161
16162 : see if lround exists
16163 set lround d_lround
16164 eval $inlibc
16165
16166 : see if lroundl exists
16167 set lroundl d_lroundl
16168 eval $inlibc
16169
16170 : see if prototype for lseek is available
16171 echo " "
16172 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16173 eval $hasproto
16174
16175 : see if lstat exists
16176 set lstat d_lstat
16177 eval $inlibc
16178
16179 : see if madvise exists
16180 set madvise d_madvise
16181 eval $inlibc
16182
16183 : see if malloc_size exists
16184 set malloc_size d_malloc_size
16185 eval $inlibc
16186
16187 : see if malloc_size_good exists
16188 set malloc_good_size d_malloc_good_size
16189 eval $inlibc
16190
16191 : see if malloc_usable_size exists
16192 set malloc_usable_size d_malloc_usable_size
16193 eval $inlibc
16194
16195 : see if mblen exists
16196 set mblen d_mblen
16197 eval $inlibc
16198
16199 : see if mbrlen exists
16200 set mbrlen d_mbrlen
16201 eval $inlibc
16202
16203 : see if mbrtowc exists
16204 set mbrtowc d_mbrtowc
16205 eval $inlibc
16206
16207 : see if mbstowcs exists
16208 set mbstowcs d_mbstowcs
16209 eval $inlibc
16210
16211 : see if mbtowc exists
16212 set mbtowc d_mbtowc
16213 eval $inlibc
16214
16215 : see if memmem exists
16216 : We need both a prototype in string.h and the symbol in libc.
16217 echo " "
16218 d_memmem_proto=''
16219 xx1="#$d_gnulibc HAS_GNULIBC"
16220 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16221 xx3='#   define _GNU_SOURCE'
16222 xx4='#endif'
16223 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16224 eval $hasproto
16225 case "$d_memmem_proto" in
16226     define) # see if memmem exists
16227         set memmem d_memmem
16228         eval $inlibc
16229         ;;
16230     *)  val=$undef
16231         set d_memmem
16232         eval $setvar
16233         ;;
16234 esac
16235
16236 : see if memrchr exists
16237 : We need both a prototype in string.h and the symbol in libc.
16238 echo " "
16239 d_memrchr_proto=''
16240 xx1="#$d_gnulibc HAS_GNULIBC"
16241 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16242 xx3='#   define _GNU_SOURCE'
16243 xx4='#endif'
16244 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16245 eval $hasproto
16246 case "$d_memrchr_proto" in
16247     define) # see if memrchr exists
16248         set memrchr d_memrchr
16249         eval $inlibc
16250         ;;
16251     *)  val=$undef
16252         set d_memrchr
16253         eval $setvar
16254         ;;
16255 esac
16256
16257 : see if mkdir exists
16258 set mkdir d_mkdir
16259 eval $inlibc
16260
16261 : see if mkdtemp exists
16262 set mkdtemp d_mkdtemp
16263 eval $inlibc
16264
16265 : see if mkfifo exists
16266 set mkfifo d_mkfifo
16267 eval $inlibc
16268
16269 : see if mkostemp exists
16270 set mkostemp d_mkostemp
16271 eval $inlibc
16272
16273 : see if mkstemp exists
16274 set mkstemp d_mkstemp
16275 eval $inlibc
16276
16277 : see if mkstemps exists
16278 set mkstemps d_mkstemps
16279 eval $inlibc
16280
16281 : see if mktime exists
16282 set mktime d_mktime
16283 eval $inlibc
16284
16285 : see if sys/mman.h has to be included
16286 set sys/mman.h i_sysmman
16287 eval $inhdr
16288
16289 : see if mmap exists
16290 set mmap d_mmap
16291 eval $inlibc
16292 : see what shmat returns
16293 : default to something harmless
16294 mmaptype='void *'
16295 case "$i_sysmman$d_mmap" in
16296 "$define$define")
16297         $cat >mmap.c <<'END'
16298 #include <sys/mman.h>
16299 void *mmap();
16300 END
16301         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16302                 mmaptype='void *'
16303         else
16304                 mmaptype='caddr_t'
16305         fi
16306         echo "and it returns ($mmaptype)." >&4
16307         ;;
16308 esac
16309
16310 : see if sqrtl exists
16311 set sqrtl d_sqrtl
16312 eval $inlibc
16313
16314 : see if scalbnl exists
16315 set scalbnl d_scalbnl
16316 eval $inlibc
16317
16318 : see if truncl exists
16319 set truncl d_truncl
16320 eval $inlibc
16321
16322 : see if modfl exists
16323 set modfl d_modfl
16324 eval $inlibc
16325
16326 : see if prototype for modfl is available
16327 echo " "
16328 set d_modflproto modfl define math.h
16329 eval $hasproto
16330
16331 if $test "$uselongdouble" = "$define"; then
16332     message=""
16333     if $test "$d_sqrtl" != "$define"; then
16334         message="$message sqrtl"
16335     fi
16336     if $test "$d_modfl" != "$define"; then
16337         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16338             echo "You have both truncl and copysignl, so I can emulate modfl."
16339         else
16340             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16341                 echo "You have both aintl and copysignl, so I can emulate modfl."
16342             else
16343                 message="$message modfl"
16344             fi
16345         fi
16346     fi
16347     if $test "$d_frexpl" != "$define"; then
16348         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16349             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16350         else
16351             message="$message frexpl"
16352         fi
16353     fi
16354     if $test "$d_ldexpl" != "$define"; then
16355         message="$message ldexpl"
16356     fi
16357
16358     if $test "$message" != ""; then
16359         $cat <<EOM >&4
16360
16361 *** You requested the use of long doubles but you do not seem to have
16362 *** the following mathematical functions needed for long double support:
16363 ***    $message
16364 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16365 *** Cannot continue, aborting.
16366
16367 EOM
16368
16369         exit 1
16370     fi
16371 fi
16372
16373 : see if mprotect exists
16374 set mprotect d_mprotect
16375 eval $inlibc
16376
16377 : see if msgctl exists
16378 set msgctl d_msgctl
16379 eval $inlibc
16380
16381 : see if msgget exists
16382 set msgget d_msgget
16383 eval $inlibc
16384
16385 : see if msgsnd exists
16386 set msgsnd d_msgsnd
16387 eval $inlibc
16388
16389 : see if msgrcv exists
16390 set msgrcv d_msgrcv
16391 eval $inlibc
16392
16393 : see how much of the 'msg*(2)' library is present.
16394 h_msg=true
16395 echo " "
16396 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16397 *"$undef"*) h_msg=false;;
16398 esac
16399 case "$osname" in
16400 freebsd)
16401     case "`ipcs 2>&1`" in
16402     "SVID messages"*"not configured"*)
16403         echo "Your $osname does not have the msg*(2) configured." >&4
16404         h_msg=false
16405         val="$undef"
16406         set msgctl d_msgctl
16407         eval $setvar
16408         set msgget d_msgget
16409         eval $setvar
16410         set msgsnd d_msgsnd
16411         eval $setvar
16412         set msgrcv d_msgrcv
16413         eval $setvar
16414         ;;
16415     esac
16416     ;;
16417 esac
16418 : we could also check for sys/ipc.h ...
16419 if $h_msg && $test `./findhdr sys/msg.h`; then
16420         echo "You have the full msg*(2) library." >&4
16421         val="$define"
16422 else
16423         echo "You don't have the full msg*(2) library." >&4
16424         val="$undef"
16425 fi
16426 set d_msg
16427 eval $setvar
16428
16429 : Check for msghdr_s
16430 echo " "
16431 echo "Checking to see if your system supports struct msghdr..." >&4
16432 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16433 eval $hasstruct
16434 case "$d_msghdr_s" in
16435 "$define")      echo "Yes, it does."   ;;
16436 *)              echo "No, it doesn't." ;;
16437 esac
16438
16439 : see if msync exists
16440 set msync d_msync
16441 eval $inlibc
16442
16443 : see if munmap exists
16444 set munmap d_munmap
16445 eval $inlibc
16446
16447 : see if nan exists
16448 set nan d_nan
16449 eval $inlibc
16450
16451 : see if nanosleep exists
16452 set nanosleep d_nanosleep
16453 eval $inlibc
16454
16455 : see if nearbyint exists
16456 set nearbyint d_nearbyint
16457 eval $inlibc
16458
16459 : see if nextafter exists
16460 set nextafter d_nextafter
16461 eval $inlibc
16462
16463 : see if nexttoward exists
16464 set nexttoward d_nexttoward
16465 eval $inlibc
16466
16467 : see if nice exists
16468 set nice d_nice
16469 eval $inlibc
16470
16471 : see if this is a langinfo.h system
16472 set langinfo.h i_langinfo
16473 eval $inhdr
16474
16475 : see if nl_langinfo exists
16476 set nl_langinfo d_nl_langinfo
16477 eval $inlibc
16478
16479 : see if this is a quadmath.h system
16480 set quadmath.h i_quadmath
16481 eval $inhdr
16482
16483 : Check basic sizes
16484 echo " "
16485 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16486
16487 case "$use64bitint:$d_quad:$quadtype" in
16488 define:define:?*)
16489         ivtype="$quadtype"
16490         uvtype="$uquadtype"
16491         ivsize=8
16492         uvsize=8
16493         ;;
16494 *)      ivtype="long"
16495         uvtype="unsigned long"
16496         ivsize=$longsize
16497         uvsize=$longsize
16498         ;;
16499 esac
16500
16501 case "$uselongdouble:$d_longdbl" in
16502 define:define)
16503         nvtype="long double"
16504         nvsize=$longdblsize
16505         ;;
16506 *)      nvtype=double
16507         nvsize=$doublesize
16508         ;;
16509 esac
16510
16511 case "$usequadmath:$i_quadmath" in
16512 define:define)
16513   nvtype="__float128"
16514   nvsize=16
16515   case "$libs" in
16516   *quadmath*) ;;
16517   *) $cat <<EOM >&4
16518
16519 *** You requested the use of the quadmath library, but you
16520 *** do not seem to have the quadmath library installed.
16521 *** Cannot continue, aborting.
16522 EOM
16523     exit 1
16524     ;;
16525   esac
16526   ;;
16527 define:*) $cat <<EOM >&4
16528
16529 *** You requested the use of the quadmath library, but you
16530 *** do not seem to have the required header, <quadmath.h>.
16531 EOM
16532   case "$gccversion" in
16533   [23].*|4.[0-5]*)
16534    $cat <<EOM >&4
16535 *** Your gcc looks a bit old:
16536 *** $gccversion
16537 EOM
16538     ;;
16539   '')
16540    $cat <<EOM >&4
16541 *** You are not running a gcc.
16542 EOM
16543     ;;
16544   esac
16545   $cat <<EOM >&4
16546 *** For the quadmath library you need at least gcc 4.6.
16547 *** Cannot continue, aborting.
16548 EOM
16549   exit 1
16550   ;;
16551 esac
16552
16553 $echo "(IV will be "$ivtype", $ivsize bytes)"
16554 $echo "(UV will be "$uvtype", $uvsize bytes)"
16555 $echo "(NV will be "$nvtype", $nvsize bytes)"
16556
16557 $cat >try.c <<EOCP
16558 #$i_inttypes I_INTTYPES
16559 #ifdef I_INTTYPES
16560 #include <inttypes.h>
16561 #endif
16562 #include <stdio.h>
16563 int main() {
16564 #ifdef INT8
16565    int8_t i =  INT8_MAX;
16566   uint8_t u = UINT8_MAX;
16567   printf("int8_t\n");
16568 #endif
16569 #ifdef INT16
16570    int16_t i =  INT16_MAX;
16571   uint16_t u = UINT16_MAX;
16572   printf("int16_t\n");
16573 #endif
16574 #ifdef INT32
16575    int32_t i =  INT32_MAX;
16576   uint32_t u = UINT32_MAX;
16577   printf("int32_t\n");
16578 #endif
16579 }
16580 EOCP
16581
16582 i8type="signed char"
16583 u8type="unsigned char"
16584 i8size=1
16585 u8size=1
16586
16587 case "$i16type" in
16588 '')     case "$shortsize" in
16589         2)      i16type=short
16590                 u16type="unsigned short"
16591                 i16size=$shortsize
16592                 u16size=$shortsize
16593                 ;;
16594         esac
16595         ;;
16596 esac
16597 case "$i16type" in
16598 '')     set try -DINT16
16599         if eval $compile; then
16600                 case "`$run ./try`" in
16601                 int16_t)
16602                         i16type=int16_t
16603                         u16type=uint16_t
16604                         i16size=2
16605                         u16size=2
16606                         ;;
16607                 esac
16608         fi
16609         ;;
16610 esac
16611 case "$i16type" in
16612 '')     if $test $shortsize -ge 2; then
16613                 i16type=short
16614                 u16type="unsigned short"
16615                 i16size=$shortsize
16616                 u16size=$shortsize
16617         fi
16618         ;;
16619 esac
16620
16621 case "$i32type" in
16622 '')     case "$longsize" in
16623         4)      i32type=long
16624                 u32type="unsigned long"
16625                 i32size=$longsize
16626                 u32size=$longsize
16627                 ;;
16628         *)      case "$intsize" in
16629                 4)      i32type=int
16630                         u32type="unsigned int"
16631                         i32size=$intsize
16632                         u32size=$intsize
16633                         ;;
16634                 esac
16635                 ;;
16636         esac
16637         ;;
16638 esac
16639 case "$i32type" in
16640 '')     set try -DINT32
16641         if eval $compile; then
16642                 case "`$run ./try`" in
16643                 int32_t)
16644                         i32type=int32_t
16645                         u32type=uint32_t
16646                         i32size=4
16647                         u32size=4
16648                         ;;
16649                 esac
16650         fi
16651         ;;
16652 esac
16653 case "$i32type" in
16654 '')     if $test $intsize -ge 4; then
16655                 i32type=int
16656                 u32type="unsigned int"
16657                 i32size=$intsize
16658                 u32size=$intsize
16659         fi
16660         ;;
16661 esac
16662
16663 case "$i64type" in
16664 '')     case "$d_quad:$quadtype" in
16665         define:?*)
16666                 i64type="$quadtype"
16667                 u64type="$uquadtype"
16668                 i64size=8
16669                 u64size=8
16670                 ;;
16671         esac
16672         ;;
16673 esac
16674
16675 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16676 $cat <<EOP >try.c
16677 #include <stdio.h>
16678 #$i_stdlib I_STDLIB
16679 #ifdef I_STDLIB
16680 #include <stdlib.h>
16681 #endif
16682 #include <sys/types.h>
16683 #include <signal.h>
16684 #ifdef SIGFPE
16685 /* volatile so that the compiler has to store it out to memory */
16686 volatile int bletched = 0;
16687 $signal_t blech(int s) { bletched = 1; }
16688 #endif
16689 int main() {
16690     $uvtype u = 0;
16691     $nvtype d;
16692     int     n = 8 * $uvsize;
16693     int     i;
16694 #ifdef SIGFPE
16695     signal(SIGFPE, blech);
16696 #endif
16697
16698     for (i = 0; i < n; i++) {
16699       u = u << 1 | ($uvtype)1;
16700       d = ($nvtype)u;
16701       if (($uvtype)d != u)
16702         break;
16703       if (d <= 0)
16704         break;
16705       d = ($nvtype)(u - 1);
16706       if (($uvtype)d != (u - 1))
16707         break;
16708 #ifdef SIGFPE
16709       if (bletched)
16710         break;
16711 #endif
16712     }
16713     printf("%d\n", ((i == n) ? -n : i));
16714     exit(0);
16715 }
16716 EOP
16717 set try
16718
16719 d_nv_preserves_uv="$undef"
16720 if eval $compile; then
16721         nv_preserves_uv_bits="`$run ./try`"
16722 fi
16723 case "$nv_preserves_uv_bits" in
16724 \-[1-9]*)
16725         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16726         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16727         d_nv_preserves_uv="$define"
16728         ;;
16729 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16730         d_nv_preserves_uv="$undef" ;;
16731 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16732         nv_preserves_uv_bits="0" ;;
16733 esac
16734 $rm_try
16735
16736 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16737 $cat <<EOP >try.c
16738 #include <stdio.h>
16739
16740 typedef $nvtype NV;
16741
16742 int
16743 main() {
16744   NV value = 2;
16745   int count = 1;
16746
16747   while(count < 256) {
16748     /* volatile so that the compiler has to store it out to memory */
16749     volatile NV up = value + 1.0;
16750     volatile NV negated = -value;
16751     volatile NV down = negated - 1.0;
16752     volatile NV got_up = up - value;
16753     int up_good = got_up == 1.0;
16754     int got_down = down - negated;
16755     int down_good = got_down == -1.0;
16756
16757     if (down_good != up_good) {
16758       fprintf(stderr,
16759               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16760               up_good, (double) got_up, down_good, (double) got_down,
16761               count, (double) value);
16762       return 1;
16763     }
16764     if (!up_good) {
16765       while (1) {
16766         if (count > 8) {
16767           count -= 8;
16768           fputs("256.0", stdout);
16769         } else {
16770           count--;
16771           fputs("2.0", stdout);
16772         }
16773         if (!count) {
16774           puts("");
16775           return 0;
16776         }
16777         fputs("*", stdout);
16778       }
16779     }
16780     value *= 2;
16781     ++count;
16782   }
16783   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16784           count, (double) value);
16785   return 1;
16786 }
16787 EOP
16788 set try
16789
16790 nv_overflows_integers_at='0'
16791 if eval $compile; then
16792     xxx="`$run ./try`"
16793     case "$?" in
16794         0)
16795             case "$xxx" in
16796                 2*)  cat >&4 <<EOM
16797 The largest integer your NVs can preserve is equal to $xxx
16798 EOM
16799                     nv_overflows_integers_at="$xxx"
16800                     ;;
16801                 *)  cat >&4 <<EOM
16802 Cannot determine the largest integer value your NVs can hold, unexpected output
16803 '$xxx'
16804 EOM
16805                     ;;
16806             esac
16807             ;;
16808         *)  cat >&4 <<EOM
16809 Cannot determine the largest integer value your NVs can hold
16810 EOM
16811             ;;
16812     esac
16813 fi
16814 $rm_try
16815
16816 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16817 $cat <<EOP >try.c
16818 #include <stdio.h>
16819 #$i_stdlib I_STDLIB
16820 #ifdef I_STDLIB
16821 #include <stdlib.h>
16822 #endif
16823 #include <string.h>
16824 #include <sys/types.h>
16825 #include <signal.h>
16826 #ifdef SIGFPE
16827 /* volatile so that the compiler has to store it out to memory */
16828 volatile int bletched = 0;
16829 $signal_t blech(int s) { bletched = 1; }
16830 #endif
16831
16832 int checkit($nvtype d, const char *where) {
16833     void *v = &d;
16834     unsigned char *p = (unsigned char *)v;
16835     unsigned char *end = p + sizeof(d);
16836     int fail = 0;
16837
16838     while (p < end)
16839         fail += *p++;
16840
16841     if (!fail)
16842         return 0;
16843
16844     p = (unsigned char *)v;
16845     printf("No - %s: 0x", where);
16846     while (p < end)
16847         printf ("%02X", *p++);
16848     printf("\n");
16849     return 1;
16850 }
16851
16852 int main(int argc, char **argv) {
16853     $nvtype d = 0.0;
16854     int fail = 0;
16855     fail += checkit(d, "0.0");
16856
16857     /* The compiler shouldn't be assuming that bletched is 0  */
16858     d = bletched;
16859
16860     fail += checkit(d, "bleched");
16861
16862 #ifdef SIGFPE
16863     signal(SIGFPE, blech);
16864 #endif
16865
16866     /* Paranoia - the compiler should have no way of knowing that ANSI says
16867        that argv[argc] will always be NULL.  Actually, if it did assume this it
16868        would be buggy, as this is C and main() can be called from elsewhere in
16869        the program.  */
16870     d = argv[argc] ? 1 : 0;
16871
16872     if (d) {
16873         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16874     }
16875
16876     fail += checkit(d, "ternary");
16877
16878     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16879
16880     if (d != 0.0) {
16881         printf("No - memset doesn't give 0.0\n");
16882         /* This might just blow up:  */
16883         printf("(gives %g)\n", d);
16884         return 1;
16885     }
16886
16887 #ifdef SIGFPE
16888     if (bletched) {
16889         printf("No - something bleched\n");
16890         return 1;
16891     }
16892 #endif
16893     if (fail) {
16894       printf("No - %d fail(s)\n", fail);
16895       return 1;
16896     }
16897     printf("Yes\n");
16898     return 0;
16899 }
16900 EOP
16901 set try
16902
16903 d_nv_zero_is_allbits_zero="$undef"
16904 if eval $compile; then
16905     xxx="`$run ./try`"
16906     case "$?" in
16907         0)
16908             case "$xxx" in
16909                 Yes)  cat >&4 <<EOM
16910 0.0 is represented as all bits zero in memory
16911 EOM
16912                     d_nv_zero_is_allbits_zero="$define"
16913                     ;;
16914                 *)  cat >&4 <<EOM
16915 0.0 is not represented as all bits zero in memory
16916 EOM
16917                     d_nv_zero_is_allbits_zero="$undef"
16918                     ;;
16919             esac
16920             ;;
16921         *)  cat >&4 <<EOM
16922 0.0 is not represented as all bits zero in memory
16923 EOM
16924             d_nv_zero_is_allbits_zero="$undef"
16925             ;;
16926     esac
16927 fi
16928 $rm_try
16929
16930 : check for off64_t
16931 echo " "
16932 echo "Checking to see if you have off64_t..." >&4
16933 $cat >try.c <<EOCP
16934 #include <sys/types.h>
16935 #include <unistd.h>
16936 int main() { off64_t x = 7; }
16937 EOCP
16938 set try
16939 if eval $compile; then
16940         val="$define"
16941         echo "You have off64_t."
16942 else
16943         val="$undef"
16944         echo "You do not have off64_t."
16945         case "$lseeksize" in
16946         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16947         esac
16948 fi
16949 $rm_try
16950 set d_off64_t
16951 eval $setvar
16952
16953 : how to create joinable pthreads
16954 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16955         echo " "
16956         echo "Checking what constant to use for creating joinable pthreads..." >&4
16957         $cat >try.c <<'EOCP'
16958 #include <pthread.h>
16959 int main() {
16960     int detachstate = JOINABLE;
16961 }
16962 EOCP
16963         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16964         if eval $compile; then
16965                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16966                 val="$undef" # Yes, undef.
16967                 set d_old_pthread_create_joinable
16968                 eval $setvar
16969                 val=""
16970                 set old_pthread_create_joinable
16971                 eval $setvar
16972         else
16973                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16974                 if eval $compile; then
16975                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16976                         val="$define"
16977                         set d_old_pthread_create_joinable
16978                         eval $setvar
16979                         val=PTHREAD_CREATE_UNDETACHED
16980                         set old_pthread_create_joinable
16981                         eval $setvar
16982                 else
16983                         set try -DJOINABLE=__UNDETACHED
16984                         if eval $compile; then
16985                                 echo "You seem to use __UNDETACHED." >&4
16986                                 val="$define"
16987                                 set d_old_pthread_create_joinable
16988                                 eval $setvar
16989                                 val=__UNDETACHED
16990                                 set old_pthread_create_joinable
16991                                 eval $setvar
16992                         else
16993                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16994                                 val="$define"
16995                                 set d_old_pthread_create_joinable
16996                                 eval $setvar
16997                                 val=0
16998                                 set old_pthread_create_joinable
16999                                 eval $setvar
17000                         fi
17001                 fi
17002         fi
17003         $rm_try
17004 else
17005     d_old_pthread_create_joinable="$undef"
17006     old_pthread_create_joinable=""
17007 fi
17008
17009 : see if pause exists
17010 set pause d_pause
17011 eval $inlibc
17012
17013 : see if pipe2 exists
17014 set pipe2 d_pipe2
17015 eval $inlibc
17016
17017 : see if poll exists
17018 set poll d_poll
17019 eval $inlibc
17020
17021 : see if prctl exists
17022 set prctl d_prctl
17023 eval $inlibc
17024
17025 : see if prctl supports PR_SET_NAME
17026 d_prctl_set_name=$undef
17027 case $d_prctl in
17028     $define)
17029         $cat >try.c <<EOM
17030 #ifdef __ANDROID__
17031 #include <unistd.h>
17032 #endif
17033 #include <sys/prctl.h>
17034
17035 int main (int argc, char *argv[])
17036 {
17037     return (prctl (PR_SET_NAME, "Test"));
17038     } /* main */
17039 EOM
17040         set try
17041         if eval $compile_ok && $run ./try; then
17042             echo "Your prctl (PR_SET_NAME, ...) works"
17043             d_prctl_set_name=$define
17044             fi
17045         $rm_try
17046         ;;
17047     esac
17048
17049 : see if readlink exists
17050 set readlink d_readlink
17051 eval $inlibc
17052
17053 : Check if there is a /proc symlink to the abs path of
17054 : the executing program.  We will honor hints of d_procselfexe=$undef
17055 : or procselfexe being non-empty, otherwise will try to determine both
17056 : if we have readlink.
17057 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17058 : referenced, and AmigaOS does not have a proc filesystem anyway.
17059 echo " "
17060 val="$undef"
17061 if $test "X$d_procselfexe" = Xundef; then
17062         procselfexe=''
17063 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17064         val="$define"
17065 elif $test "X$d_readlink" = Xdefine; then
17066         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17067         : and it feels more tidy to avoid an extra level of symlink
17068         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17069         while test $# -gt 0; do
17070             type=$1; try=$2
17071             shift; shift
17072             if $issymlink $try; then
17073                 $ls -l $try > reflect
17074                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17075                     echo "You have $type-like $try."
17076                     procselfexe='"'$try'"'
17077                     val="$define"
17078                     : This will break out of the loop
17079                     set X; shift
17080                 fi
17081             fi
17082         done
17083 fi
17084 $rm -f reflect
17085 set d_procselfexe
17086 eval $setvar
17087
17088 : backward compatibility for d_hvfork
17089 if test X$d_hvfork != X; then
17090         d_vfork="$d_hvfork"
17091         d_hvfork=''
17092 fi
17093 : see if there is a vfork
17094 val=''
17095 set vfork val
17096 eval $inlibc
17097
17098 d_pseudofork=$undef
17099
17100 : Ok, but do we want to use it. vfork is reportedly unreliable in
17101 : perl on Solaris 2.x, and probably elsewhere.
17102 case "$val" in
17103 $define)
17104         echo " "
17105         case "$usevfork" in
17106         false) dflt='n';;
17107         *) dflt='y';;
17108         esac
17109         cat <<'EOM'
17110
17111 Perl can only use a vfork() that doesn't suffer from strict
17112 restrictions on calling functions or modifying global data in
17113 the child.  For example, glibc-2.1 contains such a vfork()
17114 that is unsuitable.  If your system provides a proper fork()
17115 call, chances are that you do NOT want perl to use vfork().
17116
17117 EOM
17118         rp="Do you still want to use vfork()?"
17119         . ./myread
17120         case "$ans" in
17121         y|Y) ;;
17122         *)
17123                 echo "Ok, we won't use vfork()."
17124                 val="$undef"
17125                 ;;
17126         esac
17127         ;;
17128 esac
17129 set d_vfork
17130 eval $setvar
17131 case "$d_vfork" in
17132 $define) usevfork='true';;
17133 *) usevfork='false';;
17134 esac
17135
17136 : see whether the pthread_atfork exists
17137 $cat >try.c <<EOP
17138 #include <pthread.h>
17139 #include <stdio.h>
17140 int main() {
17141 #ifdef  PTHREAD_ATFORK
17142         pthread_atfork(NULL,NULL,NULL);
17143 #endif
17144 }
17145 EOP
17146
17147 : see if pthread_atfork exists
17148 set try -DPTHREAD_ATFORK
17149 if eval $compile; then
17150     val="$define"
17151 else
17152     val="$undef"
17153 fi
17154 case "$usethreads" in
17155 $define)
17156         case "$val" in
17157         $define) echo 'pthread_atfork found.' >&4        ;;
17158         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17159         esac
17160 esac
17161 set d_pthread_atfork
17162 eval $setvar
17163
17164 : see if pthread_attr_setscope exists
17165 set pthread_attr_setscope d_pthread_attr_setscope
17166 eval $inlibc
17167
17168 : see whether the various POSIXish _yields exist
17169 $cat >try.c <<EOP
17170 #include <pthread.h>
17171 #include <stdio.h>
17172 int main() {
17173 #ifdef SCHED_YIELD
17174         sched_yield();
17175 #else
17176 #ifdef PTHREAD_YIELD
17177         pthread_yield();
17178 #else
17179 #ifdef PTHREAD_YIELD_NULL
17180         pthread_yield(NULL);
17181 #endif
17182 #endif
17183 #endif
17184 }
17185 EOP
17186 : see if sched_yield exists
17187 set try -DSCHED_YIELD
17188 if eval $compile; then
17189     val="$define"
17190     sched_yield='sched_yield()'
17191 else
17192     val="$undef"
17193 fi
17194 case "$usethreads" in
17195 $define)
17196         case "$val" in
17197         $define) echo 'sched_yield() found.' >&4        ;;
17198         *)       echo 'sched_yield() NOT found.' >&4    ;;
17199         esac
17200 esac
17201 set d_sched_yield
17202 eval $setvar
17203
17204 : see if pthread_yield exists
17205 set try -DPTHREAD_YIELD
17206 if eval $compile; then
17207     val="$define"
17208     case "$sched_yield" in
17209     '') sched_yield='pthread_yield()' ;;
17210     esac
17211 else
17212     set try -DPTHREAD_YIELD_NULL
17213     if eval $compile; then
17214         val="$define"
17215         case "$sched_yield" in
17216         '') sched_yield='pthread_yield(NULL)' ;;
17217         esac
17218     else
17219         val="$undef"
17220     fi
17221 fi
17222 case "$usethreads" in
17223 $define)
17224         case "$val" in
17225         $define) echo 'pthread_yield() found.' >&4      ;;
17226         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17227         esac
17228         ;;
17229 esac
17230 set d_pthread_yield
17231 eval $setvar
17232 case "$sched_yield" in
17233 '') sched_yield=undef ;;
17234 esac
17235 $rm_try
17236
17237 : check for ptrdiff_t
17238 echo " "
17239 echo "Checking to see if you have ptrdiff_t..." >&4
17240 $cat >try.c <<EOCP
17241 #include <stddef.h>
17242 int main() { ptrdiff_t x = 7; }
17243 EOCP
17244 set try
17245 if eval $compile; then
17246         val="$define"
17247         echo "You have ptrdiff_t."
17248 else
17249         val="$undef"
17250         echo "You do not have ptrdiff_t."
17251 fi
17252 $rm_try
17253 set d_ptrdiff_t
17254 eval $setvar
17255
17256 : see if random_r exists
17257 set random_r d_random_r
17258 eval $inlibc
17259 case "$d_random_r" in
17260 "$define")
17261         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17262         case "$d_random_r_proto:$usethreads" in
17263         ":define")      d_random_r_proto=define
17264                 set d_random_r_proto random_r $hdrs
17265                 eval $hasproto ;;
17266         *)      ;;
17267         esac
17268         case "$d_random_r_proto" in
17269         define)
17270         case "$random_r_proto" in
17271         ''|0) try='int random_r(int*, struct random_data*);'
17272         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17273         esac
17274         case "$random_r_proto" in
17275         ''|0) try='int random_r(long*, struct random_data*);'
17276         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17277         esac
17278         case "$random_r_proto" in
17279         ''|0) try='int random_r(struct random_data*, int32_t*);'
17280         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17281         esac
17282         case "$random_r_proto" in
17283         ''|0)   d_random_r=undef
17284                 random_r_proto=0
17285                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17286         * )     case "$random_r_proto" in
17287                 REENTRANT_PROTO*) ;;
17288                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17289                 esac
17290                 echo "Prototype: $try" ;;
17291         esac
17292         ;;
17293         *)      case "$usethreads" in
17294                 define) echo "random_r has no prototype, not using it." >&4 ;;
17295                 esac
17296                 d_random_r=undef
17297                 random_r_proto=0
17298                 ;;
17299         esac
17300         ;;
17301 *)      random_r_proto=0
17302         ;;
17303 esac
17304
17305 : see if readdir and friends exist
17306 set readdir d_readdir
17307 eval $inlibc
17308 set seekdir d_seekdir
17309 eval $inlibc
17310 set telldir d_telldir
17311 eval $inlibc
17312 set rewinddir d_rewinddir
17313 eval $inlibc
17314
17315 : see if readdir64_r exists
17316 set readdir64_r d_readdir64_r
17317 eval $inlibc
17318 case "$d_readdir64_r" in
17319 "$define")
17320         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17321         case "$d_readdir64_r_proto:$usethreads" in
17322         ":define")      d_readdir64_r_proto=define
17323                 set d_readdir64_r_proto readdir64_r $hdrs
17324                 eval $hasproto ;;
17325         *)      ;;
17326         esac
17327         case "$d_readdir64_r_proto" in
17328         define)
17329         case "$readdir64_r_proto" in
17330         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17331         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17332         esac
17333         case "$readdir64_r_proto" in
17334         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17335         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17336         esac
17337         case "$readdir64_r_proto" in
17338         ''|0)   d_readdir64_r=undef
17339                 readdir64_r_proto=0
17340                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17341         * )     case "$readdir64_r_proto" in
17342                 REENTRANT_PROTO*) ;;
17343                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17344                 esac
17345                 echo "Prototype: $try" ;;
17346         esac
17347         ;;
17348         *)      case "$usethreads" in
17349                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17350                 esac
17351                 d_readdir64_r=undef
17352                 readdir64_r_proto=0
17353                 ;;
17354         esac
17355         ;;
17356 *)      readdir64_r_proto=0
17357         ;;
17358 esac
17359
17360 : see if readdir_r exists
17361 set readdir_r d_readdir_r
17362 eval $inlibc
17363 case "$d_readdir_r" in
17364 "$define")
17365         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17366         case "$d_readdir_r_proto:$usethreads" in
17367         ":define")      d_readdir_r_proto=define
17368                 set d_readdir_r_proto readdir_r $hdrs
17369                 eval $hasproto ;;
17370         *)      ;;
17371         esac
17372         case "$d_readdir_r_proto" in
17373         define)
17374         case "$readdir_r_proto" in
17375         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17376         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17377         esac
17378         case "$readdir_r_proto" in
17379         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17380         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17381         esac
17382         case "$readdir_r_proto" in
17383         ''|0)   d_readdir_r=undef
17384                 readdir_r_proto=0
17385                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17386         * )     case "$readdir_r_proto" in
17387                 REENTRANT_PROTO*) ;;
17388                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17389                 esac
17390                 echo "Prototype: $try" ;;
17391         esac
17392         ;;
17393         *)      case "$usethreads" in
17394                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17395                 esac
17396                 d_readdir_r=undef
17397                 readdir_r_proto=0
17398                 ;;
17399         esac
17400         ;;
17401 *)      readdir_r_proto=0
17402         ;;
17403 esac
17404
17405 : see if readv exists
17406 set readv d_readv
17407 eval $inlibc
17408
17409 : see if recvmsg exists
17410 set recvmsg d_recvmsg
17411 eval $inlibc
17412
17413 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17414 echo " "
17415 if set regcomp val -f d_regcomp; eval $csym; $val; then
17416         echo 'regcomp() found.' >&4
17417         d_regcomp="$define"
17418         d_regcmp="$undef"
17419         d_re_comp="$undef"
17420 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17421         echo 'regcmp() found.' >&4
17422         d_regcmp="$define"
17423         d_regcomp="$undef"
17424         d_re_comp="$undef"
17425 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17426         echo 're_comp() found, assuming re_exec() also exists.' >&4
17427         d_re_comp="$define"
17428         d_regcomp="$undef"
17429         d_regcmp="$undef"
17430 else
17431         $cat >&4 <<EOM
17432 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17433 EOM
17434         d_regcmp="$undef"
17435         d_re_comp="$undef"
17436         d_regcomp="$undef"
17437 fi
17438
17439 : see if remainder exists
17440 set remainder d_remainder
17441 eval $inlibc
17442
17443 : see if remquo exists
17444 set remquo d_remquo
17445 eval $inlibc
17446
17447 : see if rename exists
17448 set rename d_rename
17449 eval $inlibc
17450
17451 : see if rint exists
17452 set rint d_rint
17453 eval $inlibc
17454
17455 : see if rmdir exists
17456 set rmdir d_rmdir
17457 eval $inlibc
17458
17459 : see if round exists
17460 set round d_round
17461 eval $inlibc
17462
17463 : see if prototype for sbrk is available
17464 echo " "
17465 set d_sbrkproto sbrk $i_unistd unistd.h
17466 eval $hasproto
17467
17468 : see if scalbn exists
17469 set scalbn d_scalbn
17470 eval $inlibc
17471
17472 : see if select exists
17473 set select d_select
17474 eval $inlibc
17475
17476 : see if semctl exists
17477 set semctl d_semctl
17478 eval $inlibc
17479
17480 : see if semget exists
17481 set semget d_semget
17482 eval $inlibc
17483
17484 : see if semop exists
17485 set semop d_semop
17486 eval $inlibc
17487
17488 : see how much of the 'sem*(2)' library is present.
17489 h_sem=true
17490 echo " "
17491 case "$d_semctl$d_semget$d_semop" in
17492 *"$undef"*) h_sem=false;;
17493 esac
17494 case "$osname" in
17495 freebsd)
17496     case "`ipcs 2>&1`" in
17497     "SVID messages"*"not configured"*)
17498         echo "Your $osname does not have the sem*(2) configured." >&4
17499         h_sem=false
17500         val="$undef"
17501         set semctl d_semctl
17502         eval $setvar
17503         set semget d_semget
17504         eval $setvar
17505         set semop d_semop
17506         eval $setvar
17507         ;;
17508     esac
17509     ;;
17510 esac
17511 : we could also check for sys/ipc.h ...
17512 if $h_sem && $test `./findhdr sys/sem.h`; then
17513         echo "You have the full sem*(2) library." >&4
17514         val="$define"
17515 else
17516         echo "You don't have the full sem*(2) library." >&4
17517         val="$undef"
17518 fi
17519 set d_sem
17520 eval $setvar
17521
17522 : see whether sys/sem.h defines union semun
17523 echo " "
17524 $cat > try.c <<'END'
17525 #include <sys/types.h>
17526 #include <sys/ipc.h>
17527 #include <sys/sem.h>
17528 int main () { union semun semun; semun.buf = 0; }
17529 END
17530 set try
17531 if eval $compile; then
17532     echo "You have union semun in <sys/sem.h>." >&4
17533     val="$define"
17534 else
17535     echo "You do not have union semun in <sys/sem.h>." >&4
17536     val="$undef"
17537 fi
17538 $rm_try
17539 set d_union_semun
17540 eval $setvar
17541
17542 : see how to do semctl IPC_STAT
17543 case "$d_sem" in
17544 $define)
17545     echo " "
17546     $cat > tryh.h <<END
17547 #ifndef S_IRUSR
17548 #   ifdef S_IREAD
17549 #       define S_IRUSR S_IREAD
17550 #       define S_IWUSR S_IWRITE
17551 #       define S_IXUSR S_IEXEC
17552 #   else
17553 #       define S_IRUSR 0400
17554 #       define S_IWUSR 0200
17555 #       define S_IXUSR 0100
17556 #   endif
17557 #   define S_IRGRP (S_IRUSR>>3)
17558 #   define S_IWGRP (S_IWUSR>>3)
17559 #   define S_IXGRP (S_IXUSR>>3)
17560 #   define S_IROTH (S_IRUSR>>6)
17561 #   define S_IWOTH (S_IWUSR>>6)
17562 #   define S_IXOTH (S_IXUSR>>6)
17563 #endif
17564 #ifndef S_IRWXU
17565 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17566 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17567 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17568 #endif
17569 END
17570     : see whether semctl IPC_STAT can use union semun
17571     case "$d_semctl_semun" in
17572     '')
17573       val="$undef"
17574       $cat > try.c <<END
17575 #include <sys/types.h>
17576 #include <sys/ipc.h>
17577 #include <sys/sem.h>
17578 #include <sys/stat.h>
17579 #include <stdio.h>
17580 #include <errno.h>
17581 #include "tryh.h"
17582 #ifndef errno
17583 extern int errno;
17584 #endif
17585 #$d_union_semun HAS_UNION_SEMUN
17586 int main() {
17587     union semun
17588 #ifndef HAS_UNION_SEMUN
17589     {
17590         int val;
17591         struct semid_ds *buf;
17592         unsigned short *array;
17593     }
17594 #endif
17595     arg;
17596     int sem, st;
17597
17598 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17599     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17600     if (sem > -1) {
17601         struct semid_ds argbuf;
17602         arg.buf = &argbuf;
17603 #       ifdef IPC_STAT
17604         st = semctl(sem, 0, IPC_STAT, arg);
17605         if (st == 0)
17606             printf("semun\n");
17607         else
17608 #       endif /* IPC_STAT */
17609             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17610 #       ifdef IPC_RMID
17611         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17612 #       endif /* IPC_RMID */
17613             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17614     } else
17615 #endif /* IPC_PRIVATE && ... */
17616         printf("semget failed: errno = %d\n", errno);
17617   return 0;
17618 }
17619 END
17620       set try
17621       if eval $compile; then
17622           xxx=`$run ./try`
17623           case "$xxx" in
17624           semun) val="$define" ;;
17625           esac
17626       fi
17627       $rm_try
17628       set d_semctl_semun
17629       eval $setvar
17630       ;;
17631     esac
17632     case "$d_semctl_semun" in
17633     $define)
17634         echo "You can use union semun for semctl IPC_STAT." >&4
17635         also='also'
17636         ;;
17637     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17638         also=''
17639         ;;
17640     esac
17641
17642     : see whether semctl IPC_STAT can use struct semid_ds pointer
17643     case "$d_semctl_semid_ds" in
17644     '')
17645       val="$undef"
17646       $cat > try.c <<'END'
17647 #include <sys/types.h>
17648 #include <sys/ipc.h>
17649 #include <sys/sem.h>
17650 #include <sys/stat.h>
17651 #include "tryh.h"
17652 #include <stdio.h>
17653 #include <errno.h>
17654 #ifndef errno
17655 extern int errno;
17656 #endif
17657 int main() {
17658     union semun
17659 #ifndef HAS_UNION_SEMUN
17660     {
17661         int val;
17662         struct semid_ds *buf;
17663         unsigned short *array;
17664     }
17665 #endif
17666     arg;
17667     struct semid_ds argbuf;
17668     int sem, st;
17669
17670 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17671     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17672     if (sem > -1) {
17673         arg.buf = &argbuf;
17674 #       ifdef IPC_STAT
17675         st = semctl(sem, 0, IPC_STAT, arg);
17676         if (st == 0)
17677             printf("semid_ds\n");
17678         else
17679 #       endif /* IPC_STAT */
17680             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17681 #       ifdef IPC_RMID
17682         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17683 #       endif /* IPC_RMID */
17684             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17685     } else
17686 #endif /* IPC_PRIVATE && ... */
17687         printf("semget failed: errno = %d\n", errno);
17688
17689     return 0;
17690 }
17691 END
17692       set try
17693       if eval $compile; then
17694           xxx=`$run ./try`
17695           case "$xxx" in
17696           semid_ds) val="$define" ;;
17697           esac
17698       fi
17699       $rm_try
17700       set d_semctl_semid_ds
17701       eval $setvar
17702       ;;
17703     esac
17704     case "$d_semctl_semid_ds" in
17705     $define)
17706         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17707         ;;
17708     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17709         ;;
17710     esac
17711     ;;
17712 *)  val="$undef"
17713
17714     # We do not have the full sem*(2) library, so assume we can not
17715     # use either.
17716
17717     set d_semctl_semun
17718     eval $setvar
17719
17720     set d_semctl_semid_ds
17721     eval $setvar
17722     ;;
17723 esac
17724 $rm_try tryh.h
17725
17726 : see if sendmsg exists
17727 set sendmsg d_sendmsg
17728 eval $inlibc
17729
17730 : see if setegid exists
17731 set setegid d_setegid
17732 eval $inlibc
17733
17734 : see if seteuid exists
17735 set seteuid d_seteuid
17736 eval $inlibc
17737
17738 : see if setgrent exists
17739 set setgrent d_setgrent
17740 eval $inlibc
17741
17742 : see if setgrent_r exists
17743 set setgrent_r d_setgrent_r
17744 eval $inlibc
17745 case "$d_setgrent_r" in
17746 "$define")
17747         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17748         case "$d_setgrent_r_proto:$usethreads" in
17749         ":define")      d_setgrent_r_proto=define
17750                 set d_setgrent_r_proto setgrent_r $hdrs
17751                 eval $hasproto ;;
17752         *)      ;;
17753         esac
17754         case "$d_setgrent_r_proto" in
17755         define)
17756         case "$setgrent_r_proto" in
17757         ''|0) try='int setgrent_r(FILE**);'
17758         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17759         esac
17760         case "$setgrent_r_proto" in
17761         ''|0) try='void setgrent_r(FILE**);'
17762         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17763         esac
17764         case "$setgrent_r_proto" in
17765         ''|0)   d_setgrent_r=undef
17766                 setgrent_r_proto=0
17767                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17768         * )     case "$setgrent_r_proto" in
17769                 REENTRANT_PROTO*) ;;
17770                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17771                 esac
17772                 echo "Prototype: $try" ;;
17773         esac
17774         ;;
17775         *)      case "$usethreads" in
17776                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17777                 esac
17778                 d_setgrent_r=undef
17779                 setgrent_r_proto=0
17780                 ;;
17781         esac
17782         ;;
17783 *)      setgrent_r_proto=0
17784         ;;
17785 esac
17786
17787 : see if sethostent exists
17788 set sethostent d_sethent
17789 eval $inlibc
17790
17791 : see if sethostent_r exists
17792 set sethostent_r d_sethostent_r
17793 eval $inlibc
17794 case "$d_sethostent_r" in
17795 "$define")
17796         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17797         case "$d_sethostent_r_proto:$usethreads" in
17798         ":define")      d_sethostent_r_proto=define
17799                 set d_sethostent_r_proto sethostent_r $hdrs
17800                 eval $hasproto ;;
17801         *)      ;;
17802         esac
17803         case "$d_sethostent_r_proto" in
17804         define)
17805         case "$sethostent_r_proto" in
17806         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17807         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17808         esac
17809         case "$sethostent_r_proto" in
17810         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17811         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17812         esac
17813         case "$sethostent_r_proto" in
17814         ''|0)   d_sethostent_r=undef
17815                 sethostent_r_proto=0
17816                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17817         * )     case "$sethostent_r_proto" in
17818                 REENTRANT_PROTO*) ;;
17819                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17820                 esac
17821                 echo "Prototype: $try" ;;
17822         esac
17823         ;;
17824         *)      case "$usethreads" in
17825                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17826                 esac
17827                 d_sethostent_r=undef
17828                 sethostent_r_proto=0
17829                 ;;
17830         esac
17831         ;;
17832 *)      sethostent_r_proto=0
17833         ;;
17834 esac
17835
17836 : see if setitimer exists
17837 set setitimer d_setitimer
17838 eval $inlibc
17839
17840 : see if setlinebuf exists
17841 set setlinebuf d_setlinebuf
17842 eval $inlibc
17843
17844 : see if locale.h is available
17845 set locale.h i_locale
17846 eval $inhdr
17847
17848 : see if this system has wctype.h
17849 set wctype.h i_wctype
17850 eval $inhdr
17851
17852 : see if towupper exists
17853 set towupper d_towupper
17854 eval $inlibc
17855
17856 : check for setlocale function and behavior
17857 $cat <<EOM
17858
17859 Checking to see if you have setlocale() and its behavior
17860 EOM
17861 $cat >try.c <<EOCP
17862 #include <stdlib.h>
17863 #include <string.h>
17864 #$i_locale I_LOCALE
17865 #ifdef I_LOCALE
17866 #  include <locale.h>
17867 #endif
17868 #$i_wctype I_WCTYPE
17869 #ifdef I_WCTYPE
17870 #  include <wctype.h>
17871 #endif
17872
17873 int main() {
17874     const char * invalid_name = "\a";   /* This is really invalid! */
17875     int accepts_any_locale_name = 0;
17876     int has_C_UTF8 = 0;
17877     unsigned char bad_setlocale = 255;
17878
17879     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17880      * disabled.  It's hard to imagine an instance where meaningful locale
17881      * handling could be done without LC_CTYPE */
17882     const char *  name = setlocale(LC_CTYPE, "C");
17883
17884     if (name == NULL || strcmp(name, "C") != 0) {
17885         exit(bad_setlocale);
17886     }
17887
17888     name = setlocale(LC_CTYPE, invalid_name);
17889     if (name != NULL) {
17890
17891         /* Let it pass if it accepts the name but gives back one of the C
17892          * locales */
17893         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17894             accepts_any_locale_name = 1;
17895         }
17896     }
17897
17898     name = setlocale(LC_CTYPE, "C.UTF-8");
17899     if (name != NULL) {
17900         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17901
17902 #$d_towupper HAS_TOWUPPER
17903 #ifdef HAS_TOWUPPER
17904
17905         /* We assume that if the machine doesn't have the C99 towupper, it
17906          * doesn't have C.UTF-8, even if we successfully changed locales to
17907          * include it.  This seems safer even on platforms that didn't accept
17908          * the really invalid name */
17909
17910         if (towupper(y_with_diaeresis) == 0x178) {
17911             has_C_UTF8 = 1;
17912         }
17913
17914 #endif
17915
17916     }
17917
17918 #if 0
17919
17920     /* Currently unused code to determine if LC_ALL with disparate values uses
17921      * category = value pairs or positional, and to determine the separator
17922      * between the categories.  We could add code so that if the separator were
17923      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17924      * every possible ASCII separator would fit in the 5 bits available in the
17925      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17926      * positional, we probably would want to know the order of the categories.
17927      * Using a file between the C program and the shell script would really be
17928      * require to do that */
17929 #ifdef LC_ALL
17930
17931     unsigned char min_separator = ' ' - 1;
17932     unsigned char separator = min_separator;
17933     int uses_name_value_pair_names = 0;
17934
17935     name = setlocale(LC_ALL, "C");
17936     if (name == NULL || strcmp(name, "C") != 0) {
17937         exit(bad_setlocale);
17938     }
17939
17940     if (has_C_UTF8) {
17941         char * pos;
17942
17943         name = setlocale(LC_CTYPE, "C.UTF-8");
17944         if (name == NULL) {
17945             exit(bad_setlocale);
17946         }
17947         name = setlocale(LC_ALL, NULL);
17948         if (name == NULL) {
17949             exit(bad_setlocale);
17950         }
17951
17952         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17953         if (pos != NULL) {
17954             uses_name_value_pair_names = 1;
17955             if (pos == name) {
17956                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17957             }
17958             else {
17959                 separator = *(pos - 1);
17960             }
17961         }
17962         else {
17963             pos = strstr(name, "C.UTF-8");
17964             if (pos == NULL) {
17965                 /* bad */
17966             }
17967             else if (pos == name) {
17968                 separator = name[sizeof("C.UTF-8") - 1];
17969             }
17970             else {
17971                 separator = *(pos - 1);
17972             }
17973         }
17974     }
17975
17976 #endif
17977 #endif
17978
17979     exit( 0 /* (separator - min_separator) << 3
17980         | uses_name_value_pair_names      << 2
17981           */
17982         | has_C_UTF8                      << 1
17983         | accepts_any_locale_name);
17984
17985 }
17986 EOCP
17987 set try
17988 if eval $compile; then
17989     echo "Your system has setlocale()..." >&4
17990     $run ./try
17991     case $? in
17992         0) echo "and it seems sane" >&4
17993            d_setlocale="$define"
17994            d_setlocale_accepts_any_locale_name="$undef"
17995            d_has_C_UTF8="false"
17996            ;;
17997         1) echo "and it seems sane, but accepts any locale name as valid" >&4
17998            d_setlocale="$define"
17999            d_setlocale_accepts_any_locale_name="$define"
18000            d_has_C_UTF8="false"
18001            ;;
18002         2) echo "and it seems sane" >&4
18003            d_setlocale="$define"
18004            d_setlocale_accepts_any_locale_name="$undef"
18005            d_has_C_UTF8="true"
18006            ;;
18007         3) echo "and it seems sane, but accepts any locale name as valid" >&4
18008            d_setlocale="$define"
18009            d_setlocale_accepts_any_locale_name="$define"
18010            d_has_C_UTF8="true"
18011            ;;
18012         *) echo "but it doesn't seem to work, so we won't use it." >&4
18013            d_setlocale="$undef"
18014            d_setlocale_accepts_any_locale_name="$undef"
18015            d_has_C_UTF8="false"
18016            ;;
18017     esac
18018 else
18019     echo "your system does not have setlocale()" >&4
18020     d_setlocale="$undef"
18021     d_setlocale_accepts_any_locale_name="$undef"
18022     d_has_C_UTF8="false"
18023 fi
18024 $rm_try
18025
18026 : see if setlocale_r exists
18027 set setlocale_r d_setlocale_r
18028 eval $inlibc
18029 case "$d_setlocale_r" in
18030 "$define")
18031         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18032         case "$d_setlocale_r_proto:$usethreads" in
18033         ":define")      d_setlocale_r_proto=define
18034                 set d_setlocale_r_proto setlocale_r $hdrs
18035                 eval $hasproto ;;
18036         *)      ;;
18037         esac
18038         case "$d_setlocale_r_proto" in
18039         define)
18040         case "$setlocale_r_proto" in
18041         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18042         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18043         esac
18044         case "$setlocale_r_proto" in
18045         ''|0)   d_setlocale_r=undef
18046                 setlocale_r_proto=0
18047                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18048         * )     case "$setlocale_r_proto" in
18049                 REENTRANT_PROTO*) ;;
18050                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18051                 esac
18052                 echo "Prototype: $try" ;;
18053         esac
18054         ;;
18055         *)      case "$usethreads" in
18056                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18057                 esac
18058                 d_setlocale_r=undef
18059                 setlocale_r_proto=0
18060                 ;;
18061         esac
18062         ;;
18063 *)      setlocale_r_proto=0
18064         ;;
18065 esac
18066
18067 : see if setnetent exists
18068 set setnetent d_setnent
18069 eval $inlibc
18070
18071 : see if setnetent_r exists
18072 set setnetent_r d_setnetent_r
18073 eval $inlibc
18074 case "$d_setnetent_r" in
18075 "$define")
18076         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18077         case "$d_setnetent_r_proto:$usethreads" in
18078         ":define")      d_setnetent_r_proto=define
18079                 set d_setnetent_r_proto setnetent_r $hdrs
18080                 eval $hasproto ;;
18081         *)      ;;
18082         esac
18083         case "$d_setnetent_r_proto" in
18084         define)
18085         case "$setnetent_r_proto" in
18086         ''|0) try='int setnetent_r(int, struct netent_data*);'
18087         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18088         esac
18089         case "$setnetent_r_proto" in
18090         ''|0) try='void setnetent_r(int, struct netent_data*);'
18091         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18092         esac
18093         case "$setnetent_r_proto" in
18094         ''|0)   d_setnetent_r=undef
18095                 setnetent_r_proto=0
18096                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18097         * )     case "$setnetent_r_proto" in
18098                 REENTRANT_PROTO*) ;;
18099                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18100                 esac
18101                 echo "Prototype: $try" ;;
18102         esac
18103         ;;
18104         *)      case "$usethreads" in
18105                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18106                 esac
18107                 d_setnetent_r=undef
18108                 setnetent_r_proto=0
18109                 ;;
18110         esac
18111         ;;
18112 *)      setnetent_r_proto=0
18113         ;;
18114 esac
18115
18116 : see if setprotoent exists
18117 set setprotoent d_setpent
18118 eval $inlibc
18119
18120 : see if setpgid exists
18121 set setpgid d_setpgid
18122 eval $inlibc
18123
18124 : see if setpgrp2 exists
18125 set setpgrp2 d_setpgrp2
18126 eval $inlibc
18127
18128 : see if setpriority exists
18129 set setpriority d_setprior
18130 eval $inlibc
18131
18132 : see if setproctitle exists
18133 set setproctitle d_setproctitle
18134 eval $inlibc
18135
18136 : see if setprotoent_r exists
18137 set setprotoent_r d_setprotoent_r
18138 eval $inlibc
18139 case "$d_setprotoent_r" in
18140 "$define")
18141         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18142         case "$d_setprotoent_r_proto:$usethreads" in
18143         ":define")      d_setprotoent_r_proto=define
18144                 set d_setprotoent_r_proto setprotoent_r $hdrs
18145                 eval $hasproto ;;
18146         *)      ;;
18147         esac
18148         case "$d_setprotoent_r_proto" in
18149         define)
18150         case "$setprotoent_r_proto" in
18151         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18152         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18153         esac
18154         case "$setprotoent_r_proto" in
18155         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18156         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18157         esac
18158         case "$setprotoent_r_proto" in
18159         ''|0)   d_setprotoent_r=undef
18160                 setprotoent_r_proto=0
18161                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18162         * )     case "$setprotoent_r_proto" in
18163                 REENTRANT_PROTO*) ;;
18164                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18165                 esac
18166                 echo "Prototype: $try" ;;
18167         esac
18168         ;;
18169         *)      case "$usethreads" in
18170                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18171                 esac
18172                 d_setprotoent_r=undef
18173                 setprotoent_r_proto=0
18174                 ;;
18175         esac
18176         ;;
18177 *)      setprotoent_r_proto=0
18178         ;;
18179 esac
18180
18181 : see if setpwent exists
18182 set setpwent d_setpwent
18183 eval $inlibc
18184
18185 : see if setpwent_r exists
18186 set setpwent_r d_setpwent_r
18187 eval $inlibc
18188 case "$d_setpwent_r" in
18189 "$define")
18190         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18191         case "$d_setpwent_r_proto:$usethreads" in
18192         ":define")      d_setpwent_r_proto=define
18193                 set d_setpwent_r_proto setpwent_r $hdrs
18194                 eval $hasproto ;;
18195         *)      ;;
18196         esac
18197         case "$d_setpwent_r_proto" in
18198         define)
18199         case "$setpwent_r_proto" in
18200         ''|0) try='int setpwent_r(FILE**);'
18201         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18202         esac
18203         case "$setpwent_r_proto" in
18204         ''|0) try='void setpwent_r(FILE**);'
18205         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18206         esac
18207         case "$setpwent_r_proto" in
18208         ''|0)   d_setpwent_r=undef
18209                 setpwent_r_proto=0
18210                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18211         * )     case "$setpwent_r_proto" in
18212                 REENTRANT_PROTO*) ;;
18213                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18214                 esac
18215                 echo "Prototype: $try" ;;
18216         esac
18217         ;;
18218         *)      case "$usethreads" in
18219                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18220                 esac
18221                 d_setpwent_r=undef
18222                 setpwent_r_proto=0
18223                 ;;
18224         esac
18225         ;;
18226 *)      setpwent_r_proto=0
18227         ;;
18228 esac
18229
18230 : see if setregid exists
18231 set setregid d_setregid
18232 eval $inlibc
18233 set setresgid d_setresgid
18234 eval $inlibc
18235
18236 : see if setreuid exists
18237 set setreuid d_setreuid
18238 eval $inlibc
18239 set setresuid d_setresuid
18240 eval $inlibc
18241
18242 : see if setrgid exists
18243 set setrgid d_setrgid
18244 eval $inlibc
18245
18246 : see if setruid exists
18247 set setruid d_setruid
18248 eval $inlibc
18249
18250 : see if setservent exists
18251 set setservent d_setsent
18252 eval $inlibc
18253
18254 : see if setservent_r exists
18255 set setservent_r d_setservent_r
18256 eval $inlibc
18257 case "$d_setservent_r" in
18258 "$define")
18259         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18260         case "$d_setservent_r_proto:$usethreads" in
18261         ":define")      d_setservent_r_proto=define
18262                 set d_setservent_r_proto setservent_r $hdrs
18263                 eval $hasproto ;;
18264         *)      ;;
18265         esac
18266         case "$d_setservent_r_proto" in
18267         define)
18268         case "$setservent_r_proto" in
18269         ''|0) try='int setservent_r(int, struct servent_data*);'
18270         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18271         esac
18272         case "$setservent_r_proto" in
18273         ''|0) try='void setservent_r(int, struct servent_data*);'
18274         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18275         esac
18276         case "$setservent_r_proto" in
18277         ''|0)   d_setservent_r=undef
18278                 setservent_r_proto=0
18279                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18280         * )     case "$setservent_r_proto" in
18281                 REENTRANT_PROTO*) ;;
18282                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18283                 esac
18284                 echo "Prototype: $try" ;;
18285         esac
18286         ;;
18287         *)      case "$usethreads" in
18288                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18289                 esac
18290                 d_setservent_r=undef
18291                 setservent_r_proto=0
18292                 ;;
18293         esac
18294         ;;
18295 *)      setservent_r_proto=0
18296         ;;
18297 esac
18298
18299 : see if setsid exists
18300 set setsid d_setsid
18301 eval $inlibc
18302
18303 : see if setvbuf exists
18304 set setvbuf d_setvbuf
18305 eval $inlibc
18306
18307 : see if shmctl exists
18308 set shmctl d_shmctl
18309 eval $inlibc
18310
18311 : see if shmget exists
18312 set shmget d_shmget
18313 eval $inlibc
18314
18315 : see if shmat exists
18316 set shmat d_shmat
18317 eval $inlibc
18318 : see what shmat returns
18319 case "$d_shmat" in
18320 "$define")
18321         $cat >shmat.c <<'END'
18322 #include <sys/shm.h>
18323 void *shmat();
18324 END
18325         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18326                 shmattype='void *'
18327         else
18328                 shmattype='char *'
18329         fi
18330         echo "and it returns ($shmattype)." >&4
18331         : see if a prototype for shmat is available
18332         xxx=`./findhdr sys/shm.h`
18333         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18334         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18335                 val="$define"
18336         else
18337                 val="$undef"
18338         fi
18339         $rm -f shmat.[co]
18340         ;;
18341 *)
18342         val="$undef"
18343         ;;
18344 esac
18345 set d_shmatprototype
18346 eval $setvar
18347
18348 : see if shmdt exists
18349 set shmdt d_shmdt
18350 eval $inlibc
18351
18352 : see how much of the 'shm*(2)' library is present.
18353 h_shm=true
18354 echo " "
18355 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18356 *"$undef"*) h_shm=false;;
18357 esac
18358 case "$osname" in
18359 freebsd)
18360     case "`ipcs 2>&1`" in
18361     "SVID shared memory"*"not configured"*)
18362         echo "Your $osname does not have the shm*(2) configured." >&4
18363         h_shm=false
18364         val="$undef"
18365         set shmctl d_shmctl
18366         eval $setvar
18367         set shmget d_shmget
18368         eval $setvar
18369         set shmat d_shmat
18370         eval $setvar
18371         set shmdt d_shmdt
18372         eval $setvar
18373         ;;
18374     esac
18375     ;;
18376 esac
18377 : we could also check for sys/ipc.h ...
18378 if $h_shm && $test `./findhdr sys/shm.h`; then
18379         echo "You have the full shm*(2) library." >&4
18380         val="$define"
18381 else
18382         echo "You don't have the full shm*(2) library." >&4
18383         val="$undef"
18384 fi
18385 set d_shm
18386 eval $setvar
18387
18388 : see if we have sigaction
18389 echo " "
18390 if set sigaction val -f d_sigaction; eval $csym; $val; then
18391         echo 'sigaction() found.' >&4
18392         $cat > try.c <<EOP
18393 #include <stdio.h>
18394 #include <sys/types.h>
18395 #include <signal.h>
18396 #$i_stdlib I_STDLIB
18397 #ifdef I_STDLIB
18398 #include <stdlib.h>
18399 #endif
18400 int main()
18401 {
18402     struct sigaction act, oact;
18403     act.sa_flags = 0;
18404     oact.sa_handler = 0;
18405     /* so that act and oact are used */
18406     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18407 }
18408 EOP
18409         set try
18410         if eval $compile_ok; then
18411                 val="$define"
18412         else
18413                 echo "But you don't seem to have a usable struct sigaction." >&4
18414                 val="$undef"
18415         fi
18416 else
18417         echo 'sigaction NOT found.' >&4
18418         val="$undef"
18419 fi
18420 set d_sigaction; eval $setvar
18421 $rm_try
18422
18423 : see what type pids are declared as in the kernel
18424 rp="What is the type of process ids on this system?"
18425 set pid_t pidtype int stdio.h sys/types.h
18426 eval $typedef_ask
18427
18428 : see what type uids are declared as in the kernel
18429 echo " "
18430 echo "Looking for the type for user ids returned by getuid()."
18431 set uid_t uidtype xxx stdio.h sys/types.h
18432 eval $typedef
18433 case "$uidtype" in
18434 xxx)
18435         xxx=`./findhdr sys/user.h`
18436         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18437         case $1 in
18438         unsigned) dflt="$1 $2" ;;
18439         *) dflt="$1" ;;
18440         esac
18441         ;;
18442 *) dflt="$uidtype";;
18443 esac
18444 case "$uidtype" in
18445 uid_t)  echo "uid_t found." ;;
18446 *)      rp="What is the type for user ids returned by getuid()?"
18447         . ./myread
18448         uidtype="$ans"
18449         ;;
18450 esac
18451
18452 : Define hasfield_t macro for Configure internal use
18453 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18454 while $test $# -ge 2; do
18455     case "$1" in
18456         $define) echo "#include <$2>";;
18457     esac ;
18458     shift 2;
18459 done > try.c;
18460 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18461 set try;
18462 if eval $compile; then
18463         val="$define";
18464 else
18465         val="$undef";
18466 fi;
18467 set $varname;
18468 eval $setvar;
18469 $rm_try'
18470
18471 : see what siginfo fields we have
18472 case "$d_sigaction" in
18473 "$define")
18474         echo "Checking if your siginfo_t has si_errno field...">&4
18475         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18476         eval $hasfield_t;
18477
18478         echo "Checking if your siginfo_t has si_pid field...">&4
18479         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18480         eval $hasfield_t;
18481
18482         echo "Checking if your siginfo_t has si_uid field...">&4
18483         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18484         eval $hasfield_t;
18485
18486         echo "Checking if your siginfo_t has si_addr field...">&4
18487         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18488         eval $hasfield_t;
18489
18490         echo "Checking if your siginfo_t has si_status field...">&4
18491         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18492         eval $hasfield_t;
18493
18494         echo "Checking if your siginfo_t has si_band field...">&4
18495         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18496         eval $hasfield_t;
18497
18498         echo "Checking if your siginfo_t has si_value field...">&4
18499         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18500         eval $hasfield_t;
18501
18502         echo "Checking if your siginfo_t has si_fd field...">&4
18503         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18504         eval $hasfield_t;
18505
18506         ;;
18507 *)
18508         d_siginfo_si_errno="$undef"
18509         d_siginfo_si_pid="$undef"
18510         d_siginfo_si_uid="$undef"
18511         d_siginfo_si_addr="$undef"
18512         d_siginfo_si_status="$undef"
18513         d_siginfo_si_band="$undef"
18514         d_siginfo_si_value="$undef"
18515         d_siginfo_si_fd="$undef"
18516         ;;
18517 esac
18518
18519 : see if this is a sunmath.h system
18520 set sunmath.h i_sunmath
18521 eval $inhdr
18522
18523 : see if signbit exists
18524 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18525 $cat >try.c <<EOCP
18526 #$i_sunmath I_SUNMATH
18527 #include <math.h>
18528 #ifdef I_SUNMATH  /* Solaris special math library */
18529 #  include <sunmath.h>
18530 #endif
18531 #define NV $nvtype
18532 int main(int argc, char **argv)
18533 {
18534     NV x = 0.0;
18535     NV y = -1.0;
18536     if ((signbit(x) == 0) && (signbit(y) != 0))
18537         return 0;
18538     else
18539         return 1;
18540 }
18541 EOCP
18542 val="$undef"
18543 set try
18544 if eval $compile; then
18545     if $run ./try; then
18546         $echo "Yes." >&4
18547         val="$define"
18548     else
18549         $echo "Signbit seems to be available, but doesn't work as I expected."
18550         $echo "I won't use it." >&4
18551         val="$undef"
18552     fi
18553 else
18554     $echo "Nope." >&4
18555     dflt="$undef"
18556 fi
18557 set d_signbit
18558 eval $setvar
18559 $rm_try
18560
18561 : see if sigprocmask exists
18562 set sigprocmask d_sigprocmask
18563 eval $inlibc
18564
18565 : see if sigsetjmp exists
18566 echo " "
18567 case "$d_sigsetjmp" in
18568 '')
18569         $cat >try.c <<EOP
18570 #include <setjmp.h>
18571 #$i_stdlib I_STDLIB
18572 #ifdef I_STDLIB
18573 #include <stdlib.h>
18574 #endif
18575 sigjmp_buf env;
18576 int set = 1;
18577 int main()
18578 {
18579         if (sigsetjmp(env,1))
18580                 exit(set);
18581         set = 0;
18582         siglongjmp(env, 1);
18583         exit(1);
18584 }
18585 EOP
18586         set try
18587         if eval $compile; then
18588                 if $run ./try >/dev/null 2>&1; then
18589                         echo "POSIX sigsetjmp found." >&4
18590                         val="$define"
18591                 else
18592                         $cat >&4 <<EOM
18593 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18594 I'll ignore them.
18595 EOM
18596                         val="$undef"
18597                 fi
18598         else
18599                 echo "sigsetjmp not found." >&4
18600                 val="$undef"
18601         fi
18602         ;;
18603 *) val="$d_sigsetjmp"
18604         case "$d_sigsetjmp" in
18605         $define) echo "POSIX sigsetjmp found." >&4;;
18606         $undef) echo "sigsetjmp not found." >&4;;
18607         esac
18608         ;;
18609 esac
18610 set d_sigsetjmp
18611 eval $setvar
18612 $rm_try
18613
18614 : see if snprintf exists
18615 set snprintf d_snprintf
18616 eval $inlibc
18617
18618 : see if vsnprintf exists
18619 set vsnprintf d_vsnprintf
18620 eval $inlibc
18621
18622 case "$d_snprintf-$d_vsnprintf" in
18623 "$define-$define")
18624     $cat <<EOM
18625 Checking whether your snprintf() and vsnprintf() work okay...
18626 EOM
18627     $cat >try.c <<'EOCP'
18628 /* v?snprintf testing logic courtesy of Russ Allbery.
18629  * According to C99:
18630  * - if the buffer is too short it still must be \0-terminated
18631  * - if the buffer is too short the potentially required length
18632  *   must be returned and not -1
18633  * - if the buffer is NULL the potentially required length
18634  *   must be returned and not -1 or core dump
18635  */
18636 #include <stdio.h>
18637 #include <stdarg.h>
18638
18639 char buf[2];
18640
18641 int test (char *format, ...)
18642 {
18643     va_list args;
18644     int count;
18645
18646     va_start (args, format);
18647     count = vsnprintf (buf, sizeof buf, format, args);
18648     va_end (args);
18649     return count;
18650 }
18651
18652 int main ()
18653 {
18654     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18655              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18656 }
18657 EOCP
18658     set try
18659     if eval $compile; then
18660         `$run ./try`
18661         case "$?" in
18662         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18663         *) cat <<EOM >&4
18664 Your snprintf() and snprintf() don't seem to be working okay.
18665 EOM
18666            d_snprintf="$undef"
18667            d_vsnprintf="$undef"
18668            ;;
18669         esac
18670     else
18671         echo "(I can't seem to compile the test program--assuming they don't)"
18672         d_snprintf="$undef"
18673         d_vsnprintf="$undef"
18674     fi
18675     $rm_try
18676     ;;
18677 esac
18678
18679 : see if sockatmark exists
18680 set sockatmark d_sockatmark
18681 eval $inlibc
18682
18683 : see if prototype for sockatmark is available
18684 echo " "
18685 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18686 eval $hasproto
18687
18688 : see if socks5_init exists
18689 set socks5_init d_socks5_init
18690 eval $inlibc
18691
18692 : see if srand48_r exists
18693 set srand48_r d_srand48_r
18694 eval $inlibc
18695 case "$d_srand48_r" in
18696 "$define")
18697         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18698         case "$d_srand48_r_proto:$usethreads" in
18699         ":define")      d_srand48_r_proto=define
18700                 set d_srand48_r_proto srand48_r $hdrs
18701                 eval $hasproto ;;
18702         *)      ;;
18703         esac
18704         case "$d_srand48_r_proto" in
18705         define)
18706         case "$srand48_r_proto" in
18707         ''|0) try='int srand48_r(long, struct drand48_data*);'
18708         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18709         esac
18710         case "$srand48_r_proto" in
18711         ''|0)   d_srand48_r=undef
18712                 srand48_r_proto=0
18713                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18714         * )     case "$srand48_r_proto" in
18715                 REENTRANT_PROTO*) ;;
18716                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18717                 esac
18718                 echo "Prototype: $try" ;;
18719         esac
18720         ;;
18721         *)      case "$usethreads" in
18722                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18723                 esac
18724                 d_srand48_r=undef
18725                 srand48_r_proto=0
18726                 ;;
18727         esac
18728         ;;
18729 *)      srand48_r_proto=0
18730         ;;
18731 esac
18732
18733 : see if srandom_r exists
18734 set srandom_r d_srandom_r
18735 eval $inlibc
18736 case "$d_srandom_r" in
18737 "$define")
18738         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18739         case "$d_srandom_r_proto:$usethreads" in
18740         ":define")      d_srandom_r_proto=define
18741                 set d_srandom_r_proto srandom_r $hdrs
18742                 eval $hasproto ;;
18743         *)      ;;
18744         esac
18745         case "$d_srandom_r_proto" in
18746         define)
18747         case "$srandom_r_proto" in
18748         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18749         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18750         esac
18751         case "$srandom_r_proto" in
18752         ''|0)   d_srandom_r=undef
18753                 srandom_r_proto=0
18754                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18755         * )     case "$srandom_r_proto" in
18756                 REENTRANT_PROTO*) ;;
18757                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18758                 esac
18759                 echo "Prototype: $try" ;;
18760         esac
18761         ;;
18762         *)      case "$usethreads" in
18763                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18764                 esac
18765                 d_srandom_r=undef
18766                 srandom_r_proto=0
18767                 ;;
18768         esac
18769         ;;
18770 *)      srandom_r_proto=0
18771         ;;
18772 esac
18773
18774 : see if prototype for setresgid is available
18775 echo " "
18776 set d_sresgproto setresgid $i_unistd unistd.h
18777 eval $hasproto
18778
18779 : see if prototype for setresuid is available
18780 echo " "
18781 set d_sresuproto setresuid $i_unistd unistd.h
18782 eval $hasproto
18783
18784 : see if stat exists
18785 set stat d_stat
18786 eval $inlibc
18787
18788 : see if sys/stat.h is available
18789 set sys/stat.h i_sysstat
18790 eval $inhdr
18791
18792 : see if stat knows about block sizes
18793 echo " "
18794 echo "Checking to see if your struct stat has st_blocks field..." >&4
18795 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18796 eval $hasfield
18797
18798 : see if this is a sys/vfs.h system
18799 set sys/vfs.h i_sysvfs
18800 eval $inhdr
18801
18802 : see if this is a sys/statfs.h system
18803 set sys/statfs.h i_sysstatfs
18804 eval $inhdr
18805
18806 : Check for statfs_s
18807 echo " "
18808 echo "Checking to see if your system supports struct statfs..." >&4
18809 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
18810 eval $hasstruct
18811 case "$d_statfs_s" in
18812 "$define")      echo "Yes, it does."   ;;
18813 *)              echo "No, it doesn't." ;;
18814 esac
18815
18816 : see if struct statfs knows about f_flags
18817 case "$d_statfs_s" in
18818 define)
18819         echo " "
18820         echo "Checking to see if your struct statfs has f_flags field..." >&4
18821         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
18822         eval $hasfield
18823         ;;
18824 *)      val="$undef"
18825         set d_statfs_f_flags
18826         eval $setvar
18827         ;;
18828 esac
18829 case "$d_statfs_f_flags" in
18830 "$define")      echo "Yes, it does."   ;;
18831 *)              echo "No, it doesn't." ;;
18832 esac
18833
18834 : see what flavor, if any, of static inline is supported
18835 echo " "
18836 echo "Checking to see if your system supports static inline..."
18837 $cat > try.c <<'EOCP'
18838 #include <stdlib.h>
18839 extern int f_via_a(int x);
18840 extern int f_via_b(int x);
18841 int main(int argc, char **argv)
18842 {
18843     int y;
18844
18845     y = f_via_a(0);
18846 #ifdef USE_B
18847     y = f_via_b(0);
18848 #endif
18849     if (y == 42) {
18850         return EXIT_SUCCESS;
18851     }
18852     else {
18853         return EXIT_FAILURE;
18854     }
18855 }
18856 EOCP
18857 $cat > a.c <<'EOCP'
18858 static INLINE int f(int x) {
18859     int y;
18860     y = x + 42;
18861     return y;
18862 }
18863
18864 int f_via_a(int x)
18865 {
18866     return f(x);
18867 }
18868 EOCP
18869 $cat > b.c <<'EOCP'
18870 extern int f(int x);
18871
18872 int f_via_b(int x)
18873 {
18874     return f(x);
18875 }
18876 EOCP
18877
18878 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18879 case "$perl_static_inline" in
18880 '')     # Check the various possibilities, and break out on success.
18881         # For gcc, prefer __inline__, which will still permit
18882         # cflags.SH to add in -ansi.
18883         case "$gccversion" in
18884                 '') xxx="inline __inline__ __inline _inline";;
18885                 *)  xxx="__inline__ inline __inline _inline";;
18886         esac
18887         for inline in $xxx; do
18888                 set try -DINLINE=$inline a.c
18889                 if eval $compile && $run ./try; then
18890                         # Now make sure there is no external linkage of static
18891                         # functions
18892                         set try -DINLINE=$inline -DUSE_B a.c b.c
18893                         if eval $compile && $run ./try; then
18894                                 $echo "Your compiler supports static $inline, " >&4
18895                                 $echo "but it also creates an external definition," >&4
18896                                 $echo "so I won't use it." >&4
18897                                 val=$undef
18898                         else
18899                                 $echo "Your compiler supports static $inline." >&4
18900                                 val=$define
18901                                 perl_static_inline="static $inline";
18902                                 break;
18903                         fi
18904                 else
18905                         $echo "Your compiler does NOT support static $inline." >&4
18906                         val="$undef"
18907                 fi
18908         done
18909         ;;
18910 *inline*) # Some variant of inline exists.
18911         echo "Keeping your $hint value of $perl_static_inline."
18912         val=$define
18913         ;;
18914 static)  # No inline capabilities
18915         echo "Keeping your $hint value of $perl_static_inline."
18916         val=$undef
18917         ;;
18918 *)  # Unrecognized previous value -- blindly trust the supplied
18919         # value and hope it makes sense.  Use old value for
18920         # d_static_inline, if there is one.
18921         echo "Keeping your $hint value of $perl_static_inline."
18922         case "$d_static_inline" in
18923                 '') val=$define ;;
18924                 *)  val=$d_static_inline ;;
18925         esac
18926         ;;
18927 esac
18928 # Fallback to plain 'static' if nothing worked.
18929 case "$perl_static_inline" in
18930 '')
18931         perl_static_inline="static"
18932         val=$undef
18933         ;;
18934 esac
18935 set d_static_inline
18936 eval $setvar
18937 $rm -f a.[co] b.[co]
18938 $rm_try
18939
18940 : Check stream access
18941 $cat >&4 <<EOM
18942 Checking how to access stdio streams by file descriptor number...
18943 EOM
18944 case "$stdio_stream_array" in
18945 '')     $cat >try.c <<EOCP
18946 #include <stdio.h>
18947 int main() {
18948   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18949     printf("yes\n");
18950 }
18951 EOCP
18952         for s in _iob __iob __sF
18953         do
18954                 set try -DSTDIO_STREAM_ARRAY=$s
18955                 if eval $compile; then
18956                         case "`$run ./try`" in
18957                         yes)    stdio_stream_array=$s; break ;;
18958                         esac
18959                 fi
18960         done
18961         $rm_try
18962 esac
18963 case "$stdio_stream_array" in
18964 '')     $cat >&4 <<EOM
18965 I can't figure out how to access stdio streams by file descriptor number.
18966 EOM
18967         d_stdio_stream_array="$undef"
18968         ;;
18969 *)      $cat >&4 <<EOM
18970 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18971 EOM
18972         d_stdio_stream_array="$define"
18973         ;;
18974 esac
18975
18976 : see if strcoll exists
18977 set strcoll d_strcoll
18978 eval $inlibc
18979
18980 : see if strerror_l exists
18981 set strerror_l d_strerror_l
18982 eval $inlibc
18983
18984 : see if strerror_r exists
18985 set strerror_r d_strerror_r
18986 eval $inlibc
18987 case "$d_strerror_r" in
18988 "$define")
18989         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18990         case "$d_strerror_r_proto:$usethreads" in
18991         ":define")      d_strerror_r_proto=define
18992                 set d_strerror_r_proto strerror_r $hdrs
18993                 eval $hasproto ;;
18994         *)      ;;
18995         esac
18996         case "$d_strerror_r_proto" in
18997         define)
18998         case "$strerror_r_proto" in
18999         ''|0) try='int strerror_r(int, char*, size_t);'
19000         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19001         esac
19002         case "$strerror_r_proto" in
19003         ''|0) try='int strerror_r(int, char*, int);'
19004         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19005         esac
19006         case "$strerror_r_proto" in
19007         ''|0) try='char* strerror_r(int, char*, size_t);'
19008         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19009         esac
19010         case "$strerror_r_proto" in
19011         ''|0)   d_strerror_r=undef
19012                 strerror_r_proto=0
19013                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19014         * )     case "$strerror_r_proto" in
19015                 REENTRANT_PROTO*) ;;
19016                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19017                 esac
19018                 echo "Prototype: $try" ;;
19019         esac
19020         ;;
19021         *)      case "$usethreads" in
19022                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19023                 esac
19024                 d_strerror_r=undef
19025                 strerror_r_proto=0
19026                 ;;
19027         esac
19028         ;;
19029 *)      strerror_r_proto=0
19030         ;;
19031 esac
19032
19033 : see if strftime exists
19034 set strftime d_strftime
19035 eval $inlibc
19036
19037 : see if strlcat exists
19038 : We need both a prototype in string.h and the symbol in libc.
19039 echo " "
19040 d_strlcat_proto=''
19041 xx1="#$d_gnulibc HAS_GNULIBC"
19042 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19043 xx3='#   define _GNU_SOURCE'
19044 xx4='#endif'
19045 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19046 eval $hasproto
19047 case "$d_strlcat_proto" in
19048     define) # see if strlcat exists
19049         set strlcat d_strlcat
19050         eval $inlibc
19051         ;;
19052     *)  val=$undef
19053         set d_strlcat
19054         eval $setvar
19055         ;;
19056 esac
19057
19058 : see if strlcpy exists
19059 : We need both a prototype in string.h and the symbol in libc.
19060 echo " "
19061 d_strlcpy_proto=''
19062 xx1="#$d_gnulibc HAS_GNULIBC"
19063 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19064 xx3='#   define _GNU_SOURCE'
19065 xx4='#endif'
19066 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19067 eval $hasproto
19068 case "$d_strlcpy_proto" in
19069     define) # see if strlcpy exists
19070         set strlcpy d_strlcpy
19071         eval $inlibc
19072         ;;
19073     *)  val=$undef
19074         set d_strlcpy
19075         eval $setvar
19076         ;;
19077 esac
19078
19079 : see if strnlen exists
19080 set strnlen d_strnlen
19081 eval $inlibc
19082
19083 : see if strtod exists
19084 set strtod d_strtod
19085 eval $inlibc
19086
19087 : see if strtod_l exists
19088 set strtod_l d_strtod_l
19089 eval $inlibc
19090
19091 : see if strtol exists
19092 set strtol d_strtol
19093 eval $inlibc
19094
19095 : see if strtold exists
19096 set strtold d_strtold
19097 eval $inlibc
19098
19099 : see if strtold_l exists
19100 set strtold_l d_strtold_l
19101 eval $inlibc
19102
19103 : see if strtoll exists
19104 set strtoll d_strtoll
19105 eval $inlibc
19106
19107 case "$d_longlong-$d_strtoll" in
19108 "$define-$define")
19109         $cat <<EOM
19110 Checking whether your strtoll() works okay...
19111 EOM
19112         $cat >try.c <<'EOCP'
19113 #include <errno.h>
19114 #ifdef __hpux
19115 #define strtoll __strtoll
19116 #endif
19117 #ifdef __EMX__
19118 #define strtoll _strtoll
19119 #endif
19120 #include <stdio.h>
19121 #include <stdlib.h>
19122 static int bad = 0;
19123 void check(const char *s, long long ell, int een) {
19124         long long gll;
19125         errno = 0;
19126         gll = strtoll(s, 0, 10);
19127         if (!((gll == ell) && (errno == een)))
19128                 bad++;
19129 }
19130 int main() {
19131         check(" 1",                                      1LL, 0);
19132         check(" 0",                                      0LL, 0);
19133         check("-1",                                     -1LL, 0);
19134         check("-9223372036854775808", -9223372036854775808LL, 0);
19135         check("-9223372036854775808", -9223372036854775808LL, 0);
19136         check(" 9223372036854775807",  9223372036854775807LL, 0);
19137         check("-9223372036854775808", -9223372036854775808LL, 0);
19138         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19139         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19140         if (!bad)
19141                 printf("ok\n");
19142 }
19143 EOCP
19144         set try
19145         if eval $compile; then
19146                 yyy=`$run ./try`
19147                 case "$yyy" in
19148                 ok) echo "Your strtoll() seems to be working okay." ;;
19149                 *) cat <<EOM >&4
19150 Your strtoll() doesn't seem to be working okay.
19151 EOM
19152                    d_strtoll="$undef"
19153                    ;;
19154                 esac
19155         else
19156                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19157                 d_strtoll="$undef"
19158         fi
19159         ;;
19160 esac
19161
19162 : see if strtoq exists
19163 set strtoq d_strtoq
19164 eval $inlibc
19165
19166 : see if strtoul exists
19167 set strtoul d_strtoul
19168 eval $inlibc
19169
19170 case "$d_strtoul" in
19171 "$define")
19172         $cat <<EOM
19173 Checking whether your strtoul() works okay...
19174 EOM
19175         $cat >try.c <<'EOCP'
19176 #include <stdlib.h>
19177 #include <errno.h>
19178 #include <stdio.h>
19179 static int bad = 0;
19180 void check(const char *s, unsigned long eul, int een) {
19181         unsigned long gul;
19182         errno = 0;
19183         gul = strtoul(s, 0, 10);
19184         if (!((gul == eul) && (errno == een)))
19185                 bad++;
19186 }
19187 int main() {
19188         check(" 1", 1L, 0);
19189         check(" 0", 0L, 0);
19190 EOCP
19191         case "$longsize" in
19192         8)
19193             $cat >>try.c <<'EOCP'
19194         check("18446744073709551615", 18446744073709551615UL, 0);
19195         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19196 #if 0 /* strtoul() for /^-/ strings is undefined. */
19197         check("-1", 18446744073709551615UL, 0);
19198         check("-18446744073709551614", 2, 0);
19199         check("-18446744073709551615", 1, 0);
19200         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19201         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19202 #endif
19203 EOCP
19204                 ;;
19205         4)
19206                     $cat >>try.c <<'EOCP'
19207         check("4294967295", 4294967295UL, 0);
19208         check("4294967296", 4294967295UL, ERANGE);
19209 #if 0 /* strtoul() for /^-/ strings is undefined. */
19210         check("-1", 4294967295UL, 0);
19211         check("-4294967294", 2, 0);
19212         check("-4294967295", 1, 0);
19213         check("-4294967296", 4294967295UL, ERANGE);
19214         check("-4294967297", 4294967295UL, ERANGE);
19215 #endif
19216 EOCP
19217                 ;;
19218         *)
19219 : Should we write these tests to be more portable by sprintf-ing
19220 : ~0 and then manipulating that char string as input for strtol?
19221                 ;;
19222         esac
19223         $cat >>try.c <<'EOCP'
19224         if (!bad)
19225                 printf("ok\n");
19226         return 0;
19227 }
19228 EOCP
19229         set try
19230         if eval $compile; then
19231                 case "`$run ./try`" in
19232                 ok) echo "Your strtoul() seems to be working okay." ;;
19233                 *) cat <<EOM >&4
19234 Your strtoul() doesn't seem to be working okay.
19235 EOM
19236                    d_strtoul="$undef"
19237                    ;;
19238                 esac
19239         else
19240                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19241                 d_strtoul="$undef"
19242         fi
19243         ;;
19244 esac
19245
19246 : see if strtoull exists
19247 set strtoull d_strtoull
19248 eval $inlibc
19249
19250 case "$d_longlong-$d_strtoull" in
19251 "$define-$define")
19252         $cat <<EOM
19253 Checking whether your strtoull() works okay...
19254 EOM
19255         $cat >try.c <<'EOCP'
19256 #include <stdlib.h>
19257 #include <errno.h>
19258 #ifdef __hpux
19259 #define strtoull __strtoull
19260 #endif
19261 #include <stdio.h>
19262 static int bad = 0;
19263 void check(const char *s, long long eull, int een) {
19264         long long gull;
19265         errno = 0;
19266         gull = strtoull(s, 0, 10);
19267         if (!((gull == eull) && (errno == een)))
19268                 bad++;
19269 }
19270 int main() {
19271         check(" 1",                                        1LL, 0);
19272         check(" 0",                                        0LL, 0);
19273         check("18446744073709551615",  18446744073709551615ULL, 0);
19274         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19275 #if 0 /* strtoull() for /^-/ strings is undefined. */
19276         check("-1",                    18446744073709551615ULL, 0);
19277         check("-18446744073709551614",                     2LL, 0);
19278         check("-18446744073709551615",                     1LL, 0);
19279         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19280         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19281 #endif
19282         if (!bad)
19283                 printf("ok\n");
19284 }
19285 EOCP
19286         set try
19287         if eval $compile; then
19288                 case "`$run ./try`" in
19289                 ok) echo "Your strtoull() seems to be working okay." ;;
19290                 *) cat <<EOM >&4
19291 Your strtoull() doesn't seem to be working okay.
19292 EOM
19293                    d_strtoull="$undef"
19294                    ;;
19295                 esac
19296         else
19297                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19298                 d_strtoull="$undef"
19299         fi
19300         ;;
19301 esac
19302
19303 : see if strtouq exists
19304 set strtouq d_strtouq
19305 eval $inlibc
19306
19307 case "$d_strtouq" in
19308 "$define")
19309         $cat <<EOM
19310 Checking whether your strtouq() works okay...
19311 EOM
19312         $cat >try.c <<'EOCP'
19313 #include <stdlib.h>
19314 #include <errno.h>
19315 #include <stdio.h>
19316 static int bad = 0;
19317 void check(const char *s, unsigned long long eull, int een) {
19318         unsigned long long gull;
19319         errno = 0;
19320         gull = strtouq(s, 0, 10);
19321         if (!((gull == eull) && (errno == een)))
19322                 bad++;
19323 }
19324 int main() {
19325         check(" 1",                                        1LL, 0);
19326         check(" 0",                                        0LL, 0);
19327         check("18446744073709551615",  18446744073709551615ULL, 0);
19328         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19329 #if 0 /* strtouq() for /^-/ strings is undefined. */
19330         check("-1",                    18446744073709551615ULL, 0);
19331         check("-18446744073709551614",                     2LL, 0);
19332         check("-18446744073709551615",                     1LL, 0);
19333         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19334         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19335 #endif
19336         if (!bad)
19337                 printf("ok\n");
19338         return 0;
19339 }
19340 EOCP
19341         set try
19342         if eval $compile; then
19343                 case "`$run ./try`" in
19344                 ok) echo "Your strtouq() seems to be working okay." ;;
19345                 *) cat <<EOM >&4
19346 Your strtouq() doesn't seem to be working okay.
19347 EOM
19348                    d_strtouq="$undef"
19349                    ;;
19350                 esac
19351         else
19352                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19353                 d_strtouq="$undef"
19354         fi
19355         ;;
19356 esac
19357
19358 : see if strxfrm exists
19359 set strxfrm d_strxfrm
19360 eval $inlibc
19361
19362 : see if symlink exists
19363 set symlink d_symlink
19364 eval $inlibc
19365
19366 : see if syscall exists
19367 set syscall d_syscall
19368 eval $inlibc
19369
19370 : see if prototype for syscall is available
19371 echo " "
19372 set d_syscallproto syscall $i_unistd unistd.h
19373 eval $hasproto
19374
19375 : see if sysconf exists
19376 set sysconf d_sysconf
19377 eval $inlibc
19378
19379 : see if sys_errlist[] exists
19380 echo " "
19381 if test "X$d_syserrlst" = X; then
19382         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19383                 echo "You have sys_errlist[], so we could roll our own strerror."
19384                 d_syserrlst="$define"
19385         else
19386                 echo "You don't have sys_errlist[], so strerror() is welcome."
19387                 d_syserrlst="$undef"
19388         fi
19389 fi
19390
19391 : see if system exists
19392 set system d_system
19393 eval $inlibc
19394
19395 : see if tcgetpgrp exists
19396 set tcgetpgrp d_tcgetpgrp
19397 eval $inlibc
19398
19399 : see if tcsetpgrp exists
19400 set tcsetpgrp d_tcsetpgrp
19401 eval $inlibc
19402
19403 : see if prototype for telldir is available
19404 echo " "
19405 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19406 eval $hasproto
19407
19408 : see if tgamma exists
19409 set tgamma d_tgamma
19410 eval $inlibc
19411
19412 : check for thread_safe_nl_langinfo_l item
19413 $cat <<EOM
19414
19415 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19416 EOM
19417 $cat >try.c <<EOCP
19418 #$i_stdlib I_STDLIB
19419 #ifdef I_STDLIB
19420 #  include <stdlib.h>
19421 #endif
19422 #include <string.h>
19423 #$i_langinfo I_LANGINFO
19424 #ifdef I_LANGINFO
19425 #  include <langinfo.h>
19426 #endif
19427 #$i_pthread I_PTHREAD
19428 #ifdef I_PTHREAD
19429 #  include <pthread.h>
19430 #endif
19431 #$i_locale I_LOCALE
19432 #ifdef I_LOCALE
19433 #  include <locale.h>
19434 #endif
19435
19436 void *
19437 thread_start(void * arg)
19438 {
19439     nl_langinfo(RADIXCHAR);
19440 }
19441
19442 int main() {
19443     char * main_buffer;
19444     char save_main_buffer[1000];
19445     pthread_t subthread;
19446     pthread_attr_t attr;
19447
19448     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19449
19450     /* If too large for our generous allowance, just assume we don't have
19451      * it. */
19452     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19453         exit(1);
19454     }
19455
19456     strcpy(save_main_buffer, main_buffer);
19457
19458     if (pthread_attr_init(&attr) != 0) {
19459         exit(1);
19460     }
19461
19462     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19463         exit(1);
19464     }
19465
19466     if (pthread_join(subthread, NULL) != 0) {
19467         exit(1);
19468     }
19469
19470     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19471 }
19472 EOCP
19473 case "$usethreads" in
19474     define)
19475         set try
19476         if eval $compile; then
19477             echo "Your system has nl_langinfo_l()..." >&4
19478             if $run ./try; then
19479                 echo "and it is thread-safe (just as I'd hoped)." >&4
19480                 d_thread_safe_nl_langinfo_l="$define"
19481                 echo "$d_thread_safe_nl_langinfo_l" >&4
19482             else
19483                 echo "but it isn't thread-safe, so we won't use it." >&4
19484             fi
19485         else
19486             echo "your system does not have nl_langinfo_l()" >&4
19487         fi
19488         ;;
19489     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19490 esac
19491 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19492         d_thread_safe_nl_langinfo_l="$undef"
19493 fi
19494 $rm_try
19495
19496 : see if time exists
19497 echo " "
19498 if test "X$d_time" = X -o X"$timetype" = X; then
19499     if set time val -f d_time; eval $csym; $val; then
19500                 echo 'time() found.' >&4
19501                 val="$define"
19502                 rp="What is the type returned by time() on this system?"
19503                 set time_t timetype long stdio.h sys/types.h
19504                 eval $typedef_ask
19505     else
19506                 echo 'time() not found, hope that will do.' >&4
19507                 val="$undef"
19508                 timetype='int';
19509     fi
19510     set d_time
19511     eval $setvar
19512 fi
19513
19514 : see if timegm exists
19515 set timegm d_timegm
19516 eval $inlibc
19517
19518 : see if this is a sys/times.h system
19519 set sys/times.h i_systimes
19520 eval $inhdr
19521
19522 : see if times exists
19523 echo " "
19524 if set times val -f d_times; eval $csym; $val; then
19525         echo 'times() found.' >&4
19526         d_times="$define"
19527         inc=''
19528         case "$i_systimes" in
19529         "$define") inc='sys/times.h';;
19530         esac
19531         rp="What is the type returned by times() on this system?"
19532         set clock_t clocktype long stdio.h sys/types.h $inc
19533         eval $typedef_ask
19534 else
19535         echo 'times() NOT found, hope that will do.' >&4
19536         d_times="$undef"
19537         clocktype='int'
19538 fi
19539
19540 : see if tmpnam_r exists
19541 set tmpnam_r d_tmpnam_r
19542 eval $inlibc
19543 case "$d_tmpnam_r" in
19544 "$define")
19545         hdrs="$i_systypes sys/types.h define stdio.h "
19546         case "$d_tmpnam_r_proto:$usethreads" in
19547         ":define")      d_tmpnam_r_proto=define
19548                 set d_tmpnam_r_proto tmpnam_r $hdrs
19549                 eval $hasproto ;;
19550         *)      ;;
19551         esac
19552         case "$d_tmpnam_r_proto" in
19553         define)
19554         case "$tmpnam_r_proto" in
19555         ''|0) try='char* tmpnam_r(char*);'
19556         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19557         esac
19558         case "$tmpnam_r_proto" in
19559         ''|0)   d_tmpnam_r=undef
19560                 tmpnam_r_proto=0
19561                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19562         * )     case "$tmpnam_r_proto" in
19563                 REENTRANT_PROTO*) ;;
19564                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19565                 esac
19566                 echo "Prototype: $try" ;;
19567         esac
19568         ;;
19569         *)      case "$usethreads" in
19570                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19571                 esac
19572                 d_tmpnam_r=undef
19573                 tmpnam_r_proto=0
19574                 ;;
19575         esac
19576         ;;
19577 *)      tmpnam_r_proto=0
19578         ;;
19579 esac
19580
19581 : see if towlower exists
19582 set towlower d_towlower
19583 eval $inlibc
19584
19585 : see if trunc exists
19586 set trunc d_trunc
19587 eval $inlibc
19588
19589 : see if truncate exists
19590 set truncate d_truncate
19591 eval $inlibc
19592
19593 : see if ttyname_r exists
19594 set ttyname_r d_ttyname_r
19595 eval $inlibc
19596 case "$d_ttyname_r" in
19597 "$define")
19598         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19599         case "$d_ttyname_r_proto:$usethreads" in
19600         ":define")      d_ttyname_r_proto=define
19601                 set d_ttyname_r_proto ttyname_r $hdrs
19602                 eval $hasproto ;;
19603         *)      ;;
19604         esac
19605         case "$d_ttyname_r_proto" in
19606         define)
19607         case "$ttyname_r_proto" in
19608         ''|0) try='int ttyname_r(int, char*, size_t);'
19609         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19610         esac
19611         case "$ttyname_r_proto" in
19612         ''|0) try='int ttyname_r(int, char*, int);'
19613         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19614         esac
19615         case "$ttyname_r_proto" in
19616         ''|0) try='char* ttyname_r(int, char*, int);'
19617         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19618         esac
19619         case "$ttyname_r_proto" in
19620         ''|0)   d_ttyname_r=undef
19621                 ttyname_r_proto=0
19622                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19623         * )     case "$ttyname_r_proto" in
19624                 REENTRANT_PROTO*) ;;
19625                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19626                 esac
19627                 echo "Prototype: $try" ;;
19628         esac
19629         ;;
19630         *)      case "$usethreads" in
19631                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19632                 esac
19633                 d_ttyname_r=undef
19634                 ttyname_r_proto=0
19635                 ;;
19636         esac
19637         ;;
19638 *)      ttyname_r_proto=0
19639         ;;
19640 esac
19641
19642 : see if tzname[] exists
19643 echo " "
19644 if set tzname val -a d_tzname; eval $csym; $val; then
19645         val="$define"
19646         echo 'tzname[] found.' >&4
19647 else
19648         val="$undef"
19649         echo 'tzname[] NOT found.' >&4
19650 fi
19651 set d_tzname
19652 eval $setvar
19653
19654 : Check if is a multiplatform env
19655 case "$osname" in
19656 darwin) multiarch="$define" ;;
19657 esac
19658 case "$multiarch" in
19659 ''|[nN]*) multiarch="$undef" ;;
19660 esac
19661
19662 : check for ordering of bytes in a UV
19663 echo " "
19664 case "$multiarch" in
19665 *$define*)
19666         $cat <<EOM
19667 You seem to be doing a multiarchitecture build,
19668 skipping the byteorder check.
19669
19670 EOM
19671         byteorder='ffff'
19672         ;;
19673 *)
19674         case "$byteorder" in
19675         '')
19676                 $cat <<'EOM'
19677 In the following, larger digits indicate more significance.  A big-endian
19678 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19679 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19680 machines may have weird orders like 3412.  A Cray will report 87654321,
19681 an Alpha will report 12345678. If the test program works the default is
19682 probably right.
19683 I'm now running the test program...
19684 EOM
19685                 $cat >try.c <<EOCP
19686 #include <stdio.h>
19687 #$i_stdlib I_STDLIB
19688 #ifdef I_STDLIB
19689 #include <stdlib.h>
19690 #endif
19691 #include <sys/types.h>
19692 typedef $uvtype UV;
19693 int main()
19694 {
19695         int i;
19696         union {
19697                 UV l;
19698                 char c[$uvsize];
19699         } u;
19700
19701         if ($uvsize > 4)
19702                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19703         else
19704                 u.l = (UV)0x04030201;
19705         for (i = 0; i < $uvsize; i++)
19706                 printf("%c", u.c[i]+'0');
19707         printf("\n");
19708         exit(0);
19709 }
19710 EOCP
19711                 xxx_prompt=y
19712                 set try
19713                 if eval $compile && $run ./try > /dev/null; then
19714                         dflt=`$run ./try`
19715                         case "$dflt" in
19716                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19717                                 echo "(The test program ran ok.)"
19718                                 echo "byteorder=$dflt"
19719                                 xxx_prompt=n
19720                         ;;
19721                         ????|????????) echo "(The test program ran ok.)" ;;
19722                         *) echo "(The test program didn't run right for some reason.)" ;;
19723                         esac
19724                 else
19725                         dflt='4321'
19726                         cat <<'EOM'
19727 (I can't seem to compile the test program.  Guessing big-endian...)
19728 EOM
19729                 fi
19730                 case "$xxx_prompt" in
19731                 y)
19732                         rp="What is the order of bytes in $uvtype?"
19733                         . ./myread
19734                         byteorder="$ans"
19735                         ;;
19736                 *)      byteorder=$dflt
19737                         ;;
19738                 esac
19739                 ;;
19740         esac
19741         $rm_try
19742         ;;
19743 esac
19744
19745 : Checking 32bit alignedness
19746 $cat <<EOM
19747
19748 Checking to see whether you can access character data unalignedly...
19749 EOM
19750 case "$d_u32align" in
19751 '')   $cat >try.c <<EOCP
19752 #include <stdio.h>
19753 #$i_stdlib I_STDLIB
19754 #ifdef I_STDLIB
19755 #include <stdlib.h>
19756 #endif
19757 #define U32 $u32type
19758 #define BYTEORDER 0x$byteorder
19759 #define U8 $u8type
19760 #include <signal.h>
19761 #ifdef SIGBUS
19762 $signal_t bletch(int s) { exit(4); }
19763 #endif
19764 int main() {
19765 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19766     volatile U8 buf[8];
19767     volatile U32 *up;
19768     int i;
19769
19770     if (sizeof(U32) != 4) {
19771         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19772         exit(1);
19773     }
19774
19775     fflush(stdout);
19776
19777 #ifdef SIGBUS
19778     signal(SIGBUS, bletch);
19779 #endif
19780
19781     buf[0] = 0;
19782     buf[1] = 0;
19783     buf[2] = 0;
19784     buf[3] = 1;
19785     buf[4] = 0;
19786     buf[5] = 0;
19787     buf[6] = 0;
19788     buf[7] = 1;
19789
19790     for (i = 0; i < 4; i++) {
19791         up = (U32*)(buf + i);
19792         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19793                (*up == 1 << (8*(3-i)))  /* little-endian */
19794               )
19795            )
19796         {
19797             printf("read failed (%x)\n", *up);
19798             exit(2);
19799         }
19800     }
19801
19802     /* write test */
19803     for (i = 0; i < 4; i++) {
19804         up = (U32*)(buf + i);
19805         *up = 0xBeef;
19806         if (*up != 0xBeef) {
19807             printf("write failed (%x)\n", *up);
19808             exit(3);
19809         }
19810     }
19811
19812     exit(0);
19813 #else
19814     printf("1\n");
19815     exit(1);
19816 #endif
19817     return 0;
19818 }
19819 EOCP
19820 set try
19821 if eval $compile_ok; then
19822         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19823         $run ./try 2>&1 >/dev/null
19824         case "$?" in
19825         0)      cat >&4 <<EOM
19826 You can access character data pretty unalignedly.
19827 EOM
19828                 d_u32align="$undef"
19829                 ;;
19830         *)      cat >&4 <<EOM
19831 It seems that you must access character data in an aligned manner.
19832 EOM
19833                 d_u32align="$define"
19834                 ;;
19835         esac
19836 else
19837         rp='Can you access character data at unaligned addresses?'
19838         dflt='n'
19839         . ./myread
19840         case "$ans" in
19841         [yY]*)  d_u32align="$undef"  ;;
19842         *)      d_u32align="$define" ;;
19843         esac
19844 fi
19845 $rm_try
19846 ;;
19847 esac
19848
19849 : see if ualarm exists
19850 set ualarm d_ualarm
19851 eval $inlibc
19852
19853 : see if umask exists
19854 set umask d_umask
19855 eval $inlibc
19856
19857 : see if unordered exists
19858 set unordered d_unordered
19859 eval $inlibc
19860
19861 : see if unsetenv exists
19862 set unsetenv d_unsetenv
19863 eval $inlibc
19864
19865 : see if usleep exists
19866 set usleep d_usleep
19867 eval $inlibc
19868
19869 : see if prototype for usleep is available
19870 echo " "
19871 set d_usleepproto usleep $i_unistd unistd.h
19872 eval $hasproto
19873
19874 : see if ustat exists
19875 set ustat d_ustat
19876 eval $inlibc
19877
19878 : see if closedir exists
19879 set closedir d_closedir
19880 eval $inlibc
19881
19882 case "$d_closedir" in
19883 "$define")
19884         echo " "
19885         echo "Checking whether closedir() returns a status..." >&4
19886         cat > try.c <<EOM
19887 #$i_dirent I_DIRENT             /**/
19888 #$i_sysdir I_SYS_DIR            /**/
19889 #$i_sysndir I_SYS_NDIR          /**/
19890 #$i_systypes I_SYS_TYPES        /**/
19891
19892 #if defined(I_SYS_TYPES)
19893 #include <sys/types.h>
19894 #endif
19895 #if defined(I_DIRENT)
19896 #include <dirent.h>
19897 #else
19898 #ifdef I_SYS_NDIR
19899 #include <sys/ndir.h>
19900 #else
19901 #ifdef I_SYS_DIR
19902 #include <sys/dir.h>
19903 #endif
19904 #endif
19905 #endif
19906 int main() { return closedir(opendir(".")); }
19907 EOM
19908         set try
19909         if eval $compile_ok; then
19910                 if $run ./try > /dev/null 2>&1 ; then
19911                         echo "Yes, it does."
19912                         val="$undef"
19913                 else
19914                         echo "No, it doesn't."
19915                         val="$define"
19916                 fi
19917         else
19918                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19919                 val="$define"
19920         fi
19921         ;;
19922 *)
19923         val="$undef";
19924         ;;
19925 esac
19926 set d_void_closedir
19927 eval $setvar
19928 $rm_try
19929
19930 : see if there is a wait4
19931 set wait4 d_wait4
19932 eval $inlibc
19933
19934 : see if waitpid exists
19935 set waitpid d_waitpid
19936 eval $inlibc
19937
19938 : see if wcrtomb exists
19939 set wcrtomb d_wcrtomb
19940 eval $inlibc
19941
19942 : look for wcscmp
19943 echo " "
19944 $cat >try.c <<'EOCP'
19945 #include <stdio.h>
19946 #include <wchar.h>
19947 int main ()
19948 {
19949     wchar_t *s = L" ";
19950     return (wcscmp (s, s) ? 1 : 0);
19951     }
19952 EOCP
19953 set try
19954 val="$undef"
19955 if eval $compile; then
19956     `$run ./try`
19957     case "$?" in
19958         0)  echo "A working wcscmp() found." >&4
19959             val="$define" ;;
19960         *)  echo "wcscmp() found, but it doesn't work" >&4
19961             ;;
19962         esac
19963 else
19964     echo "wcscmp() NOT found." >&4
19965     fi
19966 set d_wcscmp
19967 eval $setvar
19968 $rm_try
19969
19970 : see if wcstombs exists
19971 set wcstombs d_wcstombs
19972 eval $inlibc
19973
19974 : look for wcsxfrm
19975 echo " "
19976 $cat >try.c <<'EOCP'
19977 #include <errno.h>
19978 #include <wchar.h>
19979 int main ()
19980 {
19981     wchar_t dst[4], *src = L" ";
19982     errno = 0;
19983     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19984     }
19985 EOCP
19986 set try
19987 val="$undef"
19988 if eval $compile; then
19989     `$run ./try`
19990     case "$?" in
19991         0)  echo "A working wcsxfrm() found." >&4
19992             val="$define" ;;
19993         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19994             ;;
19995         esac
19996 else
19997     echo "wcsxfrm() NOT found." >&4
19998     fi
19999 set d_wcsxfrm
20000 eval $setvar
20001 $rm_try
20002
20003 : see if wctomb exists
20004 set wctomb d_wctomb
20005 eval $inlibc
20006
20007 : see if writev exists
20008 set writev d_writev
20009 eval $inlibc
20010
20011 : check for alignment requirements
20012 echo " "
20013 case "$alignbytes" in
20014     '') echo "Checking alignment constraints..." >&4
20015         $cat >try.c <<EOCP
20016 #include <stdio.h>
20017 struct foobar {
20018     char foo;
20019     $nvtype bar;
20020 } try_algn;
20021 int main()
20022 {
20023     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20024     return(0);
20025 }
20026 EOCP
20027         set try
20028         if eval $compile_ok; then
20029             dflt=`$run ./try`
20030         else
20031             dflt='8'
20032             echo "(I can't seem to compile the test program...)"
20033         fi
20034         case "$multiarch" in
20035             *$define*)
20036                 : The usual safe value is 8, but Darwin with -Duselongdouble
20037                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20038                 : Configure to pick a larger value if needed.
20039                 if $test "$dflt" -lt 8; then
20040                     dflt='8'
20041                     echo "Setting alignment to 8 for multiarch support.">&4
20042                 fi
20043                 ;;
20044         esac
20045         ;;
20046     *) dflt="$alignbytes"
20047         ;;
20048 esac
20049 rp="Doubles must be aligned on a how-many-byte boundary?"
20050 . ./myread
20051 alignbytes="$ans"
20052 $rm_try
20053
20054 : set the base revision
20055 baserev=5.0
20056
20057 : length of character in bytes. Is always 1, otherwise it is not C
20058 : This used to be a test using sizeof
20059 charsize=1
20060
20061 : Check for the number of bits in a character
20062 case "$charbits" in
20063 '')     echo "Checking how long a character is (in bits)..." >&4
20064         $cat >try.c <<EOCP
20065 #include <stdio.h>
20066 int main ()
20067 {
20068     int n;
20069     unsigned char c;
20070     for (c = 1, n = 0; c; c <<= 1, n++) ;
20071     printf ("%d\n", n);
20072     return (0);
20073     }
20074 EOCP
20075         set try
20076         if eval $compile_ok; then
20077                 dflt=`$run ./try`
20078         else
20079                 dflt='8'
20080                 echo "(I can't seem to compile the test program.  Guessing...)"
20081         fi
20082         ;;
20083 *)
20084         dflt="$charbits"
20085         ;;
20086 esac
20087 rp="What is the length of a character (in bits)?"
20088 . ./myread
20089 charbits="$ans"
20090 $rm_try
20091 case "$charbits" in
20092 8)      ;;
20093 *)      cat >&4 << EOM
20094 Your system has an unsigned character size of $charbits bits, which
20095 is rather unusual (normally it is 8 bits).  Perl likely will not work
20096 correctly on your system, with subtle bugs in various places.
20097 EOM
20098         rp='Do you really want to continue?'
20099         dflt='n'
20100         . ./myread
20101         case "$ans" in
20102                 [yY])   echo >&4 "Okay, continuing."    ;;
20103                 *)      exit 1                          ;;
20104         esac
20105 esac
20106
20107 : how do we concatenate cpp tokens here?
20108 echo " "
20109 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20110 $cat >cpp_stuff.c <<'EOCP'
20111 #define RCAT(a,b)a/**/b
20112 #define ACAT(a,b)a ## b
20113 RCAT(Rei,ser)
20114 ACAT(Cir,cus)
20115 EOCP
20116 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20117 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20118         echo "Oh!  Smells like ANSI's been here." >&4
20119         echo "We can catify or stringify, separately or together!"
20120         cpp_stuff=42
20121 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20122         echo "Ah, yes!  The good old days!" >&4
20123         echo "However, in the good old days we don't know how to stringify and"
20124         echo "catify at the same time."
20125         cpp_stuff=1
20126 else
20127         $cat >&4 <<EOM
20128 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20129 You're going to have to edit the values of CAT[2-5] in config.h...
20130 EOM
20131         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20132 fi
20133 $rm -f cpp_stuff.*
20134
20135 : see if this is a db.h system
20136 set db.h i_db
20137 eval $inhdr
20138
20139 case "$i_db" in
20140 $define)
20141         : Check db version.
20142         echo " "
20143         echo "Checking Berkeley DB version ..." >&4
20144         $cat >try.c <<EOCP
20145 #include <sys/types.h>
20146 #include <stdio.h>
20147 #$i_stdlib I_STDLIB
20148 #ifdef I_STDLIB
20149 #include <stdlib.h>
20150 #endif
20151 #include <db.h>
20152 int main(int argc, char *argv[])
20153 {
20154 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20155     int Major, Minor, Patch ;
20156     unsigned long Version ;
20157     (void)db_version(&Major, &Minor, &Patch) ;
20158     if (argc == 2) {
20159         printf("%d %d %d %d %d %d\n",
20160                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20161                Major, Minor, Patch);
20162         exit(0);
20163     }
20164     printf("You have Berkeley DB Version 2 or greater.\n");
20165
20166     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20167                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20168     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20169                 Major, Minor, Patch) ;
20170
20171     /* check that db.h & libdb are compatible */
20172     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20173         printf("db.h and libdb are incompatible.\n") ;
20174         exit(3);
20175     }
20176
20177     printf("db.h and libdb are compatible.\n") ;
20178
20179     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20180                 + DB_VERSION_PATCH ;
20181
20182     /* needs to be >= 2.3.4 */
20183     if (Version < 2003004) {
20184     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20185         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20186         exit(2);
20187     }
20188
20189     exit(0);
20190 #else
20191 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20192     if (argc == 2) {
20193         printf("1 0 0\n");
20194         exit(0);
20195     }
20196     printf("You have Berkeley DB Version 1.\n");
20197     exit(0);    /* DB version < 2: the coast is clear. */
20198 #else
20199     exit(1);    /* <db.h> not Berkeley DB? */
20200 #endif
20201 #endif
20202 }
20203 EOCP
20204         set try
20205         if eval $compile_ok && $run ./try; then
20206                 echo 'Looks OK.' >&4
20207                 set `$run ./try 1`
20208                 db_version_major=$1
20209                 db_version_minor=$2
20210                 db_version_patch=$3
20211         else
20212                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20213                 i_db=$undef
20214                 case " $libs " in
20215                 *"-ldb "*)
20216                         : Remove db from list of libraries to use
20217                         echo "Removing unusable -ldb from library list" >&4
20218                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20219                         shift
20220                         libs="$*"
20221                         echo "libs = $libs" >&4
20222                         ;;
20223                 esac
20224         fi
20225         $rm_try
20226         ;;
20227 esac
20228
20229 case "$i_db" in
20230 define)
20231         : Check the return type needed for hash
20232         echo " "
20233         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20234         $cat >try.c <<EOCP
20235 #include <sys/types.h>
20236 #include <db.h>
20237
20238 #ifndef DB_VERSION_MAJOR
20239 u_int32_t hash_cb (const void* ptr, size_t size)
20240 {
20241         return 0;
20242 }
20243 HASHINFO info;
20244 int main()
20245 {
20246         info.hash = hash_cb;
20247 }
20248 #endif
20249 EOCP
20250         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20251                 if $contains warning try.out >>/dev/null 2>&1 ; then
20252                         db_hashtype='int'
20253                 else
20254                         db_hashtype='u_int32_t'
20255                 fi
20256         else
20257                 : XXX Maybe we should just give up here.
20258                 db_hashtype=u_int32_t
20259                 $cat try.out >&4
20260                 echo "Help:  I can't seem to compile the db test program." >&4
20261                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20262         fi
20263         $rm_try
20264         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20265         ;;
20266 *)      db_hashtype=u_int32_t
20267         ;;
20268 esac
20269 case "$i_db" in
20270 define)
20271         : Check the return type needed for prefix
20272         echo " "
20273         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20274         cat >try.c <<EOCP
20275 #include <sys/types.h>
20276 #include <db.h>
20277
20278 #ifndef DB_VERSION_MAJOR
20279 size_t prefix_cb (const DBT *key1, const DBT *key2)
20280 {
20281         return 0;
20282 }
20283 BTREEINFO info;
20284 int main()
20285 {
20286         info.prefix = prefix_cb;
20287 }
20288 #endif
20289 EOCP
20290         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20291                 if $contains warning try.out >>/dev/null 2>&1 ; then
20292                         db_prefixtype='int'
20293                 else
20294                         db_prefixtype='size_t'
20295                 fi
20296         else
20297                 db_prefixtype='size_t'
20298                 : XXX Maybe we should just give up here.
20299                 $cat try.out >&4
20300                 echo "Help:  I can't seem to compile the db test program." >&4
20301                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20302         fi
20303         $rm_try
20304         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20305         ;;
20306 *)      db_prefixtype='size_t'
20307         ;;
20308 esac
20309
20310 : Include . in @INC
20311 $cat <<EOM
20312
20313 Historically Perl has provided a final fallback of the current working
20314 directory '.' when searching for a library. This, however, can lead to
20315 problems when a Perl program which loads optional modules is called from
20316 a shared directory. This can lead to executing unexpected code.
20317
20318 EOM
20319
20320 # When changing to exclude by default:
20321 case "$default_inc_excludes_dot" in
20322     $undef|false|[nN]*) dflt="n" ;;
20323     *)                  dflt="y" ;;
20324 esac
20325 # To turn exclude off by default:
20326 #case "$default_inc_excludes_dot" in
20327 #    $define|true|[yY]*) dflt="y" ;;
20328 #    *)                  dflt="n" ;;
20329 #esac
20330
20331 rp='Exclude '.' from @INC by default? '
20332 . ./myread
20333 case "$ans" in
20334     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20335     *)          default_inc_excludes_dot="$define" ;;
20336 esac
20337
20338 : Check what kind of inf/nan your system has
20339 $echo "Checking the kind of infinities and nans you have..." >&4
20340 $echo "(The following tests may crash.  That's okay.)" >&4
20341 $cat >try.c <<EOP
20342 #define DOUBLESIZE $doublesize
20343 #$d_longdbl HAS_LONG_DOUBLE
20344 #ifdef HAS_LONG_DOUBLE
20345 #define LONG_DOUBLESIZE $longdblsize
20346 #define LONG_DOUBLEKIND $longdblkind
20347 #endif
20348 #include <math.h>
20349 #include <string.h>
20350 #include <stdio.h>
20351 /* Note that whether the sign bit is on or off
20352  * for NaN depends on the CPU/FPU, and possibly
20353  * can be affected by the build toolchain.
20354  *
20355  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20356  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20357  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20358  * (respectively) as opposed to the more usual
20359  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20360  *
20361  * Pre-IEEE-754 floating point format do not even have inf/nan support
20362  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20363  * to even mention, causing immediate SIGFPE or equivalent: this is
20364  * the case with VAX floating point, for example.
20365  */
20366 static void bytes(void *v, unsigned int n) {
20367   unsigned char *p = (unsigned char *)v;
20368   int i;
20369   for (i = 0; i < n; i++) {
20370     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20371   }
20372 }
20373 int main(int argc, char *argv[]) {
20374    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20375     * because some compilers are 'smart' and not only warn but refuse to
20376     * compile such 'illegal' values. */
20377    double dinf = exp(1e9);
20378    double dnan = sqrt(-1.0);
20379 #ifdef HAS_LONG_DOUBLE
20380    long double ldinf = (long double)exp(1e9);
20381    long double ldnan = (long double)sqrt(-1.0);
20382 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20383 /* the 80-bit long doubles might have garbage in their excess bytes */
20384     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20385     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20386 # endif
20387   if (argc == 2) {
20388     switch (argv[1][0]) {
20389     case '1': bytes(&dinf, sizeof(dinf)); break;
20390     case '2': bytes(&dnan, sizeof(dnan)); break;
20391     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20392     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20393 #endif
20394     }
20395   }
20396   return 0;
20397 }
20398 EOP
20399 set try
20400 if eval $compile; then
20401     doubleinfbytes=`$run ./try 1`
20402     doublenanbytes=`$run ./try 2`
20403     case "$d_longdbl" in
20404     $define)
20405       longdblinfbytes=`$run ./try 3`
20406       longdblnanbytes=`$run ./try 4`
20407       ;;
20408     esac
20409 else
20410     # Defaults in case the above test program failed.
20411     case "$doublekind" in
20412     1) # IEEE 754 32-bit LE
20413        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20414        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20415        ;;
20416     2) # IEEE 754 32-bit BE
20417        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20418        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20419        ;;
20420     3) # IEEE 754 64-bit LE
20421        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20422        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20423        ;;
20424     4) # IEEE 754 64-bit BE
20425        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20426        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20427        ;;
20428     5) # IEEE 754 128-bit LE
20429        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20430        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20431        ;;
20432     6) # IEEE 754 128-bit BE
20433        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20434        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20435        ;;
20436     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20437        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20438        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20439        ;;
20440     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20441        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20442        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20443        ;;
20444     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20445        doubleinfbytes=$undef
20446        doublenanbytes=$undef
20447        ;;
20448     *) # No idea.
20449        doubleinfbytes=$undef
20450        doublenanbytes=$undef
20451        ;;
20452     esac
20453     case "$longdblkind" in
20454     1) # IEEE 754 128-bit LE
20455        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20456        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20457        ;;
20458     2) # IEEE 754 128-bit BE
20459        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20460        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20461        ;;
20462     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20463        case "$longdblsize" in
20464        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20465            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20466            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20467            ;;
20468        16) # x86_64
20469            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20470            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20471            ;;
20472        *)  # No idea.
20473            longdblinfbytes=$undef
20474            longdblnanbytes=$undef
20475        ;;
20476        esac
20477        ;;
20478     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20479        case "$longdblsize" in
20480        12) # 32-bit system
20481            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20482            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20483            ;;
20484        16) # 64-bit system
20485            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20486            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20487            ;;
20488        *)  # No idea.
20489            longdblinfbytes=$undef
20490            longdblnanbytes=$undef
20491        ;;
20492        esac
20493        ;;
20494     5) # 128-bit LE-LE "double double"
20495        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20496        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20497        ;;
20498     6) # 128-bit BE-BE "double double"
20499        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20500        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20501        ;;
20502     7) # 128-bit LE-BE "double double"
20503        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20504        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20505        ;;
20506     8) # 128-bit BE-LE "double double"
20507        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20508        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20509        ;;
20510     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20511        longdblinfbytes=$undef
20512        longdblnanbytes=$undef
20513        ;;
20514     *) # No idea.
20515        longdblinfbytes=$undef
20516        longdblnanbytes=$undef
20517        ;;
20518     esac
20519 fi
20520 # In case the program crashed the values are empty, turn them undef.
20521 case "$doubleinfbytes" in
20522 '') doubleinfbytes=$undef ;;
20523 esac
20524 case "$doublenanbytes" in
20525 '') doublenanbytes=$undef ;;
20526 esac
20527 case "$longdblinfbytes" in
20528 '') longdblinfbytes=$undef ;;
20529 esac
20530 case "$longdblnanbytes" in
20531 '') longdblnanbytes=$undef ;;
20532 esac
20533 $rm_try
20534
20535 : Check the length of the double mantissa
20536 $echo "Checking how many mantissa bits your doubles have..." >&4
20537 $cat >try.c <<EOP
20538 #$i_sunmath I_SUNMATH
20539 #include <float.h>
20540 #ifdef I_SUNMATH
20541 # include <sunmath.h>
20542 #endif
20543 #ifdef DBL_MANT_DIG
20544 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20545 #endif
20546 #include <stdio.h>
20547 int main(int argc, char *argv[]) {
20548 #ifdef BITS
20549   printf("%d\n", BITS);
20550 #endif
20551   return 0;
20552 }
20553 EOP
20554 set try
20555 if eval $compile; then
20556     doublemantbits=`$run ./try`
20557 else
20558     doublemantbits="$undef"
20559 fi
20560 $rm_try
20561
20562 : Check the length of the longdouble mantissa
20563 $echo "Checking how many mantissa bits your long doubles have..." >&4
20564 $cat >try.c <<EOP
20565 #$i_sunmath I_SUNMATH
20566 #include <float.h>
20567 #ifdef I_SUNMATH
20568 # include <sunmath.h>
20569 #endif
20570 #$d_longdbl HAS_LONG_DOUBLE
20571 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20572 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20573 /* This format has no implicit bit.  Beware, however, that for
20574  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20575  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20576  * and the top bit must have been one since 387, zero is plain invalid.
20577  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20578 #  define BITS LDBL_MANT_DIG
20579 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20580 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20581  * reason e.g. Irix thinks 107.  But in any case, we want only
20582  * the number of real bits, the implicit bits are of no interest.  */
20583 #  define BITS 2 * (DBL_MANT_DIG - 1)
20584 # else
20585 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20586 # endif
20587 #endif
20588 #include <stdio.h>
20589 int main(int argc, char *argv[]) {
20590 #ifdef BITS
20591   printf("%d\n", BITS);
20592 #endif
20593   return 0;
20594 }
20595 EOP
20596 set try
20597 if eval $compile; then
20598     longdblmantbits=`$run ./try`
20599 else
20600     longdblmantbits="$undef"
20601 fi
20602 $rm_try
20603
20604 : Check the length of the NV mantissa
20605 $echo "Checking how many mantissa bits your NVs have..." >&4
20606 if test "X$usequadmath" = "X$define"; then
20607   nvmantbits=112 # 128-1-15
20608 else
20609   if test "X$nvsize" = "X$doublesize"; then
20610     nvmantbits="$doublemantbits"
20611   else
20612      if test "X$nvsize" = "X$longdblsize"; then
20613        nvmantbits="$longdblmantbits"
20614      else
20615        nvmantbits="$undef"
20616      fi
20617   fi
20618 fi
20619
20620 : How can we generate normalized random numbers ?
20621 echo " "
20622 echo "Using our internal random number implementation..." >&4
20623
20624 case "$ccflags" in
20625 *-Dmy_rand=*|*-Dmy_srand=*)
20626         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20627         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20628         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20629         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20630         ;;
20631 esac
20632
20633 randfunc=Perl_drand48
20634 drand01="Perl_drand48()"
20635 seedfunc="Perl_drand48_init"
20636 randbits=48
20637 randseedtype=U32
20638
20639 : Probe whether dtrace builds an object, as newer Illumos requires an input
20640 : object file that uses at least one of the probes defined in the .d file
20641 case "$usedtrace" in
20642 $define)
20643     case "$dtracexnolibs" in
20644     $define|true|[yY]*)
20645         dtracexnolibs=$define
20646         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20647         ;;
20648     ' '|'')
20649         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20650              dtracexnolibs=$define
20651              echo "Your dtrace accepts -xnolibs"
20652         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20653              dtracexnolibs=$undef
20654              echo "Your dtrace doesn't accept -xnolibs"
20655         else
20656              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20657              exit 1
20658         fi
20659         ;;
20660     *)
20661         dtracexnolibs=$undef
20662         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20663         ;;
20664     esac
20665     case $dtracexnolibs in
20666     $define) xnolibs=-xnolibs ;;
20667     *) xnolibs= ;;
20668     esac
20669
20670     case "$dtraceobject" in
20671     $define|true|[yY]*)
20672         dtraceobject=$define
20673         ;;
20674     ' '|'')
20675         $cat >try.c <<EOM
20676 #include "perldtrace.h"
20677 int main(void) {
20678     PERL_LOADED_FILE("dummy");
20679     return 0;
20680 }
20681 EOM
20682         dtraceobject=$undef
20683         if $cc -c -o try.o $optimize $ccflags try.c \
20684                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20685                 dtraceobject=$define
20686             echo "Your dtrace builds an object file"
20687         fi
20688         ;;
20689     *) dtraceobject=$undef ;;
20690     esac
20691     $rm_try perldtrace.o perldtrace.h
20692 esac
20693
20694 : Determine if this is an EBCDIC system
20695 echo " "
20696 echo "Determining whether or not we are on an EBCDIC system..." >&4
20697 $cat >try.c <<'EOM'
20698 int main()
20699 {
20700   if ('M'==0xd4) return 0;
20701   return 1;
20702 }
20703 EOM
20704
20705 val=$undef
20706 set try
20707 if eval $compile_ok; then
20708         if $run ./try; then
20709                 echo "You seem to speak EBCDIC." >&4
20710                 val="$define"
20711         else
20712                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20713         fi
20714 else
20715         echo "I'm unable to compile the test program." >&4
20716         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20717 fi
20718 $rm_try
20719 set ebcdic
20720 eval $setvar
20721
20722 : Check how to flush
20723 echo " "
20724 $cat >&4 <<EOM
20725 Checking how to flush all pending stdio output...
20726 EOM
20727 # I only know how to find the first 32 possibly open files on SunOS.
20728 # See also hints/sunos_4_1.sh and util.c  --AD
20729 case "$osname" in
20730 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20731 esac
20732 $cat >>try.c <<EOCP
20733 #include <stdio.h>
20734 #$i_stdlib I_STDLIB
20735 #ifdef I_STDLIB
20736 #include <stdlib.h>
20737 #endif
20738 #$i_unistd I_UNISTD
20739 #ifdef I_UNISTD
20740 # include <unistd.h>
20741 #endif
20742 #$d_sysconf HAS_SYSCONF
20743 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20744 #ifdef HAS_STDIO_STREAM_ARRAY
20745 # define STDIO_STREAM_ARRAY $stdio_stream_array
20746 #endif
20747 int main() {
20748   FILE* p;
20749   unlink("try.out");
20750   p = fopen("try.out", "w");
20751 #ifdef TRY_FPUTC
20752   fputc('x', p);
20753 #else
20754 # ifdef TRY_FPRINTF
20755   fprintf(p, "x");
20756 # endif
20757 #endif
20758 #ifdef TRY_FFLUSH_NULL
20759   fflush(NULL);
20760 #endif
20761 #ifdef TRY_FFLUSH_ALL
20762   {
20763     long open_max = -1;
20764 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20765     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20766 # else
20767 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20768     open_max = sysconf(_SC_OPEN_MAX);
20769 #  else
20770 #   ifdef FOPEN_MAX
20771     open_max = FOPEN_MAX;
20772 #   else
20773 #    ifdef OPEN_MAX
20774     open_max = OPEN_MAX;
20775 #    else
20776 #     ifdef _NFILE
20777     open_max = _NFILE;
20778 #     endif
20779 #    endif
20780 #   endif
20781 #  endif
20782 # endif
20783 # ifdef HAS_STDIO_STREAM_ARRAY
20784     if (open_max > 0) {
20785       long i;
20786       for (i = 0; i < open_max; i++)
20787             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20788                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20789                 STDIO_STREAM_ARRAY[i]._flag)
20790                 fflush(&STDIO_STREAM_ARRAY[i]);
20791     }
20792   }
20793 # endif
20794 #endif
20795   _exit(42);
20796 }
20797 EOCP
20798 : first we have to find out how _not_ to flush
20799 $to try.c
20800 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20801     output=''
20802     set try -DTRY_FPUTC
20803     if eval $compile; then
20804             $run ./try 2>/dev/null
20805             code="$?"
20806             $from try.out
20807             if $test ! -s try.out -a "X$code" = X42; then
20808                 output=-DTRY_FPUTC
20809             fi
20810     fi
20811     case "$output" in
20812     '')
20813             set try -DTRY_FPRINTF
20814             if eval $compile; then
20815                     $run ./try 2>/dev/null
20816                     code="$?"
20817                     $from try.out
20818                     if $test ! -s try.out -a "X$code" = X42; then
20819                         output=-DTRY_FPRINTF
20820                     fi
20821             fi
20822         ;;
20823     esac
20824 fi
20825 : check for fflush NULL behavior
20826 case "$fflushNULL" in
20827 '')     set try -DTRY_FFLUSH_NULL $output
20828         if eval $compile; then
20829                 $run ./try 2>/dev/null
20830                 code="$?"
20831                 $from try.out
20832                 if $test -s try.out -a "X$code" = X42; then
20833                         fflushNULL="`$cat try.out`"
20834                 else
20835                         if $test "X$code" != X42; then
20836                                 $cat >&4 <<EOM
20837 (If this test failed, don't worry, we'll try another method shortly.)
20838 EOM
20839                         fi
20840                 fi
20841         fi
20842         $rm -f core try.core core.try.*
20843         case "$fflushNULL" in
20844         x)      $cat >&4 <<EOM
20845 Your fflush(NULL) works okay for output streams.
20846 Let's see if it clobbers input pipes...
20847 EOM
20848 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20849 # bug that improperly flushes the input end of pipes.  So we avoid the
20850 # autoflush on fork/system/exec support for now. :-(
20851 $cat >tryp.c <<EOCP
20852 #include <stdio.h>
20853 int
20854 main(int argc, char **argv)
20855 {
20856     char buf[1024];
20857     int i;
20858     char *bp = buf;
20859     while (1) {
20860         while ((i = getc(stdin)) != -1
20861                && (*bp++ = i) != '\n'
20862                && bp < &buf[1024])
20863         /* DO NOTHING */ ;
20864         *bp = '\0';
20865         fprintf(stdout, "%s", buf);
20866         fflush(NULL);
20867         if (i == -1)
20868             return 0;
20869         bp = buf;
20870     }
20871 }
20872 EOCP
20873                 fflushNULL="$define"
20874                 set tryp
20875                 if eval $compile; then
20876                     $rm -f tryp.out
20877                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20878                     if $test "X$targethost" != X; then
20879                         $to tryp.c
20880                         $to tryp
20881                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20882                     else
20883                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20884                     fi
20885                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20886                        $cat >&4 <<EOM
20887 fflush(NULL) seems to behave okay with input streams.
20888 EOM
20889                         fflushNULL="$define"
20890                     else
20891                         $cat >&4 <<EOM
20892 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20893 EOM
20894                         fflushNULL="$undef"
20895                     fi
20896                 fi
20897                 $rm -f core tryp.c tryp.core core.tryp.*
20898                 ;;
20899         '')     $cat >&4 <<EOM
20900 Your fflush(NULL) isn't working (contrary to ANSI C).
20901 EOM
20902                 fflushNULL="$undef"
20903                 ;;
20904         *)      $cat >&4 <<EOM
20905 Cannot figure out whether your fflush(NULL) works or not.
20906 I'm assuming it doesn't (contrary to ANSI C).
20907 EOM
20908                 fflushNULL="$undef"
20909                 ;;
20910         esac
20911         ;;
20912 $define|true|[yY]*)
20913         fflushNULL="$define"
20914         ;;
20915 *)
20916         fflushNULL="$undef"
20917         ;;
20918 esac
20919 : check explicit looping only if NULL did not work, and if the pipe
20920 : bug does not show up on an explicit flush too
20921 case "$fflushNULL" in
20922 "$undef")
20923         $cat >tryp.c <<EOCP
20924 #include <stdio.h>
20925 int
20926 main(int argc, char **argv)
20927 {
20928     char buf[1024];
20929     int i;
20930     char *bp = buf;
20931     while (1) {
20932         while ((i = getc(stdin)) != -1
20933                && (*bp++ = i) != '\n'
20934                && bp < &buf[1024])
20935         /* DO NOTHING */ ;
20936         *bp = '\0';
20937         fprintf(stdout, "%s", buf);
20938         fflush(stdin);
20939         if (i == -1)
20940             return 0;
20941         bp = buf;
20942     }
20943 }
20944 EOCP
20945         set tryp
20946         if eval $compile; then
20947             $rm -f tryp.out
20948             if $test "X$targethost" != X; then
20949                 $to tryp.c
20950                 $to tryp
20951                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20952             else
20953                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20954             fi
20955             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20956                $cat >&4 <<EOM
20957 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20958 EOM
20959                 : now check for fflushall behaviour
20960                 case "$fflushall" in
20961                 '')     set try -DTRY_FFLUSH_ALL $output
20962                         if eval $compile; then
20963                                 $cat >&4 <<EOM
20964 (Now testing the other method--but note that this also may fail.)
20965 EOM
20966                                 $run ./try 2>/dev/null
20967                                 code=$?
20968                                 $from try.out
20969                                 if $test -s try.out -a "X$code" = X42; then
20970                                         fflushall="`$cat try.out`"
20971                                 fi
20972                         fi
20973                         $rm_try
20974                         case "$fflushall" in
20975                         x)      $cat >&4 <<EOM
20976 Whew. Flushing explicitly all the stdio streams works.
20977 EOM
20978                                 fflushall="$define"
20979                                 ;;
20980                         '')     $cat >&4 <<EOM
20981 Sigh. Flushing explicitly all the stdio streams doesn't work.
20982 EOM
20983                                 fflushall="$undef"
20984                                 ;;
20985                         *)      $cat >&4 <<EOM
20986 Cannot figure out whether flushing stdio streams explicitly works or not.
20987 I'm assuming it doesn't.
20988 EOM
20989                                 fflushall="$undef"
20990                                 ;;
20991                         esac
20992                         ;;
20993                 "$define"|true|[yY]*)
20994                         fflushall="$define"
20995                         ;;
20996                 *)
20997                         fflushall="$undef"
20998                         ;;
20999                 esac
21000             else
21001                 $cat >&4 <<EOM
21002 All is futile.  Even fflush(stdin) clobbers input pipes!
21003 EOM
21004                 fflushall="$undef"
21005             fi
21006         else
21007             fflushall="$undef"
21008         fi
21009         $rm -f core tryp.c tryp.core core.tryp.*
21010         ;;
21011 *)      fflushall="$undef"
21012         ;;
21013 esac
21014
21015 case "$fflushNULL$fflushall" in
21016 undefundef)
21017         $cat <<EOM
21018 OK, I give up.  I cannot figure out how to flush pending stdio output.
21019 We won't be flushing handles at all before fork/exec/popen.
21020 EOM
21021         ;;
21022 esac
21023 $rm_try tryp
21024
21025 : Store the full pathname to the ar program for use in the C program
21026 : Respect a hint or command line value for full_ar.
21027 case "$full_ar" in
21028 '') full_ar=$ar ;;
21029 esac
21030
21031 : Store the full pathname to the sed program for use in the C program
21032 full_sed=$sed
21033
21034 : see what type gids are declared as in the kernel
21035 echo " "
21036 echo "Looking for the type for group ids returned by getgid()."
21037 set gid_t gidtype xxx stdio.h sys/types.h
21038 eval $typedef
21039 case "$gidtype" in
21040 xxx)
21041         xxx=`./findhdr sys/user.h`
21042         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21043         case $1 in
21044         unsigned) dflt="$1 $2" ;;
21045         *) dflt="$1" ;;
21046         esac
21047         ;;
21048 *) dflt="$gidtype";;
21049 esac
21050 case "$gidtype" in
21051 gid_t) echo "gid_t found." ;;
21052 *)      rp="What is the type for group ids returned by getgid()?"
21053         . ./myread
21054         gidtype="$ans"
21055         ;;
21056 esac
21057
21058 : Check the size of GID
21059 echo " "
21060 case "$gidtype" in
21061 *_t) zzz="$gidtype"     ;;
21062 *)   zzz="gid"          ;;
21063 esac
21064 echo "Checking the size of $zzz..." >&4
21065 cat > try.c <<EOCP
21066 #include <sys/types.h>
21067 #include <stdio.h>
21068 #$i_stdlib I_STDLIB
21069 #ifdef I_STDLIB
21070 #include <stdlib.h>
21071 #endif
21072 int main() {
21073     printf("%d\n", (int)sizeof($gidtype));
21074     exit(0);
21075 }
21076 EOCP
21077 set try
21078 if eval $compile_ok; then
21079         yyy=`$run ./try`
21080         case "$yyy" in
21081         '')     gidsize=4
21082                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21083                 ;;
21084         *)      gidsize=$yyy
21085                 echo "Your $zzz is $gidsize bytes long."
21086                 ;;
21087         esac
21088 else
21089         gidsize=4
21090         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21091 fi
21092
21093 : Check if GID is signed
21094 echo " "
21095 case "$gidtype" in
21096 *_t) zzz="$gidtype"     ;;
21097 *)   zzz="gid"          ;;
21098 esac
21099 echo "Checking the sign of $zzz..." >&4
21100 cat > try.c <<EOCP
21101 #include <sys/types.h>
21102 #include <stdio.h>
21103 int main() {
21104         $gidtype foo = -1;
21105         if (foo < 0)
21106                 printf("-1\n");
21107         else
21108                 printf("1\n");
21109 }
21110 EOCP
21111 set try
21112 if eval $compile; then
21113         yyy=`$run ./try`
21114         case "$yyy" in
21115         '')     gidsign=1
21116                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21117                 ;;
21118         *)      gidsign=$yyy
21119                 case "$gidsign" in
21120                  1) echo "Your $zzz is unsigned." ;;
21121                 -1) echo "Your $zzz is signed."   ;;
21122                 esac
21123                 ;;
21124         esac
21125 else
21126         gidsign=1
21127         echo "(I can't compile the test program--guessing unsigned.)" >&4
21128 fi
21129
21130 : Check 64bit sizes
21131 echo " "
21132
21133 if $test X"$quadtype" != X; then
21134
21135 echo "Checking how to print 64-bit integers..." >&4
21136
21137 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21138         $cat >try.c <<'EOCP'
21139 #include <sys/types.h>
21140 #include <stdio.h>
21141 int main() {
21142   int q = 12345678901;
21143   printf("%ld\n", q);
21144 }
21145 EOCP
21146         set try
21147         if eval $compile; then
21148                 yyy=`$run ./try`
21149                 case "$yyy" in
21150                 12345678901)
21151                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21152                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21153                         echo "We will use %d."
21154                         ;;
21155                 esac
21156         fi
21157 fi
21158
21159 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21160         $cat >try.c <<'EOCP'
21161 #include <sys/types.h>
21162 #include <stdio.h>
21163 int main() {
21164   long q = 12345678901;
21165   printf("%ld\n", q);
21166 }
21167 EOCP
21168         set try
21169         if eval $compile; then
21170                 yyy=`$run ./try`
21171                 case "$yyy" in
21172                 12345678901)
21173                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21174                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21175                         echo "We will use %ld."
21176                         ;;
21177                 esac
21178         fi
21179 fi
21180
21181 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21182         $cat >try.c <<'EOCP'
21183 #include <sys/types.h>
21184 #include <inttypes.h>
21185 #include <stdio.h>
21186 int main() {
21187   int64_t q = 12345678901;
21188   printf("%" PRId64 "\n", q);
21189 }
21190 EOCP
21191         set try
21192         if eval $compile; then
21193                 yyy=`$run ./try`
21194                 case "$yyy" in
21195                 12345678901)
21196                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21197                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21198                         echo "We will use the C9X style."
21199                         ;;
21200                 esac
21201         fi
21202 fi
21203
21204 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21205         $cat >try.c <<EOCP
21206 #include <sys/types.h>
21207 #include <stdio.h>
21208 int main() {
21209   $quadtype q = 12345678901;
21210   printf("%Ld\n", q);
21211 }
21212 EOCP
21213         set try
21214         if eval $compile; then
21215                 yyy=`$run ./try`
21216                 case "$yyy" in
21217                 12345678901)
21218                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21219                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21220                         echo "We will use %Ld."
21221                         ;;
21222                 esac
21223         fi
21224 fi
21225
21226 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21227         $cat >try.c <<'EOCP'
21228 #include <sys/types.h>
21229 #include <stdio.h>
21230 int main() {
21231   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21232   printf("%lld\n", q);
21233 }
21234 EOCP
21235         set try
21236         if eval $compile; then
21237                 yyy=`$run ./try`
21238                 case "$yyy" in
21239                 12345678901)
21240                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21241                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21242                         echo "We will use the %lld style."
21243                         ;;
21244                 esac
21245         fi
21246 fi
21247
21248 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21249         $cat >try.c <<EOCP
21250 #include <sys/types.h>
21251 #include <stdio.h>
21252 int main() {
21253   $quadtype q = 12345678901;
21254   printf("%qd\n", q);
21255 }
21256 EOCP
21257         set try
21258         if eval $compile; then
21259                 yyy=`$run ./try`
21260                 case "$yyy" in
21261                 12345678901)
21262                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21263                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21264                         echo "We will use %qd."
21265                         ;;
21266                 esac
21267         fi
21268 fi
21269
21270 if $test X"$sPRId64" = X; then
21271         echo "Cannot figure out how to print 64-bit integers." >&4
21272 fi
21273 $rm_try
21274
21275 fi
21276
21277 case "$sPRId64" in
21278 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21279         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21280         ;;
21281 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21282         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21283         ;;
21284 esac
21285
21286 : Check format strings for internal types
21287 echo " "
21288 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21289
21290 if $test X"$ivsize" = X8; then
21291         ivdformat="$sPRId64"
21292         uvuformat="$sPRIu64"
21293         uvoformat="$sPRIo64"
21294         uvxformat="$sPRIx64"
21295         uvXUformat="$sPRIXU64"
21296 else
21297         if $test X"$ivsize" = X"$longsize"; then
21298                 ivdformat='"ld"'
21299                 uvuformat='"lu"'
21300                 uvoformat='"lo"'
21301                 uvxformat='"lx"'
21302                 uvXUformat='"lX"'
21303         else
21304                 if $test X"$ivsize" = X"$intsize"; then
21305                         ivdformat='"d"'
21306                         uvuformat='"u"'
21307                         uvoformat='"o"'
21308                         uvxformat='"x"'
21309                         uvXUformat='"X"'
21310                 else
21311                         : far out
21312                         if $test X"$ivsize" = X"$shortsize"; then
21313                                 ivdformat='"hd"'
21314                                 uvuformat='"hu"'
21315                                 uvoformat='"ho"'
21316                                 uvxformat='"hx"'
21317                                 uvXUformat='"hX"'
21318                         fi
21319                 fi
21320         fi
21321 fi
21322
21323 if $test X"$usequadmath" = X"$define"; then
21324     nveformat='"Qe"'
21325     nvfformat='"Qf"'
21326     nvgformat='"Qg"'
21327     nvEUformat='"QE"'
21328     nvFUformat='"QF"'
21329     nvGUformat='"QG"'
21330 else
21331     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21332         nveformat="$sPRIeldbl"
21333         nvfformat="$sPRIfldbl"
21334         nvgformat="$sPRIgldbl"
21335         nvEUformat="$sPRIEUldbl"
21336         nvFUformat="$sPRIFUldbl"
21337         nvGUformat="$sPRIGUldbl"
21338     else
21339         nveformat='"e"'
21340         nvfformat='"f"'
21341         nvgformat='"g"'
21342         nvEUformat='"E"'
21343         nvFUformat='"F"'
21344         nvGUformat='"G"'
21345     fi
21346 fi
21347
21348 case "$ivdformat" in
21349 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21350     exit 1
21351     ;;
21352 esac
21353
21354 : Check format string for GID
21355
21356 echo " "
21357 $echo "Checking the format string to be used for gids..." >&4
21358
21359 case "$gidsign" in
21360 -1)     if $test X"$gidsize" = X"$ivsize"; then
21361                 gidformat="$ivdformat"
21362         else
21363                 if $test X"$gidsize" = X"$longsize"; then
21364                         gidformat='"ld"'
21365                 else
21366                         if $test X"$gidsize" = X"$intsize"; then
21367                                 gidformat='"d"'
21368                         else
21369                                 if $test X"$gidsize" = X"$shortsize"; then
21370                                         gidformat='"hd"'
21371                                 fi
21372                         fi
21373                 fi
21374         fi
21375         ;;
21376 *)      if $test X"$gidsize" = X"$uvsize"; then
21377                 gidformat="$uvuformat"
21378         else
21379                 if $test X"$gidsize" = X"$longsize"; then
21380                         gidformat='"lu"'
21381                 else
21382                         if $test X"$gidsize" = X"$intsize"; then
21383                                 gidformat='"u"'
21384                         else
21385                                 if $test X"$gidsize" = X"$shortsize"; then
21386                                         gidformat='"hu"'
21387                                 fi
21388                         fi
21389                 fi
21390         fi
21391         ;;
21392 esac
21393
21394 : see if getgroups exists
21395 set getgroups d_getgrps
21396 eval $inlibc
21397
21398 : see if setgroups exists
21399 set setgroups d_setgrps
21400 eval $inlibc
21401
21402 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21403 echo " "
21404 case "$d_getgrps$d_setgrps" in
21405 *define*)
21406         case "$groupstype" in
21407         '') dflt="$gidtype" ;;
21408         *)  dflt="$groupstype" ;;
21409         esac
21410         $cat <<EOM
21411 What type of pointer is the second argument to getgroups() and setgroups()?
21412 Usually this is the same as group ids, $gidtype, but not always.
21413
21414 EOM
21415         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21416         . ./myread
21417         groupstype="$ans"
21418         ;;
21419 *)  groupstype="$gidtype";;
21420 esac
21421
21422 : check whether make sets MAKE
21423 echo " "
21424 echo "Checking if your $make program sets \$(MAKE)..." >&4
21425 case "$make_set_make" in
21426 '')
21427         $sed 's/^X //' > testmake.mak << 'EOF'
21428 Xall:
21429 X       @echo 'maketemp="$(MAKE)"'
21430 EOF
21431         case "`$make -f testmake.mak 2>/dev/null`" in
21432         *maketemp=*) make_set_make='#' ;;
21433         *)      make_set_make="MAKE=$make" ;;
21434         esac
21435         $rm -f testmake.mak
21436         ;;
21437 esac
21438 case "$make_set_make" in
21439 '#') echo "Yup, it does.";;
21440 *) echo "Nope, it doesn't.";;
21441 esac
21442
21443 : see what type is used for mode_t
21444 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21445 set mode_t modetype int stdio.h sys/types.h
21446 eval $typedef_ask
21447
21448 : see if we need va_copy
21449 echo " "
21450 $cat >try.c <<EOCP
21451 #include <stdarg.h>
21452 #include <stdio.h>
21453 #include <stdlib.h>
21454 #include <signal.h>
21455
21456 int
21457 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21458 {
21459   return vfprintf(f, fmt, *valp);
21460 }
21461
21462 int
21463 myvfprintf(FILE *f, const  char *fmt, va_list val)
21464 {
21465   return ivfprintf(f, fmt, &val);
21466 }
21467
21468 int
21469 myprintf(char *fmt, ...)
21470 {
21471   va_list val;
21472   va_start(val, fmt);
21473   return myvfprintf(stdout, fmt, val);
21474 }
21475
21476 int
21477 main(int ac, char **av)
21478 {
21479   signal(SIGSEGV, exit);
21480
21481   myprintf("%s%cs all right, then\n", "that", '\'');
21482   exit(0);
21483 }
21484 EOCP
21485 set try
21486 if eval $compile && $run ./try 2>&1 >/dev/null; then
21487         case "`$run ./try`" in
21488         "that's all right, then")
21489                 okay=yes
21490                 ;;
21491         esac
21492 fi
21493 case "$okay" in
21494 yes)    echo "It seems that you don't need va_copy()." >&4
21495         need_va_copy="$undef"
21496         ;;
21497 *)      echo "It seems that va_copy() or similar will be needed." >&4
21498         need_va_copy="$define"
21499         ;;
21500 esac
21501 $rm_try
21502
21503 : see what type is used for size_t
21504 rp="What is the type used for the length parameter for string functions?"
21505 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21506 eval $typedef_ask
21507
21508 : check for type of arguments to gethostbyaddr.
21509 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21510         case "$d_gethbyaddr" in
21511         $define)
21512                 $cat <<EOM
21513
21514 Checking to see what type of arguments are accepted by gethostbyaddr().
21515 EOM
21516                 hdrs="$define sys/types.h
21517                         $d_socket sys/socket.h
21518                         $i_niin netinet/in.h
21519                         $i_netdb netdb.h
21520                         $i_unistd unistd.h"
21521                 : The first arg can 'char *' or 'void *'
21522                 : The second arg is some of integral type
21523                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21524                         for yyy in size_t long int; do
21525                                 case "$netdb_host_type" in
21526                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21527                                         if ./protochk "$try" $hdrs; then
21528                                                 echo "Your system accepts $xxx for the first arg."
21529                                                 echo "...and $yyy for the second arg."
21530                                                 netdb_host_type="$xxx"
21531                                                 netdb_hlen_type="$yyy"
21532                                         fi
21533                                         ;;
21534                                 esac
21535                         done
21536                 done
21537                 : In case none of those worked, prompt the user.
21538                 case "$netdb_host_type" in
21539                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21540                         dflt='char *'
21541                         . ./myread
21542                         netdb_host_type=$ans
21543                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21544                         dflt="$sizetype"
21545                         . ./myread
21546                         netdb_hlen_type=$ans
21547                         ;;
21548                 esac
21549                 ;;
21550         *)      : no gethostbyaddr, so pick harmless defaults
21551                 netdb_host_type='char *'
21552                 netdb_hlen_type="$sizetype"
21553                 ;;
21554         esac
21555         # Remove the "const" if needed. -- but then we'll have a
21556         # prototype clash!
21557         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21558 fi
21559
21560 : check for type of argument to gethostbyname.
21561 if test "X$netdb_name_type" = X ; then
21562         case "$d_gethbyname" in
21563         $define)
21564                 $cat <<EOM
21565
21566 Checking to see what type of argument is accepted by gethostbyname().
21567 EOM
21568                 hdrs="$define sys/types.h
21569                         $d_socket sys/socket.h
21570                         $i_niin netinet/in.h
21571                         $i_netdb netdb.h
21572                         $i_unistd unistd.h"
21573                 for xxx in "const char *" "char *"; do
21574                         case "$netdb_name_type" in
21575                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21576                                 if ./protochk "$try" $hdrs; then
21577                                         echo "Your system accepts $xxx."
21578                                         netdb_name_type="$xxx"
21579                                 fi
21580                                 ;;
21581                         esac
21582                 done
21583                 : In case none of those worked, prompt the user.
21584                 case "$netdb_name_type" in
21585                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21586                         dflt='char *'
21587                         . ./myread
21588                         netdb_name_type=$ans
21589                         ;;
21590                 esac
21591                 ;;
21592         *)      : no gethostbyname, so pick harmless default
21593                 netdb_name_type='char *'
21594                 ;;
21595         esac
21596 fi
21597
21598 : check for type of 1st argument to getnetbyaddr.
21599 if test "X$netdb_net_type" = X ; then
21600         case "$d_getnbyaddr" in
21601         $define)
21602                 $cat <<EOM
21603
21604 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21605 EOM
21606                 hdrs="$define sys/types.h
21607                         $d_socket sys/socket.h
21608                         $i_niin netinet/in.h
21609                         $i_netdb netdb.h
21610                         $i_unistd unistd.h"
21611                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21612                         case "$netdb_net_type" in
21613                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21614                                 if ./protochk "$try" $hdrs; then
21615                                         echo "Your system accepts $xxx."
21616                                         netdb_net_type="$xxx"
21617                                 fi
21618                                 ;;
21619                         esac
21620                 done
21621                 : In case none of those worked, prompt the user.
21622                 case "$netdb_net_type" in
21623                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21624                         dflt='long'
21625                         . ./myread
21626                         netdb_net_type=$ans
21627                         ;;
21628                 esac
21629                 ;;
21630         *)      : no getnetbyaddr, so pick harmless default
21631                 netdb_net_type='long'
21632                 ;;
21633         esac
21634 fi
21635 : locate the preferred pager for this system
21636 fn=f/
21637 case "$pager" in
21638 '')
21639         dflt=''
21640         case "$pg" in
21641         /*) dflt=$pg;;
21642         [a-zA-Z]:/*) dflt=$pg;;
21643         esac
21644         case "$more" in
21645         /*) dflt=$more;;
21646         [a-zA-Z]:/*) dflt=$more;;
21647         esac
21648         case "$less" in
21649         /*) dflt=$less;;
21650         [a-zA-Z]:/*) dflt=$less;;
21651         esac
21652         case "$dflt" in
21653         '') dflt=/usr/ucb/more;;
21654         esac
21655         ;;
21656 *)      dflt="$pager"
21657         ;;
21658 esac
21659 fn="f/($dflt)"
21660 echo " "
21661 rp='What pager is used on your system?'
21662 . ./getfile
21663 pager="$ans"
21664
21665 : see if ar generates random libraries by itself
21666 echo " "
21667 echo "Checking how to generate random libraries on your machine..." >&4
21668 echo 'int bar1() { return bar2(); }' > bar1.c
21669 echo 'int bar2() { return 2; }' > bar2.c
21670 $cat > foo.c <<EOP
21671 #$i_stdlib I_STDLIB
21672 #ifdef I_STDLIB
21673 #include <stdlib.h>
21674 #endif
21675 int main() { printf("%d\n", bar1()); exit(0); }
21676 EOP
21677 $cc $ccflags -c bar1.c >/dev/null 2>&1
21678 $cc $ccflags -c bar2.c >/dev/null 2>&1
21679 $cc $ccflags -c foo.c >/dev/null 2>&1
21680 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21681 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21682         $run ./foobar >/dev/null 2>&1; then
21683         echo "$ar appears to generate random libraries itself."
21684         orderlib=false
21685         if [ "X$ranlib" = "X" ]; then
21686             ranlib=":"
21687         fi
21688 elif $ar s bar$_a >/dev/null 2>&1 &&
21689         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21690         $run ./foobar >/dev/null 2>&1; then
21691                 echo "a table of contents needs to be added with '$ar s'."
21692                 orderlib=false
21693                 ranlib="$ar s"
21694 elif $ar ts bar$_a >/dev/null 2>&1 &&
21695         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21696         $run ./foobar >/dev/null 2>&1; then
21697                 echo "a table of contents needs to be added with '$ar ts'."
21698                 orderlib=false
21699                 ranlib="$ar ts"
21700 else
21701         case "$ranlib" in
21702         :) ranlib='';;
21703         '')
21704                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21705                 $test -f $ranlib || ranlib=''
21706                 ;;
21707         esac
21708         if $test -n "$ranlib"; then
21709                 echo "your system has '$ranlib'; we'll use that."
21710                 orderlib=false
21711         else
21712                 echo "your system doesn't seem to support random libraries"
21713                 echo "so we'll use lorder and tsort to order the libraries."
21714                 orderlib=true
21715                 ranlib=":"
21716         fi
21717 fi
21718 $rm -f foo* bar*
21719
21720 : Check the max offset that gmtime and localtime accept
21721 echo "Checking max offsets that gmtime () accepts"
21722
21723 case "$sGMTIME_min/$sGMTIME_max" in
21724     0/0|/)
21725         $cat >try.c <<EOCP
21726 #include <sys/types.h>
21727 #include <stdio.h>
21728 #include <time.h>
21729
21730 int i;
21731 struct tm *tmp;
21732 time_t pt;
21733
21734 void gm_check (time_t t, int min_year, int max_year)
21735 {
21736     tmp = gmtime (&t);
21737     if ( tmp == NULL ||
21738         /* Check tm_year overflow */
21739          tmp->tm_year < min_year || tmp->tm_year > max_year)
21740         tmp = NULL;
21741     else
21742         pt = t;
21743     } /* gm_check */
21744
21745 int check_max ()
21746 {
21747     tmp = NULL;
21748     pt  = 0;
21749 #ifdef MAXLONG
21750     gm_check (MAXLONG, 69, 0x7fffffff);
21751 #endif
21752     if (tmp == NULL || tmp->tm_year < 0) {
21753         for (i = 63; i >= 0; i--) {
21754             time_t x = pt | ((time_t)1 << i);
21755             if (x < 0 || x < pt) continue;
21756             gm_check (x, 69, 0x7fffffff);
21757             }
21758         }
21759     printf ("sGMTIME_max=%ld\n", pt);
21760     return (0);
21761     } /* check_max */
21762
21763 int check_min ()
21764 {
21765     tmp = NULL;
21766     pt  = 0;
21767 #ifdef MINLONG
21768     gm_check (MINLONG, -1900, 70);
21769 #endif
21770     if (tmp == NULL) {
21771         for (i = 36; i >= 0; i--) {
21772             time_t x = pt - ((time_t)1 << i);
21773             if (x > 0) continue;
21774             gm_check (x, -1900, 70);
21775             }
21776         }
21777     printf ("sGMTIME_min=%ld\n", pt);
21778     return (0);
21779     } /* check_min */
21780
21781 int main (int argc, char *argv[])
21782 {
21783     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21784     check_max ();
21785     check_min ();
21786     return (0);
21787     } /* main */
21788 EOCP
21789         set try
21790         if eval $compile; then
21791             eval `$run ./try 2>/dev/null`
21792         else
21793             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21794             fi
21795         $rm_try
21796         ;;
21797     esac
21798
21799 echo "Checking max offsets that localtime () accepts"
21800
21801 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21802     0/0|/)
21803         $cat >try.c <<EOCP
21804 #include <sys/types.h>
21805 #include <stdio.h>
21806 #include <time.h>
21807
21808 int i;
21809 struct tm *tmp;
21810 time_t pt;
21811
21812 void local_check (time_t t, int min_year, int max_year)
21813 {
21814     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21815         tmp = NULL;
21816     else
21817         tmp = localtime (&t);
21818     if ( tmp == NULL ||
21819         /* Check tm_year overflow */
21820          tmp->tm_year < min_year || tmp->tm_year > max_year)
21821         tmp = NULL;
21822     else
21823         pt = t;
21824     } /* local_check */
21825
21826 int check_max ()
21827 {
21828     tmp = NULL;
21829     pt  = 0;
21830 #ifdef MAXLONG
21831     local_check (MAXLONG, 69, 0x7fffffff);
21832 #endif
21833     if (tmp == NULL || tmp->tm_year < 0) {
21834         for (i = 63; i >= 0; i--) {
21835             time_t x = pt | ((time_t)1 << i);
21836             if (x < 0 || x < pt) continue;
21837             local_check (x, 69, 0x7fffffff);
21838             }
21839         }
21840     printf ("sLOCALTIME_max=%ld\n", pt);
21841     return (0);
21842    } /* check_max */
21843
21844 int check_min ()
21845 {
21846     tmp = NULL;
21847     pt  = 0;
21848 #ifdef MINLONG
21849     local_check (MINLONG, -1900, 70);
21850 #endif
21851     if (tmp == NULL) {
21852         for (i = 36; i >= 0; i--) {
21853             time_t x = pt - ((time_t)1 << i);
21854             if (x > 0) continue;
21855             local_check (x, -1900, 70);
21856             }
21857         }
21858     printf ("sLOCALTIME_min=%ld\n", pt);
21859     return (0);
21860     } /* check_min */
21861
21862 int main (int argc, char *argv[])
21863 {
21864     check_max ();
21865     check_min ();
21866     return (0);
21867     } /* main */
21868 EOCP
21869         set try
21870         if eval $compile; then
21871             eval `$run ./try 2>/dev/null`
21872         else
21873             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21874             fi
21875         $rm_try
21876         ;;
21877     esac
21878
21879 : check for type of arguments to select.
21880 case "$selecttype" in
21881 '') case "$d_select" in
21882         $define)
21883                 echo " "
21884                 $cat <<EOM
21885 Checking to see what type of arguments are accepted by select().
21886 EOM
21887                 hdrs="$define sys/types.h
21888                         $i_systime sys/time.h
21889                         $i_sysselct sys/select.h
21890                         $d_socket sys/socket.h"
21891                 : The first arg can be int, unsigned, or size_t
21892                 : The last arg may or may not be 'const'
21893                 val=''
21894                 : void pointer has been seen but using that
21895                 : breaks the selectminbits test
21896                 for xxx in 'fd_set *' 'int *'; do
21897                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21898                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21899                                         case "$val" in
21900                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21901                                                 if ./protochk "$try" $hdrs; then
21902                                                         echo "Your system accepts $xxx."
21903                                                         val="$xxx"
21904                                                 fi
21905                                                 ;;
21906                                         esac
21907                                 done
21908                         done
21909                 done
21910                 case "$val" in
21911                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21912                         case "$d_fd_set" in
21913                                 $define) dflt="fd_set *" ;;
21914                                 *)              dflt="int *" ;;
21915                         esac
21916                         . ./myread
21917                         val=$ans
21918                         ;;
21919                 esac
21920                 selecttype="$val"
21921                 ;;
21922         *)      : no select, so pick a harmless default
21923                 selecttype='int *'
21924                 ;;
21925         esac
21926         ;;
21927 esac
21928
21929 : check for the select 'width'
21930 case "$selectminbits" in
21931 '') safebits=`expr $ptrsize \* 8`
21932     case "$d_select" in
21933         $define)
21934                 $cat <<EOM
21935
21936 Checking to see on how many bits at a time your select() operates...
21937 EOM
21938                 $cat >try.c <<EOCP
21939 #include <sys/types.h>
21940 #$i_time I_TIME
21941 #$i_systime I_SYS_TIME
21942 #$i_systimek I_SYS_TIME_KERNEL
21943 #ifdef I_TIME
21944 #   include <time.h>
21945 #endif
21946 #ifdef I_SYS_TIME
21947 #   ifdef I_SYS_TIME_KERNEL
21948 #       define KERNEL
21949 #   endif
21950 #   include <sys/time.h>
21951 #   ifdef I_SYS_TIME_KERNEL
21952 #       undef KERNEL
21953 #   endif
21954 #endif
21955 #$i_sysselct I_SYS_SELECT
21956 #ifdef I_SYS_SELECT
21957 #include <sys/select.h>
21958 #endif
21959 #$d_socket HAS_SOCKET
21960 #ifdef HAS_SOCKET
21961 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21962 #endif
21963 #include <stdio.h>
21964 #$i_stdlib I_STDLIB
21965 #ifdef I_STDLIB
21966 #include <stdlib.h>
21967 #endif
21968 $selecttype b;
21969 #define S sizeof(*(b))
21970 #define MINBITS 64
21971 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21972 #define NBITS  (NBYTES * 8)
21973 int main() {
21974     char *s = (char *)malloc(NBYTES);
21975     struct timeval t;
21976     int i;
21977     FILE* fp;
21978     int fd;
21979
21980     if (!s)
21981         exit(1);
21982     fclose(stdin);
21983     fp = fopen("try.c", "r");
21984     if (fp == 0)
21985       exit(2);
21986     fd = fileno(fp);
21987     if (fd < 0)
21988       exit(3);
21989     b = ($selecttype)s;
21990     for (i = 0; i < NBITS; i++)
21991         FD_SET(i, b);
21992     t.tv_sec  = 0;
21993     t.tv_usec = 0;
21994     select(fd + 1, b, 0, 0, &t);
21995     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21996     free(s);
21997     printf("%d\n", i + 1);
21998     return 0;
21999 }
22000 EOCP
22001                 set try
22002                 if eval $compile_ok; then
22003                         selectminbits=`$run ./try 2>/dev/null`
22004                         case "$selectminbits" in
22005                         '')     cat >&4 <<EOM
22006 Cannot figure out on how many bits at a time your select() operates.
22007 I'll play safe and guess it is $safebits bits.
22008 EOM
22009                                 selectminbits=$safebits
22010                                 bits="$safebits bits"
22011                                 ;;
22012                         1)      bits="1 bit" ;;
22013                         *)      bits="$selectminbits bits" ;;
22014                         esac
22015                         echo "Your select() operates on $bits at a time." >&4
22016                 else
22017                         rp='What is the minimum number of bits your select() operates on?'
22018                         case "$byteorder" in
22019                         12345678)       dflt=64 ;;
22020                         1234)           dflt=32 ;;
22021                         *)              dflt=1  ;;
22022                         esac
22023                         . ./myread
22024                         val=$ans
22025                         selectminbits="$val"
22026                 fi
22027                 $rm_try
22028                 ;;
22029         *)      : no select, so pick a harmless default
22030                 selectminbits=$safebits
22031                 ;;
22032         esac
22033         ;;
22034 esac
22035
22036 : Trace out the files included by signal.h, then look for SIGxxx names.
22037 case "$sig_num_init" in
22038 '')
22039 if [ "X$fieldn" = X ]; then
22040         : Just make some guesses.  We check them later.
22041         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22042 else
22043         xxx=`echo '#include <signal.h>' |
22044         $cppstdin $cppminus $cppflags 2>/dev/null |
22045         $grep '^[       ]*#.*include' |
22046         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22047                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22048 fi
22049 xxxfiles=''
22050 for xx in $xxx /dev/null ; do
22051         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22052 done
22053 case "$xxxfiles" in
22054 '')     xxxfiles=`./findhdr signal.h` ;;
22055 esac
22056 xxx=`awk '
22057 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22058         print substr($2, 4, 20)
22059 }
22060 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22061         print substr($3, 4, 20)
22062 }' $xxxfiles`
22063 : Append some common names just in case the awk scan failed.
22064 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22065 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22066 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22067 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22068 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22069
22070 : generate a few handy files for later
22071 $cat > signal.c <<EOCP
22072 #include <sys/types.h>
22073 #include <signal.h>
22074 #$i_stdlib I_STDLIB
22075 #ifdef I_STDLIB
22076 #include <stdlib.h>
22077 #endif
22078 #include <stdio.h>
22079 int main() {
22080
22081 /* Strange style to avoid deeply-nested #if/#else/#endif */
22082 #ifndef NSIG
22083 #  ifdef _NSIG
22084 #    define NSIG (_NSIG)
22085 #  endif
22086 #endif
22087
22088 #ifndef NSIG
22089 #  ifdef SIGMAX
22090 #    define NSIG (SIGMAX+1)
22091 #  endif
22092 #endif
22093
22094 #ifndef NSIG
22095 #  ifdef SIG_MAX
22096 #    define NSIG (SIG_MAX+1)
22097 #  endif
22098 #endif
22099
22100 #ifndef NSIG
22101 #  ifdef _SIG_MAX
22102 #    define NSIG (_SIG_MAX+1)
22103 #  endif
22104 #endif
22105
22106 #ifndef NSIG
22107 #  ifdef MAXSIG
22108 #    define NSIG (MAXSIG+1)
22109 #  endif
22110 #endif
22111
22112 #ifndef NSIG
22113 #  ifdef MAX_SIG
22114 #    define NSIG (MAX_SIG+1)
22115 #  endif
22116 #endif
22117
22118 #ifndef NSIG
22119 #  ifdef SIGARRAYSIZE
22120 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22121 #  endif
22122 #endif
22123
22124 #ifndef NSIG
22125 #  ifdef _sys_nsig
22126 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22127 #  endif
22128 #endif
22129
22130 /* Default to some arbitrary number that's big enough to get most
22131    of the common signals.
22132 */
22133 #ifndef NSIG
22134 #    define NSIG 50
22135 #endif
22136
22137 printf("NSIG %d\n", NSIG);
22138
22139 #ifndef JUST_NSIG
22140
22141 EOCP
22142
22143 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22144 {
22145         printf "#ifdef SIG"; printf $1; printf "\n"
22146         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22147         printf $1; printf ");\n"
22148         printf "#endif\n"
22149 }
22150 END {
22151         printf "#endif /* JUST_NSIG */\n";
22152         printf "exit(0);\n}\n";
22153 }
22154 ' >>signal.c
22155 $cat >signal.awk <<'EOP'
22156 BEGIN { ndups = 0 }
22157 $1 ~ /^NSIG$/ { nsig = $2 }
22158 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22159     if ($2 > maxsig) { maxsig = $2 }
22160     if (sig_name[$2]) {
22161         dup_name[ndups] = $1
22162         dup_num[ndups] = $2
22163         ndups++
22164     }
22165     else {
22166         sig_name[$2] = $1
22167         sig_num[$2] = $2
22168     }
22169 }
22170 END {
22171     if (nsig == 0) {
22172         nsig = maxsig + 1
22173     }
22174     printf("NSIG %d\n", nsig);
22175     for (n = 1; n < nsig; n++) {
22176         if (sig_name[n]) {
22177             printf("%s %d\n", sig_name[n], sig_num[n])
22178         }
22179         else {
22180             printf("NUM%d %d\n", n, n)
22181         }
22182     }
22183     for (n = 0; n < ndups; n++) {
22184         printf("%s %d\n", dup_name[n], dup_num[n])
22185     }
22186 }
22187 EOP
22188 $cat >signal_cmd <<EOS
22189 $startsh
22190 if $test -s signal.lst; then
22191     echo "Using your existing signal.lst file"
22192         exit 0
22193 fi
22194 xxx="$xxx"
22195 EOS
22196 $cat >>signal_cmd <<'EOS'
22197
22198 set signal
22199 if eval $compile_ok; then
22200         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22201                 $uniq | $awk -f signal.awk >signal.lst
22202 else
22203         echo "(I can't seem be able to compile the whole test program)" >&4
22204         echo "(I'll try it in little pieces.)" >&4
22205         set signal -DJUST_NSIG
22206         if eval $compile_ok; then
22207                 $run ./signal$_exe > signal.nsg
22208                 $cat signal.nsg
22209         else
22210                 echo "I can't seem to figure out how many signals you have." >&4
22211                 echo "Guessing 50." >&4
22212                 echo 'NSIG 50' > signal.nsg
22213         fi
22214         : Now look at all the signal names, one at a time.
22215         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22216                 $cat > signal.c <<EOCP
22217 #include <sys/types.h>
22218 #include <signal.h>
22219 #include <stdio.h>
22220 int main() {
22221 printf("$xx %d\n", SIG${xx});
22222 return 0;
22223 }
22224 EOCP
22225                 set signal
22226                 if eval $compile; then
22227                         echo "SIG${xx} found."
22228                         $run ./signal$_exe  >> signal.ls1
22229                 else
22230                         echo "SIG${xx} NOT found."
22231                 fi
22232         done
22233         if $test -s signal.ls1; then
22234                 $cat signal.nsg signal.ls1 |
22235                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22236         fi
22237
22238 fi
22239 if $test -s signal.lst; then
22240         :
22241 else
22242         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22243         echo 'kill -l' >signal
22244         set X `csh -f <signal`
22245         $rm -f signal
22246         shift
22247         case $# in
22248         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22249         esac
22250         echo $@ | $tr ' ' $trnl | \
22251             $awk '{ printf "%s %d\n", $1, ++s; }
22252                   END { printf "NSIG %d\n", ++s }' >signal.lst
22253 fi
22254 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22255 EOS
22256 chmod a+x signal_cmd
22257 $eunicefix signal_cmd
22258 ;;
22259 esac
22260
22261 : generate list of signal names
22262 case "$sig_num_init" in
22263 '')
22264 echo " "
22265 case "$sig_name_init" in
22266 '') doinit=yes ;;
22267 *)  case "$sig_num_init" in
22268     ''|*,*) doinit=yes ;;
22269     esac ;;
22270 esac
22271 case "$doinit" in
22272 yes)
22273         echo "Generating a list of signal names and numbers..." >&4
22274         . ./signal_cmd
22275         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22276         sig_name=`$awk 'BEGIN { printf "ZERO " }
22277                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22278         sig_num=`$awk  'BEGIN { printf "0 " }
22279                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22280         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22281                              !/^NSIG/   { printf "\"%s\", ", $1 }
22282                              END        { printf "0\n" }' signal.lst`
22283         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22284                              !/^NSIG/   { printf "%d, ", $2}
22285                              END        { printf "0\n"}' signal.lst`
22286         ;;
22287 esac
22288 echo "The following $sig_count signals are available:"
22289 echo " "
22290 echo $sig_name | $awk \
22291 'BEGIN { linelen = 0 }
22292 {
22293         for (i = 1; i <= NF; i++) {
22294                 name = "SIG" $i " "
22295                 linelen = linelen + length(name)
22296                 if (linelen > 70) {
22297                         printf "\n"
22298                         linelen = length(name)
22299                 }
22300                 printf "%s", name
22301         }
22302         printf "\n"
22303 }'
22304 sig_size=`echo $sig_name | awk '{print NF}'`
22305 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22306 ;;
22307 esac
22308
22309 : Check size of size
22310 echo " "
22311 case "$sizetype" in
22312 *_t) zzz="$sizetype"    ;;
22313 *)   zzz="filesize"     ;;
22314 esac
22315 echo "Checking the size of $zzz..." >&4
22316 cat > try.c <<EOCP
22317 #include <sys/types.h>
22318 #include <stdio.h>
22319 #$i_stdlib I_STDLIB
22320 #ifdef I_STDLIB
22321 #include <stdlib.h>
22322 #endif
22323 int main() {
22324     printf("%d\n", (int)sizeof($sizetype));
22325     exit(0);
22326 }
22327 EOCP
22328 set try
22329 if eval $compile_ok; then
22330         yyy=`$run ./try`
22331         case "$yyy" in
22332         '')     sizesize=4
22333                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22334                 ;;
22335         *)      sizesize=$yyy
22336                 echo "Your $zzz size is $sizesize bytes."
22337                 ;;
22338         esac
22339 else
22340         sizesize=4
22341         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22342 fi
22343
22344 : check for socklen_t
22345 echo " "
22346 echo "Checking to see if you have socklen_t..." >&4
22347 $cat >try.c <<EOCP
22348 #include <sys/types.h>
22349 #$d_socket HAS_SOCKET
22350 #ifdef HAS_SOCKET
22351 #include <sys/socket.h>
22352 #endif
22353 int main() { socklen_t x = 16; }
22354 EOCP
22355 set try
22356 if eval $compile; then
22357         val="$define"
22358         echo "You have socklen_t."
22359 else
22360         val="$undef"
22361         echo "You do not have socklen_t."
22362         case "$sizetype" in
22363         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22364         esac
22365 fi
22366 $rm_try
22367 set d_socklen_t
22368 eval $setvar
22369
22370 : see if this is a socks.h system
22371 set socks.h i_socks
22372 eval $inhdr
22373
22374 : check for type of the size argument to socket calls
22375 case "$d_socket" in
22376 "$define")
22377         $cat <<EOM
22378
22379 Checking to see what type is the last argument of accept().
22380 EOM
22381         yyy=''
22382         case "$d_socklen_t" in
22383         "$define") yyy="$yyy socklen_t"
22384         esac
22385         yyy="$yyy $sizetype int long unsigned"
22386         for xxx in $yyy; do
22387                 case "$socksizetype" in
22388                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22389                         case "$usesocks" in
22390                         "$define")
22391                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22392                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22393                                         socksizetype="$xxx"
22394                                 fi
22395                                 ;;
22396                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22397                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22398                                         socksizetype="$xxx"
22399                                 fi
22400                                 ;;
22401                         esac
22402                         ;;
22403                 esac
22404         done
22405 : In case none of those worked, prompt the user.
22406         case "$socksizetype" in
22407         '')     rp='What is the type for socket address structure sizes?'
22408                 dflt='int'
22409                 . ./myread
22410                 socksizetype=$ans
22411                 ;;
22412         esac
22413         ;;
22414 *)      : no sockets, so pick relatively harmless default
22415         socksizetype='int'
22416         ;;
22417 esac
22418
22419 : see what type is used for signed size_t
22420 set ssize_t ssizetype int stdio.h sys/types.h
22421 eval $typedef
22422 dflt="$ssizetype"
22423 $cat > try.c <<EOM
22424 #include <stdio.h>
22425 #$i_stdlib I_STDLIB
22426 #ifdef I_STDLIB
22427 #include <stdlib.h>
22428 #endif
22429 #include <sys/types.h>
22430 #define Size_t $sizetype
22431 #define SSize_t $dflt
22432 int main()
22433 {
22434         if (sizeof(Size_t) == sizeof(SSize_t))
22435                 printf("$dflt\n");
22436         else if (sizeof(Size_t) == sizeof(int))
22437                 printf("int\n");
22438         else
22439                 printf("long\n");
22440         exit(0);
22441 }
22442 EOM
22443 echo " "
22444 set try
22445 if eval $compile_ok && $run ./try > /dev/null; then
22446         ssizetype=`$run ./try`
22447         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22448 else
22449         $cat >&4 <<EOM
22450 Help! I can't compile and run the ssize_t test program: please enlighten me!
22451 (This is probably a misconfiguration in your system or libraries, and
22452 you really ought to fix it.  Still, I'll try anyway.)
22453
22454 I need a type that is the same size as $sizetype, but is guaranteed to
22455 be signed.  Common values are ssize_t, int and long.
22456
22457 EOM
22458         rp="What signed type is the same size as $sizetype?"
22459         . ./myread
22460         ssizetype="$ans"
22461 fi
22462 $rm_try
22463
22464 : Check the size of st_ino
22465 $echo " "
22466 $echo "Checking the size of st_ino..." >&4
22467 $cat > try.c <<EOCP
22468 #include <sys/stat.h>
22469 #include <stdio.h>
22470 #$i_stdlib I_STDLIB
22471 #ifdef I_STDLIB
22472 #include <stdlib.h>
22473 #endif
22474 int main() {
22475     struct stat st;
22476     printf("%d\n", (int)sizeof(st.st_ino));
22477     exit(0);
22478 }
22479 EOCP
22480 set try
22481 if eval $compile_ok; then
22482         val=`$run ./try`
22483         case "$val" in
22484         '')     st_ino_size=4
22485                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22486                 ;;
22487         *)      st_ino_size=$val
22488                 $echo "Your st_ino is $st_ino_size bytes long."
22489                 ;;
22490         esac
22491 else
22492         st_ino_size=4
22493         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22494 fi
22495 $rm_try
22496
22497 : Check if st_ino is signed
22498 $echo " "
22499 $echo "Checking the sign of st_ino..." >&4
22500 $cat > try.c <<EOCP
22501 #include <sys/stat.h>
22502 #include <stdio.h>
22503 int main() {
22504         struct stat foo;
22505         foo.st_ino = -1;
22506         if (foo.st_ino < 0)
22507                 printf("-1\n");
22508         else
22509                 printf("1\n");
22510 }
22511 EOCP
22512 set try
22513 if eval $compile; then
22514         val=`$run ./try`
22515         case "$val" in
22516         '')     st_ino_sign=1
22517                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22518                 ;;
22519         *)      st_ino_sign=$val
22520                 case "$st_ino_sign" in
22521                  1) $echo "Your st_ino is unsigned." ;;
22522                 -1) $echo "Your st_ino is signed."   ;;
22523                 esac
22524                 ;;
22525         esac
22526 else
22527         st_ino_sign=1
22528         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22529 fi
22530 $rm_try
22531
22532 : see what type of char stdio uses.
22533 echo " "
22534 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22535 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22536         echo "Your stdio uses unsigned chars." >&4
22537         stdchar="unsigned char"
22538 else
22539         echo "Your stdio uses signed chars." >&4
22540         stdchar="char"
22541 fi
22542 $rm -f stdioh
22543
22544 : Check size of UID
22545 echo " "
22546 case "$uidtype" in
22547 *_t) zzz="$uidtype"     ;;
22548 *)   zzz="uid"          ;;
22549 esac
22550 echo "Checking the size of $zzz..." >&4
22551 cat > try.c <<EOCP
22552 #include <sys/types.h>
22553 #include <stdio.h>
22554 #$i_stdlib I_STDLIB
22555 #ifdef I_STDLIB
22556 #include <stdlib.h>
22557 #endif
22558 int main() {
22559     printf("%d\n", (int)sizeof($uidtype));
22560     exit(0);
22561 }
22562 EOCP
22563 set try
22564 if eval $compile_ok; then
22565         yyy=`$run ./try`
22566         case "$yyy" in
22567         '')     uidsize=4
22568                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22569                 ;;
22570         *)      uidsize=$yyy
22571                 echo "Your $zzz is $uidsize bytes long."
22572                 ;;
22573         esac
22574 else
22575         uidsize=4
22576         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22577 fi
22578
22579 : Check if UID is signed
22580 echo " "
22581 case "$uidtype" in
22582 *_t) zzz="$uidtype"     ;;
22583 *)   zzz="uid"          ;;
22584 esac
22585 echo "Checking the sign of $zzz..." >&4
22586 cat > try.c <<EOCP
22587 #include <sys/types.h>
22588 #include <stdio.h>
22589 int main() {
22590         $uidtype foo = -1;
22591         if (foo < 0)
22592                 printf("-1\n");
22593         else
22594                 printf("1\n");
22595 }
22596 EOCP
22597 set try
22598 if eval $compile; then
22599         yyy=`$run ./try`
22600         case "$yyy" in
22601         '')     uidsign=1
22602                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22603                 ;;
22604         *)      uidsign=$yyy
22605                 case "$uidsign" in
22606                  1) echo "Your $zzz is unsigned." ;;
22607                 -1) echo "Your $zzz is signed."   ;;
22608                 esac
22609                 ;;
22610         esac
22611 else
22612         uidsign=1
22613         echo "(I can't compile the test program--guessing unsigned.)" >&4
22614 fi
22615
22616 : Check format string for UID
22617 echo " "
22618 $echo "Checking the format string to be used for uids..." >&4
22619
22620 case "$uidsign" in
22621 -1)     if $test X"$uidsize" = X"$ivsize"; then
22622                 uidformat="$ivdformat"
22623         else
22624                 if $test X"$uidsize" = X"$longsize"; then
22625                         uidformat='"ld"'
22626                 else
22627                         if $test X"$uidsize" = X"$intsize"; then
22628                                 uidformat='"d"'
22629                         else
22630                                 if $test X"$uidsize" = X"$shortsize"; then
22631                                         uidformat='"hd"'
22632                                 fi
22633                         fi
22634                 fi
22635         fi
22636         ;;
22637 *)      if $test X"$uidsize" = X"$uvsize"; then
22638                 uidformat="$uvuformat"
22639         else
22640                 if $test X"$uidsize" = X"$longsize"; then
22641                         uidformat='"lu"'
22642                 else
22643                         if $test X"$uidsize" = X"$intsize"; then
22644                                 uidformat='"u"'
22645                         else
22646                                 if $test X"$uidsize" = X"$shortsize"; then
22647                                         uidformat='"hu"'
22648                                 fi
22649                         fi
22650                 fi
22651         fi
22652         ;;
22653 esac
22654
22655 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22656 echo " "
22657 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22658 $cat >try.c <<'EOM'
22659 /* Intentionally a long probe as I'd like to sanity check that the exact
22660    approach is going to work, as thinking it will work, but only having it
22661    part working at runtime is worse than not having it.  */
22662
22663 #include <sys/types.h>
22664 #include <sys/sysctl.h>
22665 #include <sys/param.h>
22666 #include <stdio.h>
22667 #include <string.h>
22668 #include <stdlib.h>
22669 #include <unistd.h>
22670
22671 int
22672 main(int argc, char **argv) {
22673     char *buffer;
22674     char *argv_leaf = strrchr(argv[0], '/');
22675     char *buffer_leaf;
22676     size_t size = 0;
22677     int mib[4];
22678
22679     mib[0] = CTL_KERN;
22680     mib[1] = KERN_PROC;
22681     mib[2] = KERN_PROC_PATHNAME;
22682     mib[3] = -1;
22683
22684     if (!argv_leaf) {
22685         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22686         return 1;
22687     }
22688
22689     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22690         perror("sysctl");
22691         return 2;
22692     }
22693
22694     if (size < strlen(argv_leaf) + 1) {
22695         fprintf(stderr, "size %lu is too short for a path\n",
22696                 (unsigned long) size);
22697         return 3;
22698     }
22699
22700     if (size > MAXPATHLEN * MAXPATHLEN) {
22701         fprintf(stderr, "size %lu is too long for a path\n",
22702                 (unsigned long) size);
22703         return 4;
22704     }
22705
22706     buffer = (char *)malloc(size);
22707     if (!buffer) {
22708         perror("malloc");
22709         return 5;
22710     }
22711
22712     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22713         perror("sysctl");
22714         return 6;
22715     }
22716
22717     if (strlen(buffer) + 1 != size) {
22718         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22719                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22720         return 7;
22721     }
22722
22723
22724     if (*buffer != '/') {
22725         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22726         return 8;
22727     }
22728
22729     if (strstr(buffer, "/./")) {
22730         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22731         return 9;
22732     }
22733
22734     if (strstr(buffer, "/../")) {
22735         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22736         return 10;
22737     }
22738
22739     buffer_leaf = strrchr(buffer, '/');
22740     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22741         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22742         return 11;
22743     }
22744
22745     free(buffer);
22746
22747     return 0;
22748 }
22749 EOM
22750
22751 val=$undef
22752 set try
22753 if eval $compile; then
22754         if $run ./try; then
22755                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22756                 val="$define"
22757         else
22758                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22759                 val="$undef"
22760         fi
22761 else
22762         echo "I'm unable to compile the test program." >&4
22763         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22764         val="$undef"
22765 fi
22766 $rm_try
22767 set usekernprocpathname
22768 eval $setvar
22769
22770 : Determine if we can use _NSGetExecutablePath to find executing program
22771 echo " "
22772 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22773 $cat >try.c <<'EOM'
22774 /* Intentionally a long probe as I'd like to sanity check that the exact
22775    approach is going to work, as thinking it will work, but only having it
22776    part working at runtime is worse than not having it.  */
22777 #include <mach-o/dyld.h>
22778 #include <stdio.h>
22779 #include <stdlib.h>
22780 #include <sys/param.h>
22781 #include <string.h>
22782
22783 int
22784 main(int argc, char **argv) {
22785     char buf[1];
22786     uint32_t size = sizeof(buf);
22787     int result;
22788     char *buffer;
22789     char *tidied;
22790     char *argv_leaf = strrchr(argv[0], '/');
22791     char *tidied_leaf;
22792
22793     if (!argv_leaf) {
22794         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22795         return 1;
22796     }
22797
22798     _NSGetExecutablePath(buf, &size);
22799     if (size > MAXPATHLEN * MAXPATHLEN) {
22800         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22801                 (unsigned int) size);
22802         return 2;
22803     }
22804
22805     buffer = (char *)malloc(size);
22806     if (!buffer) {
22807         perror("malloc");
22808         return 3;
22809     }
22810
22811     result = _NSGetExecutablePath(buffer, &size);
22812     if (result != 0) {
22813         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22814                 result, (unsigned int) size);
22815         return 4;
22816     }
22817
22818     tidied = realpath(buffer, NULL);
22819     if (!tidied) {
22820         perror("realpath");
22821         return 5;
22822     }
22823
22824     free(buffer);
22825
22826     if (*tidied != '/') {
22827         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22828         return 6;
22829     }
22830
22831     if (strstr(tidied, "/./")) {
22832         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22833         return 7;
22834     }
22835
22836     if (strstr(tidied, "/../")) {
22837         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22838         return 8;
22839     }
22840
22841     tidied_leaf = strrchr(tidied, '/');
22842     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22843         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22844         return 9;
22845     }
22846
22847     free(tidied);
22848
22849     return 0;
22850 }
22851 EOM
22852
22853 val=$undef
22854 set try
22855 if eval $compile; then
22856         if $run ./try; then
22857                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22858                 val="$define"
22859         else
22860                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22861         fi
22862 else
22863         echo "I'm unable to compile the test program." >&4
22864         echo "I'll assume no _NSGetExecutablePath here." >&4
22865 fi
22866 $rm_try
22867 set usensgetexecutablepath
22868 eval $setvar
22869
22870 : Check if site customization support was requested
22871 case "$usesitecustomize" in
22872     $define|true|[Yy]*)
22873         usesitecustomize="$define"
22874         ;;
22875     *)
22876         usesitecustomize="$undef"
22877         ;;
22878     esac
22879
22880 : determine compiler compiler
22881 case "$yacc" in
22882 '')
22883         dflt=yacc;;
22884 *)
22885         dflt="$yacc";;
22886 esac
22887 echo " "
22888 comp='yacc'
22889 if $test -f "$byacc$_exe"; then
22890         dflt="$byacc"
22891         comp="byacc or $comp"
22892 fi
22893 if $test -f "$bison$_exe"; then
22894         comp="$comp or bison -y"
22895 fi
22896 rp="Which compiler compiler ($comp) shall I use?"
22897 . ./myread
22898 yacc="$ans"
22899 case "$yacc" in
22900 *bis*)
22901         case "$yacc" in
22902         *-y*) ;;
22903         *)
22904                 yacc="$yacc -y"
22905                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22906                 ;;
22907         esac
22908         ;;
22909 esac
22910
22911 : see if this is a bfd.h system
22912 set bfd.h i_bfd
22913 eval $inhdr
22914
22915 : see if this is an execinfo.h system
22916 set execinfo.h i_execinfo
22917 eval $inhdr
22918
22919 : see if this is a fenv.h system
22920 set fenv.h i_fenv
22921 eval $inhdr
22922
22923 : see if this is a fp.h system
22924 set fp.h i_fp
22925 eval $inhdr
22926
22927 : see if this is a fp_class.h system
22928 set fp_class.h i_fp_class
22929 eval $inhdr
22930
22931 : see if gdbm.h is available
22932 set gdbm.h t_gdbm
22933 eval $inhdr
22934 case "$t_gdbm" in
22935 $define)
22936         : see if gdbm_open exists
22937         set gdbm_open d_gdbm_open
22938         eval $inlibc
22939         case "$d_gdbm_open" in
22940         $undef)
22941                 t_gdbm="$undef"
22942                 echo "We won't be including <gdbm.h>"
22943                 ;;
22944         esac
22945         ;;
22946 esac
22947 val="$t_gdbm"
22948 set i_gdbm
22949 eval $setvar
22950
22951 : see if this is a ieeefp.h system
22952 case "$i_ieeefp" in
22953 '' ) set ieeefp.h i_ieeefp
22954      eval $inhdr
22955      ;;
22956 esac
22957
22958 : see if this is a libutil.h system
22959 set libutil.h i_libutil
22960 eval $inhdr
22961
22962 : see if mach cthreads are available
22963 if test "X$usethreads" = "X$define"; then
22964         set mach/cthreads.h i_machcthr
22965         eval $inhdr
22966 else
22967         i_machcthr="$undef"
22968 fi
22969
22970 : see if this is a mntent.h system
22971 set mntent.h i_mntent
22972 eval $inhdr
22973
22974 : see if net/errno.h is available
22975 val=''
22976 set net/errno.h val
22977 eval $inhdr
22978
22979 : Unfortunately, it causes problems on some systems.  Arrgh.
22980 case "$val" in
22981 $define)
22982         cat > try.c <<'EOM'
22983 #include <stdio.h>
22984 #include <errno.h>
22985 #include <net/errno.h>
22986 int func()
22987 {
22988         return ENOTSOCK;
22989 }
22990 EOM
22991         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22992                 echo "We'll be including <net/errno.h>." >&4
22993         else
22994                 echo "We won't be including <net/errno.h>." >&4
22995                 val="$undef"
22996         fi
22997         $rm_try
22998         ;;
22999 esac
23000 set i_neterrno
23001 eval $setvar
23002
23003 : see if netinet/tcp.h is available
23004 set netinet/tcp.h i_netinettcp
23005 eval $inhdr
23006
23007 : see if this is a poll.h system
23008 set poll.h i_poll
23009 eval $inhdr
23010
23011 : see if this is a prot.h system
23012 set prot.h i_prot
23013 eval $inhdr
23014
23015 : Preprocessor symbols
23016 echo " "
23017 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23018 $cat <<'EOSH' > Cppsym.know
23019 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23020 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23021 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23022 arch_pwr ardent ARM ARM32 atarist att386 att3b
23023 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23024 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23025 byteorder byte_order
23026 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23027 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23028 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23029 ELF encore EPI EXTENSIONS
23030 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23031 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23032 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23033 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23034 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23035 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23036 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23037 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23038 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23039 ksr1
23040 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23041 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23042 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23043 luna88k Lynx
23044 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23045 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23046 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23047 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23048 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23049 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23050 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23051 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23052 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23053 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23054 ns32000 ns32016 ns32332 ns32k nsc32000
23055 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23056 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23057 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23058 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23059 QK_USER QNX
23060 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23061 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23062 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23063 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23064 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23065 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23066 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23067 SYSV4 SYSV5 sysV68 sysV88
23068 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23069 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23070 tower32_800 tower32_850 tss
23071 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23072 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23073 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23074 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23075 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23076 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23077 uxpm uxps
23078 vax venix VMESA vms
23079 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23080 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23081 z8000 zarch
23082 EOSH
23083 # Maybe put other stuff here too.
23084 ./tr '-' '_' <<EOSH >>Cppsym.know
23085 $osname
23086 EOSH
23087 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23088 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23089 $cat Cppsym.know > Cppsym.c
23090 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23091 $rm -f Cppsym.a Cppsym.b Cppsym.c
23092 cat <<EOSH > Cppsym
23093 $startsh
23094 if $test \$# -gt 0; then
23095     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23096     if $test -s Cppsym.got; then
23097         $rm -f Cppsym.got
23098         exit 0
23099     fi
23100     $rm -f Cppsym.got
23101     exit 1
23102 else
23103     $tr " " "$trnl" | ./Cppsym.try
23104     exit 0
23105 fi
23106 EOSH
23107 chmod +x Cppsym
23108 $eunicefix Cppsym
23109 cat <<EOSH > Cppsym.try
23110 $startsh
23111 cat <<'EOCP' > try.c
23112 #include <stdio.h>
23113 #if cpp_stuff == 1
23114 #define STRINGIFY(a)    "a"
23115 #endif
23116 #if cpp_stuff == 42
23117 #define StGiFy(a)  #a
23118 #define STRINGIFY(a)    StGiFy(a)
23119 #endif
23120 #if $cpp_stuff != 1 && $cpp_stuff != 42
23121 #   include "Bletch: How does this C preprocessor stringify macros?"
23122 #endif
23123 int main() {
23124 EOCP
23125 $awk \\
23126 EOSH
23127 cat <<'EOSH' >> Cppsym.try
23128 'length($1) > 0 {
23129     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23130     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23131     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23132     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23133 }' >> try.c
23134 echo 'return 0;}' >> try.c
23135 EOSH
23136 cat <<EOSH >> Cppsym.try
23137 ccflags="$ccflags"
23138 case "$osname-$gccversion" in
23139 irix-) ccflags="\$ccflags -woff 1178" ;;
23140 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23141 esac
23142 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23143 EOSH
23144 chmod +x Cppsym.try
23145 $eunicefix Cppsym.try
23146 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23147 : Add in any Linux cpp "predefined macros":
23148 case "$osname::$gccversion" in
23149   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23150     tHdrH=_tmpHdr
23151     rm -f $tHdrH'.h' $tHdrH
23152     touch $tHdrH'.h'
23153     # Filter out macro arguments, such as Linux's __INT8_C(c)
23154     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23155        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23156        if [ -s $tHdrH'_cppsym.real' ]; then
23157           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23158        fi
23159     fi
23160     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23161   ;;
23162 esac
23163 : now check the C compiler for additional symbols
23164 postprocess_cc_v=''
23165 case "$osname" in
23166 aix) postprocess_cc_v="|$tr , ' '" ;;
23167 esac
23168 $cat >ccsym <<EOS
23169 $startsh
23170 $cat >tmp.c <<EOF
23171 extern int foo;
23172 EOF
23173 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23174 do
23175         case "\$i" in
23176         -D*) echo "\$i" | $sed 's/^-D//';;
23177         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23178         esac
23179 done
23180 $rm_try
23181 EOS
23182 postprocess_cc_v=''
23183 chmod +x ccsym
23184 $eunicefix ccsym
23185 ./ccsym > ccsym1.raw
23186 if $test -s ccsym1.raw; then
23187     $sort ccsym1.raw | $uniq >ccsym.raw
23188 else
23189     mv ccsym1.raw ccsym.raw
23190 fi
23191
23192 $awk '/\=/ { print $0; next }
23193         { print $0"=1" }' ccsym.raw >ccsym.list
23194 $comm -13 Cppsym.true ccsym.list >ccsym.own
23195 $comm -12 Cppsym.true ccsym.list >ccsym.com
23196 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23197 also=''
23198 if $test -z ccsym.raw; then
23199         echo "Your C compiler doesn't seem to define any symbols!" >&4
23200         echo " "
23201         echo "However, your C preprocessor defines the following symbols:"
23202         $cat Cppsym.true
23203         ccsymbols=''
23204         cppsymbols=`$cat Cppsym.true`
23205         cppsymbols=`echo $cppsymbols`
23206         cppccsymbols="$cppsymbols"
23207 else
23208         if $test -s ccsym.com; then
23209                 echo "Your C compiler and pre-processor define these symbols:"
23210                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23211                 also='also '
23212                 symbols='ones'
23213                 cppccsymbols=`$cat ccsym.com`
23214                 cppccsymbols=`echo $cppccsymbols`
23215                 $test "$silent" || sleep 1
23216         fi
23217         if $test -s ccsym.cpp; then
23218                 $test "$also" && echo " "
23219                 echo "Your C pre-processor ${also}defines the following symbols:"
23220                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23221                 also='further '
23222                 cppsymbols=`$cat ccsym.cpp`
23223                 cppsymbols=`echo $cppsymbols`
23224                 $test "$silent" || sleep 1
23225         fi
23226         if $test -s ccsym.own; then
23227                 $test "$also" && echo " "
23228                 echo "Your C compiler ${also}defines the following cpp symbols:"
23229                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23230                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23231                 ccsymbols=`$cat ccsym.own`
23232                 ccsymbols=`echo $ccsymbols`
23233                 $test "$silent" || sleep 1
23234         fi
23235 fi
23236
23237 : add -D_FORTIFY_SOURCE if feasible and not already there
23238 case "$gccversion" in
23239 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23240         *-O*)   case "$ccflags$cppsymbols" in
23241                 *_FORTIFY_SOURCE=*) # Don't add it again.
23242                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23243                         ;;
23244                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23245                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23246                         ;;
23247                 esac
23248                 ;;
23249         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23250                 ;;
23251         esac
23252         ;;
23253 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23254         ;;
23255 esac
23256
23257 : script used to emit important warnings
23258 cat >warn <<EOS
23259 $startsh
23260 if test \$# -gt 0; then
23261         echo "\$@" >msg
23262 else
23263         cat >msg
23264 fi
23265 echo "*** WARNING:" >&4
23266 sed -e 's/^/*** /' <msg >&4
23267 echo "*** " >&4
23268 cat msg >>config.msg
23269 echo " " >>config.msg
23270 rm -f msg
23271 EOS
23272 chmod +x warn
23273 $eunicefix warn
23274
23275 : see if this is a termio system
23276 val="$undef"
23277 val2="$undef"
23278 val3="$undef"
23279 if $test `./findhdr termios.h`; then
23280     set tcsetattr i_termios
23281     eval $inlibc
23282     val3="$i_termios"
23283 fi
23284 echo " "
23285 case "$val3" in
23286     "$define") echo "You have POSIX termios.h... good!" >&4;;
23287     *)  if ./Cppsym pyr; then
23288             case "`$run /bin/universe`" in
23289                 ucb) if $test `./findhdr sgtty.h`; then
23290                         val2="$define"
23291                         echo "<sgtty.h> found." >&4
23292                     else
23293                         echo "System is pyramid with BSD universe."
23294                         ./warn "<sgtty.h> not found--you could have problems."
23295                     fi;;
23296                 *)  if $test `./findhdr termio.h`; then
23297                         val="$define"
23298                         echo "<termio.h> found." >&4
23299                     else
23300                         echo "System is pyramid with USG universe."
23301                         ./warn "<termio.h> not found--you could have problems."
23302                     fi;;
23303             esac
23304         elif ./usg; then
23305             if $test `./findhdr termio.h`; then
23306                 echo "<termio.h> found." >&4
23307                 val="$define"
23308             elif $test `./findhdr sgtty.h`; then
23309                 echo "<sgtty.h> found." >&4
23310                 val2="$define"
23311             else
23312                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23313             fi
23314         else
23315             if $test `./findhdr sgtty.h`; then
23316                 echo "<sgtty.h> found." >&4
23317                 val2="$define"
23318             elif $test `./findhdr termio.h`; then
23319                 echo "<termio.h> found." >&4
23320                 val="$define"
23321             else
23322                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23323             fi
23324         fi;;
23325 esac
23326 set i_termio; eval $setvar
23327 val=$val2; set i_sgtty; eval $setvar
23328 val=$val3; set i_termios; eval $setvar
23329
23330 : see if stdbool is available
23331 : we want a real compile instead of Inhdr because some Solaris systems
23332 : have stdbool.h, but it can only be used if the compiler indicates it
23333 : is sufficiently c99-compliant.
23334 echo " "
23335 $cat >try.c <<EOCP
23336 #include <stdio.h>
23337 #include <stdbool.h>
23338 int func(bool x)
23339 {
23340     return x ? 1 : 0;
23341 }
23342 int main(int argc, char **argv)
23343 {
23344     return func(0);
23345 }
23346 EOCP
23347 set try
23348 if eval $compile; then
23349         echo "<stdbool.h> found." >&4
23350         val="$define"
23351 else
23352         echo "<stdbool.h> NOT found." >&4
23353         val="$undef"
23354 fi
23355 $rm_try
23356 set i_stdbool
23357 eval $setvar
23358
23359 : see if stdint is available
23360 set stdint.h i_stdint
23361 eval $inhdr
23362
23363 : see if sys/access.h is available
23364 set sys/access.h i_sysaccess
23365 eval $inhdr
23366
23367 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23368 set sys/filio.h i_sysfilio
23369 eval $inhdr
23370 echo " "
23371 if $test `./findhdr sys/ioctl.h`; then
23372         val="$define"
23373         echo '<sys/ioctl.h> found.' >&4
23374 else
23375         val="$undef"
23376         if $test $i_sysfilio = "$define"; then
23377             echo '<sys/ioctl.h> NOT found.' >&4
23378         else
23379                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23380                 $test $i_termio = "$define" && xxx="termio.h"
23381                 $test $i_termios = "$define" && xxx="termios.h"
23382 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23383         fi
23384 fi
23385 set i_sysioctl
23386 eval $setvar
23387
23388 : see if socket ioctl defs are in sys/sockio.h
23389 echo " "
23390 xxx=`./findhdr sys/sockio.h`
23391 if $test "$xxx"; then
23392         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23393                 val="$define"
23394                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23395         else
23396                 val="$undef"
23397                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23398         fi
23399 else
23400         val="$undef"
23401         $cat <<EOM
23402 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23403 EOM
23404 fi
23405 set i_syssockio
23406 eval $setvar
23407
23408 : see if this is a syslog.h system
23409 set syslog.h i_syslog
23410 eval $inhdr
23411
23412 : see if this is a sys/mode.h system
23413 set sys/mode.h i_sysmode
23414 eval $inhdr
23415
23416 : see if there is a sys/poll.h file
23417 set sys/poll.h i_syspoll
23418 eval $inhdr
23419
23420 : see if sys/resource.h has to be included
23421 set sys/resource.h i_sysresrc
23422 eval $inhdr
23423
23424 : see if sys/security.h is available
23425 set sys/security.h i_syssecrt
23426 eval $inhdr
23427
23428 : see if this is a sys/statvfs.h system
23429 set sys/statvfs.h i_sysstatvfs
23430 eval $inhdr
23431
23432 : see if this is a sys/un.h system
23433 set sys/un.h i_sysun
23434 eval $inhdr
23435
23436 : see if this is a sys/utsname.h system
23437 set sys/utsname.h i_sysutsname
23438 eval $inhdr
23439
23440 : see if this is a syswait system
23441 set sys/wait.h i_syswait
23442 eval $inhdr
23443
23444 : see if this is a ustat.h system
23445 set ustat.h i_ustat
23446 eval $inhdr
23447
23448 : see if this is an utime system
23449 set utime.h i_utime
23450 eval $inhdr
23451
23452 : see if this is a vfork system
23453 case "$d_vfork" in
23454 "$define")
23455         set vfork.h i_vfork
23456         eval $inhdr
23457         ;;
23458 *)
23459         i_vfork="$undef"
23460         ;;
23461 esac
23462
23463 : see if wchar.h is present
23464 set wchar.h i_wchar
23465 eval $inhdr
23466
23467 : Check extensions
23468 echo " "
23469 echo "Looking for extensions..." >&4
23470 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23471 : contain old or inaccurate or duplicate values.
23472 nonxs_extensions=''
23473 xs_extensions=''
23474 : We do not use find because it might not be available.
23475 : We do not just use MANIFEST because the user may have dropped
23476 : some additional extensions into the source tree and expect them
23477 : to be built.
23478
23479 : Function to recursively find available extensions, ignoring DynaLoader
23480 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23481 : In 5.10.1 and later, extensions are stored in directories
23482 : like File-Glob instead of the older File/Glob/.
23483 find_extensions='
23484     for xxx in *; do
23485         case "$xxx" in
23486             DynaLoader|dynaload) ;;
23487             *)
23488             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23489             case "$this_ext" in
23490                 Scalar/List/Utils) this_ext="List/Util" ;;
23491                 PathTools)         this_ext="Cwd"       ;;
23492             esac;
23493             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23494             if $contains " $this_ext " "$tdir/$$.tmp"; then
23495                 echo >&4;
23496                 echo "Duplicate directories detected for extension $xxx" >&4;
23497                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23498                 case "$knowitall" in
23499                 "") dflt=y;;
23500                 *) dflt=n;;
23501                 esac;
23502                 . ../UU/myread;
23503                 case "$ans" in
23504                 n*|N*) ;;
23505                 *) echo >&4;
23506                     echo "Ok.  Stopping Configure." >&4;
23507                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23508                     exit 1;;
23509                 esac;
23510                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23511             fi;
23512             $ls -1 "$xxx" > "$tdir/$$.tmp";
23513             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23514                 xs_extensions="$xs_extensions $this_ext";
23515             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23516                 xs_extensions="$xs_extensions $this_ext";
23517             elif $test -d "$xxx"; then
23518                 nonxs_extensions="$nonxs_extensions $this_ext";
23519             fi;
23520             $rm -f "$tdir/$$.tmp";
23521             ;;
23522         esac;
23523     done'
23524 tdir=`pwd`
23525 cd "$rsrc/cpan"
23526 set X
23527 shift
23528 eval $find_extensions
23529 cd "$rsrc/dist"
23530 set X
23531 shift
23532 eval $find_extensions
23533 cd "$rsrc/ext"
23534 set X
23535 shift
23536 eval $find_extensions
23537 set X $xs_extensions
23538 shift
23539 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23540 set X $nonxs_extensions
23541 shift
23542 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23543 cd "$tdir"
23544 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23545
23546 : Now see which are supported on this system.
23547 avail_ext=''
23548 for xxx in $xs_extensions ; do
23549         case "$xxx" in
23550         Amiga*)
23551                 case "$osname" in
23552                 amigaos) avail_ext="$avail_ext $xxx" ;;
23553                 esac
23554                 ;;
23555         DB_File|db_file)
23556                 case "$i_db" in
23557                 $define) avail_ext="$avail_ext $xxx" ;;
23558                 esac
23559                 ;;
23560         GDBM_File|gdbm_fil)
23561                 case "$i_gdbm" in
23562                 $define) avail_ext="$avail_ext $xxx" ;;
23563                 esac
23564                 ;;
23565         IPC/SysV|ipc/sysv)
23566                 : XXX Do we need a useipcsysv variable here
23567                 case "${d_msg}${d_sem}${d_shm}" in
23568                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23569                 esac
23570                 ;;
23571         NDBM_File|ndbm_fil)
23572                 case "$d_ndbm" in
23573                 $define)
23574                     case "$osname-$use64bitint" in
23575                     hpux-define)
23576                         case "$libs" in
23577                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23578                         esac
23579                         ;;
23580                     *) avail_ext="$avail_ext $xxx" ;;
23581                     esac
23582                     ;;
23583                 esac
23584                 ;;
23585         ODBM_File|odbm_fil)
23586                 case "${i_dbm}${i_rpcsvcdbm}" in
23587                 *"${define}"*)
23588                     case "$d_cplusplus" in
23589                     define) ;; # delete as a function name will not work
23590                     *)  case "$osname-$use64bitint" in
23591                         hpux-define)
23592                             case "$libs" in
23593                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23594                             esac
23595                             ;;
23596                         *) avail_ext="$avail_ext $xxx" ;;
23597                         esac
23598                         ;;
23599                     esac
23600                     ;;
23601                 esac
23602                 ;;
23603         Opcode|opcode)
23604                 case "$useopcode" in
23605                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23606                 esac
23607                 ;;
23608         POSIX|posix)
23609                 case "$useposix" in
23610                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23611                 esac
23612                 ;;
23613         Socket|socket)
23614                 case "$d_socket" in
23615                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23616                 esac
23617                 ;;
23618         I18N/Langinfo|langinfo)
23619                 case "$uselanginfo" in
23620                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23621                 esac
23622                 ;;
23623         Sys/Syslog|sys/syslog)
23624                 case $osname in
23625                         amigaos) ;; # not really very useful on AmigaOS
23626                         *)
23627                         : XXX syslog requires socket
23628                         case "$d_socket" in
23629                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23630                         esac
23631                         ;;
23632                 esac
23633                 ;;
23634         Thread|thread)
23635                 case "$usethreads" in
23636                 true|$define|y)
23637                         case "$use5005threads" in
23638                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23639                         esac
23640                 esac
23641                 ;;
23642         threads|threads/shared)
23643                 # threads and threads::shared are special cases.
23644                 # To stop people from asking "Perl 5.8.0 was supposed
23645                 # to have this new fancy threads implementation but my
23646                 # perl doesn't have it" and from people trying to
23647                 # (re)install the threads module using CPAN.pm and
23648                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23649                 # the threads.pm and threads/shared.pm will always be
23650                 # there, croaking informatively ("you need to rebuild
23651                 # all of Perl with threads, sorry") when threads haven't
23652                 # been compiled in.
23653                 # --jhi
23654                 avail_ext="$avail_ext $xxx"
23655                 ;;
23656         VMS*)
23657                 ;;
23658         Win32*)
23659                 case "$osname" in
23660                 cygwin) avail_ext="$avail_ext $xxx" ;;
23661                 esac
23662                 ;;
23663         XS/APItest|xs/apitest)
23664                 # This is just for testing.  Skip it unless we have dynamic loading.
23665
23666                 case "$usedl" in
23667                 $define) avail_ext="$avail_ext $xxx" ;;
23668                 esac
23669                 ;;
23670         XS/Typemap|xs/typemap)
23671                 # This is just for testing.  Skip it unless we have dynamic loading.
23672                 case "$usedl" in
23673                 $define) avail_ext="$avail_ext $xxx" ;;
23674                 esac
23675                 ;;
23676         *)      avail_ext="$avail_ext $xxx"
23677                 ;;
23678         esac
23679 done
23680
23681 set X $avail_ext
23682 shift
23683 avail_ext="$*"
23684
23685 case "$onlyextensions" in
23686 '') ;;
23687 *)  keepextensions=''
23688     echo "You have requested that only certain extensions be included..." >&4
23689     for i in $onlyextensions; do
23690         case " $avail_ext " in
23691         *" $i "*)
23692             echo "Keeping extension $i."
23693             keepextensions="$keepextensions $i"
23694             ;;
23695         *) echo "Ignoring extension $i." ;;
23696         esac
23697     done
23698     avail_ext="$keepextensions"
23699     ;;
23700 esac
23701
23702 case "$noextensions" in
23703 '') ;;
23704 *)  keepextensions=''
23705     echo "You have requested that certain extensions be ignored..." >&4
23706     for i in $avail_ext; do
23707         case " $noextensions " in
23708         *" $i "*) echo "Ignoring extension $i." ;;
23709         *) echo "Keeping extension $i.";
23710            keepextensions="$keepextensions $i"
23711            ;;
23712         esac
23713     done
23714     avail_ext="$keepextensions"
23715     ;;
23716 esac
23717
23718 : Now see which nonxs extensions are supported on this system.
23719 : For now assume all are.
23720 nonxs_ext=''
23721 for xxx in $nonxs_extensions ; do
23722         case "$xxx" in
23723         VMS*)
23724                 ;;
23725         *)      nonxs_ext="$nonxs_ext $xxx"
23726                 ;;
23727         esac
23728 done
23729
23730 set X $nonxs_ext
23731 shift
23732 nonxs_ext="$*"
23733
23734 case $usedl in
23735 $define)
23736         $cat <<EOM
23737 A number of extensions are supplied with $package.  You may choose to
23738 compile these extensions for dynamic loading (the default), compile
23739 them into the $package executable (static loading), or not include
23740 them at all.  Answer "none" to include no extensions.
23741 Note that DynaLoader is always built and need not be mentioned here.
23742
23743 EOM
23744         case "$dynamic_ext" in
23745         '')
23746                 : Exclude those listed in static_ext
23747                 dflt=''
23748                 for xxx in $avail_ext; do
23749                         case " $static_ext " in
23750                         *" $xxx "*) ;;
23751                         *) dflt="$dflt $xxx" ;;
23752                         esac
23753                 done
23754                 set X $dflt
23755                 shift
23756                 dflt="$*"
23757                 ;;
23758         *)      dflt="$dynamic_ext"
23759                 # Perhaps we are reusing an old out-of-date config.sh.
23760                 case "$hint" in
23761                 previous)
23762                         if test X"$dynamic_ext" != X"$avail_ext"; then
23763                                 $cat <<EOM
23764 NOTICE:  Your previous config.sh list may be incorrect.
23765 The extensions now available to you are
23766         ${avail_ext}
23767 but the default list from your previous config.sh is
23768         ${dynamic_ext}
23769
23770 EOM
23771                         fi
23772                         ;;
23773                 esac
23774                 ;;
23775         esac
23776         case "$dflt" in
23777         '')     dflt=none;;
23778         esac
23779         rp="What extensions do you wish to load dynamically?"
23780         . ./myread
23781         case "$ans" in
23782         none) dynamic_ext=' ' ;;
23783         *) dynamic_ext="$ans" ;;
23784         esac
23785
23786         case "$static_ext" in
23787         '')
23788                 : Exclude those already listed in dynamic linking
23789                 dflt=''
23790                 for xxx in $avail_ext; do
23791                         case " $dynamic_ext " in
23792                         *" $xxx "*) ;;
23793                         *) dflt="$dflt $xxx" ;;
23794                         esac
23795                 done
23796                 set X $dflt
23797                 shift
23798                 dflt="$*"
23799                 ;;
23800         *)  dflt="$static_ext"
23801                 ;;
23802         esac
23803
23804         case "$dflt" in
23805         '')     dflt=none;;
23806         esac
23807         rp="What extensions do you wish to load statically?"
23808         . ./myread
23809         case "$ans" in
23810         none) static_ext=' ' ;;
23811         *) static_ext="$ans" ;;
23812         esac
23813         ;;
23814 *)
23815         $cat <<EOM
23816 A number of extensions are supplied with $package.  Answer "none"
23817 to include no extensions.
23818 Note that DynaLoader is always built and need not be mentioned here.
23819
23820 EOM
23821         case "$static_ext" in
23822         '') dflt="$avail_ext" ;;
23823         *)      dflt="$static_ext"
23824                 # Perhaps we are reusing an old out-of-date config.sh.
23825                 case "$hint" in
23826                 previous)
23827                         if test X"$static_ext" != X"$avail_ext"; then
23828                                 $cat <<EOM
23829 NOTICE:  Your previous config.sh list may be incorrect.
23830 The extensions now available to you are
23831         ${avail_ext}
23832 but the default list from your previous config.sh is
23833         ${static_ext}
23834
23835 EOM
23836                         fi
23837                         ;;
23838                 esac
23839                 ;;
23840         esac
23841         : Exclude those that are not xs extensions
23842         case "$dflt" in
23843         '')     dflt=none;;
23844         esac
23845         rp="What extensions do you wish to include?"
23846         . ./myread
23847         case "$ans" in
23848         none) static_ext=' ' ;;
23849         *) static_ext="$ans" ;;
23850         esac
23851         ;;
23852 esac
23853 #
23854 # Encode is a special case.  If we are building Encode as a static
23855 # extension, we need to explicitly list its subextensions as well.
23856 # For other nested extensions, this is handled automatically by
23857 # the appropriate Makefile.PL.
23858 case " $static_ext " in
23859         *" Encode "*) # Add the subextensions of Encode
23860         cd "$rsrc/cpan"
23861         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23862                 static_ext="$static_ext Encode/$xxx"
23863                 known_extensions="$known_extensions Encode/$xxx"
23864         done
23865         cd "$tdir"
23866         ;;
23867 esac
23868
23869 set X $dynamic_ext $static_ext $nonxs_ext
23870 shift
23871 extensions="$*"
23872
23873 # Sanity check:  We require an extension suitable for use with
23874 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23875 # should show up as failures in the test suite, but it's helpful to
23876 # catch them now.) The 'extensions' list is normally sorted
23877 # alphabetically, so we need to accept either
23878 #    DB_File ... Fcntl ... IO  ....
23879 # or something like
23880 #    Fcntl ... NDBM_File ... IO  ....
23881 case " $extensions"  in
23882 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23883 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23884 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23885 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23886    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23887    ;;
23888 esac
23889
23890 : Remove libraries needed only for extensions
23891 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23892 : The exception is SunOS 4.x, which needs them.
23893 case "${osname}X${osvers}" in
23894 sunos*X4*)
23895     perllibs="$libs"
23896     ;;
23897 *) case "$usedl" in
23898     $define|true|[yY]*)
23899             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23900             shift
23901             perllibs="$*"
23902             ;;
23903     *)  perllibs="$libs"
23904             ;;
23905     esac
23906     ;;
23907 esac
23908
23909 : Remove build directory name from cppstdin so it can be used from
23910 : either the present location or the final installed location.
23911 echo " "
23912 : Get out of the UU directory to get correct path name.
23913 cd ..
23914 case "$cppstdin" in
23915 `pwd`/cppstdin)
23916         echo "Stripping down cppstdin path name"
23917         cppstdin=cppstdin
23918         ;;
23919 esac
23920 cd UU
23921
23922 : end of configuration questions
23923 echo " "
23924 echo "End of configuration questions."
23925 echo " "
23926
23927 : back to where it started
23928 if test -d ../UU; then
23929         cd ..
23930 fi
23931
23932 : configuration may be unconditionally patched via a 'config.arch' file
23933 if $test -f config.arch; then
23934         echo "I see a config.arch file, loading it." >&4
23935         . ./config.arch
23936 fi
23937
23938 : configuration may be patched via a 'config.over' file
23939 if $test -f config.over; then
23940         echo " "
23941         dflt=y
23942         rp='I see a config.over file.  Do you wish to load it?'
23943         . UU/myread
23944         case "$ans" in
23945         n*) echo "OK, I'll ignore it.";;
23946         *)      . ./config.over
23947                 echo "Configuration override changes have been loaded."
23948                 ;;
23949         esac
23950 fi
23951
23952 : in case they want portability, strip down executable paths
23953 case "$d_portable" in
23954 "$define")
23955         echo " "
23956         echo "Stripping down executable paths..." >&4
23957         for file in $loclist $trylist; do
23958                 eval temp=\$$file
23959                 eval $file=`basename $temp`
23960         done
23961         ;;
23962 esac
23963
23964 : create config.sh file
23965 echo " "
23966 echo "Creating config.sh..." >&4
23967 $spitshell <<EOT >config.sh
23968 $startsh
23969 #
23970 # This file was produced by running the Configure script. It holds all the
23971 # definitions figured out by Configure. Should you modify one of these values,
23972 # do not forget to propagate your changes by running "Configure -der". You may
23973 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23974 #
23975
23976 # Package name      : $package
23977 # Source directory  : $src
23978 # Configuration time: $cf_time
23979 # Configured by     : $cf_by
23980 # Target system     : $myuname
23981
23982 EOT
23983 : Add in command line options if available
23984 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23985
23986 $spitshell <<EOT >>config.sh
23987
23988 Author='$Author'
23989 Date='$Date'
23990 Header='$Header'
23991 Id='$Id'
23992 Locker='$Locker'
23993 Log='$Log'
23994 RCSfile='$RCSfile'
23995 Revision='$Revision'
23996 Source='$Source'
23997 State='$State'
23998 _a='$_a'
23999 _exe='$_exe'
24000 _o='$_o'
24001 afs='$afs'
24002 afsroot='$afsroot'
24003 alignbytes='$alignbytes'
24004 aphostname='$aphostname'
24005 api_revision='$api_revision'
24006 api_subversion='$api_subversion'
24007 api_version='$api_version'
24008 api_versionstring='$api_versionstring'
24009 ar='$ar'
24010 archlib='$archlib'
24011 archlibexp='$archlibexp'
24012 archname64='$archname64'
24013 archname='$archname'
24014 archobjs='$archobjs'
24015 asctime_r_proto='$asctime_r_proto'
24016 awk='$awk'
24017 baserev='$baserev'
24018 bash='$bash'
24019 bin='$bin'
24020 bin_ELF='$bin_ELF'
24021 binexp='$binexp'
24022 bison='$bison'
24023 byacc='$byacc'
24024 byteorder='$byteorder'
24025 c='$c'
24026 castflags='$castflags'
24027 cat='$cat'
24028 cc='$cc'
24029 cccdlflags='$cccdlflags'
24030 ccdlflags='$ccdlflags'
24031 ccflags='$ccflags'
24032 ccflags_uselargefiles='$ccflags_uselargefiles'
24033 ccname='$ccname'
24034 ccsymbols='$ccsymbols'
24035 ccversion='$ccversion'
24036 cf_by='$cf_by'
24037 cf_email='$cf_email'
24038 cf_time='$cf_time'
24039 charbits='$charbits'
24040 charsize='$charsize'
24041 chgrp='$chgrp'
24042 chmod='$chmod'
24043 chown='$chown'
24044 clocktype='$clocktype'
24045 comm='$comm'
24046 compress='$compress'
24047 contains='$contains'
24048 cp='$cp'
24049 cpio='$cpio'
24050 cpp='$cpp'
24051 cpp_stuff='$cpp_stuff'
24052 cppccsymbols='$cppccsymbols'
24053 cppflags='$cppflags'
24054 cpplast='$cpplast'
24055 cppminus='$cppminus'
24056 cpprun='$cpprun'
24057 cppstdin='$cppstdin'
24058 cppsymbols='$cppsymbols'
24059 crypt_r_proto='$crypt_r_proto'
24060 cryptlib='$cryptlib'
24061 csh='$csh'
24062 ctermid_r_proto='$ctermid_r_proto'
24063 ctime_r_proto='$ctime_r_proto'
24064 d_Gconvert='$d_Gconvert'
24065 d_PRIEUldbl='$d_PRIEUldbl'
24066 d_PRIFUldbl='$d_PRIFUldbl'
24067 d_PRIGUldbl='$d_PRIGUldbl'
24068 d_PRIXU64='$d_PRIXU64'
24069 d_PRId64='$d_PRId64'
24070 d_PRIeldbl='$d_PRIeldbl'
24071 d_PRIfldbl='$d_PRIfldbl'
24072 d_PRIgldbl='$d_PRIgldbl'
24073 d_PRIi64='$d_PRIi64'
24074 d_PRIo64='$d_PRIo64'
24075 d_PRIu64='$d_PRIu64'
24076 d_PRIx64='$d_PRIx64'
24077 d_SCNfldbl='$d_SCNfldbl'
24078 d__fwalk='$d__fwalk'
24079 d_accept4='$d_accept4'
24080 d_access='$d_access'
24081 d_accessx='$d_accessx'
24082 d_acosh='$d_acosh'
24083 d_aintl='$d_aintl'
24084 d_alarm='$d_alarm'
24085 d_archlib='$d_archlib'
24086 d_asctime64='$d_asctime64'
24087 d_asctime_r='$d_asctime_r'
24088 d_asinh='$d_asinh'
24089 d_atanh='$d_atanh'
24090 d_atolf='$d_atolf'
24091 d_atoll='$d_atoll'
24092 d_attribute_always_inline='$d_attribute_always_inline'
24093 d_attribute_deprecated='$d_attribute_deprecated'
24094 d_attribute_format='$d_attribute_format'
24095 d_attribute_malloc='$d_attribute_malloc'
24096 d_attribute_nonnull='$d_attribute_nonnull'
24097 d_attribute_noreturn='$d_attribute_noreturn'
24098 d_attribute_pure='$d_attribute_pure'
24099 d_attribute_unused='$d_attribute_unused'
24100 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24101 d_backtrace='$d_backtrace'
24102 d_bsd='$d_bsd'
24103 d_bsdgetpgrp='$d_bsdgetpgrp'
24104 d_bsdsetpgrp='$d_bsdsetpgrp'
24105 d_builtin_add_overflow='$d_builtin_add_overflow'
24106 d_builtin_choose_expr='$d_builtin_choose_expr'
24107 d_builtin_expect='$d_builtin_expect'
24108 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24109 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24110 d_c99_variadic_macros='$d_c99_variadic_macros'
24111 d_casti32='$d_casti32'
24112 d_castneg='$d_castneg'
24113 d_cbrt='$d_cbrt'
24114 d_chown='$d_chown'
24115 d_chroot='$d_chroot'
24116 d_chsize='$d_chsize'
24117 d_class='$d_class'
24118 d_clearenv='$d_clearenv'
24119 d_closedir='$d_closedir'
24120 d_cmsghdr_s='$d_cmsghdr_s'
24121 d_copysign='$d_copysign'
24122 d_copysignl='$d_copysignl'
24123 d_cplusplus='$d_cplusplus'
24124 d_crypt='$d_crypt'
24125 d_crypt_r='$d_crypt_r'
24126 d_csh='$d_csh'
24127 d_ctermid='$d_ctermid'
24128 d_ctermid_r='$d_ctermid_r'
24129 d_ctime64='$d_ctime64'
24130 d_ctime_r='$d_ctime_r'
24131 d_cuserid='$d_cuserid'
24132 d_dbminitproto='$d_dbminitproto'
24133 d_difftime64='$d_difftime64'
24134 d_difftime='$d_difftime'
24135 d_dir_dd_fd='$d_dir_dd_fd'
24136 d_dirfd='$d_dirfd'
24137 d_dirnamlen='$d_dirnamlen'
24138 d_dladdr='$d_dladdr'
24139 d_dlerror='$d_dlerror'
24140 d_dlopen='$d_dlopen'
24141 d_dlsymun='$d_dlsymun'
24142 d_dosuid='$d_dosuid'
24143 d_double_has_inf='$d_double_has_inf'
24144 d_double_has_nan='$d_double_has_nan'
24145 d_double_has_negative_zero='$d_double_has_negative_zero'
24146 d_double_has_subnormals='$d_double_has_subnormals'
24147 d_double_style_cray='$d_double_style_cray'
24148 d_double_style_ibm='$d_double_style_ibm'
24149 d_double_style_ieee='$d_double_style_ieee'
24150 d_double_style_vax='$d_double_style_vax'
24151 d_drand48_r='$d_drand48_r'
24152 d_drand48proto='$d_drand48proto'
24153 d_dup2='$d_dup2'
24154 d_dup3='$d_dup3'
24155 d_duplocale='$d_duplocale'
24156 d_eaccess='$d_eaccess'
24157 d_endgrent='$d_endgrent'
24158 d_endgrent_r='$d_endgrent_r'
24159 d_endhent='$d_endhent'
24160 d_endhostent_r='$d_endhostent_r'
24161 d_endnent='$d_endnent'
24162 d_endnetent_r='$d_endnetent_r'
24163 d_endpent='$d_endpent'
24164 d_endprotoent_r='$d_endprotoent_r'
24165 d_endpwent='$d_endpwent'
24166 d_endpwent_r='$d_endpwent_r'
24167 d_endsent='$d_endsent'
24168 d_endservent_r='$d_endservent_r'
24169 d_eofnblk='$d_eofnblk'
24170 d_erf='$d_erf'
24171 d_erfc='$d_erfc'
24172 d_eunice='$d_eunice'
24173 d_exp2='$d_exp2'
24174 d_expm1='$d_expm1'
24175 d_faststdio='$d_faststdio'
24176 d_fchdir='$d_fchdir'
24177 d_fchmod='$d_fchmod'
24178 d_fchmodat='$d_fchmodat'
24179 d_fchown='$d_fchown'
24180 d_fcntl='$d_fcntl'
24181 d_fcntl_can_lock='$d_fcntl_can_lock'
24182 d_fd_macros='$d_fd_macros'
24183 d_fd_set='$d_fd_set'
24184 d_fdclose='$d_fdclose'
24185 d_fdim='$d_fdim'
24186 d_fds_bits='$d_fds_bits'
24187 d_fegetround='$d_fegetround'
24188 d_fgetpos='$d_fgetpos'
24189 d_finite='$d_finite'
24190 d_finitel='$d_finitel'
24191 d_flexfnam='$d_flexfnam'
24192 d_flock='$d_flock'
24193 d_flockproto='$d_flockproto'
24194 d_fma='$d_fma'
24195 d_fmax='$d_fmax'
24196 d_fmin='$d_fmin'
24197 d_fork='$d_fork'
24198 d_fp_class='$d_fp_class'
24199 d_fp_classify='$d_fp_classify'
24200 d_fp_classl='$d_fp_classl'
24201 d_fpathconf='$d_fpathconf'
24202 d_fpclass='$d_fpclass'
24203 d_fpclassify='$d_fpclassify'
24204 d_fpclassl='$d_fpclassl'
24205 d_fpgetround='$d_fpgetround'
24206 d_fpos64_t='$d_fpos64_t'
24207 d_freelocale='$d_freelocale'
24208 d_frexpl='$d_frexpl'
24209 d_fs_data_s='$d_fs_data_s'
24210 d_fseeko='$d_fseeko'
24211 d_fsetpos='$d_fsetpos'
24212 d_fstatfs='$d_fstatfs'
24213 d_fstatvfs='$d_fstatvfs'
24214 d_fsync='$d_fsync'
24215 d_ftello='$d_ftello'
24216 d_ftime='$d_ftime'
24217 d_futimes='$d_futimes'
24218 d_gai_strerror='$d_gai_strerror'
24219 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24220 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24221 d_getaddrinfo='$d_getaddrinfo'
24222 d_getcwd='$d_getcwd'
24223 d_getespwnam='$d_getespwnam'
24224 d_getfsstat='$d_getfsstat'
24225 d_getgrent='$d_getgrent'
24226 d_getgrent_r='$d_getgrent_r'
24227 d_getgrgid_r='$d_getgrgid_r'
24228 d_getgrnam_r='$d_getgrnam_r'
24229 d_getgrps='$d_getgrps'
24230 d_gethbyaddr='$d_gethbyaddr'
24231 d_gethbyname='$d_gethbyname'
24232 d_gethent='$d_gethent'
24233 d_gethname='$d_gethname'
24234 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24235 d_gethostbyname_r='$d_gethostbyname_r'
24236 d_gethostent_r='$d_gethostent_r'
24237 d_gethostprotos='$d_gethostprotos'
24238 d_getitimer='$d_getitimer'
24239 d_getlogin='$d_getlogin'
24240 d_getlogin_r='$d_getlogin_r'
24241 d_getmnt='$d_getmnt'
24242 d_getmntent='$d_getmntent'
24243 d_getnameinfo='$d_getnameinfo'
24244 d_getnbyaddr='$d_getnbyaddr'
24245 d_getnbyname='$d_getnbyname'
24246 d_getnent='$d_getnent'
24247 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24248 d_getnetbyname_r='$d_getnetbyname_r'
24249 d_getnetent_r='$d_getnetent_r'
24250 d_getnetprotos='$d_getnetprotos'
24251 d_getpagsz='$d_getpagsz'
24252 d_getpbyname='$d_getpbyname'
24253 d_getpbynumber='$d_getpbynumber'
24254 d_getpent='$d_getpent'
24255 d_getpgid='$d_getpgid'
24256 d_getpgrp2='$d_getpgrp2'
24257 d_getpgrp='$d_getpgrp'
24258 d_getppid='$d_getppid'
24259 d_getprior='$d_getprior'
24260 d_getprotobyname_r='$d_getprotobyname_r'
24261 d_getprotobynumber_r='$d_getprotobynumber_r'
24262 d_getprotoent_r='$d_getprotoent_r'
24263 d_getprotoprotos='$d_getprotoprotos'
24264 d_getprpwnam='$d_getprpwnam'
24265 d_getpwent='$d_getpwent'
24266 d_getpwent_r='$d_getpwent_r'
24267 d_getpwnam_r='$d_getpwnam_r'
24268 d_getpwuid_r='$d_getpwuid_r'
24269 d_getsbyname='$d_getsbyname'
24270 d_getsbyport='$d_getsbyport'
24271 d_getsent='$d_getsent'
24272 d_getservbyname_r='$d_getservbyname_r'
24273 d_getservbyport_r='$d_getservbyport_r'
24274 d_getservent_r='$d_getservent_r'
24275 d_getservprotos='$d_getservprotos'
24276 d_getspnam='$d_getspnam'
24277 d_getspnam_r='$d_getspnam_r'
24278 d_gettimeod='$d_gettimeod'
24279 d_gmtime64='$d_gmtime64'
24280 d_gmtime_r='$d_gmtime_r'
24281 d_gnulibc='$d_gnulibc'
24282 d_grpasswd='$d_grpasswd'
24283 d_has_C_UTF8='$d_has_C_UTF8'
24284 d_hasmntopt='$d_hasmntopt'
24285 d_htonl='$d_htonl'
24286 d_hypot='$d_hypot'
24287 d_ilogb='$d_ilogb'
24288 d_ilogbl='$d_ilogbl'
24289 d_inc_version_list='$d_inc_version_list'
24290 d_inetaton='$d_inetaton'
24291 d_inetntop='$d_inetntop'
24292 d_inetpton='$d_inetpton'
24293 d_int64_t='$d_int64_t'
24294 d_ip_mreq='$d_ip_mreq'
24295 d_ip_mreq_source='$d_ip_mreq_source'
24296 d_ipv6_mreq='$d_ipv6_mreq'
24297 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24298 d_isascii='$d_isascii'
24299 d_isblank='$d_isblank'
24300 d_isfinite='$d_isfinite'
24301 d_isfinitel='$d_isfinitel'
24302 d_isinf='$d_isinf'
24303 d_isinfl='$d_isinfl'
24304 d_isless='$d_isless'
24305 d_isnan='$d_isnan'
24306 d_isnanl='$d_isnanl'
24307 d_isnormal='$d_isnormal'
24308 d_j0='$d_j0'
24309 d_j0l='$d_j0l'
24310 d_killpg='$d_killpg'
24311 d_lc_monetary_2008='$d_lc_monetary_2008'
24312 d_lchown='$d_lchown'
24313 d_ldbl_dig='$d_ldbl_dig'
24314 d_ldexpl='$d_ldexpl'
24315 d_lgamma='$d_lgamma'
24316 d_lgamma_r='$d_lgamma_r'
24317 d_libm_lib_version='$d_libm_lib_version'
24318 d_libname_unique='$d_libname_unique'
24319 d_link='$d_link'
24320 d_linkat='$d_linkat'
24321 d_llrint='$d_llrint'
24322 d_llrintl='$d_llrintl'
24323 d_llround='$d_llround'
24324 d_llroundl='$d_llroundl'
24325 d_localeconv_l='$d_localeconv_l'
24326 d_localtime64='$d_localtime64'
24327 d_localtime_r='$d_localtime_r'
24328 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24329 d_locconv='$d_locconv'
24330 d_lockf='$d_lockf'
24331 d_log1p='$d_log1p'
24332 d_log2='$d_log2'
24333 d_logb='$d_logb'
24334 d_long_double_style_ieee='$d_long_double_style_ieee'
24335 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24336 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24337 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24338 d_long_double_style_vax='$d_long_double_style_vax'
24339 d_longdbl='$d_longdbl'
24340 d_longlong='$d_longlong'
24341 d_lrint='$d_lrint'
24342 d_lrintl='$d_lrintl'
24343 d_lround='$d_lround'
24344 d_lroundl='$d_lroundl'
24345 d_lseekproto='$d_lseekproto'
24346 d_lstat='$d_lstat'
24347 d_madvise='$d_madvise'
24348 d_malloc_good_size='$d_malloc_good_size'
24349 d_malloc_size='$d_malloc_size'
24350 d_malloc_usable_size='$d_malloc_usable_size'
24351 d_mblen='$d_mblen'
24352 d_mbrlen='$d_mbrlen'
24353 d_mbrtowc='$d_mbrtowc'
24354 d_mbstowcs='$d_mbstowcs'
24355 d_mbtowc='$d_mbtowc'
24356 d_memmem='$d_memmem'
24357 d_memrchr='$d_memrchr'
24358 d_mkdir='$d_mkdir'
24359 d_mkdtemp='$d_mkdtemp'
24360 d_mkfifo='$d_mkfifo'
24361 d_mkostemp='$d_mkostemp'
24362 d_mkstemp='$d_mkstemp'
24363 d_mkstemps='$d_mkstemps'
24364 d_mktime64='$d_mktime64'
24365 d_mktime='$d_mktime'
24366 d_mmap='$d_mmap'
24367 d_modfl='$d_modfl'
24368 d_modflproto='$d_modflproto'
24369 d_mprotect='$d_mprotect'
24370 d_msg='$d_msg'
24371 d_msg_ctrunc='$d_msg_ctrunc'
24372 d_msg_dontroute='$d_msg_dontroute'
24373 d_msg_oob='$d_msg_oob'
24374 d_msg_peek='$d_msg_peek'
24375 d_msg_proxy='$d_msg_proxy'
24376 d_msgctl='$d_msgctl'
24377 d_msgget='$d_msgget'
24378 d_msghdr_s='$d_msghdr_s'
24379 d_msgrcv='$d_msgrcv'
24380 d_msgsnd='$d_msgsnd'
24381 d_msync='$d_msync'
24382 d_munmap='$d_munmap'
24383 d_mymalloc='$d_mymalloc'
24384 d_nan='$d_nan'
24385 d_nanosleep='$d_nanosleep'
24386 d_ndbm='$d_ndbm'
24387 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24388 d_nearbyint='$d_nearbyint'
24389 d_newlocale='$d_newlocale'
24390 d_nextafter='$d_nextafter'
24391 d_nexttoward='$d_nexttoward'
24392 d_nice='$d_nice'
24393 d_nl_langinfo='$d_nl_langinfo'
24394 d_nv_preserves_uv='$d_nv_preserves_uv'
24395 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24396 d_off64_t='$d_off64_t'
24397 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24398 d_oldpthreads='$d_oldpthreads'
24399 d_oldsock='$d_oldsock'
24400 d_open3='$d_open3'
24401 d_openat='$d_openat'
24402 d_pathconf='$d_pathconf'
24403 d_pause='$d_pause'
24404 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24405 d_phostname='$d_phostname'
24406 d_pipe2='$d_pipe2'
24407 d_pipe='$d_pipe'
24408 d_poll='$d_poll'
24409 d_portable='$d_portable'
24410 d_prctl='$d_prctl'
24411 d_prctl_set_name='$d_prctl_set_name'
24412 d_printf_format_null='$d_printf_format_null'
24413 d_procselfexe='$d_procselfexe'
24414 d_pseudofork='$d_pseudofork'
24415 d_pthread_atfork='$d_pthread_atfork'
24416 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24417 d_pthread_yield='$d_pthread_yield'
24418 d_ptrdiff_t='$d_ptrdiff_t'
24419 d_pwage='$d_pwage'
24420 d_pwchange='$d_pwchange'
24421 d_pwclass='$d_pwclass'
24422 d_pwcomment='$d_pwcomment'
24423 d_pwexpire='$d_pwexpire'
24424 d_pwgecos='$d_pwgecos'
24425 d_pwpasswd='$d_pwpasswd'
24426 d_pwquota='$d_pwquota'
24427 d_qgcvt='$d_qgcvt'
24428 d_quad='$d_quad'
24429 d_querylocale='$d_querylocale'
24430 d_random_r='$d_random_r'
24431 d_re_comp='$d_re_comp'
24432 d_readdir64_r='$d_readdir64_r'
24433 d_readdir='$d_readdir'
24434 d_readdir_r='$d_readdir_r'
24435 d_readlink='$d_readlink'
24436 d_readv='$d_readv'
24437 d_recvmsg='$d_recvmsg'
24438 d_regcmp='$d_regcmp'
24439 d_regcomp='$d_regcomp'
24440 d_remainder='$d_remainder'
24441 d_remquo='$d_remquo'
24442 d_rename='$d_rename'
24443 d_renameat='$d_renameat'
24444 d_rewinddir='$d_rewinddir'
24445 d_rint='$d_rint'
24446 d_rmdir='$d_rmdir'
24447 d_round='$d_round'
24448 d_sbrkproto='$d_sbrkproto'
24449 d_scalbn='$d_scalbn'
24450 d_scalbnl='$d_scalbnl'
24451 d_sched_yield='$d_sched_yield'
24452 d_scm_rights='$d_scm_rights'
24453 d_seekdir='$d_seekdir'
24454 d_select='$d_select'
24455 d_sem='$d_sem'
24456 d_semctl='$d_semctl'
24457 d_semctl_semid_ds='$d_semctl_semid_ds'
24458 d_semctl_semun='$d_semctl_semun'
24459 d_semget='$d_semget'
24460 d_semop='$d_semop'
24461 d_sendmsg='$d_sendmsg'
24462 d_setegid='$d_setegid'
24463 d_seteuid='$d_seteuid'
24464 d_setgrent='$d_setgrent'
24465 d_setgrent_r='$d_setgrent_r'
24466 d_setgrps='$d_setgrps'
24467 d_sethent='$d_sethent'
24468 d_sethostent_r='$d_sethostent_r'
24469 d_setitimer='$d_setitimer'
24470 d_setlinebuf='$d_setlinebuf'
24471 d_setlocale='$d_setlocale'
24472 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24473 d_setlocale_r='$d_setlocale_r'
24474 d_setnent='$d_setnent'
24475 d_setnetent_r='$d_setnetent_r'
24476 d_setpent='$d_setpent'
24477 d_setpgid='$d_setpgid'
24478 d_setpgrp2='$d_setpgrp2'
24479 d_setpgrp='$d_setpgrp'
24480 d_setprior='$d_setprior'
24481 d_setproctitle='$d_setproctitle'
24482 d_setprotoent_r='$d_setprotoent_r'
24483 d_setpwent='$d_setpwent'
24484 d_setpwent_r='$d_setpwent_r'
24485 d_setregid='$d_setregid'
24486 d_setresgid='$d_setresgid'
24487 d_setresuid='$d_setresuid'
24488 d_setreuid='$d_setreuid'
24489 d_setrgid='$d_setrgid'
24490 d_setruid='$d_setruid'
24491 d_setsent='$d_setsent'
24492 d_setservent_r='$d_setservent_r'
24493 d_setsid='$d_setsid'
24494 d_setvbuf='$d_setvbuf'
24495 d_shm='$d_shm'
24496 d_shmat='$d_shmat'
24497 d_shmatprototype='$d_shmatprototype'
24498 d_shmctl='$d_shmctl'
24499 d_shmdt='$d_shmdt'
24500 d_shmget='$d_shmget'
24501 d_sigaction='$d_sigaction'
24502 d_siginfo_si_addr='$d_siginfo_si_addr'
24503 d_siginfo_si_band='$d_siginfo_si_band'
24504 d_siginfo_si_errno='$d_siginfo_si_errno'
24505 d_siginfo_si_fd='$d_siginfo_si_fd'
24506 d_siginfo_si_pid='$d_siginfo_si_pid'
24507 d_siginfo_si_status='$d_siginfo_si_status'
24508 d_siginfo_si_uid='$d_siginfo_si_uid'
24509 d_siginfo_si_value='$d_siginfo_si_value'
24510 d_signbit='$d_signbit'
24511 d_sigprocmask='$d_sigprocmask'
24512 d_sigsetjmp='$d_sigsetjmp'
24513 d_sin6_scope_id='$d_sin6_scope_id'
24514 d_sitearch='$d_sitearch'
24515 d_snprintf='$d_snprintf'
24516 d_sockaddr_in6='$d_sockaddr_in6'
24517 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24518 d_sockaddr_storage='$d_sockaddr_storage'
24519 d_sockatmark='$d_sockatmark'
24520 d_sockatmarkproto='$d_sockatmarkproto'
24521 d_socket='$d_socket'
24522 d_socklen_t='$d_socklen_t'
24523 d_sockpair='$d_sockpair'
24524 d_socks5_init='$d_socks5_init'
24525 d_sqrtl='$d_sqrtl'
24526 d_srand48_r='$d_srand48_r'
24527 d_srandom_r='$d_srandom_r'
24528 d_sresgproto='$d_sresgproto'
24529 d_sresuproto='$d_sresuproto'
24530 d_stat='$d_stat'
24531 d_statblks='$d_statblks'
24532 d_statfs_f_flags='$d_statfs_f_flags'
24533 d_statfs_s='$d_statfs_s'
24534 d_static_inline='$d_static_inline'
24535 d_statvfs='$d_statvfs'
24536 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24537 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24538 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24539 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24540 d_stdio_stream_array='$d_stdio_stream_array'
24541 d_stdiobase='$d_stdiobase'
24542 d_stdstdio='$d_stdstdio'
24543 d_strcoll='$d_strcoll'
24544 d_strerror_l='$d_strerror_l'
24545 d_strerror_r='$d_strerror_r'
24546 d_strftime='$d_strftime'
24547 d_strlcat='$d_strlcat'
24548 d_strlcpy='$d_strlcpy'
24549 d_strnlen='$d_strnlen'
24550 d_strtod='$d_strtod'
24551 d_strtod_l='$d_strtod_l'
24552 d_strtol='$d_strtol'
24553 d_strtold='$d_strtold'
24554 d_strtold_l='$d_strtold_l'
24555 d_strtoll='$d_strtoll'
24556 d_strtoq='$d_strtoq'
24557 d_strtoul='$d_strtoul'
24558 d_strtoull='$d_strtoull'
24559 d_strtouq='$d_strtouq'
24560 d_strxfrm='$d_strxfrm'
24561 d_suidsafe='$d_suidsafe'
24562 d_symlink='$d_symlink'
24563 d_syscall='$d_syscall'
24564 d_syscallproto='$d_syscallproto'
24565 d_sysconf='$d_sysconf'
24566 d_sysernlst='$d_sysernlst'
24567 d_syserrlst='$d_syserrlst'
24568 d_system='$d_system'
24569 d_tcgetpgrp='$d_tcgetpgrp'
24570 d_tcsetpgrp='$d_tcsetpgrp'
24571 d_telldir='$d_telldir'
24572 d_telldirproto='$d_telldirproto'
24573 d_tgamma='$d_tgamma'
24574 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24575 d_time='$d_time'
24576 d_timegm='$d_timegm'
24577 d_times='$d_times'
24578 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24579 d_tm_tm_zone='$d_tm_tm_zone'
24580 d_tmpnam_r='$d_tmpnam_r'
24581 d_towlower='$d_towlower'
24582 d_towupper='$d_towupper'
24583 d_trunc='$d_trunc'
24584 d_truncate='$d_truncate'
24585 d_truncl='$d_truncl'
24586 d_ttyname_r='$d_ttyname_r'
24587 d_tzname='$d_tzname'
24588 d_u32align='$d_u32align'
24589 d_ualarm='$d_ualarm'
24590 d_umask='$d_umask'
24591 d_uname='$d_uname'
24592 d_union_semun='$d_union_semun'
24593 d_unlinkat='$d_unlinkat'
24594 d_unordered='$d_unordered'
24595 d_unsetenv='$d_unsetenv'
24596 d_uselocale='$d_uselocale'
24597 d_usleep='$d_usleep'
24598 d_usleepproto='$d_usleepproto'
24599 d_ustat='$d_ustat'
24600 d_vendorarch='$d_vendorarch'
24601 d_vendorbin='$d_vendorbin'
24602 d_vendorlib='$d_vendorlib'
24603 d_vendorscript='$d_vendorscript'
24604 d_vfork='$d_vfork'
24605 d_void_closedir='$d_void_closedir'
24606 d_voidsig='$d_voidsig'
24607 d_voidtty='$d_voidtty'
24608 d_vsnprintf='$d_vsnprintf'
24609 d_wait4='$d_wait4'
24610 d_waitpid='$d_waitpid'
24611 d_wcrtomb='$d_wcrtomb'
24612 d_wcscmp='$d_wcscmp'
24613 d_wcstombs='$d_wcstombs'
24614 d_wcsxfrm='$d_wcsxfrm'
24615 d_wctomb='$d_wctomb'
24616 d_writev='$d_writev'
24617 d_xenix='$d_xenix'
24618 date='$date'
24619 db_hashtype='$db_hashtype'
24620 db_prefixtype='$db_prefixtype'
24621 db_version_major='$db_version_major'
24622 db_version_minor='$db_version_minor'
24623 db_version_patch='$db_version_patch'
24624 default_inc_excludes_dot='$default_inc_excludes_dot'
24625 direntrytype='$direntrytype'
24626 dlext='$dlext'
24627 dlsrc='$dlsrc'
24628 doubleinfbytes='$doubleinfbytes'
24629 doublekind='$doublekind'
24630 doublemantbits='$doublemantbits'
24631 doublenanbytes='$doublenanbytes'
24632 doublesize='$doublesize'
24633 drand01='$drand01'
24634 drand48_r_proto='$drand48_r_proto'
24635 dtrace='$dtrace'
24636 dtraceobject='$dtraceobject'
24637 dtracexnolibs='$dtracexnolibs'
24638 dynamic_ext='$dynamic_ext'
24639 eagain='$eagain'
24640 ebcdic='$ebcdic'
24641 echo='$echo'
24642 egrep='$egrep'
24643 emacs='$emacs'
24644 endgrent_r_proto='$endgrent_r_proto'
24645 endhostent_r_proto='$endhostent_r_proto'
24646 endnetent_r_proto='$endnetent_r_proto'
24647 endprotoent_r_proto='$endprotoent_r_proto'
24648 endpwent_r_proto='$endpwent_r_proto'
24649 endservent_r_proto='$endservent_r_proto'
24650 eunicefix='$eunicefix'
24651 exe_ext='$exe_ext'
24652 expr='$expr'
24653 extensions='$extensions'
24654 extern_C='$extern_C'
24655 extras='$extras'
24656 fflushNULL='$fflushNULL'
24657 fflushall='$fflushall'
24658 find='$find'
24659 firstmakefile='$firstmakefile'
24660 flex='$flex'
24661 fpossize='$fpossize'
24662 fpostype='$fpostype'
24663 freetype='$freetype'
24664 from='$from'
24665 full_ar='$full_ar'
24666 full_csh='$full_csh'
24667 full_sed='$full_sed'
24668 gccansipedantic='$gccansipedantic'
24669 gccosandvers='$gccosandvers'
24670 gccversion='$gccversion'
24671 getgrent_r_proto='$getgrent_r_proto'
24672 getgrgid_r_proto='$getgrgid_r_proto'
24673 getgrnam_r_proto='$getgrnam_r_proto'
24674 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24675 gethostbyname_r_proto='$gethostbyname_r_proto'
24676 gethostent_r_proto='$gethostent_r_proto'
24677 getlogin_r_proto='$getlogin_r_proto'
24678 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24679 getnetbyname_r_proto='$getnetbyname_r_proto'
24680 getnetent_r_proto='$getnetent_r_proto'
24681 getprotobyname_r_proto='$getprotobyname_r_proto'
24682 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24683 getprotoent_r_proto='$getprotoent_r_proto'
24684 getpwent_r_proto='$getpwent_r_proto'
24685 getpwnam_r_proto='$getpwnam_r_proto'
24686 getpwuid_r_proto='$getpwuid_r_proto'
24687 getservbyname_r_proto='$getservbyname_r_proto'
24688 getservbyport_r_proto='$getservbyport_r_proto'
24689 getservent_r_proto='$getservent_r_proto'
24690 getspnam_r_proto='$getspnam_r_proto'
24691 gidformat='$gidformat'
24692 gidsign='$gidsign'
24693 gidsize='$gidsize'
24694 gidtype='$gidtype'
24695 glibpth='$glibpth'
24696 gmake='$gmake'
24697 gmtime_r_proto='$gmtime_r_proto'
24698 gnulibc_version='$gnulibc_version'
24699 grep='$grep'
24700 groupcat='$groupcat'
24701 groupstype='$groupstype'
24702 gzip='$gzip'
24703 h_fcntl='$h_fcntl'
24704 h_sysfile='$h_sysfile'
24705 hint='$hint'
24706 hostcat='$hostcat'
24707 hostgenerate='$hostgenerate'
24708 hostosname='$hostosname'
24709 hostperl='$hostperl'
24710 html1dir='$html1dir'
24711 html1direxp='$html1direxp'
24712 html3dir='$html3dir'
24713 html3direxp='$html3direxp'
24714 i16size='$i16size'
24715 i16type='$i16type'
24716 i32size='$i32size'
24717 i32type='$i32type'
24718 i64size='$i64size'
24719 i64type='$i64type'
24720 i8size='$i8size'
24721 i8type='$i8type'
24722 i_arpainet='$i_arpainet'
24723 i_bfd='$i_bfd'
24724 i_bsdioctl='$i_bsdioctl'
24725 i_crypt='$i_crypt'
24726 i_db='$i_db'
24727 i_dbm='$i_dbm'
24728 i_dirent='$i_dirent'
24729 i_dlfcn='$i_dlfcn'
24730 i_execinfo='$i_execinfo'
24731 i_fcntl='$i_fcntl'
24732 i_fenv='$i_fenv'
24733 i_fp='$i_fp'
24734 i_fp_class='$i_fp_class'
24735 i_gdbm='$i_gdbm'
24736 i_gdbm_ndbm='$i_gdbm_ndbm'
24737 i_gdbmndbm='$i_gdbmndbm'
24738 i_grp='$i_grp'
24739 i_ieeefp='$i_ieeefp'
24740 i_inttypes='$i_inttypes'
24741 i_langinfo='$i_langinfo'
24742 i_libutil='$i_libutil'
24743 i_locale='$i_locale'
24744 i_machcthr='$i_machcthr'
24745 i_malloc='$i_malloc'
24746 i_mallocmalloc='$i_mallocmalloc'
24747 i_mntent='$i_mntent'
24748 i_ndbm='$i_ndbm'
24749 i_netdb='$i_netdb'
24750 i_neterrno='$i_neterrno'
24751 i_netinettcp='$i_netinettcp'
24752 i_niin='$i_niin'
24753 i_poll='$i_poll'
24754 i_prot='$i_prot'
24755 i_pthread='$i_pthread'
24756 i_pwd='$i_pwd'
24757 i_quadmath='$i_quadmath'
24758 i_rpcsvcdbm='$i_rpcsvcdbm'
24759 i_sgtty='$i_sgtty'
24760 i_shadow='$i_shadow'
24761 i_socks='$i_socks'
24762 i_stdbool='$i_stdbool'
24763 i_stdint='$i_stdint'
24764 i_stdlib='$i_stdlib'
24765 i_sunmath='$i_sunmath'
24766 i_sysaccess='$i_sysaccess'
24767 i_sysdir='$i_sysdir'
24768 i_sysfile='$i_sysfile'
24769 i_sysfilio='$i_sysfilio'
24770 i_sysin='$i_sysin'
24771 i_sysioctl='$i_sysioctl'
24772 i_syslog='$i_syslog'
24773 i_sysmman='$i_sysmman'
24774 i_sysmode='$i_sysmode'
24775 i_sysmount='$i_sysmount'
24776 i_sysndir='$i_sysndir'
24777 i_sysparam='$i_sysparam'
24778 i_syspoll='$i_syspoll'
24779 i_sysresrc='$i_sysresrc'
24780 i_syssecrt='$i_syssecrt'
24781 i_sysselct='$i_sysselct'
24782 i_syssockio='$i_syssockio'
24783 i_sysstat='$i_sysstat'
24784 i_sysstatfs='$i_sysstatfs'
24785 i_sysstatvfs='$i_sysstatvfs'
24786 i_systime='$i_systime'
24787 i_systimek='$i_systimek'
24788 i_systimes='$i_systimes'
24789 i_systypes='$i_systypes'
24790 i_sysuio='$i_sysuio'
24791 i_sysun='$i_sysun'
24792 i_sysutsname='$i_sysutsname'
24793 i_sysvfs='$i_sysvfs'
24794 i_syswait='$i_syswait'
24795 i_termio='$i_termio'
24796 i_termios='$i_termios'
24797 i_time='$i_time'
24798 i_unistd='$i_unistd'
24799 i_ustat='$i_ustat'
24800 i_utime='$i_utime'
24801 i_vfork='$i_vfork'
24802 i_wchar='$i_wchar'
24803 i_wctype='$i_wctype'
24804 i_xlocale='$i_xlocale'
24805 ignore_versioned_solibs='$ignore_versioned_solibs'
24806 inc_version_list='$inc_version_list'
24807 inc_version_list_init='$inc_version_list_init'
24808 incpath='$incpath'
24809 incpth='$incpth'
24810 inews='$inews'
24811 initialinstalllocation='$initialinstalllocation'
24812 installarchlib='$installarchlib'
24813 installbin='$installbin'
24814 installhtml1dir='$installhtml1dir'
24815 installhtml3dir='$installhtml3dir'
24816 installman1dir='$installman1dir'
24817 installman3dir='$installman3dir'
24818 installprefix='$installprefix'
24819 installprefixexp='$installprefixexp'
24820 installprivlib='$installprivlib'
24821 installscript='$installscript'
24822 installsitearch='$installsitearch'
24823 installsitebin='$installsitebin'
24824 installsitehtml1dir='$installsitehtml1dir'
24825 installsitehtml3dir='$installsitehtml3dir'
24826 installsitelib='$installsitelib'
24827 installsiteman1dir='$installsiteman1dir'
24828 installsiteman3dir='$installsiteman3dir'
24829 installsitescript='$installsitescript'
24830 installstyle='$installstyle'
24831 installusrbinperl='$installusrbinperl'
24832 installvendorarch='$installvendorarch'
24833 installvendorbin='$installvendorbin'
24834 installvendorhtml1dir='$installvendorhtml1dir'
24835 installvendorhtml3dir='$installvendorhtml3dir'
24836 installvendorlib='$installvendorlib'
24837 installvendorman1dir='$installvendorman1dir'
24838 installvendorman3dir='$installvendorman3dir'
24839 installvendorscript='$installvendorscript'
24840 intsize='$intsize'
24841 issymlink='$issymlink'
24842 ivdformat='$ivdformat'
24843 ivsize='$ivsize'
24844 ivtype='$ivtype'
24845 known_extensions='$known_extensions'
24846 ksh='$ksh'
24847 ld='$ld'
24848 ld_can_script='$ld_can_script'
24849 lddlflags='$lddlflags'
24850 ldflags='$ldflags'
24851 ldflags_uselargefiles='$ldflags_uselargefiles'
24852 ldlibpthname='$ldlibpthname'
24853 less='$less'
24854 lib_ext='$lib_ext'
24855 libc='$libc'
24856 libperl='$libperl'
24857 libpth='$libpth'
24858 libs='$libs'
24859 libsdirs='$libsdirs'
24860 libsfiles='$libsfiles'
24861 libsfound='$libsfound'
24862 libspath='$libspath'
24863 libswanted='$libswanted'
24864 libswanted_uselargefiles='$libswanted_uselargefiles'
24865 line='$line'
24866 lint='$lint'
24867 lkflags='$lkflags'
24868 ln='$ln'
24869 lns='$lns'
24870 localtime_r_proto='$localtime_r_proto'
24871 locincpth='$locincpth'
24872 loclibpth='$loclibpth'
24873 longdblinfbytes='$longdblinfbytes'
24874 longdblkind='$longdblkind'
24875 longdblmantbits='$longdblmantbits'
24876 longdblnanbytes='$longdblnanbytes'
24877 longdblsize='$longdblsize'
24878 longlongsize='$longlongsize'
24879 longsize='$longsize'
24880 lp='$lp'
24881 lpr='$lpr'
24882 ls='$ls'
24883 lseeksize='$lseeksize'
24884 lseektype='$lseektype'
24885 mail='$mail'
24886 mailx='$mailx'
24887 make='$make'
24888 make_set_make='$make_set_make'
24889 mallocobj='$mallocobj'
24890 mallocsrc='$mallocsrc'
24891 malloctype='$malloctype'
24892 man1dir='$man1dir'
24893 man1direxp='$man1direxp'
24894 man1ext='$man1ext'
24895 man3dir='$man3dir'
24896 man3direxp='$man3direxp'
24897 man3ext='$man3ext'
24898 mips_type='$mips_type'
24899 mistrustnm='$mistrustnm'
24900 mkdir='$mkdir'
24901 mmaptype='$mmaptype'
24902 modetype='$modetype'
24903 more='$more'
24904 multiarch='$multiarch'
24905 mv='$mv'
24906 myarchname='$myarchname'
24907 mydomain='$mydomain'
24908 myhostname='$myhostname'
24909 myuname='$myuname'
24910 n='$n'
24911 need_va_copy='$need_va_copy'
24912 netdb_hlen_type='$netdb_hlen_type'
24913 netdb_host_type='$netdb_host_type'
24914 netdb_name_type='$netdb_name_type'
24915 netdb_net_type='$netdb_net_type'
24916 nm='$nm'
24917 nm_opt='$nm_opt'
24918 nm_so_opt='$nm_so_opt'
24919 nonxs_ext='$nonxs_ext'
24920 nroff='$nroff'
24921 nvEUformat='$nvEUformat'
24922 nvFUformat='$nvFUformat'
24923 nvGUformat='$nvGUformat'
24924 nv_overflows_integers_at='$nv_overflows_integers_at'
24925 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24926 nveformat='$nveformat'
24927 nvfformat='$nvfformat'
24928 nvgformat='$nvgformat'
24929 nvmantbits='$nvmantbits'
24930 nvsize='$nvsize'
24931 nvtype='$nvtype'
24932 o_nonblock='$o_nonblock'
24933 obj_ext='$obj_ext'
24934 old_pthread_create_joinable='$old_pthread_create_joinable'
24935 optimize='$optimize'
24936 orderlib='$orderlib'
24937 osname='$osname'
24938 osvers='$osvers'
24939 otherlibdirs='$otherlibdirs'
24940 package='$package'
24941 pager='$pager'
24942 passcat='$passcat'
24943 patchlevel='$patchlevel'
24944 path_sep='$path_sep'
24945 perl5='$perl5'
24946 perl='$perl'
24947 perl_patchlevel='$perl_patchlevel'
24948 perl_static_inline='$perl_static_inline'
24949 perladmin='$perladmin'
24950 perllibs='$perllibs'
24951 perlpath='$perlpath'
24952 pg='$pg'
24953 phostname='$phostname'
24954 pidtype='$pidtype'
24955 plibpth='$plibpth'
24956 pmake='$pmake'
24957 pr='$pr'
24958 prefix='$prefix'
24959 prefixexp='$prefixexp'
24960 privlib='$privlib'
24961 privlibexp='$privlibexp'
24962 procselfexe='$procselfexe'
24963 ptrsize='$ptrsize'
24964 quadkind='$quadkind'
24965 quadtype='$quadtype'
24966 randbits='$randbits'
24967 randfunc='$randfunc'
24968 random_r_proto='$random_r_proto'
24969 randseedtype='$randseedtype'
24970 ranlib='$ranlib'
24971 rd_nodata='$rd_nodata'
24972 readdir64_r_proto='$readdir64_r_proto'
24973 readdir_r_proto='$readdir_r_proto'
24974 revision='$revision'
24975 rm='$rm'
24976 rm_try='$rm_try'
24977 rmail='$rmail'
24978 run='$run'
24979 runnm='$runnm'
24980 sGMTIME_max='$sGMTIME_max'
24981 sGMTIME_min='$sGMTIME_min'
24982 sLOCALTIME_max='$sLOCALTIME_max'
24983 sLOCALTIME_min='$sLOCALTIME_min'
24984 sPRIEUldbl='$sPRIEUldbl'
24985 sPRIFUldbl='$sPRIFUldbl'
24986 sPRIGUldbl='$sPRIGUldbl'
24987 sPRIXU64='$sPRIXU64'
24988 sPRId64='$sPRId64'
24989 sPRIeldbl='$sPRIeldbl'
24990 sPRIfldbl='$sPRIfldbl'
24991 sPRIgldbl='$sPRIgldbl'
24992 sPRIi64='$sPRIi64'
24993 sPRIo64='$sPRIo64'
24994 sPRIu64='$sPRIu64'
24995 sPRIx64='$sPRIx64'
24996 sSCNfldbl='$sSCNfldbl'
24997 sched_yield='$sched_yield'
24998 scriptdir='$scriptdir'
24999 scriptdirexp='$scriptdirexp'
25000 sed='$sed'
25001 seedfunc='$seedfunc'
25002 selectminbits='$selectminbits'
25003 selecttype='$selecttype'
25004 sendmail='$sendmail'
25005 setgrent_r_proto='$setgrent_r_proto'
25006 sethostent_r_proto='$sethostent_r_proto'
25007 setlocale_r_proto='$setlocale_r_proto'
25008 setnetent_r_proto='$setnetent_r_proto'
25009 setprotoent_r_proto='$setprotoent_r_proto'
25010 setpwent_r_proto='$setpwent_r_proto'
25011 setservent_r_proto='$setservent_r_proto'
25012 sh='$sh'
25013 shar='$shar'
25014 sharpbang='$sharpbang'
25015 shmattype='$shmattype'
25016 shortsize='$shortsize'
25017 shrpenv='$shrpenv'
25018 shsharp='$shsharp'
25019 sig_count='$sig_count'
25020 sig_name='$sig_name'
25021 sig_name_init='$sig_name_init'
25022 sig_num='$sig_num'
25023 sig_num_init='$sig_num_init'
25024 sig_size='$sig_size'
25025 signal_t='$signal_t'
25026 sitearch='$sitearch'
25027 sitearchexp='$sitearchexp'
25028 sitebin='$sitebin'
25029 sitebinexp='$sitebinexp'
25030 sitehtml1dir='$sitehtml1dir'
25031 sitehtml1direxp='$sitehtml1direxp'
25032 sitehtml3dir='$sitehtml3dir'
25033 sitehtml3direxp='$sitehtml3direxp'
25034 sitelib='$sitelib'
25035 sitelib_stem='$sitelib_stem'
25036 sitelibexp='$sitelibexp'
25037 siteman1dir='$siteman1dir'
25038 siteman1direxp='$siteman1direxp'
25039 siteman3dir='$siteman3dir'
25040 siteman3direxp='$siteman3direxp'
25041 siteprefix='$siteprefix'
25042 siteprefixexp='$siteprefixexp'
25043 sitescript='$sitescript'
25044 sitescriptexp='$sitescriptexp'
25045 sizesize='$sizesize'
25046 sizetype='$sizetype'
25047 sleep='$sleep'
25048 smail='$smail'
25049 so='$so'
25050 sockethdr='$sockethdr'
25051 socketlib='$socketlib'
25052 socksizetype='$socksizetype'
25053 sort='$sort'
25054 spackage='$spackage'
25055 spitshell='$spitshell'
25056 srand48_r_proto='$srand48_r_proto'
25057 srandom_r_proto='$srandom_r_proto'
25058 src='$src'
25059 ssizetype='$ssizetype'
25060 st_ino_sign='$st_ino_sign'
25061 st_ino_size='$st_ino_size'
25062 startperl='$startperl'
25063 startsh='$startsh'
25064 static_ext='$static_ext'
25065 stdchar='$stdchar'
25066 stdio_base='$stdio_base'
25067 stdio_bufsiz='$stdio_bufsiz'
25068 stdio_cnt='$stdio_cnt'
25069 stdio_filbuf='$stdio_filbuf'
25070 stdio_ptr='$stdio_ptr'
25071 stdio_stream_array='$stdio_stream_array'
25072 strerror_r_proto='$strerror_r_proto'
25073 submit='$submit'
25074 subversion='$subversion'
25075 sysman='$sysman'
25076 sysroot='$sysroot'
25077 tail='$tail'
25078 tar='$tar'
25079 targetarch='$targetarch'
25080 targetdir='$targetdir'
25081 targetenv='$targetenv'
25082 targethost='$targethost'
25083 targetmkdir='$targetmkdir'
25084 targetport='$targetport'
25085 targetsh='$targetsh'
25086 tbl='$tbl'
25087 tee='$tee'
25088 test='$test'
25089 timeincl='$timeincl'
25090 timetype='$timetype'
25091 tmpnam_r_proto='$tmpnam_r_proto'
25092 to='$to'
25093 touch='$touch'
25094 tr='$tr'
25095 trnl='$trnl'
25096 troff='$troff'
25097 ttyname_r_proto='$ttyname_r_proto'
25098 u16size='$u16size'
25099 u16type='$u16type'
25100 u32size='$u32size'
25101 u32type='$u32type'
25102 u64size='$u64size'
25103 u64type='$u64type'
25104 u8size='$u8size'
25105 u8type='$u8type'
25106 uidformat='$uidformat'
25107 uidsign='$uidsign'
25108 uidsize='$uidsize'
25109 uidtype='$uidtype'
25110 uname='$uname'
25111 uniq='$uniq'
25112 uquadtype='$uquadtype'
25113 use5005threads='$use5005threads'
25114 use64bitall='$use64bitall'
25115 use64bitint='$use64bitint'
25116 usecbacktrace='$usecbacktrace'
25117 usecrosscompile='$usecrosscompile'
25118 usedevel='$usedevel'
25119 usedl='$usedl'
25120 usedtrace='$usedtrace'
25121 usefaststdio='$usefaststdio'
25122 useithreads='$useithreads'
25123 usekernprocpathname='$usekernprocpathname'
25124 uselanginfo='$uselanginfo'
25125 uselargefiles='$uselargefiles'
25126 uselongdouble='$uselongdouble'
25127 usemallocwrap='$usemallocwrap'
25128 usemorebits='$usemorebits'
25129 usemultiplicity='$usemultiplicity'
25130 usemymalloc='$usemymalloc'
25131 usenm='$usenm'
25132 usensgetexecutablepath='$usensgetexecutablepath'
25133 useopcode='$useopcode'
25134 useperlio='$useperlio'
25135 useposix='$useposix'
25136 usequadmath='$usequadmath'
25137 usereentrant='$usereentrant'
25138 userelocatableinc='$userelocatableinc'
25139 useshrplib='$useshrplib'
25140 usesitecustomize='$usesitecustomize'
25141 usesocks='$usesocks'
25142 usethreads='$usethreads'
25143 usevendorprefix='$usevendorprefix'
25144 useversionedarchname='$useversionedarchname'
25145 usevfork='$usevfork'
25146 usrinc='$usrinc'
25147 uuname='$uuname'
25148 uvXUformat='$uvXUformat'
25149 uvoformat='$uvoformat'
25150 uvsize='$uvsize'
25151 uvtype='$uvtype'
25152 uvuformat='$uvuformat'
25153 uvxformat='$uvxformat'
25154 vendorarch='$vendorarch'
25155 vendorarchexp='$vendorarchexp'
25156 vendorbin='$vendorbin'
25157 vendorbinexp='$vendorbinexp'
25158 vendorhtml1dir='$vendorhtml1dir'
25159 vendorhtml1direxp='$vendorhtml1direxp'
25160 vendorhtml3dir='$vendorhtml3dir'
25161 vendorhtml3direxp='$vendorhtml3direxp'
25162 vendorlib='$vendorlib'
25163 vendorlib_stem='$vendorlib_stem'
25164 vendorlibexp='$vendorlibexp'
25165 vendorman1dir='$vendorman1dir'
25166 vendorman1direxp='$vendorman1direxp'
25167 vendorman3dir='$vendorman3dir'
25168 vendorman3direxp='$vendorman3direxp'
25169 vendorprefix='$vendorprefix'
25170 vendorprefixexp='$vendorprefixexp'
25171 vendorscript='$vendorscript'
25172 vendorscriptexp='$vendorscriptexp'
25173 version='$version'
25174 version_patchlevel_string='$version_patchlevel_string'
25175 versiononly='$versiononly'
25176 vi='$vi'
25177 xlibpth='$xlibpth'
25178 yacc='$yacc'
25179 yaccflags='$yaccflags'
25180 zcat='$zcat'
25181 zip='$zip'
25182 EOT
25183
25184 : add special variables
25185 $test -f $src/patchlevel.h && \
25186 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25187 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25188 echo "PERL_CONFIG_SH=true" >>config.sh
25189
25190 : propagate old symbols
25191 if $test -f UU/config.sh; then
25192         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25193         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25194                 config.sh config.sh UU/oldconfig.sh |\
25195                 $sort | $uniq -u >UU/oldsyms
25196         set X `$cat UU/oldsyms`
25197         shift
25198         case $# in
25199         0) ;;
25200         *)
25201                 $cat <<EOM
25202 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25203 EOM
25204                 echo ": Variables propagated from previous config.sh file." >>config.sh
25205                 for sym in `$cat UU/oldsyms`; do
25206                         echo "    Propagating $hint variable "'$'"$sym..."
25207                         eval 'tmp="$'"${sym}"'"'
25208                         echo "$tmp" | \
25209                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25210                 done
25211                 ;;
25212         esac
25213 fi
25214
25215 : preserve RCS keywords in files with variable substitution, grrr
25216 Id='$Id'
25217
25218 : Finish up by extracting the .SH files
25219 case "$alldone" in
25220 exit)
25221         echo "Stopping at your request, leaving temporary files around."
25222         exit 0
25223         ;;
25224 cont)
25225         ;;
25226 '')
25227         dflt=''
25228         nostick=true
25229         $cat <<EOM
25230
25231 If you'd like to make any changes to the config.sh file before I begin
25232 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25233
25234 EOM
25235         rp="Press return or use a shell escape to edit config.sh:"
25236         . UU/myread
25237         nostick=''
25238         case "$ans" in
25239         '') ;;
25240         *) : in case they cannot read
25241                 sh 1>&4 -c "$ans";;
25242         esac
25243         ;;
25244 esac
25245
25246 : if this fails, just run all the .SH files by hand
25247 . ./config.sh
25248
25249 echo " "
25250 exec 1>&4
25251 pwd=`pwd`
25252 . ./UU/extract
25253 cd "$pwd"
25254
25255 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25256         dflt=y
25257         case "$silent" in
25258         true) ;;
25259         *)
25260                 $cat <<EOM
25261
25262 Now you need to generate make dependencies by running "$make depend".
25263 You might prefer to run it in background: "$make depend > makedepend.out &"
25264 It can take a while, so you might not want to run it right now.
25265
25266 EOM
25267                 ;;
25268         esac
25269         rp="Run $make depend now?"
25270         . UU/myread
25271         case "$ans" in
25272         y*)
25273                 $make depend && echo "Now you must run '$make'."
25274                 ;;
25275         *)
25276                 echo "You must run '$make depend' then '$make'."
25277                 ;;
25278         esac
25279 elif test -f [Mm]akefile; then
25280         echo " "
25281         echo "Now you must run a $make."
25282 else
25283         echo "Configure done."
25284 fi
25285
25286 if $test -f Policy.sh; then
25287     $cat <<EOM
25288
25289 If you compile $package on a different machine or from a different object
25290 directory, copy the Policy.sh file from this object directory to the
25291 new one before you run Configure -- this will help you with most of
25292 the policy defaults.
25293
25294 EOM
25295 fi
25296 if $test -f UU/config.msg; then
25297     echo "Hmm.  I also noted the following information while running:"
25298     echo " "
25299     $cat UU/config.msg >&4
25300 fi
25301 $rm -f kit*isdone ark*isdone
25302 $rm -rf UU
25303
25304 : End of Configure
25305