This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updating the cross-references to perlfunc/open so that it aims at the new first heading.
[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_socket=''
837 d_sockpair=''
838 sockethdr=''
839 socketlib=''
840 d_socklen_t=''
841 d_socks5_init=''
842 d_sqrtl=''
843 d_srand48_r=''
844 srand48_r_proto=''
845 d_srandom_r=''
846 srandom_r_proto=''
847 d_sresgproto=''
848 d_sresuproto=''
849 d_stat=''
850 d_statblks=''
851 d_statfs_f_flags=''
852 d_statfs_s=''
853 d_static_inline=''
854 perl_static_inline=''
855 d_fstatvfs=''
856 d_statvfs=''
857 d_stdio_cnt_lval=''
858 d_stdio_ptr_lval=''
859 d_stdio_ptr_lval_nochange_cnt=''
860 d_stdio_ptr_lval_sets_cnt=''
861 d_stdiobase=''
862 d_stdstdio=''
863 stdio_base=''
864 stdio_bufsiz=''
865 stdio_cnt=''
866 stdio_filbuf=''
867 stdio_ptr=''
868 d_strcoll=''
869 d_sysernlst=''
870 d_syserrlst=''
871 d_strerror_l=''
872 d_strerror_r=''
873 strerror_r_proto=''
874 d_strftime=''
875 d_strlcat=''
876 d_strlcpy=''
877 d_strnlen=''
878 d_strtod=''
879 d_strtod_l=''
880 d_strtol=''
881 d_strtold=''
882 d_strtold_l=''
883 d_strtoll=''
884 d_strtoq=''
885 d_strtoul=''
886 d_strtoull=''
887 d_strtouq=''
888 d_strxfrm=''
889 d_symlink=''
890 d_syscall=''
891 d_syscallproto=''
892 d_sysconf=''
893 d_system=''
894 d_tcgetpgrp=''
895 d_tcsetpgrp=''
896 d_telldirproto=''
897 d_tgamma=''
898 d_time=''
899 timetype=''
900 d_asctime64=''
901 d_ctime64=''
902 d_difftime64=''
903 d_gmtime64=''
904 d_localtime64=''
905 d_mktime64=''
906 d_timegm=''
907 clocktype=''
908 d_times=''
909 d_tmpnam_r=''
910 tmpnam_r_proto=''
911 d_towlower=''
912 d_towupper=''
913 d_trunc=''
914 d_truncate=''
915 d_truncl=''
916 d_ttyname_r=''
917 ttyname_r_proto=''
918 d_tzname=''
919 d_u32align=''
920 d_ualarm=''
921 d_umask=''
922 d_semctl_semid_ds=''
923 d_semctl_semun=''
924 d_union_semun=''
925 d_unordered=''
926 d_unsetenv=''
927 d_usleep=''
928 d_usleepproto=''
929 d_ustat=''
930 d_pseudofork=''
931 d_vfork=''
932 usevfork=''
933 d_voidsig=''
934 signal_t=''
935 d_wait4=''
936 d_waitpid=''
937 d_wcrtomb=''
938 d_wcscmp=''
939 d_wcstombs=''
940 d_wcsxfrm=''
941 d_wctomb=''
942 d_writev=''
943 default_inc_excludes_dot=''
944 dlext=''
945 bin_ELF=''
946 cccdlflags=''
947 ccdlflags=''
948 dlsrc=''
949 ld=''
950 ld_can_script=''
951 lddlflags=''
952 usedl=''
953 doublesize=''
954 dtraceobject=''
955 dtracexnolibs=''
956 ebcdic=''
957 fflushNULL=''
958 fflushall=''
959 fpossize=''
960 fpostype=''
961 gccansipedantic=''
962 gccosandvers=''
963 gccversion=''
964 gidformat=''
965 gidsign=''
966 gidsize=''
967 gidtype=''
968 groupstype=''
969 h_fcntl=''
970 h_sysfile=''
971 html1dir=''
972 html1direxp=''
973 installhtml1dir=''
974 html3dir=''
975 html3direxp=''
976 installhtml3dir=''
977 i_arpainet=''
978 i_bfd=''
979 i_crypt=''
980 db_hashtype=''
981 db_prefixtype=''
982 db_version_major=''
983 db_version_minor=''
984 db_version_patch=''
985 i_db=''
986 i_dbm=''
987 i_rpcsvcdbm=''
988 d_dirnamlen=''
989 direntrytype=''
990 i_dirent=''
991 i_dlfcn=''
992 i_execinfo=''
993 i_fcntl=''
994 i_fenv=''
995 i_fp=''
996 i_fp_class=''
997 i_gdbm=''
998 d_grpasswd=''
999 i_grp=''
1000 i_ieeefp=''
1001 i_inttypes=''
1002 i_langinfo=''
1003 i_libutil=''
1004 i_locale=''
1005 i_machcthr=''
1006 i_malloc=''
1007 i_mallocmalloc=''
1008 i_mntent=''
1009 d_gdbm_ndbm_h_uses_prototypes=''
1010 d_gdbmndbm_h_uses_prototypes=''
1011 d_ndbm=''
1012 d_ndbm_h_uses_prototypes=''
1013 i_gdbm_ndbm=''
1014 i_gdbmndbm=''
1015 i_ndbm=''
1016 i_netdb=''
1017 i_neterrno=''
1018 i_netinettcp=''
1019 i_niin=''
1020 i_sysin=''
1021 i_poll=''
1022 i_prot=''
1023 i_pthread=''
1024 d_pwage=''
1025 d_pwchange=''
1026 d_pwclass=''
1027 d_pwcomment=''
1028 d_pwexpire=''
1029 d_pwgecos=''
1030 d_pwpasswd=''
1031 d_pwquota=''
1032 i_pwd=''
1033 i_quadmath=''
1034 i_shadow=''
1035 i_socks=''
1036 i_stdbool=''
1037 i_stdint=''
1038 i_stdlib=''
1039 i_sunmath=''
1040 i_sysaccess=''
1041 i_sysdir=''
1042 i_sysfile=''
1043 d_voidtty=''
1044 i_bsdioctl=''
1045 i_sysfilio=''
1046 i_sysioctl=''
1047 i_syssockio=''
1048 i_syslog=''
1049 i_sysmman=''
1050 i_sysmode=''
1051 i_sysmount=''
1052 i_sysndir=''
1053 i_sysparam=''
1054 i_syspoll=''
1055 i_sysresrc=''
1056 i_syssecrt=''
1057 i_sysselct=''
1058 i_sysstat=''
1059 i_sysstatfs=''
1060 i_sysstatvfs=''
1061 i_systimes=''
1062 i_systypes=''
1063 i_sysuio=''
1064 i_sysun=''
1065 i_sysutsname=''
1066 i_sysvfs=''
1067 i_syswait=''
1068 i_sgtty=''
1069 i_termio=''
1070 i_termios=''
1071 d_tm_tm_gmtoff=''
1072 d_tm_tm_zone=''
1073 i_systime=''
1074 i_systimek=''
1075 i_time=''
1076 timeincl=''
1077 i_unistd=''
1078 i_ustat=''
1079 i_utime=''
1080 i_vfork=''
1081 i_wchar=''
1082 i_wctype=''
1083 d_inc_version_list=''
1084 inc_version_list=''
1085 inc_version_list_init=''
1086 doubleinfbytes=''
1087 doublenanbytes=''
1088 longdblinfbytes=''
1089 longdblnanbytes=''
1090 installprefix=''
1091 installprefixexp=''
1092 installstyle=''
1093 installusrbinperl=''
1094 intsize=''
1095 longsize=''
1096 shortsize=''
1097 issymlink=''
1098 libc=''
1099 ldlibpthname=''
1100 libperl=''
1101 shrpenv=''
1102 useshrplib=''
1103 glibpth=''
1104 incpth=''
1105 libpth=''
1106 loclibpth=''
1107 plibpth=''
1108 xlibpth=''
1109 ignore_versioned_solibs=''
1110 libs=''
1111 libsdirs=''
1112 libsfiles=''
1113 libsfound=''
1114 libspath=''
1115 lns=''
1116 d_PRIEUldbl=''
1117 d_PRIFUldbl=''
1118 d_PRIGUldbl=''
1119 d_PRIeldbl=''
1120 d_PRIfldbl=''
1121 d_PRIgldbl=''
1122 d_SCNfldbl=''
1123 d_double_has_inf=''
1124 d_double_has_nan=''
1125 d_double_has_negative_zero=''
1126 d_double_has_subnormals=''
1127 d_double_style_cray=''
1128 d_double_style_ibm=''
1129 d_double_style_ieee=''
1130 d_double_style_vax=''
1131 doublekind=''
1132 sPRIEUldbl=''
1133 sPRIFUldbl=''
1134 sPRIGUldbl=''
1135 sPRIeldbl=''
1136 sPRIfldbl=''
1137 sPRIgldbl=''
1138 sSCNfldbl=''
1139 lseeksize=''
1140 lseektype=''
1141 make_set_make=''
1142 d_mymalloc=''
1143 freetype=''
1144 mallocobj=''
1145 mallocsrc=''
1146 malloctype=''
1147 usemallocwrap=''
1148 usemymalloc=''
1149 installman1dir=''
1150 man1dir=''
1151 man1direxp=''
1152 man1ext=''
1153 installman3dir=''
1154 man3dir=''
1155 man3direxp=''
1156 man3ext=''
1157 doublemantbits=''
1158 longdblmantbits=''
1159 nvmantbits=''
1160 modetype=''
1161 multiarch=''
1162 mydomain=''
1163 myhostname=''
1164 phostname=''
1165 c=''
1166 n=''
1167 d_eofnblk=''
1168 eagain=''
1169 o_nonblock=''
1170 rd_nodata=''
1171 need_va_copy=''
1172 netdb_hlen_type=''
1173 netdb_host_type=''
1174 netdb_name_type=''
1175 netdb_net_type=''
1176 groupcat=''
1177 hostcat=''
1178 passcat=''
1179 orderlib=''
1180 ranlib=''
1181 d_perl_otherlibdirs=''
1182 otherlibdirs=''
1183 package=''
1184 spackage=''
1185 pager=''
1186 api_revision=''
1187 api_subversion=''
1188 api_version=''
1189 api_versionstring=''
1190 patchlevel=''
1191 perl_patchlevel=''
1192 revision=''
1193 subversion=''
1194 version=''
1195 version_patchlevel_string=''
1196 perl5=''
1197 perladmin=''
1198 perlpath=''
1199 d_nv_preserves_uv=''
1200 d_nv_zero_is_allbits_zero=''
1201 i16size=''
1202 i16type=''
1203 i32size=''
1204 i32type=''
1205 i64size=''
1206 i64type=''
1207 i8size=''
1208 i8type=''
1209 ivsize=''
1210 ivtype=''
1211 nv_overflows_integers_at=''
1212 nv_preserves_uv_bits=''
1213 nvsize=''
1214 nvtype=''
1215 u16size=''
1216 u16type=''
1217 u32size=''
1218 u32type=''
1219 u64size=''
1220 u64type=''
1221 u8size=''
1222 u8type=''
1223 uvsize=''
1224 uvtype=''
1225 ivdformat=''
1226 nvEUformat=''
1227 nvFUformat=''
1228 nvGUformat=''
1229 nveformat=''
1230 nvfformat=''
1231 nvgformat=''
1232 uvXUformat=''
1233 uvoformat=''
1234 uvuformat=''
1235 uvxformat=''
1236 pidtype=''
1237 prefix=''
1238 prefixexp=''
1239 installprivlib=''
1240 privlib=''
1241 privlibexp=''
1242 ptrsize=''
1243 d_PRIXU64=''
1244 d_PRId64=''
1245 d_PRIi64=''
1246 d_PRIo64=''
1247 d_PRIu64=''
1248 d_PRIx64=''
1249 sPRIXU64=''
1250 sPRId64=''
1251 sPRIi64=''
1252 sPRIo64=''
1253 sPRIu64=''
1254 sPRIx64=''
1255 d_quad=''
1256 quadkind=''
1257 quadtype=''
1258 uquadtype=''
1259 drand01=''
1260 randbits=''
1261 randfunc=''
1262 randseedtype=''
1263 seedfunc=''
1264 installscript=''
1265 scriptdir=''
1266 scriptdirexp=''
1267 selectminbits=''
1268 selecttype=''
1269 sh=''
1270 targetsh=''
1271 sig_count=''
1272 sig_name=''
1273 sig_name_init=''
1274 sig_num=''
1275 sig_num_init=''
1276 sig_size=''
1277 d_sitearch=''
1278 installsitearch=''
1279 sitearch=''
1280 sitearchexp=''
1281 installsitebin=''
1282 sitebin=''
1283 sitebinexp=''
1284 installsitehtml1dir=''
1285 sitehtml1dir=''
1286 sitehtml1direxp=''
1287 installsitehtml3dir=''
1288 sitehtml3dir=''
1289 sitehtml3direxp=''
1290 installsitelib=''
1291 sitelib=''
1292 sitelib_stem=''
1293 sitelibexp=''
1294 installsiteman1dir=''
1295 siteman1dir=''
1296 siteman1direxp=''
1297 installsiteman3dir=''
1298 siteman3dir=''
1299 siteman3direxp=''
1300 siteprefix=''
1301 siteprefixexp=''
1302 installsitescript=''
1303 sitescript=''
1304 sitescriptexp=''
1305 sizesize=''
1306 sizetype=''
1307 d_libname_unique=''
1308 so=''
1309 socksizetype=''
1310 sharpbang=''
1311 shsharp=''
1312 spitshell=''
1313 src=''
1314 ssizetype=''
1315 st_ino_sign=''
1316 st_ino_size=''
1317 startperl=''
1318 startsh=''
1319 stdchar=''
1320 d_stdio_stream_array=''
1321 stdio_stream_array=''
1322 sysman=''
1323 sGMTIME_max=''
1324 sGMTIME_min=''
1325 sLOCALTIME_max=''
1326 sLOCALTIME_min=''
1327 trnl=''
1328 uidformat=''
1329 uidsign=''
1330 uidsize=''
1331 uidtype=''
1332 archname64=''
1333 use64bitall=''
1334 use64bitint=''
1335 usecbacktrace=''
1336 dtrace=''
1337 usedtrace=''
1338 usefaststdio=''
1339 usekernprocpathname=''
1340 ccflags_uselargefiles=''
1341 ldflags_uselargefiles=''
1342 libswanted_uselargefiles=''
1343 uselargefiles=''
1344 uselongdouble=''
1345 usemorebits=''
1346 usemultiplicity=''
1347 nm_opt=''
1348 nm_so_opt=''
1349 runnm=''
1350 usenm=''
1351 usensgetexecutablepath=''
1352 useperlio=''
1353 usequadmath=''
1354 usesocks=''
1355 d_oldpthreads=''
1356 use5005threads=''
1357 useithreads=''
1358 usereentrant=''
1359 usethreads=''
1360 incpath=''
1361 mips_type=''
1362 usrinc=''
1363 d_vendorarch=''
1364 installvendorarch=''
1365 vendorarch=''
1366 vendorarchexp=''
1367 d_vendorbin=''
1368 installvendorbin=''
1369 vendorbin=''
1370 vendorbinexp=''
1371 installvendorhtml1dir=''
1372 vendorhtml1dir=''
1373 vendorhtml1direxp=''
1374 installvendorhtml3dir=''
1375 vendorhtml3dir=''
1376 vendorhtml3direxp=''
1377 d_vendorlib=''
1378 installvendorlib=''
1379 vendorlib=''
1380 vendorlib_stem=''
1381 vendorlibexp=''
1382 installvendorman1dir=''
1383 vendorman1dir=''
1384 vendorman1direxp=''
1385 installvendorman3dir=''
1386 vendorman3dir=''
1387 vendorman3direxp=''
1388 usevendorprefix=''
1389 vendorprefix=''
1390 vendorprefixexp=''
1391 d_vendorscript=''
1392 installvendorscript=''
1393 vendorscript=''
1394 vendorscriptexp=''
1395 versiononly=''
1396 yacc=''
1397 yaccflags=''
1398 CONFIG=''
1399
1400 : Detect odd OSs
1401 define='define'
1402 undef='undef'
1403 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1404 rmlist=''
1405
1406 : We must find out about Eunice early
1407 eunicefix=':'
1408 if test -f /etc/unixtovms; then
1409         eunicefix=/etc/unixtovms
1410 fi
1411 if test -f /etc/unixtovms.exe; then
1412         eunicefix=/etc/unixtovms.exe
1413 fi
1414
1415 : Set executable suffix now -- needed before hints available
1416 if test -f "/libs/version.library"; then
1417 : Amiga OS
1418     _exe=""
1419 elif test -f "/system/gnu_library/bin/ar.pm"; then
1420 : Stratus VOS
1421     _exe=".pm"
1422 elif test -n "$DJGPP"; then
1423 : DOS DJGPP
1424     _exe=".exe"
1425 elif test -f /kern/cookiejar; then
1426 : MiNT
1427     _exe=""
1428 elif test -d c:/. -o -n "$is_os2" ; then
1429 : OS/2 or cygwin
1430     _exe=".exe"
1431 fi
1432
1433 groupstype=''
1434 i_whoami=''
1435 : Possible local include directories to search.
1436 : Set locincpth to "" in a hint file to defeat local include searches.
1437 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1438 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1439 :
1440 : no include file wanted by default
1441 inclwanted=''
1442
1443 : Enable -DEBUGGING and -DDEBUGGING from the command line
1444 EBUGGING=''
1445 DEBUGGING=''
1446
1447 : Trailing extension.  Override this in a hint file, if needed.
1448 : Extra object files, if any, needed on this platform.
1449 archobjs=''
1450 libnames=''
1451 : change the next line if compiling for Xenix/286 on Xenix/386
1452 xlibpth='/usr/lib/386 /lib/386'
1453 : Possible local library directories to search.
1454 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1455 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1456
1457 : general looking path for locating libraries
1458 glibpth="/lib /usr/lib $xlibpth"
1459 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1460 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1461 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1462 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1463
1464 : Private path used by Configure to find libraries.  Its value
1465 : is prepended to libpth. This variable takes care of special
1466 : machines, like the mips.  Usually, it should be empty.
1467 plibpth=''
1468
1469 : default library list
1470 libswanted=''
1471 : some systems want to use only the non-versioned libso:s
1472 ignore_versioned_solibs=''
1473 ccname=''
1474 ccversion=''
1475 perllibs=''
1476 : set useposix=false in your hint file to disable the POSIX extension.
1477 useposix=true
1478 : set useopcode=false in your hint file to disable the Opcode extension.
1479 useopcode=true
1480 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1481 uselanginfo=true
1482 archname64=''
1483 ccflags_uselargefiles=''
1484 ldflags_uselargefiles=''
1485 libswanted_uselargefiles=''
1486 : set usemultiplicity on the Configure command line to enable multiplicity.
1487 : set usesocks on the Configure command line to enable socks.
1488 archname=''
1489 : set usethreads on the Configure command line to enable threads.
1490 usereentrant='undef'
1491 : List of libraries we want.
1492 : If anyone needs extra -lxxx, put those in a hint file.
1493 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1494 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1495 : We probably want to search /usr/shlib before most other libraries.
1496 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1497 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1498 glibpth="/usr/shlib $glibpth"
1499 : Do not use vfork unless overridden by a hint file.
1500 usevfork=false
1501
1502 : Find the basic shell for Bourne shell scripts
1503 case "$sh" in
1504 '')
1505         case "$SYSTYPE" in
1506         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1507         *) xxx='/bin/sh';;
1508         esac
1509         if test -f "$xxx"; then
1510                 sh="$xxx"
1511         else
1512                 : Build up a list and do a single loop so we can 'break' out.
1513                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1514                 for xxx in sh bash ksh pdksh ash; do
1515                         for p in $pth; do
1516                                 try="$try ${p}/${xxx}"
1517                         done
1518                 done
1519                 for xxx in $try; do
1520                         if test -f "$xxx"; then
1521                                 sh="$xxx";
1522                                 break
1523                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1524                                 sh="$xxx";
1525                                 break
1526                         elif test -f "$xxx.exe"; then
1527                                 sh="$xxx";
1528                                 break
1529                         fi
1530                 done
1531         fi
1532         ;;
1533 esac
1534
1535 case "$sh" in
1536 '')     cat >&2 <<EOM
1537 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1538
1539 Usually it's in /bin/sh.  How did you even get this far?
1540 Please report this issue at https://github.com/Perl/perl5/issues
1541 and we'll try to straighten this all out.
1542 EOM
1543         exit 1
1544         ;;
1545 esac
1546
1547 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1548 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1549 targetsh=$sh
1550
1551 : see if sh knows # comments
1552 if `$sh -c '#' >/dev/null 2>&1`; then
1553         shsharp=true
1554         spitshell=cat
1555         xcat=/bin/cat
1556         test -f $xcat$_exe || xcat=/usr/bin/cat
1557         if test ! -f $xcat$_exe; then
1558                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1559                         if test -f $p/cat$_exe; then
1560                                 xcat=$p/cat
1561                                 break
1562                         fi
1563                 done
1564                 if test ! -f $xcat$_exe; then
1565                         echo "Can't find cat anywhere!"
1566                         exit 1
1567                 fi
1568         fi
1569         echo "#!$xcat" >sharp
1570         $eunicefix sharp
1571         chmod +x sharp
1572         ./sharp > today 2>/dev/null
1573         if test -s today; then
1574                 sharpbang='#!'
1575         else
1576                 echo "#! $xcat" > sharp
1577                 $eunicefix sharp
1578                 chmod +x sharp
1579                 ./sharp > today 2>/dev/null
1580                 if test -s today; then
1581                         sharpbang='#! '
1582                 else
1583                         sharpbang=': use '
1584                 fi
1585         fi
1586 else
1587         echo " "
1588         echo "Your $sh doesn't grok # comments--I will strip them later on."
1589         shsharp=false
1590         cd ..
1591         echo "exec grep -v '^[  ]*#'" >spitshell
1592         chmod +x spitshell
1593         $eunicefix spitshell
1594         spitshell=`pwd`/spitshell
1595         cd UU
1596         echo "I presume that if # doesn't work, #! won't work either!"
1597         sharpbang=': use '
1598 fi
1599 rm -f sharp today
1600
1601 : figure out how to guarantee sh startup
1602 case "$startsh" in
1603 '') startsh=${sharpbang}${sh} ;;
1604 *)
1605 esac
1606 cat >sharp <<EOSS
1607 $startsh
1608 set abc
1609 test "$?abc" != 1
1610 EOSS
1611
1612 chmod +x sharp
1613 $eunicefix sharp
1614 if ./sharp; then
1615         : echo "Yup, it does."
1616 else
1617         echo "Hmm... '$startsh' does not guarantee sh startup..."
1618         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1619 fi
1620 rm -f sharp
1621
1622 : Save command line options in file UU/cmdline.opt for later use in
1623 : generating config.sh.
1624 cat > cmdline.opt <<EOSH
1625 : Configure command line arguments.
1626 config_arg0='$0'
1627 config_args='$*'
1628 config_argc=$#
1629 EOSH
1630 argn=1
1631 args_exp=''
1632 args_sep=''
1633 for arg in "$@"; do
1634         cat >>cmdline.opt <<EOSH
1635 config_arg$argn='$arg'
1636 EOSH
1637         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1638 $arg
1639 EOC
1640         arg_exp=`cat cmdl.opt`
1641         args_exp="$args_exp$args_sep'$arg_exp'"
1642         argn=`expr $argn + 1`
1643         args_sep=' '
1644 done
1645 rm -f cmdl.opt
1646
1647 : produce awk script to parse command line options
1648 cat >options.awk <<'EOF'
1649 BEGIN {
1650         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1651
1652         len = length(optstr);
1653         for (i = 1; i <= len; i++) {
1654                 c = substr(optstr, i, 1);
1655                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1656                 if (a == ":") {
1657                         arg[c] = 1;
1658                         i++;
1659                 }
1660                 opt[c] = 1;
1661         }
1662 }
1663 {
1664         expect = 0;
1665         str = $0;
1666         if (substr(str, 1, 1) != "-") {
1667                 printf("'%s'\n", str);
1668                 next;
1669         }
1670         len = length($0);
1671         for (i = 2; i <= len; i++) {
1672                 c = substr(str, i, 1);
1673                 if (!opt[c]) {
1674                         printf("-%s\n", substr(str, i));
1675                         next;
1676                 }
1677                 printf("-%s\n", c);
1678                 if (arg[c]) {
1679                         if (i < len)
1680                                 printf("'%s'\n", substr(str, i + 1));
1681                         else
1682                                 expect = 1;
1683                         next;
1684                 }
1685         }
1686 }
1687 END {
1688         if (expect)
1689                 print "?";
1690 }
1691 EOF
1692
1693 : process the command line options
1694 set X `for arg in "$@"; do echo "X$arg"; done |
1695         sed -e s/X// | awk -f options.awk`
1696 eval "set $*"
1697 shift
1698 rm -f options.awk
1699
1700 : set up default values
1701 fastread=''
1702 reuseval=false
1703 config_sh=''
1704 alldone=''
1705 error=''
1706 silent=''
1707 extractsh=''
1708 knowitall=''
1709 rm -f optdef.sh posthint.sh
1710 cat >optdef.sh <<EOS
1711 $startsh
1712 EOS
1713
1714
1715 : option parsing
1716 while test $# -gt 0; do
1717         case "$1" in
1718         -d) shift; fastread=yes;;
1719         -e) shift; alldone=cont;;
1720         -f)
1721                 shift
1722                 cd ..
1723                 if test -r "$1"; then
1724                         config_sh="$1"
1725                 else
1726                         echo "$me: cannot read config file $1." >&2
1727                         error=true
1728                 fi
1729                 cd UU
1730                 shift;;
1731         --help|\
1732         -h) shift; error=true;;
1733         -r) shift; reuseval=true;;
1734         -s) shift; silent=true; realsilent=true;;
1735         -E) shift; alldone=exit;;
1736         -K) shift; knowitall=true;;
1737         -O) shift;;
1738         -S) shift; silent=true; extractsh=true;;
1739         -D)
1740                 shift
1741                 case "$1" in
1742                 *=)
1743                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1744                         echo "$me: ignoring -D $1" >&2
1745                         ;;
1746                 *=*) echo "$1" | \
1747                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1748                 *) echo "$1='define'" >> optdef.sh;;
1749                 esac
1750                 shift
1751                 ;;
1752         -U)
1753                 shift
1754                 case "$1" in
1755                 *=) echo "$1" >> optdef.sh;;
1756                 *=*)
1757                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1758                         echo "$me: ignoring -U $1" >&2
1759                         ;;
1760                 *) echo "$1='undef'" >> optdef.sh;;
1761                 esac
1762                 shift
1763                 ;;
1764         -A)
1765             shift
1766             xxx=''
1767             yyy="$1"
1768             zzz=''
1769             uuu=undef
1770             case "$yyy" in
1771             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1772                  case "$zzz" in
1773                  *:*) zzz='' ;;
1774                  *)   xxx=append
1775                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1776                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1777                  esac
1778                  ;;
1779             esac
1780             case "$xxx" in
1781             '')  case "$yyy" in
1782                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1783                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1784                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1785                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1786                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1787                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1788                  esac
1789                  ;;
1790             esac
1791             case "$xxx" in
1792             append)
1793                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1794             clear)
1795                 echo "$yyy=''"                  >> posthint.sh ;;
1796             define)
1797                 case "$zzz" in
1798                 '') zzz=define ;;
1799                 esac
1800                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1801             eval)
1802                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1803             prepend)
1804                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1805             undef)
1806                 case "$zzz" in
1807                 '') zzz="$uuu" ;;
1808                 esac
1809                 echo "$yyy=$zzz"                >> posthint.sh ;;
1810             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1811             esac
1812             shift
1813             ;;
1814         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1815             exit 0;;
1816         --) break;;
1817         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1818         *) break;;
1819         esac
1820 done
1821
1822 case "$error" in
1823 true)
1824         cat >&2 <<EOM
1825 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1826                  [-U symbol] [-U symbol=] [-A command:symbol...]
1827   -d : use defaults for all answers.
1828   -e : go on without questioning past the production of config.sh.
1829   -f : specify an alternate default configuration file.
1830   -h : print this help message and exit (with an error status).
1831   -r : reuse C symbols value if possible (skips costly nm extraction).
1832   -s : silent mode, only echoes questions and essential information.
1833   -D : define symbol to have some value:
1834          -D symbol         symbol gets the value 'define'
1835          -D symbol=value   symbol gets the value 'value'
1836        common used examples (see INSTALL for more info):
1837          -Duse64bitint            use 64bit integers
1838          -Duse64bitall            use 64bit integers and pointers
1839          -Dusethreads             use thread support
1840          -Dinc_version_list=none  do not include older perl trees in @INC
1841          -DEBUGGING=none          DEBUGGING options
1842          -Dcc=gcc                 choose your compiler
1843          -Dprefix=/opt/perl5      choose your destination
1844   -E : stop at the end of questions, after having produced config.sh.
1845   -K : do not use unless you know what you are doing.
1846   -O : ignored for backward compatibility
1847   -S : perform variable substitutions on all .SH files (can mix with -f)
1848   -U : undefine symbol:
1849          -U symbol    symbol gets the value 'undef'
1850          -U symbol=   symbol gets completely empty
1851        e.g.:  -Uversiononly
1852   -A : manipulate symbol after the platform specific hints have been applied:
1853          -A append:symbol=value   append value to symbol
1854          -A symbol=value          like append:, but with a separating space
1855          -A define:symbol=value   define symbol to have value
1856          -A clear:symbol          define symbol to be ''
1857          -A define:symbol         define symbol to be 'define'
1858          -A eval:symbol=value     define symbol to be eval of value
1859          -A prepend:symbol=value  prepend value to symbol
1860          -A undef:symbol          define symbol to be 'undef'
1861          -A undef:symbol=         define symbol to be ''
1862        e.g.:  -A prepend:libswanted='cl pthread '
1863               -A ccflags=-DSOME_MACRO
1864   -V : print version number and exit (with a zero status).
1865 EOM
1866         exit 1
1867         ;;
1868 esac
1869
1870 : Sanity checks
1871 case "$fastread$alldone" in
1872 yescont|yesexit) ;;
1873 *)
1874         case "$extractsh" in
1875         true) ;;
1876         *)
1877                 if test ! -t 0; then
1878                         echo "Say 'sh Configure', not 'sh <Configure'"
1879                         exit 1
1880                 fi
1881                 ;;
1882         esac
1883         ;;
1884 esac
1885
1886 exec 4>&1
1887 case "$silent" in
1888 true) exec 1>/dev/null;;
1889 esac
1890
1891 : run the defines and the undefines, if any, but leave the file out there...
1892 touch optdef.sh
1893 grep '\\' optdef.sh >/dev/null 2>&1
1894 if test $? = 0; then
1895     echo "Configure does not support \\ in -D arguments"
1896     exit 1
1897 fi
1898 . ./optdef.sh
1899 : create the posthint manipulation script and leave the file out there...
1900 touch posthint.sh
1901
1902 : set package name
1903 package='perl5'
1904 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1905 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1906 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1907 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1908 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1909 esac
1910
1911 : Some greps do not return status, grrr.
1912 echo "grimblepritz" >grimble
1913 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1914         contains=contains
1915 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1916         contains=grep
1917 else
1918         contains=contains
1919 fi
1920 rm -f grimble
1921 : the following should work in any shell
1922 case "$contains" in
1923 contains*)
1924         echo " "
1925         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1926         cat >contains <<'EOSS'
1927 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1928 EOSS
1929 chmod +x contains
1930 esac
1931
1932 : Find the path to the source tree
1933 case "$src" in
1934 '') case "$0" in
1935     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1936          case "$src" in
1937          /*)    ;;
1938          .)     ;;
1939          *)     src=`cd ../$src && pwd` ;;
1940          esac
1941          ;;
1942     *)   src='.';;
1943     esac;;
1944 esac
1945 case "$src" in
1946 '')     src=/
1947         rsrc=/
1948         ;;
1949 /*)     rsrc="$src";;
1950 *)      rsrc="../$src";;
1951 esac
1952 if test -f $rsrc/Configure && \
1953         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1954 then
1955    : found it, so we are ok.
1956 else
1957         rsrc=''
1958         for src in . .. ../.. ../../.. ../../../..; do
1959                 if test -f ../$src/Configure && \
1960                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1961                 then
1962                         rsrc=../$src
1963                         break
1964                 fi
1965         done
1966 fi
1967 case "$rsrc" in
1968 '')
1969         cat <<EOM >&4
1970
1971 Sorry, I can't seem to locate the source dir for $package.  Please start
1972 Configure with an explicit path -- i.e. /some/path/Configure.
1973
1974 EOM
1975         exit 1
1976         ;;
1977 ../.)   rsrc='..';;
1978 *)
1979         echo " "
1980         echo "Sources for $package found in \"$src\"." >&4
1981         ;;
1982 esac
1983
1984 : script used to extract .SH files with variable substitutions
1985 cat >extract <<'EOS'
1986 PERL_CONFIG_SH=true
1987 echo "Doing variable substitutions on .SH files..."
1988 if test -f MANIFEST; then
1989         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1990 else
1991         echo "(Looking for .SH files under the source directory.)"
1992         set x `(cd "$src"; find . -name "*.SH" -print)`
1993 fi
1994 shift
1995 case $# in
1996 0) set x `(cd "$src"; echo *.SH)`; shift;;
1997 esac
1998 if test ! -f "$src/$1"; then
1999         shift
2000 fi
2001 mkdir_p='
2002 name=$1;
2003 create="";
2004 while test $name; do
2005         if test ! -d "$name"; then
2006                 create="$name $create";
2007                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2008                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2009         else
2010                 name="";
2011         fi;
2012 done;
2013 for file in $create; do
2014         mkdir $file;
2015 done
2016 '
2017 for file in $*; do
2018         case "$src" in
2019         ".")
2020                 case "$file" in
2021                 */*)
2022                         dir=`expr X$file : 'X\(.*\)/'`
2023                         file=`expr X$file : 'X.*/\(.*\)'`
2024                         (cd "$dir" && . ./$file)
2025                         ;;
2026                 *)
2027                         . ./$file
2028                         ;;
2029                 esac
2030                 ;;
2031         *)
2032                 case "$file" in
2033                 */*)
2034                         dir=`expr X$file : 'X\(.*\)/'`
2035                         file=`expr X$file : 'X.*/\(.*\)'`
2036                         (set x $dir; shift; eval $mkdir_p)
2037                         sh <"$src/$dir/$file"
2038                         ;;
2039                 *)
2040                         sh <"$src/$file"
2041                         ;;
2042                 esac
2043                 ;;
2044         esac
2045 done
2046 if test -f "$src/config_h.SH"; then
2047         if test ! -f config.h; then
2048         : oops, they left it out of MANIFEST, probably, so do it anyway.
2049         . "$src/config_h.SH"
2050         fi
2051 fi
2052 EOS
2053
2054 : extract files and exit if asked to do so
2055 case "$extractsh" in
2056 true)
2057         case "$realsilent" in
2058         true) ;;
2059         *) exec 1>&4;;
2060         esac
2061         case "$config_sh" in
2062         '') config_sh='config.sh';;
2063         esac
2064         echo " "
2065         echo "Fetching answers from $config_sh..."
2066         cd ..
2067         . $config_sh
2068         . UU/optdef.sh
2069         echo " "
2070         . UU/extract
2071         rm -rf UU
2072         echo "Extraction done."
2073         exit 0
2074         ;;
2075 esac
2076
2077 : Eunice requires " " instead of "", can you believe it
2078 echo " "
2079 : Here we go...
2080 echo "Beginning of configuration questions for $package."
2081
2082 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2083
2084 : first determine how to suppress newline on echo command
2085 echo " "
2086 echo "Checking echo to see how to suppress newlines..."
2087 (echo "hi there\c" ; echo " ") >.echotmp
2088 if $contains c .echotmp >/dev/null 2>&1 ; then
2089         echo "...using -n."
2090         n='-n'
2091         c=''
2092 else
2093         cat <<'EOM'
2094 ...using \c
2095 EOM
2096         n=''
2097         c='\c'
2098 fi
2099 echo $n "The star should be here-->$c"
2100 echo '*'
2101 rm -f .echotmp
2102
2103 : Now test for existence of everything in MANIFEST
2104 echo " "
2105 if test -f "$rsrc/MANIFEST"; then
2106         echo "First let's make sure your kit is complete.  Checking..." >&4
2107         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2108                 (split -l 50 2>/dev/null || split -50)
2109         rm -f missing
2110         tmppwd=`pwd`
2111         for filelist in x??; do
2112                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2113                         >/dev/null 2>>"$tmppwd/missing")
2114         done
2115         if test -s missing; then
2116                 cat missing >&4
2117                 cat >&4 <<'EOM'
2118
2119 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2120
2121 You have the option of continuing the configuration process, despite the
2122 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2123 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2124 and contact the author (https://github.com/Perl/perl5/issues).
2125
2126 EOM
2127                 echo $n "Continue? [n] $c" >&4
2128                 read ans
2129                 case "$ans" in
2130                 y*)
2131                         echo "Continuing..." >&4
2132                         rm -f missing
2133                         ;;
2134                 *)
2135                         echo "ABORTING..." >&4
2136                         kill $$
2137                         ;;
2138                 esac
2139         else
2140                 echo "Looks good..."
2141         fi
2142 else
2143         echo "There is no MANIFEST file.  I hope your kit is complete !"
2144 fi
2145 rm -f missing x??
2146
2147 : Find the appropriate value for a newline for tr
2148 if test -n "$DJGPP"; then
2149        trnl='\012'
2150 fi
2151 if test X"$trnl" = X; then
2152         case "`echo foo | tr '\n' x 2>/dev/null`" in
2153         foox) trnl='\n' ;;
2154         esac
2155 fi
2156 if test X"$trnl" = X; then
2157         case "`echo foo | tr '\012' x 2>/dev/null`" in
2158         foox) trnl='\012' ;;
2159         esac
2160 fi
2161 if test X"$trnl" = X; then
2162        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2163        fooxy) trnl='\n\r' ;;
2164        esac
2165 fi
2166 if test X"$trnl" = X; then
2167         cat <<EOM >&2
2168
2169 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2170
2171 EOM
2172         exit 1
2173 fi
2174
2175 : compute the number of columns on the terminal for proper question formatting
2176 case "$COLUMNS" in
2177 '') COLUMNS='80';;
2178 esac
2179
2180 : set up the echo used in my read
2181 myecho="case \"\$xxxm\" in
2182 '') echo $n \"\$rp $c\" >&4;;
2183 *) case \"\$rp\" in
2184         '') echo $n \"[\$xxxm] $c\";;
2185         *)
2186                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2187                         echo \"\$rp\" >&4
2188                         echo $n \"[\$xxxm] $c\" >&4
2189                 else
2190                         echo $n \"\$rp [\$xxxm] $c\" >&4
2191                 fi
2192                 ;;
2193         esac;;
2194 esac"
2195
2196 : now set up to do reads with possible shell escape and default assignment
2197 cat <<EOSC >myread
2198 $startsh
2199 xxxm=\$dflt
2200 $myecho
2201 ans='!'
2202 case "\$fastread" in
2203 yes) case "\$dflt" in
2204         '') ;;
2205         *) ans='';
2206                 case "\$silent-\$rp" in
2207                 true-) ;;
2208                 *) echo " " >&4;;
2209                 esac;;
2210         esac;;
2211 *) case "\$silent" in
2212         true) case "\$rp" in
2213                 '') ans='';;
2214                 esac;;
2215         esac;;
2216 esac
2217 while expr "X\$ans" : "X!" >/dev/null; do
2218         read answ
2219         set x \$xxxm
2220         shift
2221         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2222         case  "\$answ" in
2223         "!")
2224                 sh 1>&4
2225                 echo " "
2226                 $myecho
2227                 ;;
2228         !*)
2229                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2230                 shift
2231                 sh 1>&4 -c "\$*"
2232                 echo " "
2233                 $myecho
2234                 ;;
2235         "\$ans")
2236                 case "\$ans" in
2237                 \\&*)
2238                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2239                         shift
2240                         case "\$1" in
2241                         -d)
2242                                 fastread=yes
2243                                 echo "(OK, I'll run with -d after this question.)" >&4
2244                                 ;;
2245                         -*)
2246                                 echo "*** Sorry, \$1 not supported yet." >&4
2247                                 ;;
2248                         esac
2249                         $myecho
2250                         ans=!
2251                         ;;
2252                 esac;;
2253         *)
2254                 case "\$aok" in
2255                 y)
2256                         echo "*** Substitution done -- please confirm."
2257                         xxxm="\$ans"
2258                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2259                         xxxm="\$ans"
2260                         ans=!
2261                         ;;
2262                 *)
2263                         echo "*** Error -- try again."
2264                         ans=!
2265                         ;;
2266                 esac
2267                 $myecho
2268                 ;;
2269         esac
2270         case "\$ans\$xxxm\$nostick" in
2271         '')
2272                 ans=!
2273                 $myecho
2274                 ;;
2275         esac
2276 done
2277 case "\$ans" in
2278 '') ans="\$xxxm";;
2279 esac
2280 EOSC
2281
2282 : create .config dir to save info across Configure sessions
2283 test -d ../.config || mkdir ../.config
2284 cat >../.config/README <<EOF
2285 This directory created by Configure to save information that should
2286 persist across sessions for $package.
2287
2288 You may safely delete it if you wish.
2289 EOF
2290
2291 : See if we are using a devel version and want that
2292 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2293 case "$usedevel" in
2294 $define|true|[yY]*)
2295     usedevel="$define" ;;
2296 *) case "$xversion" in
2297    *[13579])
2298         cat >&4 <<EOH
2299 *** WHOA THERE!!! ***
2300
2301     This is an UNSTABLE DEVELOPMENT release.
2302     The version of this $package distribution is $xversion, that is, odd,
2303     (as opposed to even) and that signifies a development release.
2304     If you want a maintenance release, you want an even-numbered version.
2305
2306     Do ***NOT*** install this into production use.
2307     Data corruption and crashes are possible.
2308
2309     It is most seriously suggested that you do not continue any further
2310     unless you want to help in developing and debugging Perl.
2311
2312     If you *still* want to build perl, you can answer 'y' now,
2313     or pass -Dusedevel to Configure.
2314
2315 EOH
2316         rp='Do you really want to continue?'
2317         dflt='n'
2318         . ./myread
2319         case "$ans" in
2320         [yY]) echo >&4 "Okay, continuing."
2321               usedevel="$define" ;;
2322         *) echo >&4 "Okay, bye."
2323            exit 1
2324            ;;
2325         esac
2326         ;;
2327     esac
2328     usedevel="$undef"
2329     ;;
2330 esac
2331 case "$usedevel" in
2332 $define|true|[yY]*)
2333         case "$versiononly" in
2334         '') versiononly="$define" ;;
2335         esac
2336         case "$installusrbinperl" in
2337         '') installusrbinperl="$undef" ;;
2338         esac
2339         ;;
2340 esac
2341
2342 : general instructions
2343 needman=true
2344 firsttime=true
2345 user=`(logname) 2>/dev/null`
2346 case "$user" in
2347 '') user=`whoami 2>&1`;;
2348 esac
2349 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2350         firsttime=false
2351         echo " "
2352         rp='Would you like to see the instructions?'
2353         dflt=n
2354         . ./myread
2355         case "$ans" in
2356         [yY]*) ;;
2357         *) needman=false;;
2358         esac
2359 fi
2360 if $needman; then
2361         cat <<EOH
2362
2363 This installation shell script will examine your system and ask you questions
2364 to determine how the perl5 package should be installed. If you get
2365 stuck on a question, you may use a ! shell escape to start a subshell or
2366 execute a command.  Many of the questions will have default answers in square
2367 brackets; typing carriage return will give you the default.
2368
2369 On some of the questions which ask for file or directory names you are allowed
2370 to use the ~name construct to specify the login directory belonging to "name",
2371 even if you don't have a shell which knows about that.  Questions where this is
2372 allowed will be marked "(~name ok)".
2373
2374 EOH
2375         rp=''
2376         dflt='Type carriage return to continue'
2377         . ./myread
2378         cat <<'EOH'
2379
2380 The prompter used in this script allows you to use shell variables and
2381 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2382 in the default answer, as if the default line was a set of arguments given to a
2383 script shell.  This means you may also use $* to repeat the whole default line,
2384 so you do not have to re-type everything to add something to the default.
2385
2386 Every time there is a substitution, you will have to confirm.  If there is an
2387 error (e.g. an unmatched backtick), the default answer will remain unchanged
2388 and you will be prompted again.
2389
2390 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2391 the questions and use the computed defaults (or the previous answers if there
2392 was already a config.sh file). Type 'Configure -h' for a list of options.
2393 You may also start interactively and then answer '& -d' at any prompt to turn
2394 on the non-interactive behaviour for the remainder of the execution.
2395
2396 EOH
2397         . ./myread
2398         cat <<EOH
2399
2400 Much effort has been expended to ensure that this shell script will run on any
2401 Unix system.  If despite that it blows up on yours, your best bet is to edit
2402 Configure and run it again.  If you can't run Configure for some reason,
2403 you'll have to generate a config.sh file by hand.  Whatever problems you
2404 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2405
2406 This installation script affects things in two ways:
2407
2408 1) it may do direct variable substitutions on some of the files included
2409    in this kit.
2410 2) it builds a config.h file for inclusion in C programs.  You may edit
2411    any of these files as the need arises after running this script.
2412
2413 If you make a mistake on a question, there is no easy way to back up to it
2414 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2415 files.  Configure will offer to let you do this before it runs the SH files.
2416
2417 EOH
2418         dflt='Type carriage return to continue'
2419         . ./myread
2420         case "$firsttime" in
2421         true) echo $user >>../.config/instruct;;
2422         esac
2423 fi
2424
2425 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2426 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2427 if test "X$sysroot" = X; then
2428     sysroot=""
2429 else
2430     case "$cc" in
2431         *gcc*|*g++*)
2432             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2433             # _sysroot is used in places where we need --sysroot=foo
2434             # but using the rest of the flags could cause issues.
2435             _sysroot="--sysroot=$sysroot";
2436             case "$ccflags" in
2437                 *sysroot*) ;;
2438                 'undef'|*)
2439                 ccflags="$ccflags $_sysroot"
2440             esac
2441             case "$ldflags" in
2442                 *sysroot*) ;;
2443                 'undef'|*)
2444                 ldflags="$ldflags $_sysroot"
2445             esac
2446             case "$cppflags" in
2447                 *sysroot*) ;;
2448                 'undef'|*)
2449                 cppflags="$cppflags $_sysroot"
2450             esac
2451             # lddlflags updated below in lddlflags section;
2452             # same with cccdlflags
2453             ;;
2454     esac
2455
2456     # Adjust some defaults to also use $sysroot
2457     for var in xlibpth loclibpth locincpth glibpth; do
2458         eval xxx=\$$var
2459         eval $var=''
2460         for path in $xxx; do
2461             eval $var=\"\$$var $sysroot$path\"
2462         done
2463     done
2464
2465 fi
2466
2467 : find out where common programs are
2468 echo " "
2469 echo "Locating common programs..." >&4
2470 cat <<EOSC >loc
2471 $startsh
2472 case \$# in
2473 0) exit 1;;
2474 esac
2475 thing=\$1
2476 shift
2477 dflt=\$1
2478 shift
2479 for dir in \$*; do
2480         case "\$thing" in
2481         .)
2482         if test -d \$dir/\$thing; then
2483                 echo \$dir
2484                 exit 0
2485         fi
2486         ;;
2487         *)
2488         for thisthing in \$dir/\$thing; do
2489                 : just loop through to pick last item
2490         done
2491         if test -f \$thisthing; then
2492                 echo \$thisthing
2493                 exit 0
2494         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2495                 echo \$thisthing
2496                 exit 0
2497         elif test -f \$dir/\$thing.exe; then
2498                 if test -n "$DJGPP"; then
2499                         echo \$dir/\$thing.exe
2500                 elif test "$eunicefix" != ":"; then
2501                         : on Eunice apparently
2502                         echo \$dir/\$thing
2503                 fi
2504                 exit 0
2505         fi
2506         ;;
2507         esac
2508 done
2509 echo \$dflt
2510 exit 1
2511 EOSC
2512 chmod +x loc
2513 $eunicefix loc
2514 loclist="
2515 awk
2516 cat
2517 chmod
2518 comm
2519 cp
2520 echo
2521 expr
2522 grep
2523 ls
2524 mkdir
2525 rm
2526 sed
2527 sort
2528 touch
2529 tr
2530 uniq
2531 "
2532 trylist="
2533 ar
2534 bison
2535 byacc
2536 cpp
2537 csh
2538 date
2539 egrep
2540 gmake
2541 gzip
2542 less
2543 ln
2544 make
2545 more
2546 nm
2547 nroff
2548 perl
2549 pg
2550 test
2551 uname
2552 zip
2553 "
2554 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2555 pth="$pth $sysroot/lib $sysroot/usr/lib"
2556 for file in $loclist; do
2557         eval xxx=\$$file
2558         case "$xxx" in
2559         /*|?:[\\/]*)
2560                 if test -f "$xxx"; then
2561                         : ok
2562                 else
2563                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2564                         xxx=`./loc $file $file $pth`
2565                 fi
2566                 ;;
2567         '') xxx=`./loc $file $file $pth`;;
2568         *) xxx=`./loc $xxx $xxx $pth`;;
2569         esac
2570         eval $file=$xxx$_exe
2571         eval _$file=$xxx
2572         case "$xxx" in
2573         /*)
2574                 echo $file is in $xxx.
2575                 ;;
2576         ?:[\\/]*)
2577                 echo $file is in $xxx.
2578                 ;;
2579         *)
2580                 echo "I don't know where '$file' is, and my life depends on it." >&4
2581                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2582                 exit 1
2583                 ;;
2584         esac
2585 done
2586 echo " "
2587 echo "Don't worry if any of the following aren't found..."
2588 say=offhand
2589 for file in $trylist; do
2590         eval xxx=\$$file
2591         case "$xxx" in
2592         /*|?:[\\/]*)
2593                 if test -f "$xxx"; then
2594                         : ok
2595                 else
2596                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2597                         xxx=`./loc $file $file $pth`
2598                 fi
2599                 ;;
2600         '') xxx=`./loc $file $file $pth`;;
2601         *) xxx=`./loc $xxx $xxx $pth`;;
2602         esac
2603         eval $file=$xxx$_exe
2604         eval _$file=$xxx
2605         case "$xxx" in
2606         /*)
2607                 echo $file is in $xxx.
2608                 ;;
2609         ?:[\\/]*)
2610                 echo $file is in $xxx.
2611                 ;;
2612         *)
2613                 echo "I don't see $file out there, $say."
2614                 say=either
2615                 ;;
2616         esac
2617 done
2618 case "$egrep" in
2619 egrep)
2620         echo "Substituting grep for egrep."
2621         egrep=$grep
2622         _egrep=$grep
2623         ;;
2624 esac
2625 case "$less" in
2626 '')     ;;
2627 *)      if $less -R </dev/null >/dev/null 2>&1; then
2628                echo "Substituting less -R for less."
2629                less="$less -R"
2630                _less=$less
2631         fi
2632         ;;
2633 esac
2634 case "$ln" in
2635 ln)
2636         echo "Substituting cp for ln."
2637         ln=$cp
2638         _ln=$cp
2639         ;;
2640 esac
2641 case "$make" in
2642 make)
2643         case "$gmake" in
2644         gmake)
2645         echo "I can't find make or gmake, and my life depends on it." >&4
2646         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2647         exit 1
2648         ;;
2649         esac
2650         ;;
2651 esac
2652 case "$gmake" in
2653 gmake)  ;;
2654 *)      # We can't have osname yet.
2655         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2656                 # Assume that gmake, if found, is definitely GNU make
2657                 # and prefer it over the system make.
2658                 echo "Substituting gmake for make."
2659                 make=$gmake
2660                 _make=$gmake
2661         fi
2662         ;;
2663 esac
2664 case "$test" in
2665 test)
2666         echo "Hopefully test is built into your sh."
2667         ;;
2668 *)
2669         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2670                 echo "Using the test built into your sh."
2671                 test=test
2672                 _test=test
2673         fi
2674         ;;
2675 esac
2676 case "$echo" in
2677 echo)
2678         echo "Hopefully echo is built into your sh."
2679         ;;
2680 '') ;;
2681 *)
2682         echo " "
2683 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2684         $echo $n "hi there$c" >foo1
2685         echo $n "hi there$c" >foo2
2686         if cmp foo1 foo2 >/dev/null 2>&1; then
2687                 echo "They are compatible.  In fact, they may be identical."
2688         else
2689                 case "$n" in
2690                 '-n') n='' c='\c';;
2691                 *) n='-n' c='';;
2692                 esac
2693                 cat <<FOO
2694 They are not compatible!  You are probably running ksh on a non-USG system.
2695 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2696 have echo built in and we may have to run some Bourne shell scripts.  That
2697 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2698
2699 FOO
2700                 $echo $n "The star should be here-->$c"
2701                 $echo "*"
2702         fi
2703         $rm -f foo1 foo2
2704         ;;
2705 esac
2706
2707 # This question was auctioned at YAPC::Europe-2007 in Vienna
2708 # I never promised you could answer it. I only auctioned the question.
2709 cat <<FOO
2710 The following message is sponsored by
2711
2712   Dresden.pm<--The stars should be here.
2713
2714 Dear Perl user, system administrator or package
2715 maintainer, the Perl community sends greetings to
2716 you. Do you (emblematical) greet back [Y/n]? n
2717
2718 FOO
2719
2720 : Check what type of C compiler we use
2721 cat <<EOS >trygcc
2722 $startsh
2723 EOS
2724 cat <<'EOSC' >>trygcc
2725 case "$cc" in
2726 '') ;;
2727 *)  $rm -f try try.*
2728     $cat >try.c <<EOM
2729 int main(int argc, char *argv[]) {
2730   return 0;
2731 }
2732 EOM
2733     if $cc -o try $ccflags $ldflags try.c; then
2734        :
2735     else
2736         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2737         despair=yes
2738         trygcc=yes
2739         case "$cc" in
2740         *gcc*) trygcc=no ;;
2741         esac
2742         # Skip this test because it gives a false match on output like:
2743         #    ./trygcc: line 23: cc: command not found
2744         # case "`$cc -v -c try.c 2>&1`" in
2745         # *gcc*) trygcc=no ;;
2746         # esac
2747         if $test X"$trygcc" = Xyes; then
2748             if gcc -o try -c try.c; then
2749                 echo " "
2750                 echo "You seem to have a working gcc, though." >&4
2751                 # Switching compilers may undo the work of hints files.
2752                 # The most common problem is -D_REENTRANT for threads.
2753                 # This heuristic catches that case, but gets false positives
2754                 # if -Dusethreads was not actually specified.  Better to
2755                 # bail out here with a useful message than fail
2756                 # mysteriously later. Should we perhaps just try to
2757                 # re-invoke Configure -Dcc=gcc config_args ?
2758                 if $test -f usethreads.cbu; then
2759                         $cat >&4 <<EOM
2760
2761 *** However, any setting of the C compiler flags (e.g. for thread support)
2762 *** will be lost.  It may be necessary for you to restart Configure and
2763 *** add -Dcc=gcc to your Configure command line.
2764
2765 EOM
2766                         rp="Would you like to go ahead and try gcc anyway?"
2767                         dflt=n
2768                 else
2769                         rp="Would you like to use it?"
2770                         dflt=y
2771                 fi
2772                 if $test -f myread; then
2773                     . ./myread
2774                 else
2775                     if $test -f UU/myread; then
2776                         . ./UU/myread
2777                     else
2778                         echo "Cannot find myread, sorry.  Aborting." >&2
2779                         exit 1
2780                     fi
2781                 fi
2782                 case "$ans" in
2783                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2784                 esac
2785             fi
2786         fi
2787     fi
2788     $rm -f try try.*
2789     ;;
2790 esac
2791 EOSC
2792
2793 cat <<EOS >checkcc
2794 $startsh
2795 EOS
2796 cat <<'EOSC' >>checkcc
2797 case "$cc" in
2798 '') ;;
2799 *)  $rm -f try try.*
2800     $cat >try.c <<EOM
2801 int main(int argc, char *argv[]) {
2802   return 0;
2803 }
2804 EOM
2805     if $cc -o try $ccflags $ldflags try.c; then
2806        :
2807     else
2808         if $test X"$despair" = Xyes; then
2809            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2810         fi
2811         $cat >&4 <<EOM
2812 You need to find a working C compiler.
2813 Either (purchase and) install the C compiler supplied by your OS vendor,
2814 or for a free C compiler try http://gcc.gnu.org/
2815 I cannot continue any further, aborting.
2816 EOM
2817         exit 1
2818     fi
2819     $rm -f try try.*
2820     ;;
2821 esac
2822 EOSC
2823
2824 : determine whether symbolic links are supported
2825 echo " "
2826 $touch blurfl
2827 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2828         echo "Symbolic links are supported." >&4
2829         lns="$ln -s"
2830 else
2831         echo "Symbolic links are NOT supported." >&4
2832         lns="$ln"
2833 fi
2834 $rm -f blurfl sym
2835
2836 : determine whether symbolic links are supported
2837 echo " "
2838 case "$lns" in
2839 *"ln"*" -s")
2840         echo "Checking how to test for symbolic links..." >&4
2841         $lns blurfl sym
2842         if $test "X$issymlink" = X; then
2843                 case "$newsh" in
2844                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2845                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2846                 esac
2847                 if test $? = 0; then
2848                         issymlink="test -h"
2849                 else
2850                         echo "Your builtin 'test -h' may be broken." >&4
2851                         case "$test" in
2852                         /*)     ;;
2853                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2854                                 for p in $pth
2855                                 do
2856                                         if test -f "$p/$test"; then
2857                                                 test="$p/$test"
2858                                                 break
2859                                         fi
2860                                 done
2861                                 ;;
2862                         esac
2863                         case "$test" in
2864                         /*)
2865                                 echo "Trying external '$test -h'." >&4
2866                                 issymlink="$test -h"
2867                                 if $test ! -h sym >/dev/null 2>&1; then
2868                                         echo "External '$test -h' is broken, too." >&4
2869                                         issymlink=''
2870                                 fi
2871                                 ;;
2872                         *)      issymlink='' ;;
2873                         esac
2874                 fi
2875         fi
2876         if $test "X$issymlink" = X; then
2877                 if $test -L sym 2>/dev/null; then
2878                         issymlink="$test -L"
2879                         echo "The builtin '$test -L' worked." >&4
2880                 fi
2881         fi
2882         if $test "X$issymlink" != X; then
2883                 echo "You can test for symbolic links with '$issymlink'." >&4
2884         else
2885                 echo "I do not know how you can test for symbolic links." >&4
2886         fi
2887         $rm -f blurfl sym
2888         ;;
2889 *)      echo "No symbolic links, so not testing for their testing..." >&4
2890         ;;
2891 esac
2892
2893 : Make symlinks util
2894 case "$mksymlinks" in
2895 $define|true|[yY]*)
2896         case "$src" in
2897         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2898                 exit 1
2899                 ;;
2900         *)      case "$lns:$issymlink" in
2901                 *"ln"*" -s:"*"test -"?)
2902                         echo "Creating the symbolic links..." >&4
2903                         cd ..
2904                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2905                         awk 'NF == 1 {
2906                                 dir=".";
2907                                 file=$1 "";
2908                              }
2909                              NF == 2 {
2910                                 dir=$1 "";
2911                                 file=$2 "";
2912                              }
2913                              {
2914                                  print "# dir = ", dir, "file = ", file
2915                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2916                              } END {
2917                                  for (d in mf) {
2918                                      if (d != ".") { print("mkdir -p "d) }
2919                                      print("ln -sf "mf[d]" "d);
2920                                  }
2921                              }' source="$src" > UU/mksymlinks.$$
2922                         sh UU/mksymlinks.$$
2923                         rm UU/mksymlinks.$$
2924                         # Sanity check 1.
2925                         if test ! -d t/base; then
2926                                 echo "Failed to create the subdirectories.  Aborting." >&4
2927                                 exit 1
2928                         fi
2929                         # Sanity check 2.
2930                         if test ! -f t/base/lex.t; then
2931                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2932                                 exit 1
2933                         fi
2934                         if test ! -f win32/win32.c; then
2935                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2936                                 exit 1
2937                         fi
2938                         cd UU
2939                         ;;
2940                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2941                         ;;
2942                 esac
2943                 ;;
2944         esac
2945         ;;
2946 esac
2947
2948 : Check for Cross-Compilation
2949 if $test "X$targethost" = "X"; then
2950     targethost=""
2951 fi
2952 if $test "X$targetenv" = "X"; then
2953     targetenv=""
2954 fi
2955 case "$usecrosscompile" in
2956 $define|true|[yY]*)
2957         $echo "Cross-compiling..."
2958         croak=''
2959         case "$cc" in
2960         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2961             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2962             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2963             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2964             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2965             # leave out ld, choosing it is more complex
2966             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2967             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2968             # We are in a weird spot. Just before us, some values
2969             # were 'saved', to be restored after the hints are
2970             # run.  This means that the changes we made to ar,
2971             # nm and ranlib will get reverted.
2972             # To avoid that, we hijack the saving mechanism and
2973             # have it save our new values.
2974             for file in ar nm ranlib; do
2975                 eval xxx=\$$file
2976                 eval $file=$xxx$_exe
2977                 eval _$file=$xxx
2978             done
2979         ;;
2980         esac
2981         case "$targetarch" in
2982         '') echo "Targetarch not defined." >&4; croak=y ;;
2983         *)  echo "Using targetarch $targetarch." >&4 ;;
2984         esac
2985         case "$targethost" in
2986         '') echo "Targethost not defined." >&4; croak=n ;;
2987         *)  echo "Using targethost $targethost." >&4
2988         esac
2989         locincpth=' '
2990         loclibpth=' '
2991         case "$croak" in
2992         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2993         esac
2994     : compile a host miniperl and generate_uudmap, unless we got passed them
2995     if $test "X$hostperl" = X; then
2996       echo "Building host miniperl and generate_uudmap binaries" >&4
2997       before_host=`pwd`
2998       cd ..
2999       cd $src
3000       src=`pwd`
3001       rm -rf $src/host
3002       mkdir $src/host
3003       cd $src/host
3004       $src/Configure -des -Dusedevel -Dmksymlinks
3005       $make miniperl
3006       case "$hostgenerate" in
3007       '') $make generate_uudmap
3008           hostgenerate=$src/host/generate_uudmap
3009           ;;
3010        "$undef") hostgenerate=''
3011           ;;
3012       esac
3013       hostperl=$src/host/miniperl
3014       cd $before_host
3015     fi
3016     hostosname=`$hostperl -le 'print $^O'`
3017     ;;
3018 *)
3019     usecrosscompile="$undef"
3020     ;;
3021 esac
3022
3023 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3024 case "$targethost" in
3025     '') echo "Checking for cross-compile" >&4
3026     case "$usecrosscompile$multiarch" in
3027        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3028          if [ -f Makefile ]; then
3029            echo " "
3030            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3031          else
3032            echo "Configure done."
3033          fi
3034        exit 0
3035        ;;
3036      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3037         run=''
3038         to=:
3039         from=:
3040         ;;
3041     esac
3042     ;;
3043     *) echo "Using targethost $targethost." >&4
3044         case "$src" in
3045         /*) run=$src/Cross/run
3046             targetmkdir=$src/Cross/mkdir
3047             to=$src/Cross/to
3048             from=$src/Cross/from
3049             ;;
3050         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3051             run=$pwd/Cross/run
3052             targetmkdir=$pwd/Cross/mkdir
3053             to=$pwd/Cross/to
3054             from=$pwd/Cross/from
3055             ;;
3056         esac
3057         case "$targetrun" in
3058         '') targetrun=ssh ;;
3059         esac
3060         case "$targetto" in
3061         '') targetto=scp ;;
3062         esac
3063         case "$targetfrom" in
3064         '') targetfrom=scp ;;
3065         esac
3066         run=$run-$targetrun
3067         to=$to-$targetto
3068         from=$from-$targetfrom
3069         case "$targetdir" in
3070         '')  targetdir=/tmp
3071              echo "Guessing targetdir $targetdir." >&4
3072              ;;
3073         esac
3074         case "$targetuser" in
3075         '')  targetuser=root
3076              echo "Guessing targetuser $targetuser." >&4
3077              ;;
3078         esac
3079         case "$targetport" in
3080         '')  targetport=22
3081              echo "Guessing targetport $targetport." >&4
3082              ;;
3083         esac
3084         case "$targetfrom" in
3085         scp)    q=-q ;;
3086         *)      q='' ;;
3087         esac
3088         case "$targetrun" in
3089         ssh|rsh)
3090             cat >$run <<EOF
3091 #!/bin/sh
3092 env=''
3093 case "\$1" in
3094 -cwd)
3095   shift
3096   cwd=\$1
3097   shift
3098   ;;
3099 esac
3100 case "\$1" in
3101 -env)
3102   shift
3103   env=\$1
3104   shift
3105   ;;
3106 esac
3107 case "\$cwd" in
3108 '') cwd=$targetdir ;;
3109 esac
3110 exe=\$1
3111 shift
3112 $to \$exe
3113 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3114 EOF
3115             ;;
3116         adb)
3117             $touch $run
3118             ;;
3119         *)  echo "Unknown targetrun '$targetrun'" >&4
3120             exit 1
3121             ;;
3122         esac
3123         case "$targetmkdir" in
3124         */Cross/mkdir)
3125             cat >$targetmkdir <<EOF
3126 #!/bin/sh
3127 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3128 EOF
3129             $chmod a+rx $targetmkdir
3130             ;;
3131         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3132             exit 1
3133             ;;
3134         esac
3135         case "$targetto" in
3136         scp|rcp)
3137             cat >$to <<EOF
3138 #!/bin/sh
3139 for f in \$@
3140 do
3141   case "\$f" in
3142   /*)
3143     $targetmkdir \`dirname \$f\`
3144     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3145     ;;
3146   *)
3147     $targetmkdir $targetdir/\`dirname \$f\`
3148     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3149     ;;
3150   esac
3151 done
3152 exit 0
3153 EOF
3154             ;;
3155         cp) cat >$to <<EOF
3156 #!/bin/sh
3157 for f in \$@
3158 do
3159   case "\$f" in
3160   /*)
3161     $mkdir -p $targetdir/\`dirname \$f\`
3162     $cp \$f $targetdir/\$f || exit 1
3163     ;;
3164   *)
3165     $targetmkdir $targetdir/\`dirname \$f\`
3166     $cp \$f $targetdir/\$f || exit 1
3167     ;;
3168   esac
3169 done
3170 exit 0
3171 EOF
3172             ;;
3173         *)  echo "Unknown targetto '$targetto'" >&4
3174             exit 1
3175             ;;
3176         esac
3177         case "$targetfrom" in
3178         scp|rcp)
3179           cat >$from <<EOF
3180 #!/bin/sh
3181 for f in \$@
3182 do
3183   $rm -f \$f
3184   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3185 done
3186 exit 0
3187 EOF
3188             ;;
3189         cp) cat >$from <<EOF
3190 #!/bin/sh
3191 for f in \$@
3192 do
3193   $rm -f \$f
3194   cp $targetdir/\$f . || exit 1
3195 done
3196 exit 0
3197 EOF
3198             ;;
3199         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3200             exit 1
3201             ;;
3202         esac
3203         if $test ! -f $run; then
3204             echo "Target 'run' script '$run' not found." >&4
3205         else
3206             $chmod a+rx $run
3207         fi
3208         if $test ! -f $to; then
3209             echo "Target 'to' script '$to' not found." >&4
3210         else
3211             $chmod a+rx $to
3212         fi
3213         if $test ! -f $from; then
3214             echo "Target 'from' script '$from' not found." >&4
3215         else
3216             $chmod a+rx $from
3217         fi
3218         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3219             exit 1
3220         fi
3221         cat >&4 <<EOF
3222 Using '$run' for remote execution,
3223 and '$from' and '$to'
3224 for remote file transfer.
3225 EOF
3226         ;;
3227 *)      run=''
3228         to=:
3229         from=:
3230         usecrosscompile="$undef"
3231         targetarch=''
3232         ;;
3233 esac
3234
3235 : see whether [:lower:] and [:upper:] are supported character classes
3236 echo " "
3237 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3238 ABYZ-abyz)
3239         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3240         up='[:upper:]'
3241         low='[:lower:]'
3242         ;;
3243 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3244         # (0xd9 and 0xe2), therefore that is a nice testing point.
3245         if test "X$up" = X -o "X$low" = X; then
3246             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3247             rs) up='[A-Z]'
3248                 low='[a-z]'
3249                 ;;
3250             esac
3251         fi
3252         if test "X$up" = X -o "X$low" = X; then
3253             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3254             rs) up='A-Z'
3255                 low='a-z'
3256                 ;;
3257             esac
3258         fi
3259         if test "X$up" = X -o "X$low" = X; then
3260             case "`echo RS | od -x 2>/dev/null`" in
3261             *D9E2*|*d9e2*)
3262                 echo "Hey, this might be EBCDIC." >&4
3263                 if test "X$up" = X -o "X$low" = X; then
3264                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3265                     rs) up='[A-IJ-RS-Z]'
3266                         low='[a-ij-rs-z]'
3267                         ;;
3268                     esac
3269                 fi
3270                 if test "X$up" = X -o "X$low" = X; then
3271                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3272                     rs) up='A-IJ-RS-Z'
3273                         low='a-ij-rs-z'
3274                         ;;
3275                     esac
3276                 fi
3277                 ;;
3278             esac
3279         fi
3280 esac
3281 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3282 rs)
3283     echo "Using $up and $low to convert case." >&4
3284     ;;
3285 *)
3286     echo "I don't know how to translate letters from upper to lower case." >&4
3287     echo "Your tr is not acting any way I know of." >&4
3288     exit 1
3289     ;;
3290 esac
3291 : set up the translation script tr, must be called with ./tr of course
3292 cat >tr <<EOSC
3293 $startsh
3294 case "\$1\$2" in
3295 '[A-Z][a-z]') exec $tr '$up' '$low';;
3296 '[a-z][A-Z]') exec $tr '$low' '$up';;
3297 esac
3298 exec $tr "\$@"
3299 EOSC
3300 chmod +x tr
3301 $eunicefix tr
3302
3303 : Try to determine whether config.sh was made on this system
3304 case "$config_sh" in
3305 '')
3306 myuname=`$uname -a 2>/dev/null`
3307 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3308 # Downcase everything to avoid ambiguity.
3309 # Remove slashes and single quotes so we can use parts of this in
3310 # directory and file names.
3311 # Remove newlines so myuname is sane to use elsewhere.
3312 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3313 # because the A-Z/a-z are not consecutive.
3314 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3315         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3316 newmyuname="$myuname"
3317 dflt=n
3318 case "$knowitall" in
3319 '')
3320         if test -f ../config.sh; then
3321                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3322                         eval "`grep myuname= ../config.sh`"
3323                 fi
3324                 if test "X$myuname" = "X$newmyuname"; then
3325                         dflt=y
3326                 fi
3327         fi
3328         ;;
3329 *) dflt=y;;
3330 esac
3331
3332 : Get old answers from old config file if Configure was run on the
3333 : same system, otherwise use the hints.
3334 hint=default
3335 cd ..
3336 if test -f config.sh; then
3337         echo " "
3338         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3339         . UU/myread
3340         case "$ans" in
3341         n*|N*) echo "OK, I'll ignore it."
3342                 mv config.sh config.sh.old
3343                 myuname="$newmyuname"
3344                 ;;
3345         *)  echo "Fetching default answers from your old config.sh file..." >&4
3346                 tmp_n="$n"
3347                 tmp_c="$c"
3348                 tmp_sh="$sh"
3349                 . ./config.sh
3350                 cp config.sh UU
3351                 n="$tmp_n"
3352                 c="$tmp_c"
3353                 : Older versions did not always set $sh.  Catch re-use of such
3354                 : an old config.sh.
3355                 case "$sh" in
3356                 '') sh="$tmp_sh" ;;
3357                 esac
3358                 hint=previous
3359                 ;;
3360         esac
3361 fi
3362 . ./UU/checkcc
3363 if test ! -f config.sh; then
3364         $cat <<EOM
3365
3366 First time through, eh?  I have some defaults handy for some systems
3367 that need some extra help getting the Configure answers right:
3368
3369 EOM
3370         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3371         dflt=''
3372         : Half the following guesses are probably wrong... If you have better
3373         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3374         : The metaconfig authors would also appreciate a copy...
3375         $test -f /irix && osname=irix
3376         $test -f /xenix && osname=sco_xenix
3377         $test -f /dynix && osname=dynix
3378         $test -f /dnix && osname=dnix
3379         $test -f /lynx.os && osname=lynxos
3380         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3381         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3382         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3383         $test -f /bin/mips && /bin/mips && osname=mips
3384         $test -d /usr/apollo/bin && osname=apollo
3385         $test -f /etc/saf/_sactab && osname=svr4
3386         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3387         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3388         $test -f /sys/utilities/MultiView && osname=amigaos
3389         if $test -d /MachTen -o -d /MachTen_Folder; then
3390                 osname=machten
3391                 if $test -x /sbin/version; then
3392                         osvers=`/sbin/version | $awk '{print $2}' |
3393                         $sed -e 's/[A-Za-z]$//'`
3394                 elif $test -x /usr/etc/version; then
3395                         osvers=`/usr/etc/version | $awk '{print $2}' |
3396                         $sed -e 's/[A-Za-z]$//'`
3397                 else
3398                         osvers="$2.$3"
3399                 fi
3400         fi
3401
3402         $test -f /sys/posix.dll &&
3403                 $test -f /usr/bin/what &&
3404                 set X `/usr/bin/what /sys/posix.dll` &&
3405                 $test "$3" = UWIN &&
3406                 osname=uwin &&
3407                 osvers="$5"
3408
3409         if $test -f $uname; then
3410                 set X $myuname
3411                 shift
3412
3413                 case "$5" in
3414                 fps*) osname=fps ;;
3415                 mips*)
3416                         case "$4" in
3417                         umips) osname=umips ;;
3418                         *) osname=mips ;;
3419                         esac;;
3420                 [23]100) osname=mips ;;
3421                 i386*)
3422                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3423                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3424                                 osname='sco'
3425                                 osvers=$tmp
3426                         elif $test -f /etc/kconfig; then
3427                                 osname=isc
3428                                 if test "$lns" = "$ln -s"; then
3429                                         osvers=4
3430                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3431                                         osvers=3
3432                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3433                                         osvers=2
3434                                 fi
3435                         fi
3436                         tmp=''
3437                         ;;
3438                 pc*)
3439                         if test -n "$DJGPP"; then
3440                                 osname=dos
3441                                 osvers=djgpp
3442                         fi
3443                         ;;
3444                 esac
3445
3446                 case "$1" in
3447                 aix) osname=aix
3448                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3449                         case "$tmp" in
3450                         # oslevel can fail with:
3451                         # oslevel: Unable to acquire lock.
3452                         *not\ found) osvers="$4"."$3" ;;
3453                         '<3240'|'<>3240') osvers=3.2.0 ;;
3454                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3455                         '=3250'|'>3250') osvers=3.2.5 ;;
3456                         *) osvers=$tmp;;
3457                         esac
3458                         ;;
3459                 bitrig) osname=bitrig
3460                         osvers="$3"
3461                         ;;
3462                 bsd386) osname=bsd386
3463                         osvers=`$uname -r`
3464                         ;;
3465                 cygwin*) osname=cygwin
3466                         osvers="$3"
3467                         ;;
3468                 *dc.osx) osname=dcosx
3469                         osvers="$3"
3470                         ;;
3471                 dnix) osname=dnix
3472                         osvers="$3"
3473                         ;;
3474                 domainos) osname=apollo
3475                         osvers="$3"
3476                         ;;
3477                 dgux)   osname=dgux
3478                         osvers="$3"
3479                         ;;
3480                 dragonfly) osname=dragonfly
3481                         osvers="$3"
3482                         ;;
3483                 dynixptx*) osname=dynixptx
3484                         osvers=`echo "$4"|sed 's/^v//'`
3485                         ;;
3486                 freebsd) osname=freebsd
3487                         osvers="$3" ;;
3488                 genix)  osname=genix ;;
3489                 gnu)    osname=gnu
3490                         osvers="$3" ;;
3491                 hp*)    osname=hpux
3492                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3493                         ;;
3494                 irix*)  osname=irix
3495                         case "$3" in
3496                         4*) osvers=4 ;;
3497                         5*) osvers=5 ;;
3498                         *)      osvers="$3" ;;
3499                         esac
3500                         ;;
3501                 linux)  osname=linux
3502                         case "$3" in
3503                         *)      osvers="$3" ;;
3504                         esac
3505                         $test -f /system/lib/libandroid.so && osname=linux-android
3506                         ;;
3507                 MiNT)   osname=mint
3508                         ;;
3509                 minix)  osname=minix
3510                         osvers=`$uname -r`
3511                         ;;
3512                 netbsd*) osname=netbsd
3513                         osvers="$3"
3514                         ;;
3515                 news-os) osvers="$3"
3516                         case "$3" in
3517                         4*) osname=newsos4 ;;
3518                         *) osname=newsos ;;
3519                         esac
3520                         ;;
3521                 nonstop-ux) osname=nonstopux ;;
3522                 openbsd) osname=openbsd
3523                         osvers="$3"
3524                         ;;
3525                 os2)    osname=os2
3526                         osvers="$4"
3527                         ;;
3528                 POSIX-BC | posix-bc ) osname=posix-bc
3529                         osvers="$3"
3530                         ;;
3531                 powerux | power_ux | powermax_os | powermaxos | \
3532                 powerunix | power_unix) osname=powerux
3533                         osvers="$3"
3534                         ;;
3535                 qnx) osname=qnx
3536                         osvers="$4"
3537                         ;;
3538                 solaris) osname=solaris
3539                         case "$3" in
3540                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3541                         *)      osvers="$3" ;;
3542                         esac
3543                         ;;
3544                 sunos) osname=sunos
3545                         case "$3" in
3546                         5*) osname=solaris
3547                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3548                         *)      osvers="$3" ;;
3549                         esac
3550                         ;;
3551                 titanos) osname=titanos
3552                         case "$3" in
3553                         1*) osvers=1 ;;
3554                         2*) osvers=2 ;;
3555                         3*) osvers=3 ;;
3556                         4*) osvers=4 ;;
3557                         *)      osvers="$3" ;;
3558                         esac
3559                         ;;
3560                 ultrix) osname=ultrix
3561                         osvers="$3"
3562                         ;;
3563                 osf1|mls+)      case "$5" in
3564                                 alpha)
3565                                         osname=dec_osf
3566                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3567                                         case "$osvers" in
3568                                         [1-9].[0-9]*) ;;
3569                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3570                                         esac
3571                                         ;;
3572                         hp*)    osname=hp_osf1  ;;
3573                         mips)   osname=mips_osf1 ;;
3574                         esac
3575                         ;;
3576                 # UnixWare 7.1.2 is known as Open UNIX 8
3577                 openunix|unixware) osname=svr5
3578                         osvers="$4"
3579                         ;;
3580                 uts)    osname=uts
3581                         osvers="$3"
3582                         ;;
3583                 vos) osvers="$3"
3584                         ;;
3585                 $2) case "$osname" in
3586                         *isc*) ;;
3587                         *freebsd*) ;;
3588                         svr*)
3589                                 : svr4.x or possibly later
3590                                 case "svr$3" in
3591                                 ${osname}*)
3592                                         osname=svr$3
3593                                         osvers=$4
3594                                         ;;
3595                                 esac
3596                                 case "$osname" in
3597                                 svr4.0)
3598                                         : Check for ESIX
3599                                         if test -f /stand/boot ; then
3600                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3601                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3602                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3603                                                         if test -n "$isesix"; then
3604                                                                 osname=esix4
3605                                                         fi
3606                                                 fi
3607                                         fi
3608                                         ;;
3609                                 esac
3610                                 ;;
3611                         *)      if test -f /etc/systemid; then
3612                                         osname=sco
3613                                         set `echo $3 | $sed 's/\./ /g'` $4
3614                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3615                                                 osvers=$1.$2.$3
3616                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3617                                                 osvers=$1.$2
3618                                         elif $test -f $src/hints/sco_$1.sh; then
3619                                                 osvers=$1
3620                                         fi
3621                                 else
3622                                         case "$osname" in
3623                                         '') : Still unknown.  Probably a generic Sys V.
3624                                                 osname="sysv"
3625                                                 osvers="$3"
3626                                                 ;;
3627                                         esac
3628                                 fi
3629                                 ;;
3630                         esac
3631                         ;;
3632                 *)      case "$osname" in
3633                         '') : Still unknown.  Probably a generic BSD.
3634                                 osname="$1"
3635                                 osvers="$3"
3636                                 ;;
3637                         esac
3638                         ;;
3639                 esac
3640         else
3641                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3642                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3643                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3644                                 osname=news_os
3645                         fi
3646                         $rm -f UU/kernel.what
3647                 elif test -d c:/. -o -n "$is_os2" ; then
3648                         set X $myuname
3649                         osname=os2
3650                         osvers="$5"
3651                 fi
3652         fi
3653
3654         case "$targetarch" in
3655         '') ;;
3656         *)  hostarch=$osname
3657             case "$targetarch" in
3658                 nto*|*-nto-*)
3659                     # Will load qnx.sh, which should change osname to nto
3660                     osname=qnx
3661                     osvers=''
3662                     ;;
3663                 *linux-android*)
3664                     # Catch arm-linux-androideabi, mipsel-linux-android,
3665                     # and i686-linux-android
3666                     osname=linux-android
3667                     osvers=''
3668                     ;;
3669                 *linux*)
3670                     # Something like arm-linux-gnueabihf is really just
3671                     # plain linux.
3672                     osname=linux
3673                     osvers=''
3674                     ;;
3675                 *solaris*|*sunos*)
3676                     osname=solaris
3677                     # XXX perhaps we should just assume
3678                     # osvers to be 2, or maybe take the value
3679                     # from targetarch. Using $run before the
3680                     # hints are run is somewhat icky.
3681                     set X `$run $uname -a 2>/dev/null`
3682                     shift
3683                     case "$3" in
3684                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3685                         *)  osvers="$3" ;;
3686                     esac
3687                     ;;
3688                 *)
3689                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3690                     osvers=''
3691                 ;;
3692             esac
3693             ;;
3694         esac
3695
3696         : Now look for a hint file osname_osvers, unless one has been
3697         : specified already.
3698         case "$hintfile" in
3699         ''|' ')
3700                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3701                 : Also try without trailing minor version numbers.
3702                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3703                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3704                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3705                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3706                 case "$file" in
3707                 '') dflt=none ;;
3708                 *)  case "$osvers" in
3709                         '') dflt=$file
3710                                 ;;
3711                         *)  if $test -f $src/hints/$file.sh ; then
3712                                         dflt=$file
3713                                 elif $test -f $src/hints/$xfile.sh ; then
3714                                         dflt=$xfile
3715                                 elif $test -f $src/hints/$xxfile.sh ; then
3716                                         dflt=$xxfile
3717                                 elif $test -f $src/hints/$xxxfile.sh ; then
3718                                         dflt=$xxxfile
3719                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3720                                         dflt=$xxxxfile
3721                                 elif $test -f "$src/hints/${osname}.sh" ; then
3722                                         dflt="${osname}"
3723                                 else
3724                                         dflt=none
3725                                 fi
3726                                 ;;
3727                         esac
3728                         ;;
3729                 esac
3730                 if $test -f Policy.sh ; then
3731                         case "$dflt" in
3732                         *Policy*) ;;
3733                         none) dflt="Policy" ;;
3734                         *) dflt="Policy $dflt" ;;
3735                         esac
3736                 fi
3737                 ;;
3738         *)
3739                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3740                 ;;
3741         esac
3742
3743         if $test -f Policy.sh ; then
3744                 $cat <<EOM
3745
3746 There's also a Policy hint file available, which should make the
3747 site-specific (policy) questions easier to answer.
3748 EOM
3749
3750         fi
3751
3752         $cat <<EOM
3753
3754 You may give one or more space-separated answers, or "none" if appropriate.
3755 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3756 previous run of Configure, you may specify it as well as or instead of
3757 OS-specific hints.  If hints are provided for your OS, you should use them:
3758 although Perl can probably be built without hints on many platforms, using
3759 hints often improve performance and may enable features that Configure can't
3760 set up on its own. If there are no hints that match your OS, specify "none";
3761 DO NOT give a wrong version or a wrong OS.
3762
3763 EOM
3764
3765         rp="Which of these apply, if any?"
3766         . UU/myread
3767         tans=$ans
3768         for file in $tans; do
3769                 if $test X$file = XPolicy -a -f Policy.sh; then
3770                         . Policy.sh
3771                         $cat Policy.sh >> UU/config.sh
3772                 elif $test -f $src/hints/$file.sh; then
3773                         . $src/hints/$file.sh
3774                         $cat $src/hints/$file.sh >> UU/config.sh
3775                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3776                         : nothing
3777                 else
3778                         : Give one chance to correct a possible typo.
3779                         echo "$file.sh does not exist"
3780                         dflt=$file
3781                         rp="hint to use instead?"
3782                         . UU/myread
3783                         for file in $ans; do
3784                                 if $test -f "$src/hints/$file.sh"; then
3785                                         . $src/hints/$file.sh
3786                                         $cat $src/hints/$file.sh >> UU/config.sh
3787                                 elif $test X$ans = X -o X$ans = Xnone ; then
3788                                         : nothing
3789                                 else
3790                                         echo "$file.sh does not exist -- ignored."
3791                                 fi
3792                         done
3793                 fi
3794         done
3795
3796         hint=recommended
3797         : Remember our hint file for later.
3798         if $test -f "$src/hints/$file.sh" ; then
3799                 hintfile="$file"
3800         else
3801                 hintfile=''
3802         fi
3803 fi
3804 cd UU
3805 ;;
3806 *)
3807         echo " "
3808         echo "Fetching default answers from $config_sh..." >&4
3809         tmp_n="$n"
3810         tmp_c="$c"
3811         cd ..
3812         cp $config_sh config.sh 2>/dev/null
3813         chmod +w config.sh
3814         . ./config.sh
3815         cd UU
3816         cp ../config.sh .
3817         n="$tmp_n"
3818         c="$tmp_c"
3819         hint=previous
3820         ;;
3821 esac
3822 . ./optdef.sh
3823
3824 : Restore computed paths
3825 for file in $loclist $trylist; do
3826         eval $file="\$_$file"
3827 done
3828
3829 cat << EOM
3830
3831 Configure uses the operating system name and version to set some defaults.
3832 The default value is probably right if the name rings a bell. Otherwise,
3833 since spelling matters for me, either accept the default or answer "none"
3834 to leave it blank.
3835
3836 EOM
3837 case "$osname" in
3838         ''|' ')
3839                 case "$hintfile" in
3840                 ''|' '|none) dflt=none ;;
3841                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3842                 esac
3843                 ;;
3844         *) dflt="$osname" ;;
3845 esac
3846 rp="Operating system name?"
3847 . ./myread
3848 case "$ans" in
3849 none)  osname='' ;;
3850 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3851 esac
3852 echo " "
3853 case "$osvers" in
3854         ''|' ')
3855                 case "$hintfile" in
3856                 ''|' '|none) dflt=none ;;
3857                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3858                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3859                         case "$dflt" in
3860                         ''|' ') dflt=none ;;
3861                         esac
3862                         ;;
3863                 esac
3864                 ;;
3865         *) dflt="$osvers" ;;
3866 esac
3867 rp="Operating system version?"
3868 . ./myread
3869 case "$ans" in
3870 none)  osvers='' ;;
3871 *) osvers="$ans" ;;
3872 esac
3873
3874
3875 . ./posthint.sh
3876
3877 : who configured the system
3878 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3879 case "$cf_by" in
3880 "")
3881         cf_by=`(logname) 2>/dev/null`
3882         case "$cf_by" in
3883         "")
3884                 cf_by=`(whoami) 2>/dev/null`
3885                 case "$cf_by" in
3886                 "") cf_by=unknown ;;
3887                 esac ;;
3888         esac ;;
3889 esac
3890
3891 : decide how portable to be.  Allow command line overrides.
3892 case "$d_portable" in
3893 "$undef") ;;
3894 *)      d_portable="$define" ;;
3895 esac
3896
3897 : set up shell script to do ~ expansion
3898 cat >filexp <<EOSS
3899 $startsh
3900 : expand filename
3901 case "\$1" in
3902  \~/*|\~)
3903         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3904         ;;
3905  \~*)
3906         if $test -f /bin/csh; then
3907                 /bin/csh -f -c "glob \$1"
3908                 failed=\$?
3909                 echo ""
3910                 exit \$failed
3911         else
3912                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3913                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3914                 if $test ! -d "\$dir"; then
3915                         me=\`basename \$0\`
3916                         echo "\$me: can't locate home directory for: \$name" >&2
3917                         exit 1
3918                 fi
3919                 case "\$1" in
3920                 */*)
3921                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3922                         ;;
3923                 *)
3924                         echo \$dir
3925                         ;;
3926                 esac
3927         fi
3928         ;;
3929 *)
3930         echo \$1
3931         ;;
3932 esac
3933 EOSS
3934 chmod +x filexp
3935 $eunicefix filexp
3936
3937 : now set up to get a file name
3938 cat <<EOS >getfile
3939 $startsh
3940 EOS
3941 cat <<'EOSC' >>getfile
3942 tilde=''
3943 fullpath=''
3944 already=''
3945 skip=''
3946 none_ok=''
3947 exp_file=''
3948 nopath_ok=''
3949 orig_rp="$rp"
3950 orig_dflt="$dflt"
3951 case "$gfpth" in
3952 '') gfpth='.' ;;
3953 esac
3954
3955 case "$fn" in
3956 *\(*)
3957         : getfile will accept an answer from the comma-separated list
3958         : enclosed in parentheses even if it does not meet other criteria.
3959         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3960         fn=`echo $fn | sed 's/(.*)//'`
3961         ;;
3962 esac
3963
3964 case "$fn" in
3965 *:*)
3966         loc_file=`expr $fn : '.*:\(.*\)'`
3967         fn=`expr $fn : '\(.*\):.*'`
3968         ;;
3969 esac
3970
3971 case "$fn" in
3972 *~*) tilde=true;;
3973 esac
3974 case "$fn" in
3975 */*) fullpath=true;;
3976 esac
3977 case "$fn" in
3978 *+*) skip=true;;
3979 esac
3980 case "$fn" in
3981 *n*) none_ok=true;;
3982 esac
3983 case "$fn" in
3984 *e*) exp_file=true;;
3985 esac
3986 case "$fn" in
3987 *p*) nopath_ok=true;;
3988 esac
3989
3990 case "$fn" in
3991 *f*) type='File';;
3992 *d*) type='Directory';;
3993 *l*) type='Locate';;
3994 esac
3995
3996 what="$type"
3997 case "$what" in
3998 Locate) what='File';;
3999 esac
4000
4001 case "$exp_file" in
4002 '')
4003         case "$d_portable" in
4004         "$define") ;;
4005         *) exp_file=true;;
4006         esac
4007         ;;
4008 esac
4009
4010 cd ..
4011 while test "$type"; do
4012         redo=''
4013         rp="$orig_rp"
4014         dflt="$orig_dflt"
4015         case "$tilde" in
4016         true) rp="$rp (~name ok)";;
4017         esac
4018         . UU/myread
4019         if test -f UU/getfile.ok && \
4020                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4021         then
4022                 value="$ans"
4023                 ansexp="$ans"
4024                 break
4025         fi
4026         case "$ans" in
4027         none)
4028                 value=''
4029                 ansexp=''
4030                 case "$none_ok" in
4031                 true) type='';;
4032                 esac
4033                 ;;
4034         *)
4035                 case "$tilde" in
4036                 '') value="$ans"
4037                         ansexp="$ans";;
4038                 *)
4039                         value=`UU/filexp $ans`
4040                         case $? in
4041                         0)
4042                                 if test "$ans" != "$value"; then
4043                                         echo "(That expands to $value on this system.)"
4044                                 fi
4045                                 ;;
4046                         *) value="$ans";;
4047                         esac
4048                         ansexp="$value"
4049                         case "$exp_file" in
4050                         '') value="$ans";;
4051                         esac
4052                         ;;
4053                 esac
4054                 case "$fullpath" in
4055                 true)
4056                         case "$ansexp" in
4057                         /*) value="$ansexp" ;;
4058                         [a-zA-Z]:/*) value="$ansexp" ;;
4059                         *)
4060                                 redo=true
4061                                 case "$already" in
4062                                 true)
4063                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4064                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4065                                         ;;
4066                                 *)
4067                                 echo "Please give a full path name, starting with slash." >&4
4068                                         case "$tilde" in
4069                                         true)
4070                                 echo "Note that using ~name is ok provided it expands well." >&4
4071                                                 already=true
4072                                                 ;;
4073                                         esac
4074                                 esac
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079                 case "$redo" in
4080                 '')
4081                         case "$type" in
4082                         File)
4083                                 for fp in $gfpth; do
4084                                         if test "X$fp" = X.; then
4085                                             pf="$ansexp"
4086                                         else    
4087                                             pf="$fp/$ansexp"
4088                                         fi
4089                                         if test -f "$pf"; then
4090                                                 type=''
4091                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4092                                         then
4093                                                 echo "($value is not a plain file, but that's ok.)"
4094                                                 type=''
4095                                         fi
4096                                         if test X"$type" = X; then
4097                                             value="$pf"
4098                                             break
4099                                         fi
4100                                 done
4101                                 ;;
4102                         Directory)
4103                                 for fp in $gfpth; do
4104                                         if test "X$fp" = X.; then
4105                                             dir="$ans"
4106                                             direxp="$ansexp"
4107                                         else    
4108                                             dir="$fp/$ansexp"
4109                                             direxp="$fp/$ansexp"
4110                                         fi
4111                                         if test -d "$direxp"; then
4112                                                 type=''
4113                                                 value="$dir"
4114                                                 break
4115                                         fi
4116                                 done
4117                                 ;;
4118                         Locate)
4119                                 if test -d "$ansexp"; then
4120                                         echo "(Looking for $loc_file in directory $value.)"
4121                                         value="$value/$loc_file"
4122                                         ansexp="$ansexp/$loc_file"
4123                                 fi
4124                                 if test -f "$ansexp"; then
4125                                         type=''
4126                                 fi
4127                                 case "$nopath_ok" in
4128                                 true)   case "$value" in
4129                                         */*) ;;
4130                                         *)      echo "Assuming $value will be in people's path."
4131                                                 type=''
4132                                                 ;;
4133                                         esac
4134                                         ;;
4135                                 esac
4136                                 ;;
4137                         esac
4138
4139                         case "$skip" in
4140                         true) type='';
4141                         esac
4142
4143                         case "$type" in
4144                         '') ;;
4145                         *)
4146                                 if test "$fastread" = yes; then
4147                                         dflt=y
4148                                 else
4149                                         dflt=n
4150                                 fi
4151                                 rp="$what $value doesn't exist.  Use that name anyway?"
4152                                 . UU/myread
4153                                 dflt=''
4154                                 case "$ans" in
4155                                 y*) type='';;
4156                                 *) echo " ";;
4157                                 esac
4158                                 ;;
4159                         esac
4160                         ;;
4161                 esac
4162                 ;;
4163         esac
4164 done
4165 cd UU
4166 ans="$value"
4167 rp="$orig_rp"
4168 dflt="$orig_dflt"
4169 rm -f getfile.ok
4170 test "X$gfpthkeep" != Xy && gfpth=""
4171 EOSC
4172
4173 : determine root of directory hierarchy where package will be installed.
4174 case "$prefix" in
4175 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4176         ;;
4177 *)      dflt="$prefix"
4178         ;;
4179 esac
4180 $cat <<EOM
4181
4182 By default, $package will be installed in $dflt/bin, manual pages
4183 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4184 installation directories. Typically this is something like /usr/local.
4185 If you wish to have binaries under /usr/bin but other parts of the
4186 installation under /usr/local, that's ok: you will be prompted
4187 separately for each of the installation directories, the prefix being
4188 only used to set the defaults.
4189
4190 EOM
4191 fn=d~
4192 rp='Installation prefix to use?'
4193 . ./getfile
4194 oldprefix=''
4195 case "$prefix" in
4196 '')     ;;
4197 *)      case "$ans" in
4198         "$prefix") ;;
4199         *) oldprefix="$prefix";;
4200         esac
4201         ;;
4202 esac
4203
4204 case "$ans" in
4205 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4206         ;;
4207 *)      prefix="$ans"
4208 esac
4209
4210 case "$ansexp" in
4211 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4212         ;;
4213 *)      prefixexp="$ansexp"
4214 esac
4215
4216 : allow them to override the AFS root
4217 case "$afsroot" in
4218 '')     afsroot=/afs ;;
4219 *)      afsroot=$afsroot ;;
4220 esac
4221
4222 : is AFS running?
4223 echo " "
4224 case "$afs" in
4225 $define|true)   afs=true ;;
4226 $undef|false)   afs=false ;;
4227 *)      if $test -d $afsroot; then
4228                 afs=true
4229         else
4230                 afs=false
4231         fi
4232         ;;
4233 esac
4234 if $afs; then
4235         echo "AFS may be running... I'll be extra cautious then..." >&4
4236 else
4237         echo "AFS does not seem to be running..." >&4
4238 fi
4239
4240 : determine installation prefix for where package is to be installed.
4241 if $afs; then
4242 $cat <<EOM
4243
4244 Since you are running AFS, I need to distinguish the directory in which
4245 files will reside from the directory in which they are installed (and from
4246 which they are presumably copied to the former directory by occult means).
4247
4248 EOM
4249         case "$installprefix" in
4250         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4251         *) dflt="$installprefix";;
4252         esac
4253 else
4254 $cat <<EOM
4255
4256 In some special cases, particularly when building $package for distribution,
4257 it is convenient to distinguish the directory in which files should be
4258 installed from the directory ($prefix) in which they will
4259 eventually reside.  For most users, these two directories are the same.
4260
4261 EOM
4262         case "$installprefix" in
4263         '') dflt=$prefix ;;
4264         *) dflt=$installprefix;;
4265         esac
4266 fi
4267 fn=d~
4268 rp='What installation prefix should I use for installing files?'
4269 . ./getfile
4270 installprefix="$ans"
4271 installprefixexp="$ansexp"
4272
4273 : Perform the prefixexp/installprefixexp correction if necessary
4274 cat <<EOS >installprefix
4275 $startsh
4276 EOS
4277 cat <<'EOSC' >>installprefix
4278 : Change installation prefix, if necessary.
4279 if $test X"$prefix" != X"$installprefix"; then
4280     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4281 else
4282     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4283 fi
4284 EOSC
4285 chmod +x installprefix
4286 $eunicefix installprefix
4287
4288 : Set variables such as privlib and privlibexp from the output of ./getfile
4289 : performing the prefixexp/installprefixexp correction if necessary.
4290 cat <<EOS >setprefixvar
4291 $startsh
4292 EOS
4293 cat <<'EOSC' >>setprefixvar
4294 eval "${prefixvar}=\"\$ans\""
4295 eval "${prefixvar}exp=\"\$ansexp\""
4296 . ./installprefix
4297 EOSC
4298 chmod +x setprefixvar
4299 $eunicefix setprefixvar
4300
4301 : set up the script used to warn in case of inconsistency
4302 cat <<EOS >whoa
4303 $startsh
4304 EOS
4305 cat <<'EOSC' >>whoa
4306 dflt=y
4307 case "$hint" in
4308     recommended)
4309         case "$hintfile" in
4310         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4311                 ;;
4312         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4313                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4314                 ;;
4315         esac
4316         ;;
4317     *)  echo " "
4318         echo "*** WHOA THERE!!! ***" >&4
4319         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4320         ;;
4321 esac
4322 rp="    Keep the $hint value?"
4323 . ./myread
4324 case "$ans" in
4325 y) td=$was; tu=$was;;
4326 esac
4327 EOSC
4328
4329 : function used to set '$1' to '$val'
4330 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4331 case "$val$was" in
4332 $define$undef) . ./whoa; eval "$var=\$td";;
4333 $undef$define) . ./whoa; eval "$var=\$tu";;
4334 *) eval "$var=$val";;
4335 esac'
4336
4337 : get the patchlevel
4338 echo " "
4339 echo "Getting the current patchlevel..." >&4
4340 if $test -r $rsrc/patchlevel.h;then
4341         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4342         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4343         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4344         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4345         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4346         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4347         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4348 else
4349         revision=0
4350         patchlevel=0
4351         subversion=0
4352         api_revision=0
4353         api_version=0
4354         api_subversion=0
4355         perl_patchlevel=0
4356         $echo "(You do not have patchlevel.h.  Eek.)"
4357 fi
4358 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4359 version_patchlevel_string="version $patchlevel subversion $subversion"
4360 case "$perl_patchlevel" in
4361 0|'') ;;
4362 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4363     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4364     ;;
4365 esac
4366
4367 $echo "(You have $package $version_patchlevel_string.)"
4368
4369 case "$osname" in
4370 dos|vms)
4371         : XXX Should be a Configure test for double-dots in filenames.
4372         version=`echo $revision $patchlevel $subversion | \
4373                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4374         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4375                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4376         ;;
4377 *)
4378         version=`echo $revision $patchlevel $subversion | \
4379                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4380         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4381                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4382         ;;
4383 esac
4384 : Special case the 5.005_xx maintenance series, which used 5.005
4385 : without any subversion label as a subdirectory in $sitelib
4386 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4387         api_versionstring='5.005'
4388 fi
4389
4390 : Do we want threads support and if so, what type
4391 case "$usethreads" in
4392 $define|true|[yY]*)     dflt='y';;
4393 *)     # Catch case where user specified ithreads or 5005threads but
4394        # forgot -Dusethreads (A.D. 4/2002)
4395        case "$useithreads$use5005threads" in
4396        *$define*)       dflt='y';;
4397        *)               dflt='n';;
4398        esac
4399        ;;
4400 esac
4401 cat <<EOM
4402
4403 Perl can be built to offer a form of threading support on some systems
4404 To do so, Configure can be run with -Dusethreads.
4405
4406 Note that Perl built with threading support runs slightly slower
4407 and uses slightly more memory than plain Perl.
4408
4409 If this doesn't make any sense to you, just accept the default '$dflt'.
4410 EOM
4411 rp='Build a threading Perl?'
4412 . ./myread
4413 case "$ans" in
4414 y|Y)    val="$define" ;;
4415 *)      val="$undef" ;;
4416 esac
4417 set usethreads
4418 eval $setvar
4419
4420 if $test $patchlevel -lt 9; then
4421     case "$usethreads" in
4422     $define)
4423         : Default to ithreads unless overridden on command line or with
4424         : old config.sh
4425         dflt='y'
4426         case "$use5005threads" in
4427                 $define|true|[yY]*)
4428                         echo "5.005 threads are no longer supported"
4429                         exit 1
4430                 ;;
4431         esac
4432         case "$useithreads" in
4433                 $undef|false|[nN]*) dflt='n';;
4434         esac
4435         rp='Use the newer interpreter-based ithreads?'
4436         . ./myread
4437         case "$ans" in
4438         y|Y)    val="$define" ;;
4439         *)      val="$undef" ;;
4440         esac
4441         set useithreads
4442         eval $setvar
4443         : Now set use5005threads to the opposite value.
4444         case "$useithreads" in
4445         $define) val="$undef" ;;
4446         *) val="$define" ;;
4447         esac
4448         set use5005threads
4449         eval $setvar
4450         ;;
4451     *)
4452         useithreads="$undef"
4453         use5005threads="$undef"
4454         ;;
4455     esac
4456
4457     case "$useithreads$use5005threads" in
4458     "$define$define")
4459         $cat >&4 <<EOM
4460
4461 You cannot have both the ithreads and the 5.005 threads enabled
4462 at the same time.  Disabling the 5.005 threads since they are
4463 much less stable than the ithreads.
4464
4465 EOM
4466         use5005threads="$undef"
4467         ;;
4468     esac
4469
4470 else
4471 : perl-5.9.x and later
4472
4473     if test X"$usethreads" = "X$define"; then
4474         case "$use5005threads" in
4475             $define|true|[yY]*)
4476                 $cat >&4 <<EOM
4477
4478 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4479
4480 EOM
4481             ;;
4482         esac
4483     fi
4484
4485     use5005threads="$undef"
4486     useithreads="$usethreads"
4487 fi
4488
4489 case "$d_oldpthreads" in
4490 '')     : Configure tests would be welcome here.  For now, assume undef.
4491         val="$undef" ;;
4492 *)      val="$d_oldpthreads" ;;
4493 esac
4494 set d_oldpthreads
4495 eval $setvar
4496
4497
4498 : Look for a hint-file generated 'call-back-unit'.  If the
4499 : user has specified that a threading perl is to be built,
4500 : we may need to set or change some other defaults.
4501 if $test -f usethreads.cbu; then
4502     echo "Your platform has some specific hints regarding threaded builds, using them..."
4503     . ./usethreads.cbu
4504 else
4505     case "$usethreads" in
4506         "$define"|true|[yY]*)
4507                 $cat <<EOM
4508 (Your platform does not have any specific hints for threaded builds.
4509  Assuming POSIX threads, then.)
4510 EOM
4511         ;;
4512     esac
4513 fi
4514
4515 : Check if multiplicity is required
4516 cat <<EOM
4517
4518 Perl can be built so that multiple Perl interpreters can coexist
4519 within the same Perl executable.
4520 EOM
4521
4522 case "$useithreads" in
4523 $define)
4524         cat <<EOM
4525 This multiple interpreter support is required for interpreter-based threads.
4526 EOM
4527         val="$define"
4528         ;;
4529 *)      case "$usemultiplicity" in
4530         $define|true|[yY]*)     dflt='y';;
4531         *) dflt='n';;
4532         esac
4533         echo " "
4534         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4535         rp='Build Perl for multiplicity?'
4536         . ./myread
4537         case "$ans" in
4538         y|Y)    val="$define" ;;
4539         *)      val="$undef" ;;
4540         esac
4541         ;;
4542 esac
4543 set usemultiplicity
4544 eval $setvar
4545
4546 : Check if morebits is requested
4547 case "$usemorebits" in
4548 "$define"|true|[yY]*)
4549         use64bitint="$define"
4550         uselongdouble="$define"
4551         usemorebits="$define"
4552         ;;
4553 *)      usemorebits="$undef"
4554         ;;
4555 esac
4556
4557 : Determine the C compiler to be used
4558 echo " "
4559 case "$cc" in
4560 '') dflt=cc;;
4561 *) dflt="$cc";;
4562 esac
4563 rp="Use which C compiler?"
4564 . ./myread
4565 cc="$ans"
4566
4567 : See whether they have no cc but they do have gcc
4568 . ./trygcc
4569 if $test -f cc.cbu; then
4570     . ./cc.cbu
4571 fi
4572 . ./checkcc
4573
4574 : make some quick guesses about what we are up against
4575 echo " "
4576 $echo $n "Hmm...  $c"
4577 echo exit 1 >bsd
4578 echo exit 1 >usg
4579 echo exit 1 >v7
4580 echo exit 1 >osf1
4581 echo exit 1 >eunice
4582 echo exit 1 >xenix
4583 echo exit 1 >venix
4584 echo exit 1 >os2
4585 d_bsd="$undef"
4586 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4587 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4588 then
4589         echo "Looks kind of like an OSF/1 system, but we'll see..."
4590         echo exit 0 >osf1
4591 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4592         xxx=`./loc addbib blurfl $pth`
4593         if $test -f $xxx; then
4594         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4595                 echo exit 0 >bsd
4596                 echo exit 0 >usg
4597         else
4598                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4599                         echo "Looks kind of like an extended USG system, but we'll see..."
4600                 else
4601                         echo "Looks kind of like a USG system, but we'll see..."
4602                 fi
4603                 echo exit 0 >usg
4604         fi
4605 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4606         echo "Looks kind of like a BSD system, but we'll see..."
4607         d_bsd="$define"
4608         echo exit 0 >bsd
4609 else
4610         echo "Looks kind of like a Version 7 system, but we'll see..."
4611         echo exit 0 >v7
4612 fi
4613 case "$eunicefix" in
4614 *unixtovms*)
4615         $cat <<'EOI'
4616 There is, however, a strange, musty smell in the air that reminds me of
4617 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4618 EOI
4619         echo exit 0 >eunice
4620         d_eunice="$define"
4621 : it so happens the Eunice I know will not run shell scripts in Unix format
4622         ;;
4623 *)
4624         echo " "
4625         echo "Congratulations.  You aren't running Eunice."
4626         d_eunice="$undef"
4627         ;;
4628 esac
4629 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4630 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4631 : semicolon as a patch separator
4632 case "$p_" in
4633 :) ;;
4634 *)
4635         $cat <<'EOI'
4636 I have the feeling something is not exactly right, however...don't tell me...
4637 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4638 (Or you may be running DOS with DJGPP.)
4639 EOI
4640         echo exit 0 >os2
4641         ;;
4642 esac
4643 if test -f /xenix; then
4644         echo "Actually, this looks more like a XENIX system..."
4645         echo exit 0 >xenix
4646         d_xenix="$define"
4647 else
4648         echo " "
4649         echo "It's not Xenix..."
4650         d_xenix="$undef"
4651 fi
4652 chmod +x xenix
4653 $eunicefix xenix
4654 if test -f /venix; then
4655         echo "Actually, this looks more like a VENIX system..."
4656         echo exit 0 >venix
4657 else
4658         echo " "
4659         if ./xenix; then
4660                 : null
4661         else
4662                 echo "Nor is it Venix..."
4663         fi
4664 fi
4665 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4666 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4667 $rm -f foo
4668
4669 : Check if we are using GNU gcc and what its version is
4670 echo " "
4671 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4672 $cat >try.c <<EOM
4673 #include <stdio.h>
4674 int main() {
4675 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4676 #ifdef __VERSION__
4677         printf("%s\n", __VERSION__);
4678 #else
4679         printf("%s\n", "1");
4680 #endif
4681 #endif
4682         return(0);
4683 }
4684 EOM
4685 if $cc -o try $ccflags $ldflags try.c; then
4686         gccversion=`$run ./try`
4687         case "$gccversion" in
4688         '') echo "You are not using GNU cc." ;;
4689         *)  echo "You are using GNU cc $gccversion."
4690             ccname=gcc
4691             ;;
4692         esac
4693 else
4694         echo " "
4695         echo "*** WHOA THERE!!! ***" >&4
4696         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4697         case "$knowitall" in
4698         '')
4699         echo "    You'd better start hunting for one and let me know about it." >&4
4700                 exit 1
4701                 ;;
4702         esac
4703 fi
4704 $rm -f try try.*
4705 case "$gccversion" in
4706 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4707 esac
4708 case "$gccversion" in
4709 '') gccosandvers='' ;;
4710 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4711    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4712    gccshortvers=''
4713    case "$gccosandvers" in
4714    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4715    $osname$osvers) ;; # looking good
4716    $osname*) cat <<EOM >&4
4717
4718 *** WHOA THERE!!! ***
4719
4720     Your gcc has not been compiled for the exact release of
4721     your operating system ($gccosandvers versus $osname$osvers).
4722
4723     In general it is a good idea to keep gcc synchronized with
4724     the operating system because otherwise serious problems
4725     may ensue when trying to compile software, like Perl.
4726
4727     I'm trying to be optimistic here, though, and will continue.
4728     If later during the configuration and build icky compilation
4729     problems appear (headerfile conflicts being the most common
4730     manifestation), I suggest reinstalling the gcc to match
4731     your operating system release.
4732
4733 EOM
4734       ;;
4735    *) gccosandvers='' ;; # failed to parse, better be silent
4736    esac
4737    ;;
4738 esac
4739 case "$ccname" in
4740 '') ccname="$cc" ;;
4741 esac
4742
4743 # gcc 3.* complain about adding -Idirectories that they already know about,
4744 # so we will take those off from locincpth.
4745 case "$gccversion" in
4746 3.*)
4747     echo "main(){}">try.c
4748     for incdir in $locincpth; do
4749        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4750              grep '^c[cp]p*[01]: warning: changing search order '`
4751        if test "X$warn" != X; then
4752            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4753        fi
4754     done
4755     $rm -f try try.*
4756 esac
4757
4758 # gcc 4.9 by default does some optimizations that break perl.
4759 # see ticket 121505.
4760 #
4761 # The -fwrapv disables those optimizations (and probably others,) so
4762 # for gcc 4.9 (and later, since the optimizations probably won't go
4763 # away), add -fwrapv unless the user requests -fno-wrapv, which
4764 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4765 # which turns the overflows -fwrapv ignores into runtime errors.
4766 case "$gccversion" in
4767 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4768     case "$ccflags" in
4769     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4770     *) ccflags="$ccflags -fwrapv" ;;
4771     esac
4772 esac
4773
4774 : What should the include directory be ?
4775 : Use sysroot if set, so findhdr looks in the right place.
4776 echo " "
4777 $echo $n "Hmm...  $c"
4778 dflt="$sysroot/usr/include"
4779 incpath=''
4780 mips_type=''
4781 if $test -f /bin/mips && /bin/mips; then
4782         echo "Looks like a MIPS system..."
4783         $cat >usr.c <<'EOCP'
4784 #ifdef SYSTYPE_BSD43
4785 /bsd43
4786 #endif
4787 EOCP
4788         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4789                 dflt='/bsd43/usr/include'
4790                 incpath='/bsd43'
4791                 mips_type='BSD 4.3'
4792         else
4793                 mips_type='System V'
4794         fi
4795         $rm -f usr.c usr.out
4796         echo "and you're compiling with the $mips_type compiler and libraries."
4797         xxx_prompt=y
4798         echo "exit 0" >mips
4799 else
4800         echo "Doesn't look like a MIPS system."
4801         xxx_prompt=n
4802         echo "exit 1" >mips
4803 fi
4804 chmod +x mips
4805 $eunicefix mips
4806 case "$usrinc" in
4807 '') ;;
4808 *) dflt="$usrinc";;
4809 esac
4810 case "$xxx_prompt" in
4811 y)      fn=d/
4812         echo " "
4813         rp='Where are the include files you want to use?'
4814         . ./getfile
4815         usrinc="$ans"
4816         ;;
4817 *)      usrinc="$dflt"
4818         ;;
4819 esac
4820
4821 : see how we invoke the C preprocessor
4822 echo " "
4823 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4824 cat <<'EOT' >testcpp.c
4825 #define ABC abc
4826 #define XYZ xyz
4827 ABC.XYZ
4828 EOT
4829 cd ..
4830 if test ! -f cppstdin; then
4831         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4832                 # AIX cc -E doesn't show the absolute headerfile
4833                 # locations but we'll cheat by using the -M flag.
4834                 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
4835         else
4836                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4837         fi
4838 else
4839         echo "Keeping your $hint cppstdin wrapper."
4840 fi
4841 chmod 755 cppstdin
4842 wrapper=`pwd`/cppstdin
4843 ok='false'
4844 cd UU
4845
4846 if $test "X$cppstdin" != "X" && \
4847         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4848         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4849 then
4850         echo "You used to use $cppstdin $cppminus so we'll use that again."
4851         case "$cpprun" in
4852         '') echo "But let's see if we can live without a wrapper..." ;;
4853         *)
4854                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4855                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4856                 then
4857                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4858                         ok='true'
4859                 else
4860                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4861                 fi
4862                 ;;
4863         esac
4864 else
4865         case "$cppstdin" in
4866         '') ;;
4867         *)
4868                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4869                 ;;
4870         esac
4871 fi
4872
4873 if $ok; then
4874         : nothing
4875 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4876         $cc -E <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "Yup, it does."
4879         x_cpp="$cc $cppflags -E"
4880         x_minus='';
4881 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4882         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "Yup, it does."
4885         x_cpp="$cc $cppflags -E"
4886         x_minus='-';
4887 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4888         $cc -P <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         echo "Yipee, that works!"
4891         x_cpp="$cc $cppflags -P"
4892         x_minus='';
4893 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4894         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896         echo "At long last!"
4897         x_cpp="$cc $cppflags -P"
4898         x_minus='-';
4899 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4900         $cpp <testcpp.c >testcpp.out 2>&1; \
4901         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4902         echo "It works!"
4903         x_cpp="$cpp $cppflags"
4904         x_minus='';
4905 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4906         $cpp - <testcpp.c >testcpp.out 2>&1; \
4907         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4908         echo "Hooray, it works!  I was beginning to wonder."
4909         x_cpp="$cpp $cppflags"
4910         x_minus='-';
4911 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4912         $wrapper <testcpp.c >testcpp.out 2>&1; \
4913         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4914         x_cpp="$wrapper"
4915         x_minus=''
4916         echo "Eureka!"
4917 else
4918         dflt=''
4919         rp="No dice.  I can't find a C preprocessor.  Name one:"
4920         . ./myread
4921         x_cpp="$ans"
4922         x_minus=''
4923         $x_cpp <testcpp.c >testcpp.out 2>&1
4924         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4925                 echo "OK, that will do." >&4
4926         else
4927 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4928                 exit 1
4929         fi
4930 fi
4931
4932 case "$ok" in
4933 false)
4934         cppstdin="$x_cpp"
4935         cppminus="$x_minus"
4936         cpprun="$x_cpp"
4937         cpplast="$x_minus"
4938         set X $x_cpp
4939         shift
4940         case "$1" in
4941         "$cpp")
4942                 echo "Perhaps can we force $cc -E using a wrapper..."
4943                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4944                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4945                 then
4946                         echo "Yup, we can."
4947                         cppstdin="$wrapper"
4948                         cppminus='';
4949                 else
4950                         echo "Nope, we'll have to live without it..."
4951                 fi
4952                 ;;
4953         esac
4954         case "$cpprun" in
4955         "$wrapper")
4956                 cpprun=''
4957                 cpplast=''
4958                 ;;
4959         esac
4960         ;;
4961 esac
4962
4963 case "$cppstdin" in
4964 "$wrapper"|'cppstdin') ;;
4965 *) $rm -f $wrapper;;
4966 esac
4967 $rm -f testcpp.c testcpp.out
4968
4969 : Adjust cppfilter for path component separator
4970 case "$osname" in
4971 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4972 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4973 *)   cppfilter='' ;;
4974 esac
4975
4976 : Use gcc to determine libpth and incpth
4977 # If using gcc or clang, we can get better values for libpth, incpth
4978 # and usrinc directly from the compiler.
4979 # Note that ccname for clang is also gcc.
4980 case "$ccname" in
4981     gcc)
4982         $echo 'extern int foo;' > try.c
4983         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4984         shift
4985         if $test $# -gt 0; then
4986             incpth="$incpth $*"
4987             incpth="`$echo $incpth|$sed 's/^ //'`"
4988             for i in $*; do
4989                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4990                 if $test -d $j; then
4991                     libpth="$libpth $j"
4992                 fi
4993             done
4994             libpth="`$echo $libpth|$sed 's/^ //'`"
4995             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4996                 if $test -d $xxx; then
4997                     case " $libpth " in
4998                     *" $xxx "*) ;;
4999                     *) libpth="$libpth $xxx";;
5000                     esac
5001                 fi
5002             done
5003         fi
5004         $rm -f try.c
5005         case "$usrinc" in
5006         '') for i in $incpth; do
5007                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5008                     usrinc="$i"
5009                     break
5010                 fi
5011             done
5012             ;;
5013         esac
5014
5015         case "$usecrosscompile" in
5016         $define|true|[yY]*)
5017             case "$incpth" in
5018                 '') echo "Incpth not defined." >&4; croak=y ;;
5019                 *)  echo "Using incpth '$incpth'." >&4 ;;
5020             esac
5021             case "$libpth" in
5022                 '') echo "Libpth not defined." >&4; croak=y ;;
5023                 *)  echo "Using libpth '$libpth'." >&4 ;;
5024             esac
5025             case "$usrinc" in
5026                 '') echo "Usrinc not defined." >&4; croak=y ;;
5027                 *)  echo "Using usrinc $usrinc." >&4 ;;
5028             esac
5029             case "$croak" in
5030                 y)
5031                 if test "X$sysroot" = X; then
5032                     echo "Cannot continue, aborting." >&4; exit 1
5033                 else
5034                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5035                 fi
5036                 ;;
5037             esac
5038             ;;
5039         esac
5040     ;;
5041 esac
5042
5043 : Default value for incpth is just usrinc
5044 case "$incpth" in
5045 '') incpth="$usrinc";;
5046 esac
5047
5048 : Set private lib path
5049 case "$plibpth" in
5050 '') if ./mips; then
5051         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5052     fi;;
5053 esac
5054 case "$libpth" in
5055 ' ') dlist='';;
5056 '') dlist="$loclibpth $plibpth $glibpth";;
5057 *) dlist="$libpth";;
5058 esac
5059
5060 : Now check and see which directories actually exist, avoiding duplicates
5061 for xxx in $dlist
5062 do
5063     if $test -d $xxx; then
5064                 case " $libpth " in
5065                 *" $xxx "*) ;;
5066                 *) libpth="$libpth $xxx";;
5067                 esac
5068     fi
5069 done
5070 $cat <<'EOM'
5071
5072 Some systems have incompatible or broken versions of libraries.  Among
5073 the directories listed in the question below, please remove any you
5074 know not to be holding relevant libraries, and add any that are needed.
5075 Say "none" for none.
5076
5077 EOM
5078
5079 if test "X$sysroot" != X; then
5080     $cat <<EOM
5081 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5082
5083 EOM
5084 fi
5085
5086 case "$libpth" in
5087 '') dflt='none';;
5088 *)
5089         set X $libpth
5090         shift
5091         dflt=${1+"$@"}
5092         ;;
5093 esac
5094 rp="Directories to use for library searches?"
5095 . ./myread
5096 case "$ans" in
5097 none) libpth=' ';;
5098 *) libpth="$ans";;
5099 esac
5100
5101 : compute shared library extension
5102 case "$so" in
5103 '')
5104         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5105                 dflt='sl'
5106         else
5107                 dflt='so'
5108         fi
5109         ;;
5110 *) dflt="$so";;
5111 esac
5112 $cat <<EOM
5113
5114 On some systems, shared libraries may be available.  Answer 'none' if
5115 you want to suppress searching of shared libraries for the remainder
5116 of this configuration.
5117
5118 EOM
5119 rp='What is the file extension used for shared libraries?'
5120 . ./myread
5121 so="$ans"
5122
5123 : Does target system insist that shared library basenames are unique
5124 $cat << EOM
5125
5126 Some dynamic loaders assume that the *basename* of shared library filenames
5127 are globally unique.  We'll default this to undef as we assume your system
5128 is not this weird. Set to defined if you're on one of them.
5129
5130 EOM
5131
5132 dflt='n'
5133 rp='Make shared library basenames unique?'
5134 . ./myread
5135 case "$ans" in
5136 y|Y) val="$define" ;;
5137 *)   val="$undef"  ;;
5138 esac
5139 set d_libname_unique
5140 eval $setvar
5141
5142 : Define several unixisms.
5143 : Hints files or command line option can be used to override them.
5144 : The convoluted testing is in case hints files set either the old
5145 : or the new name.
5146 case "$_exe" in
5147 '')     case "$exe_ext" in
5148         '')     ;;
5149         *)      _exe="$exe_ext" ;;
5150         esac
5151         ;;
5152 esac
5153 case "$_a" in
5154 '')     case "$lib_ext" in
5155     '') _a='.a';;
5156         *)      _a="$lib_ext" ;;
5157         esac
5158         ;;
5159 esac
5160 case "$_o" in
5161 '') case "$obj_ext" in
5162         '')     _o='.o';;
5163         *)      _o="$obj_ext";;
5164         esac
5165         ;;
5166 esac
5167 case "$p_" in
5168 '') case "$path_sep" in
5169         '')     p_=':';;
5170         *)      p_="$path_sep";;
5171         esac
5172         ;;
5173 esac
5174 exe_ext=$_exe
5175 lib_ext=$_a
5176 obj_ext=$_o
5177 path_sep=$p_
5178
5179 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5180
5181 : Which makefile gets called first.  This is used by make depend.
5182 case "$firstmakefile" in
5183 '') firstmakefile='makefile';;
5184 esac
5185
5186 : Check is we will use socks
5187 case "$usesocks" in
5188 $define|true|[yY]*)     dflt='y';;
5189 *) dflt='n';;
5190 esac
5191 cat <<EOM
5192
5193 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5194 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5195 to use the PerlIO abstraction layer, this will be implicitly selected.
5196
5197 If this doesn't make any sense to you, just accept the default '$dflt'.
5198 EOM
5199 rp='Build Perl for SOCKS?'
5200 . ./myread
5201 case "$ans" in
5202 y|Y)    val="$define" ;;
5203 *)      val="$undef" ;;
5204 esac
5205 set usesocks
5206 eval $setvar
5207
5208 : Check for uselongdouble support
5209 case "$ccflags" in
5210 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5211 esac
5212
5213 case "$uselongdouble" in
5214 $define|true|[yY]*)     dflt='y';;
5215 *) dflt='n';;
5216 esac
5217 cat <<EOM
5218
5219 Perl can be built to take advantage of long doubles which
5220 (if available) may give more accuracy and range for floating point numbers.
5221
5222 If this doesn't make any sense to you, just accept the default '$dflt'.
5223 EOM
5224 rp='Try to use long doubles if available?'
5225 . ./myread
5226 case "$ans" in
5227 y|Y)    val="$define"   ;;
5228 *)      val="$undef"    ;;
5229 esac
5230 set uselongdouble
5231 eval $setvar
5232
5233 case "$uselongdouble" in
5234 true|[yY]*) uselongdouble="$define" ;;
5235 esac
5236
5237 : Look for a hint-file generated 'call-back-unit'.  If the
5238 : user has specified that long doubles should be used,
5239 : we may need to set or change some other defaults.
5240 if $test -f uselongdouble.cbu; then
5241     echo "Your platform has some specific hints regarding long doubles, using them..."
5242     . ./uselongdouble.cbu
5243 else
5244     case "$uselongdouble" in
5245         $define)
5246                 $cat <<EOM
5247 (Your platform does not have any specific hints for long doubles.)
5248 EOM
5249         ;;
5250     esac
5251 fi
5252
5253 : Check if quadmath is requested
5254 case "$usequadmath" in
5255 "$define"|true|[yY]*) usequadmath="$define" ;;
5256 *)                    usequadmath="$undef"  ;;
5257 esac
5258
5259 : Fail if both uselongdouble and usequadmath are requested
5260 case "$usequadmath:$uselongdouble" in
5261 define:define)
5262         $cat <<EOM >&4
5263
5264 *** You requested the use of the quadmath library and use
5265 *** of long doubles.
5266 ***
5267 *** Please select one or the other.
5268 EOM
5269         exit 1
5270         ;;
5271 esac
5272
5273 : Looking for optional libraries
5274 echo " "
5275 echo "Checking for optional libraries..." >&4
5276 case "$libs" in
5277 ' '|'') dflt='';;
5278 *) dflt="$libs";;
5279 esac
5280 case "$libswanted" in
5281 '') libswanted='c_s';;
5282 esac
5283 case "$usesocks" in
5284 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5285 esac
5286 case "$usecbacktrace" in
5287 "$define") libswanted="$libswanted bfd" ;;
5288 esac
5289 case "$usequadmath" in
5290 "$define") libswanted="$libswanted quadmath" ;;
5291 esac
5292 libsfound=''
5293 libsfiles=''
5294 libsdirs=''
5295 libspath=''
5296 for thisdir in $libpth $xlibpth; do
5297   test -d $thisdir && libspath="$libspath $thisdir"
5298 done
5299 for thislib in $libswanted; do
5300         for thisdir in $libspath; do
5301             xxx=''
5302             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5303                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5304                 $test -f "$xxx" && eval $libscheck
5305                 $test -f "$xxx" && libstyle=shared
5306                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5307                 $test -f "$xxx" && eval $libscheck
5308                 $test -f "$xxx" && libstyle=shared
5309             fi
5310             if test ! -f "$xxx"; then
5311                 xxx=$thisdir/lib$thislib.$so
5312                 $test -f "$xxx" && eval $libscheck
5313                 $test -f "$xxx" && libstyle=shared
5314             fi
5315             if test ! -f "$xxx"; then
5316                 xxx=$thisdir/lib$thislib$_a
5317                 $test -f "$xxx" && eval $libscheck
5318                 $test -f "$xxx" && libstyle=static
5319             fi
5320             if test ! -f "$xxx"; then
5321                 xxx=$thisdir/$thislib$_a
5322                 $test -f "$xxx" && eval $libscheck
5323                 $test -f "$xxx" && libstyle=static
5324             fi
5325             if test ! -f "$xxx"; then
5326                 xxx=$thisdir/lib${thislib}_s$_a
5327                 $test -f "$xxx" && eval $libscheck
5328                 $test -f "$xxx" && libstyle=static
5329                 $test -f "$xxx" && thislib=${thislib}_s
5330             fi
5331             if test ! -f "$xxx"; then
5332                 xxx=$thisdir/Slib$thislib$_a
5333                 $test -f "$xxx" && eval $libscheck
5334                 $test -f "$xxx" && libstyle=static
5335             fi
5336             if $test -f "$xxx"; then
5337                 case "$libstyle" in
5338                 shared) echo "Found -l$thislib (shared)." ;;
5339                 static) echo "Found -l$thislib." ;;
5340                 *)      echo "Found -l$thislib ($libstyle)." ;;
5341                 esac
5342                 case " $dflt " in
5343                 *"-l$thislib "*);;
5344                 *) dflt="$dflt -l$thislib"
5345                    libsfound="$libsfound $xxx"
5346                    yyy=`basename $xxx`
5347                    libsfiles="$libsfiles $yyy"
5348                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5349                    case " $libsdirs " in
5350                    *" $yyy "*) ;;
5351                    *) libsdirs="$libsdirs $yyy" ;;
5352                    esac
5353                    ;;
5354                 esac
5355                 break
5356             fi
5357         done
5358         if $test ! -f "$xxx"; then
5359             echo "No -l$thislib."
5360         fi
5361 done
5362 set X $dflt
5363 shift
5364 dflt="$*"
5365 case "$libs" in
5366 '') dflt="$dflt";;
5367 *) dflt="$libs";;
5368 esac
5369 case "$dflt" in
5370 ' '|'') dflt='none';;
5371 esac
5372
5373 $cat <<EOM
5374
5375 In order to compile $package on your machine, a number of libraries
5376 are usually needed.  Include any other special libraries here as well.
5377 Say "none" for none.  The default list is almost always right.
5378 EOM
5379
5380 echo " "
5381 rp="What libraries to use?"
5382 . ./myread
5383 case "$ans" in
5384 none) libs=' ';;
5385 *) libs="$ans";;
5386 esac
5387
5388 : determine optimization, if desired, or use for debug flag also
5389 case "$optimize" in
5390 ' '|$undef) dflt='none';;
5391 '') dflt='-O';;
5392 *) dflt="$optimize";;
5393 esac
5394 $cat <<EOH
5395
5396 By default, $package compiles with the -O flag to use the optimizer.
5397 Alternately, you might want to use the symbolic debugger, which uses
5398 the -g flag (on traditional Unix systems).  Either flag can be
5399 specified here.  To use neither flag, specify the word "none".
5400
5401 EOH
5402 rp="What optimizer/debugger flag should be used?"
5403 . ./myread
5404 optimize="$ans"
5405 case "$optimize" in
5406 'none') optimize=" ";;
5407 esac
5408
5409 : Check what DEBUGGING is required from the command line
5410 : -DEBUGGING      or -DDEBUGGING or
5411 : -DEBUGGING=both                       = -g + -DDEBUGGING
5412 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5413 : -DEBUGGING=none or -UDEBUGGING        =
5414 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5415 case "$EBUGGING" in
5416 '')     ;;
5417 *)      DEBUGGING=$EBUGGING ;;
5418 esac
5419
5420 case "$DEBUGGING" in
5421 -g|both|$define)
5422     case "$optimize" in
5423         *-g*) ;;
5424         *)    optimize="$optimize -g" ;;
5425     esac ;;
5426 none|$undef)
5427     case "$optimize" in
5428         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5429                 shift
5430                 optimize="$*"
5431                 ;;
5432     esac ;;
5433 esac
5434
5435 dflt=''
5436 case "$DEBUGGING" in
5437 both|$define) dflt='-DDEBUGGING'
5438 esac
5439
5440 : argument order is deliberate, as the flag will start with - which set could
5441 : think is an option
5442 checkccflag='check=$1; flag=$2; callback=$3;
5443 echo " ";
5444 echo "Checking if your compiler accepts $flag" 2>&1;
5445 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5446 echo "int main(void) { return 0; }" > gcctest.c;
5447 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5448     echo "Yes, it does." 2>&1;
5449     if $test -s gcctest.out ; then
5450         echo "But your platform does not like it:";
5451         cat gcctest.out;
5452     else
5453         case "$ccflags" in
5454         *$check*)
5455             echo "Leaving current flags $ccflags alone." 2>&1
5456             ;;
5457         *) dflt="$dflt $flag";
5458             eval $callback
5459             ;;
5460         esac
5461     fi
5462 else
5463     echo "Nope, it does not, but that is ok." 2>&1;
5464 fi
5465 '
5466
5467 : We will not override a previous value, but we might want to
5468 : augment a hint file
5469 case "$hint" in
5470 default|recommended)
5471         case "$gccversion" in
5472         1.*) dflt="$dflt -fpcc-struct-return" ;;
5473         esac
5474         case "$optimize:$DEBUGGING" in
5475         *-g*:old) dflt="$dflt -DDEBUGGING";;
5476         esac
5477         case "$gccversion" in
5478         2.*) if $test -d /etc/conf/kconfig.d &&
5479                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5480                 then
5481                         # Interactive Systems (ISC) POSIX mode.
5482                         dflt="$dflt -posix"
5483                 fi
5484                 ;;
5485         esac
5486         case "$gccversion" in
5487         1.*) ;;
5488         2.[0-8]*) ;;
5489         ?*)     set strict-aliasing -fno-strict-aliasing
5490                 eval $checkccflag
5491                 ;;
5492         esac
5493         # For gcc, adding -pipe speeds up compilations for some, but apparently
5494         # some assemblers can't read from stdin.  (It also slows down compilations
5495         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5496         case "$gccversion" in
5497         ?*)     set pipe -pipe
5498                 eval $checkccflag
5499                 ;;
5500         esac
5501
5502         # on x86_64 (at least) we require an extra library (libssp) in the
5503         # link command line. This library is not named, so I infer that it is
5504         # an implementation detail that may change. Hence the safest approach
5505         # is to add the flag to the flags passed to the compiler at link time,
5506         # as that way the compiler can do the right implementation dependant
5507         # thing. (NWC)
5508         case "$osname" in
5509         amigaos) ;; # -fstack-protector builds but doesn't work
5510         *)      case "$gccversion" in
5511                 ?*)     set stack-protector-strong -fstack-protector-strong
5512                         eval $checkccflag
5513                         case "$dflt" in
5514                         *-fstack-protector-strong*) ;; # It got added.
5515                         *) # Try the plain/older -fstack-protector.
5516                            set stack-protector -fstack-protector
5517                            eval $checkccflag
5518                            ;;
5519                         esac
5520                         ;;
5521                 esac
5522                 ;;
5523         esac
5524         ;;
5525 esac
5526
5527 case "$mips_type" in
5528 *BSD*|'') inclwanted="$locincpth $usrinc";;
5529 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5530 esac
5531 for thisincl in $inclwanted; do
5532         if $test -d $thisincl; then
5533                 if $test x$thisincl != x$usrinc; then
5534                         case "$dflt" in
5535                         *" -I$thisincl "*);;
5536                         *) dflt="$dflt -I$thisincl ";;
5537                         esac
5538                 fi
5539         fi
5540 done
5541
5542 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5543         xxx=true;
5544 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5545         xxx=true;
5546 else
5547         xxx=false;
5548 fi;
5549 if $xxx; then
5550         case "$dflt" in
5551         *$2*);;
5552         *) dflt="$dflt -D$2";;
5553         esac;
5554 fi'
5555
5556 set signal.h LANGUAGE_C; eval $inctest
5557
5558 case "$usesocks" in
5559 $define)
5560         ccflags="$ccflags -DSOCKS"
5561         ;;
5562 esac
5563
5564 case "$hint" in
5565 default|recommended) dflt="$ccflags $dflt" ;;
5566 *) dflt="$ccflags";;
5567 esac
5568
5569 case "$dflt" in
5570 ''|' ') dflt=none;;
5571 esac
5572
5573 $cat <<EOH
5574
5575 Your C compiler may want other flags.  For this question you should include
5576 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5577 but you should NOT include libraries or ld flags like -lwhatever.  If you
5578 want $package to honor its debug switch, you should include -DDEBUGGING here.
5579 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5580
5581 To use no flags, specify the word "none".
5582
5583 EOH
5584 set X $dflt
5585 shift
5586 dflt=${1+"$@"}
5587 rp="Any additional cc flags?"
5588 . ./myread
5589 case "$ans" in
5590 none) ccflags='';;
5591 *) ccflags="$ans";;
5592 esac
5593
5594 : the following weeds options from ccflags that are of no interest to cpp
5595 case "$cppflags" in
5596 '') cppflags="$ccflags" ;;
5597 *)  set X $ccflags; shift
5598     case " $cppflags " in
5599     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5600     *) cppflags="$cppflags $ccflags" ;;
5601     esac
5602     ;;
5603 esac
5604 case "$gccversion" in
5605 1.*) cppflags="$cppflags -D__GNUC__"
5606 esac
5607 case "$mips_type" in
5608 '');;
5609 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5610 esac
5611 case "$cppflags" in
5612 '');;
5613 *)
5614         echo " "
5615         echo "Let me guess what the preprocessor flags are..." >&4
5616         set X $cppflags
5617         shift
5618         cppflags=''
5619         $cat >cpp.c <<'EOM'
5620 #define BLURFL foo
5621
5622 BLURFL xx LFRULB
5623 EOM
5624         previous=''
5625         for flag in $*
5626         do
5627                 case "$flag" in
5628                 -*) ftry="$flag";;
5629                 *) ftry="$previous $flag";;
5630                 esac
5631                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5632                         >cpp1.out 2>/dev/null && \
5633                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5634                         >cpp2.out 2>/dev/null && \
5635                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5636                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5637                 then
5638                         cppflags="$cppflags $ftry"
5639                         previous=''
5640                 else
5641                         previous="$flag"
5642                 fi
5643         done
5644         set X $cppflags
5645         shift
5646         cppflags=${1+"$@"}
5647         case "$cppflags" in
5648         *-*)  echo "They appear to be: $cppflags";;
5649         esac
5650         $rm -f cpp.c cpp?.out
5651         ;;
5652 esac
5653
5654 : flags used in final linking phase
5655 case "$ldflags" in
5656 '') if ./venix; then
5657                 dflt='-i -z'
5658         else
5659                 dflt=''
5660         fi
5661         case "$ccflags" in
5662         *-posix*) dflt="$dflt -posix" ;;
5663         esac
5664         ;;
5665 *) dflt="$ldflags";;
5666 esac
5667 # See note above about -fstack-protector
5668 case "$ccflags" in
5669 *-fstack-protector-strong*)
5670         case "$dflt" in
5671         *-fstack-protector-strong*) ;; # Don't add it again
5672         *) dflt="$dflt -fstack-protector-strong" ;;
5673         esac
5674         ;;
5675 *-fstack-protector*)
5676         case "$dflt" in
5677         *-fstack-protector*) ;; # Don't add it again
5678         *) dflt="$dflt -fstack-protector" ;;
5679         esac
5680         ;;
5681 esac
5682
5683 : Try to guess additional flags to pick up local libraries.
5684 for thislibdir in $libpth; do
5685         case " $loclibpth " in
5686         *" $thislibdir "*)
5687                 case "$dflt " in
5688                 *"-L$thislibdir "*) ;;
5689                 *)  dflt="$dflt -L$thislibdir" ;;
5690                 esac
5691                 ;;
5692         esac
5693 done
5694
5695 case "$dflt" in
5696 '') dflt='none' ;;
5697 esac
5698
5699 $cat <<EOH
5700
5701 Your C linker may need flags.  For this question you should
5702 include -L/whatever and any other flags used by the C linker, but you
5703 should NOT include libraries like -lwhatever.
5704
5705 Make sure you include the appropriate -L/path flags if your C linker
5706 does not normally search all of the directories you specified above,
5707 namely
5708         $libpth
5709 To use no flags, specify the word "none".
5710
5711 EOH
5712
5713 rp="Any additional ld flags (NOT including libraries)?"
5714 . ./myread
5715 case "$ans" in
5716 none) ldflags='';;
5717 *) ldflags="$ans";;
5718 esac
5719 rmlist="$rmlist pdp11"
5720
5721 : coherency check
5722 echo " "
5723 echo "Checking your choice of C compiler and flags for coherency..." >&4
5724 $cat > try.c <<'EOF'
5725 #include <stdio.h>
5726 int main() { printf("Ok\n"); return(0); }
5727 EOF
5728 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5729 shift
5730 $cat >try.msg <<'EOM'
5731 I've tried to compile and run the following simple program:
5732
5733 EOM
5734 $cat try.c >> try.msg
5735
5736 $cat >> try.msg <<EOM
5737
5738 I used the command:
5739
5740         $*
5741         $run ./try
5742
5743 and I got the following output:
5744
5745 EOM
5746 dflt=y
5747 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5748         if $sh -c "$run ./try " >>try.msg 2>&1; then
5749                 xxx=`$run ./try`
5750                 case "$xxx" in
5751                 "Ok") dflt=n ;;
5752                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5753                 esac
5754         else
5755                 echo "The program compiled OK, but exited with status $?." >>try.msg
5756                 rp="You have a problem.  Shall I abort Configure"
5757                 dflt=y
5758         fi
5759 else
5760         echo "I can't compile the test program." >>try.msg
5761         rp="You have a BIG problem.  Shall I abort Configure"
5762         dflt=y
5763 fi
5764 case "$dflt" in
5765 y)
5766         $cat try.msg >&4
5767         case "$knowitall" in
5768         '')
5769                 echo "(The supplied flags or libraries might be incorrect.)"
5770                 ;;
5771         *) dflt=n;;
5772         esac
5773         echo " "
5774         . ./myread
5775         case "$ans" in
5776         n*|N*) ;;
5777         *)      echo "Ok.  Stopping Configure." >&4
5778                 exit 1
5779                 ;;
5780         esac
5781         ;;
5782 n) echo "OK, that should do.";;
5783 esac
5784 $rm_try gcctest gcctest.out
5785
5786 : define a shorthand compile call
5787 compile='
5788 mc_file=$1;
5789 shift;
5790 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5791 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5792 exit 1;
5793 fi;
5794 esac;
5795 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5796 : define a shorthand compile call for compilations that should be ok.
5797 compile_ok='
5798 mc_file=$1;
5799 shift;
5800 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5801
5802 : stub, used only to satisfy other units
5803 i_stdlib='define'
5804
5805 : check for lengths of integral types
5806 echo " "
5807 case "$intsize" in
5808 '')
5809         echo "Checking to see how big your integers are..." >&4
5810         $cat >try.c <<EOCP
5811 #include <stdio.h>
5812 #$i_stdlib I_STDLIB
5813 #ifdef I_STDLIB
5814 #include <stdlib.h>
5815 #endif
5816 int main()
5817 {
5818         printf("intsize=%d;\n", (int)sizeof(int));
5819         printf("longsize=%d;\n", (int)sizeof(long));
5820         printf("shortsize=%d;\n", (int)sizeof(short));
5821         exit(0);
5822 }
5823 EOCP
5824         set try
5825         if eval $compile_ok && $run ./try > /dev/null; then
5826                 eval `$run ./try`
5827                 echo "Your integers are $intsize bytes long."
5828                 echo "Your long integers are $longsize bytes long."
5829                 echo "Your short integers are $shortsize bytes long."
5830         else
5831                 $cat >&4 <<EOM
5832 !
5833 Help! I can't compile and run the intsize test program: please enlighten me!
5834 (This is probably a misconfiguration in your system or libraries, and
5835 you really ought to fix it.  Still, I'll try anyway.)
5836 !
5837 EOM
5838                 dflt=4
5839                 rp="What is the size of an integer (in bytes)?"
5840                 . ./myread
5841                 intsize="$ans"
5842                 dflt=$intsize
5843                 rp="What is the size of a long integer (in bytes)?"
5844                 . ./myread
5845                 longsize="$ans"
5846                 dflt=2
5847                 rp="What is the size of a short integer (in bytes)?"
5848                 . ./myread
5849                 shortsize="$ans"
5850         fi
5851         ;;
5852 esac
5853 $rm_try
5854
5855 : check for long long
5856 echo " "
5857 echo "Checking to see if you have long long..." >&4
5858 echo 'int main() { long long x = 7; return 0; }' > try.c
5859 set try
5860 if eval $compile; then
5861         val="$define"
5862         echo "You have long long."
5863 else
5864         val="$undef"
5865         echo "You do not have long long."
5866 fi
5867 $rm_try
5868 set d_longlong
5869 eval $setvar
5870
5871 : check for length of long long
5872 case "${d_longlong}${longlongsize}" in
5873 $define)
5874         echo " "
5875         echo "Checking to see how big your long longs are..." >&4
5876         $cat >try.c <<'EOCP'
5877 #include <stdio.h>
5878 int main()
5879 {
5880     printf("%d\n", (int)sizeof(long long));
5881     return(0);
5882 }
5883 EOCP
5884         set try
5885         if eval $compile_ok; then
5886                 longlongsize=`$run ./try`
5887                 echo "Your long longs are $longlongsize bytes long."
5888         else
5889                 dflt='8'
5890                 echo " "
5891                 echo "(I can't seem to compile the test program.  Guessing...)"
5892                 rp="What is the size of a long long (in bytes)?"
5893                 . ./myread
5894                 longlongsize="$ans"
5895         fi
5896         if $test "X$longsize" = "X$longlongsize"; then
5897                 echo "(That isn't any different from an ordinary long.)"
5898         fi
5899         ;;
5900 esac
5901 $rm_try
5902
5903 : determine filename position in cpp output
5904 echo " "
5905 echo "Computing filename position in cpp output for #include directives..." >&4
5906 case "$osname" in
5907 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5908 esac
5909 case "$fieldn" in
5910 '')
5911 case "$osname" in
5912 vos) testaccess=-e ;;
5913 *)   testaccess=-r ;;
5914 esac
5915 echo '#include <stdio.h>' > foo.c
5916 $cat >fieldn <<EOF
5917 $startsh
5918 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5919 $grep '^[       ]*#.*stdio\.h' | \
5920 while read cline; do
5921         pos=1
5922         set \$cline
5923         while $test \$# -gt 0; do
5924                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5925                         echo "\$pos"
5926                         exit 0
5927                 fi
5928                 shift
5929                 pos=\`expr \$pos + 1\`
5930         done
5931 done
5932 EOF
5933 chmod +x fieldn
5934 fieldn=`./fieldn`
5935 $rm -f foo.c fieldn
5936 ;;
5937 esac
5938 case $fieldn in
5939 '') pos='???';;
5940 1) pos=first;;
5941 2) pos=second;;
5942 3) pos=third;;
5943 *) pos="${fieldn}th";;
5944 esac
5945 echo "Your cpp writes the filename in the $pos field of the line."
5946
5947 : locate header file
5948 $cat >findhdr <<EOF
5949 $startsh
5950 wanted=\$1
5951 name=''
5952 for usrincdir in $incpth
5953 do
5954         if test -f \$usrincdir/\$wanted; then
5955                 echo "\$usrincdir/\$wanted"
5956                 exit 0
5957         fi
5958 done
5959 awkprg='{ print \$$fieldn }'
5960 echo "#include <\$wanted>" > foo\$\$.c
5961 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5962 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5963 while read cline; do
5964         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5965         case "\$name" in
5966         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5967         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5968         *) exit 2;;
5969         esac;
5970 done;
5971 #
5972 # status = 0: grep returned 0 lines, case statement not executed
5973 # status = 1: headerfile found
5974 # status = 2: while loop executed, no headerfile found
5975 #
5976 status=\$?
5977 $rm -f foo\$\$.c;
5978 if test \$status -eq 1; then
5979         exit 0;
5980 fi
5981 exit 1
5982 EOF
5983 chmod +x findhdr
5984
5985 : define an alternate in-header-list? function
5986 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5987 cont=true; xxf="echo \"<\$1> found.\" >&4";
5988 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5989 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5990 esac;
5991 case $# in 4) instead=instead;; *) instead="at last";; esac;
5992 while $test "$cont"; do
5993         xxx=`./findhdr $1`
5994         var=$2; eval "was=\$$2";
5995         if $test "$xxx" && $test -r "$xxx";
5996         then eval $xxf;
5997         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5998                 cont="";
5999         else eval $xxnf;
6000         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6001         set $yyy; shift; shift; yyy=$@;
6002         case $# in 0) cont="";;
6003         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6004                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6005         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6006                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6007         esac;
6008 done;
6009 while $test "$yyy";
6010 do set $yyy; var=$2; eval "was=\$$2";
6011         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6012         set $yyy; shift; shift; yyy=$@;
6013 done'
6014
6015 : see if inttypes.h is available
6016 : we want a real compile instead of Inhdr because some systems
6017 : have an inttypes.h which includes non-existent headers
6018 echo " "
6019 $cat >try.c <<EOCP
6020 #include <inttypes.h>
6021 int main() {
6022         static int32_t foo32 = 0x12345678;
6023 }
6024 EOCP
6025 set try
6026 if eval $compile; then
6027         echo "<inttypes.h> found." >&4
6028         val="$define"
6029 else
6030         echo "<inttypes.h> NOT found." >&4
6031         val="$undef"
6032 fi
6033 $rm_try
6034 set i_inttypes
6035 eval $setvar
6036
6037 : check for int64_t
6038 echo " "
6039 echo "Checking to see if you have int64_t..." >&4
6040 $cat >try.c <<EOCP
6041 #include <sys/types.h>
6042 #$i_inttypes I_INTTYPES
6043 #ifdef I_INTTYPES
6044 #include <inttypes.h>
6045 #endif
6046 int main() { int64_t x = 7; }
6047 EOCP
6048 set try
6049 if eval $compile; then
6050         val="$define"
6051         echo "You have int64_t."
6052 else
6053         val="$undef"
6054         echo "You do not have int64_t."
6055 fi
6056 $rm_try
6057 set d_int64_t
6058 eval $setvar
6059
6060 : Check if 64bit ints have a quad type
6061 echo " "
6062 echo "Checking which 64-bit integer type we could use..." >&4
6063
6064 case "$intsize" in
6065 8) val=int
6066    set quadtype
6067    eval $setvar
6068    val='"unsigned int"'
6069    set uquadtype
6070    eval $setvar
6071    quadkind=1
6072    ;;
6073 *) case "$longsize" in
6074    8) val=long
6075       set quadtype
6076       eval $setvar
6077       val='"unsigned long"'
6078       set uquadtype
6079       eval $setvar
6080       quadkind=2
6081       ;;
6082    *) case "$d_longlong:$longlongsize" in
6083       define:8)
6084         val='"long long"'
6085         set quadtype
6086         eval $setvar
6087         val='"unsigned long long"'
6088         set uquadtype
6089         eval $setvar
6090         quadkind=3
6091         ;;
6092       *) case "$d_int64_t" in
6093          define)
6094            val=int64_t
6095            set quadtype
6096            eval $setvar
6097            val=uint64_t
6098            set uquadtype
6099            eval $setvar
6100            quadkind=4
6101            ;;
6102          esac
6103          ;;
6104       esac
6105       ;;
6106    esac
6107    ;;
6108 esac
6109
6110 case "$quadtype" in
6111 '')     echo "Alas, no 64-bit integer types in sight." >&4
6112         d_quad="$undef"
6113         ;;
6114 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6115         d_quad="$define"
6116         ;;
6117 esac
6118
6119 : Do we want 64bit support
6120 case "$uselonglong" in
6121 "$define"|true|[yY]*)
6122         cat <<EOM >&4
6123
6124 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6125 EOM
6126         use64bitint="$define"
6127         ;;
6128 esac
6129 case "$use64bits" in
6130 "$define"|true|[yY]*)
6131         cat <<EOM >&4
6132
6133 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6134 EOM
6135         use64bitint="$define"
6136         ;;
6137 esac
6138 case "$use64bitints" in
6139 "$define"|true|[yY]*)
6140         cat <<EOM >&4
6141
6142 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6143 EOM
6144         use64bitint="$define"
6145         ;;
6146 esac
6147 case "$use64bitsint" in
6148 "$define"|true|[yY]*)
6149         cat <<EOM >&4
6150
6151 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6152 EOM
6153         use64bitint="$define"
6154         ;;
6155 esac
6156 case "$uselonglongs" in
6157 "$define"|true|[yY]*)
6158         cat <<EOM >&4
6159
6160 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6161 EOM
6162         use64bitint="$define"
6163         ;;
6164 esac
6165 case "$use64bitsall" in
6166 "$define"|true|[yY]*)
6167         cat <<EOM >&4
6168
6169 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6170 EOM
6171         use64bitall="$define"
6172         ;;
6173 esac
6174
6175 case "$ccflags" in
6176 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6177 esac
6178 case "$use64bitall" in
6179 "$define"|true|[yY]*) use64bitint="$define" ;;
6180 esac
6181
6182 case "$longsize" in
6183 8) cat <<EOM
6184
6185 You have natively 64-bit long integers.
6186 EOM
6187    val="$define"
6188    ;;
6189 *) case "$use64bitint" in
6190    "$define"|true|[yY]*) dflt='y';;
6191    *) dflt='n';;
6192    esac
6193    case "$d_quad" in
6194    "$define") ;;
6195    *) dflt='n' ;;
6196    esac
6197    cat <<EOM
6198
6199 Perl can be built to take advantage of 64-bit integer types
6200 on some systems.  To do so, Configure can be run with -Duse64bitint.
6201 Choosing this option will most probably introduce binary incompatibilities.
6202
6203 If this doesn't make any sense to you, just accept the default '$dflt'.
6204 (The default has been chosen based on your configuration.)
6205 EOM
6206    rp='Try to use 64-bit integers, if available?'
6207    . ./myread
6208    case "$ans" in
6209    [yY]*) val="$define" ;;
6210    *)     val="$undef"  ;;
6211    esac
6212    ;;
6213 esac
6214 set use64bitint
6215 eval $setvar
6216
6217 case "$use64bitall" in
6218 "$define"|true|[yY]*) dflt='y' ;;
6219 *) case "$longsize" in
6220    8) dflt='y' ;;
6221    *) dflt='n' ;;
6222    esac
6223    ;;
6224 esac
6225 cat <<EOM
6226
6227 You may also choose to try maximal 64-bitness.  It means using as much
6228 64-bitness as possible on the platform.  This in turn means even more
6229 binary incompatibilities.  On the other hand, your platform may not
6230 have any more 64-bitness available than what you already have chosen.
6231
6232 If this doesn't make any sense to you, just accept the default '$dflt'.
6233 (The default has been chosen based on your configuration.)
6234 EOM
6235 rp='Try to use maximal 64-bit support, if available?'
6236 . ./myread
6237 case "$ans" in
6238 [yY]*) val="$define" ;;
6239 *)     val="$undef"  ;;
6240 esac
6241 set use64bitall
6242 eval $setvar
6243 case "$use64bitall" in
6244 "$define")
6245         case "$use64bitint" in
6246         "$undef")
6247                 cat <<EOM
6248
6249 Since you have chosen a maximally 64-bit build, I'm also turning on
6250 the use of 64-bit integers.
6251 EOM
6252                 use64bitint="$define" ;;
6253         esac
6254         ;;
6255 esac
6256
6257 : Look for a hint-file generated 'call-back-unit'.  If the
6258 : user has specified that a 64-bit perl is to be built,
6259 : we may need to set or change some other defaults.
6260 if $test -f use64bitint.cbu; then
6261         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6262         . ./use64bitint.cbu
6263 fi
6264 case "$use64bitint" in
6265 "$define"|true|[yY]*)
6266         : This test was common to all the OpenBSD forks, and seems harmless for
6267         : other platforms:
6268         echo " "
6269         echo "Checking if your C library has broken 64-bit functions..." >&4
6270         cat >try.c <<EOCP
6271 #include <stdio.h>
6272 typedef $uquadtype myULL;
6273 int main (void)
6274 {
6275     struct {
6276         double d;
6277         myULL  u;
6278     } *p, test[] = {
6279         {4294967303.15, 4294967303ULL},
6280         {4294967294.2,  4294967294ULL},
6281         {4294967295.7,  4294967295ULL},
6282         {0.0, 0ULL}
6283     };
6284     for (p = test; p->u; p++) {
6285         myULL x = (myULL)p->d;
6286         if (x != p->u) {
6287             printf("buggy\n");
6288             return 0;
6289         }
6290     }
6291     printf("ok\n");
6292     return 0;
6293 }
6294 EOCP
6295         set try
6296         if eval $compile_ok; then
6297             libcquad=`$run ./try`
6298             echo "Your C library's 64-bit functions are $libcquad."
6299         else
6300             echo "(I can't seem to compile the test program.)"
6301             echo "Assuming that your C library's 64-bit functions are ok."
6302             libcquad="ok"
6303         fi
6304         $rm_try
6305
6306         case "$libcquad" in
6307             buggy*)
6308                 cat >&4 <<EOM
6309
6310 *** You have a C library with broken 64-bit functions.
6311 *** 64-bit support does not work reliably in this configuration.
6312 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6313 *** Cannot continue, aborting.
6314
6315 EOM
6316                 exit 1
6317                 ;;
6318         esac
6319         case "$longsize" in
6320         4) case "$archname64" in
6321            '') archname64=64int ;;
6322            esac
6323            ;;
6324         esac
6325         ;;
6326 esac
6327
6328 : Look for a hint-file generated 'call-back-unit'.  If the
6329 : user has specified that a maximally 64-bit perl is to be built,
6330 : we may need to set or change some other defaults.
6331 if $test -f use64bitall.cbu; then
6332         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6333         . ./use64bitall.cbu
6334 fi
6335 case "$use64bitall" in
6336 "$define"|true|[yY]*)
6337         case "$longsize" in
6338         4) case "$archname64" in
6339            ''|64int) archname64=64all ;;
6340            esac
6341            ;;
6342         esac
6343         ;;
6344 esac
6345
6346 case "$d_quad:$use64bitint" in
6347 $undef:$define)
6348         cat >&4 <<EOF
6349
6350 *** You have chosen to use 64-bit integers,
6351 *** but none can be found.
6352 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6353 *** Cannot continue, aborting.
6354
6355 EOF
6356         exit 1
6357         ;;
6358 esac
6359
6360 : Check if we are using the GNU C library
6361 echo " "
6362 echo "Checking for GNU C Library..." >&4
6363 cat >try.c <<'EOCP'
6364 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6365    alone are insufficient to distinguish different versions, such as
6366    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6367    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6368 */
6369 #include <stdio.h>
6370 int main(void)
6371 {
6372 #ifdef __GLIBC__
6373 #   ifdef __GLIBC_MINOR__
6374 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6375 #           include <gnu/libc-version.h>
6376             printf("%s\n",  gnu_get_libc_version());
6377 #       else
6378             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6379 #       endif
6380 #   else
6381         printf("%d\n",  __GLIBC__);
6382 #   endif
6383     return 0;
6384 #else
6385     return 1;
6386 #endif
6387 }
6388 EOCP
6389 set try
6390 if eval $compile_ok && $run ./try > glibc.ver; then
6391         val="$define"
6392         gnulibc_version=`$cat glibc.ver`
6393         echo "You are using the GNU C Library version $gnulibc_version"
6394 else
6395         val="$undef"
6396         gnulibc_version=''
6397         echo "You are not using the GNU C Library"
6398 fi
6399 $rm_try glibc.ver
6400 set d_gnulibc
6401 eval $setvar
6402
6403 : see if nm is to be used to determine whether a symbol is defined or not
6404 case "$usenm" in
6405 '')
6406         dflt=''
6407         case "$d_gnulibc" in
6408         "$define")
6409                 echo " "
6410                 echo "nm probably won't work on the GNU C Library." >&4
6411                 dflt=n
6412                 ;;
6413         esac
6414         case "$dflt" in
6415         '')
6416                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6417                         echo " "
6418                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6419                         echo "'nm' won't be sufficient on this system." >&4
6420                         dflt=n
6421                 fi
6422                 ;;
6423         esac
6424         case "$dflt" in
6425         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6426                 if $test $dflt -gt 20; then
6427                         dflt=y
6428                 else
6429                         dflt=n
6430                 fi
6431                 ;;
6432         esac
6433         ;;
6434 *)
6435         case "$usenm" in
6436         true|$define) dflt=y;;
6437         *) dflt=n;;
6438         esac
6439         ;;
6440 esac
6441 $cat <<EOM
6442
6443 I can use $nm to extract the symbols from your C libraries. This
6444 is a time consuming task which may generate huge output on the disk (up
6445 to 3 megabytes) but that should make the symbols extraction faster. The
6446 alternative is to skip the 'nm' extraction part and to compile a small
6447 test program instead to determine whether each symbol is present. If
6448 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6449 this may be the best solution.
6450
6451 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6452
6453 EOM
6454 rp="Shall I use $nm to extract C symbols from the libraries?"
6455 . ./myread
6456 case "$ans" in
6457 [Nn]*) usenm=false;;
6458 *) usenm=true;;
6459 esac
6460
6461 runnm=$usenm
6462 case "$reuseval" in
6463 true) runnm=false;;
6464 esac
6465
6466 : nm options which may be necessary
6467 case "$nm_opt" in
6468 '') if $test -f /mach_boot; then
6469                 nm_opt=''       # Mach
6470         elif $test -d /usr/ccs/lib; then
6471                 nm_opt='-p'     # Solaris (and SunOS?)
6472         elif $test -f /dgux; then
6473                 nm_opt='-p'     # DG-UX
6474         elif $test -f /lib64/rld; then
6475                 nm_opt='-p'     # 64-bit Irix
6476         else
6477                 nm_opt=''
6478         fi;;
6479 esac
6480
6481 : nm options which may be necessary for shared libraries but illegal
6482 : for archive libraries.  Thank you, Linux.
6483 case "$nm_so_opt" in
6484 '')     case "$myuname" in
6485         *linux*|gnu*)
6486                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6487                         nm_so_opt='--dynamic'
6488                 fi
6489                 ;;
6490         esac
6491         ;;
6492 esac
6493
6494 : Figure out where the libc is located
6495 case "$runnm" in
6496 true)
6497 : get list of predefined functions in a handy place
6498 echo " "
6499 case "$libc" in
6500 '') libc=unknown
6501         case "$libs" in
6502         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6503         esac
6504         ;;
6505 esac
6506 case "$libs" in
6507 '') ;;
6508 *)  for thislib in $libs; do
6509         case "$thislib" in
6510         -lc|-lc_s)
6511                 : Handle C library specially below.
6512                 ;;
6513         -l*)
6514                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6515                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6516                         :
6517                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6518                         :
6519                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6520                         :
6521                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6522                         :
6523                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6524                         :
6525                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6526                         :
6527                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6528                         :
6529                 else
6530                         try=''
6531                 fi
6532                 libnames="$libnames $try"
6533                 ;;
6534         *) libnames="$libnames $thislib" ;;
6535         esac
6536         done
6537         ;;
6538 esac
6539 xxx=normal
6540 case "$libc" in
6541 unknown)
6542         set /lib/libc.$so
6543         for xxx in $libpth; do
6544                 $test -r $1 || set $xxx/libc.$so
6545                 : The messy sed command sorts on library version numbers.
6546                 $test -r $1 || \
6547                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6548                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6549                                 h
6550                                 s/[0-9][0-9]*/0000&/g
6551                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6552                                 G
6553                                 s/\n/ /' | \
6554                          $sort | $sed -e 's/^.* //'`
6555                 eval set \$$#
6556         done
6557         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6558         $test -r $1 || set $sysroot/lib/libsys_s$_a
6559         ;;
6560 *)
6561         set blurfl
6562         ;;
6563 esac
6564 if $test -r "$1"; then
6565         echo "Your (shared) C library seems to be in $1."
6566         libc="$1"
6567 elif $test -r /lib/libc && $test -r /lib/clib; then
6568         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6569         xxx=apollo
6570         libc='/lib/clib /lib/libc'
6571         if $test -r /lib/syslib; then
6572                 echo "(Your math library is in /lib/syslib.)"
6573                 libc="$libc /lib/syslib"
6574         fi
6575 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6576         echo "Your C library seems to be in $libc, as you said before."
6577 elif $test -r $incpath/usr/lib/libc$_a; then
6578         libc=$incpath/usr/lib/libc$_a;
6579         echo "Your C library seems to be in $libc.  That's fine."
6580 elif $test -r /lib/libc$_a; then
6581         libc=/lib/libc$_a;
6582         echo "Your C library seems to be in $libc.  You're normal."
6583 else
6584         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6585                 :
6586         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6587                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6588         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6589                 :
6590         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6591                 :
6592         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6593                 :
6594         else
6595                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6596         fi
6597         if $test -r "$tans"; then
6598                 echo "Your C library seems to be in $tans, of all places."
6599                 libc=$tans
6600         else
6601                 libc='blurfl'
6602         fi
6603 fi
6604 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6605         dflt="$libc"
6606         cat <<EOM
6607
6608 If the guess above is wrong (which it might be if you're using a strange
6609 compiler, or your machine supports multiple models), you can override it here.
6610
6611 EOM
6612 else
6613         dflt=''
6614         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6615         cat >&4 <<EOM
6616 I can't seem to find your C library.  I've looked in the following places:
6617
6618 EOM
6619         $sed 's/^/      /' libpath
6620         cat <<EOM
6621
6622 None of these seems to contain your C library. I need to get its name...
6623
6624 EOM
6625 fi
6626 fn=f
6627 rp='Where is your C library?'
6628 . ./getfile
6629 libc="$ans"
6630
6631 echo " "
6632 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6633 set X `cat libnames`
6634 shift
6635 xxx=files
6636 case $# in 1) xxx=file; esac
6637 echo "Extracting names from the following $xxx for later perusal:" >&4
6638 echo " "
6639 $sed 's/^/      /' libnames >&4
6640 echo " "
6641 $echo $n "This may take a while...$c" >&4
6642
6643 for file in $*; do
6644         case $file in
6645         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6646         *) $nm $nm_opt $file 2>/dev/null;;
6647         esac
6648 done >libc.tmp
6649
6650 $echo $n ".$c"
6651 $grep fprintf libc.tmp > libc.ptf
6652 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6653 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6654 xxx='[ADTSIWi]'
6655 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6656         eval $xscan;\
6657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658                 eval $xrun
6659 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6660         eval $xscan;\
6661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662                 eval $xrun
6663 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6664         eval $xscan;\
6665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666                 eval $xrun
6667 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6668         eval $xscan;\
6669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670                 eval $xrun
6671 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6672         eval $xscan;\
6673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674                 eval $xrun
6675 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6676         eval $xscan;\
6677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678                 eval $xrun
6679 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6680                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6681         eval $xscan;\
6682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683                 eval $xrun
6684 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6685         eval $xscan;\
6686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687                 eval $xrun
6688 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6689         eval $xscan;\
6690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691                 eval $xrun
6692 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6693         eval $xscan;\
6694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695                 eval $xrun
6696 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6697         eval $xscan;\
6698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699                 eval $xrun
6700 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6701         eval $xscan;\
6702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703                 eval $xrun
6704 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6705         eval $xscan;\
6706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6707                 eval $xrun
6708 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6709         eval $xscan;\
6710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6711                 eval $xrun
6712 else
6713         $nm -p $* 2>/dev/null >libc.tmp
6714         $grep fprintf libc.tmp > libc.ptf
6715         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6716                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6717         then
6718                 nm_opt='-p'
6719                 eval $xrun
6720         else
6721                 echo " "
6722                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6723                 com=''
6724                 if $ar t $libc > libc.tmp && \
6725                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6726                 then
6727                         for thisname in $libnames $libc; do
6728                                 $ar t $thisname >>libc.tmp
6729                         done
6730                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6731                         echo "Ok." >&4
6732                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6733                         for thisname in $libnames $libc; do
6734                                 $ar tv $thisname >>libc.tmp
6735                                 emximp -o tmp.imp $thisname \
6736                                     2>/dev/null && \
6737                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6738                                     < tmp.imp >>libc.tmp
6739                                 $rm -f tmp.imp
6740                         done
6741                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6742                         echo "Ok." >&4
6743                 else
6744                         echo "$ar didn't seem to work right." >&4
6745                         echo "Maybe this is a Cray...trying bld instead..." >&4
6746                         if  bld t $libc | \
6747                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6748                                 $test -s libc.list
6749                         then
6750                                 for thisname in $libnames; do
6751                                         bld t $libnames | \
6752                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6753                                         $ar t $thisname >>libc.tmp
6754                                 done
6755                                 echo "Ok." >&4
6756                         else
6757                                 echo "That didn't work either.  Giving up." >&4
6758                                 exit 1
6759                         fi
6760                 fi
6761         fi
6762 fi
6763 nm_extract="$com"
6764 case "$PASE" in
6765 define)
6766     echo " "
6767     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6768     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6769     ;;
6770 *)  if $test -f /lib/syscalls.exp; then
6771         echo " "
6772         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6773         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6774                 /lib/syscalls.exp >>libc.list
6775     fi
6776     ;;
6777 esac
6778 ;;
6779 esac
6780 $rm -f libnames libpath
6781
6782 : Check if we are using C++
6783 echo " "
6784 echo "Checking for C++..." >&4
6785 $cat >try.c <<'EOCP'
6786 #include <stdio.h>
6787 int main(void)
6788 {
6789 #ifdef __cplusplus
6790     return 0;
6791 #else
6792     return 1;
6793 #endif
6794 }
6795 EOCP
6796 set try
6797 if eval $compile_ok && $run ./try; then
6798         val="$define"
6799         echo "You are using a C++ compiler."
6800 else
6801         val="$undef"
6802         echo "You are not using a C++ compiler."
6803 fi
6804 $rm_try cplusplus$$
6805 set d_cplusplus
6806 eval $setvar
6807
6808 : is a C symbol defined?
6809 csym='tlook=$1;
6810 case "$3" in
6811 -v) tf=libc.tmp; tdc="";;
6812 -a) tf=libc.tmp; tdc="[]";;
6813 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6814 esac;
6815 case "$d_cplusplus" in
6816     $define)    extern_C="extern \"C\"" ;;
6817     *)          extern_C="extern"       ;;
6818 esac;
6819 tx=yes;
6820 case "$reuseval-$4" in
6821 true-) ;;
6822 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6823 esac;
6824 case "$tx" in
6825 yes)
6826         tval=false;
6827         if $test "$runnm" = true; then
6828                 if $contains $tlook $tf >/dev/null 2>&1; then
6829                         tval=true;
6830                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6831                         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;
6832                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6833                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6834                         $rm_try;
6835                 fi;
6836         else
6837                 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;
6838                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6839                 $rm_try;
6840         fi;
6841         ;;
6842 *)
6843         case "$tval" in
6844         $define) tval=true;;
6845         *) tval=false;;
6846         esac;
6847         ;;
6848 esac;
6849 eval "$2=$tval"'
6850
6851 : define an is-in-libc? function
6852 inlibc='echo " "; td=$define; tu=$undef;
6853 sym=$1; var=$2; eval "was=\$$2";
6854 tx=yes;
6855 case "$reuseval$was" in
6856 true) ;;
6857 true*) tx=no;;
6858 esac;
6859 case "$tx" in
6860 yes)
6861         set $sym tres -f;
6862         eval $csym;
6863         case "$tres" in
6864         true)
6865                 echo "$sym() found." >&4;
6866                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6867         *)
6868                 echo "$sym() NOT found." >&4;
6869                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6870         esac;;
6871 *)
6872         case "$was" in
6873         $define) echo "$sym() found." >&4;;
6874         *) echo "$sym() NOT found." >&4;;
6875         esac;;
6876 esac'
6877
6878 : check for length of double
6879 echo " "
6880 case "$doublesize" in
6881 '')
6882         echo "Checking to see how big your double precision numbers are..." >&4
6883         $cat >try.c <<EOCP
6884 #include <stdio.h>
6885 #$i_stdlib I_STDLIB
6886 #ifdef I_STDLIB
6887 #include <stdlib.h>
6888 #endif
6889 int main()
6890 {
6891     printf("%d\n", (int)sizeof(double));
6892     exit(0);
6893 }
6894 EOCP
6895         set try
6896         if eval $compile_ok; then
6897                 doublesize=`$run ./try`
6898                 echo "Your double is $doublesize bytes long."
6899         else
6900                 dflt='8'
6901                 echo "(I can't seem to compile the test program.  Guessing...)"
6902                 rp="What is the size of a double precision number (in bytes)?"
6903                 . ./myread
6904                 doublesize="$ans"
6905         fi
6906         ;;
6907 esac
6908 $rm_try
6909
6910 : check for long doubles
6911 echo " "
6912 echo "Checking to see if you have long double..." >&4
6913 echo 'int main() { long double x = 7.0; }' > try.c
6914 set try
6915 if eval $compile; then
6916         val="$define"
6917         echo "You have long double."
6918 else
6919         val="$undef"
6920         echo "You do not have long double."
6921 fi
6922 $rm_try
6923 set d_longdbl
6924 eval $setvar
6925
6926 : see if ldexpl exists
6927 set ldexpl d_ldexpl
6928 eval $inlibc
6929
6930 : check for length of long double
6931 case "${d_longdbl}${longdblsize}" in
6932 $define)
6933         echo " "
6934         echo "Checking to see how big your long doubles are..." >&4
6935         $cat >try.c <<'EOCP'
6936 #include <stdio.h>
6937 int main()
6938 {
6939         printf("%d\n", sizeof(long double));
6940 }
6941 EOCP
6942         set try
6943         set try
6944         if eval $compile; then
6945                 longdblsize=`$run ./try`
6946                 echo "Your long doubles are $longdblsize bytes long."
6947         else
6948                 dflt='8'
6949                 echo " "
6950                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6951                 rp="What is the size of a long double (in bytes)?"
6952                 . ./myread
6953                 longdblsize="$ans"
6954         fi
6955         if $test "X$doublesize" = "X$longdblsize"; then
6956                 echo "That isn't any different from an ordinary double."
6957                 echo "I'll keep your setting anyway, but you may see some"
6958                 echo "harmless compilation warnings."
6959         fi
6960         ;;
6961 esac
6962 $rm_try
6963
6964 $echo "Checking the kind of long doubles you have..." >&4
6965 case "$d_longdbl" in
6966 define)
6967 $cat <<EOP >try.c
6968 #$i_stdlib I_STDLIB
6969 #define LONGDBLSIZE $longdblsize
6970 #define DOUBLESIZE $doublesize
6971 #include <float.h>
6972 #ifdef I_STDLIB
6973 #include <stdlib.h>
6974 #endif
6975 #include <stdio.h>
6976 static const long double d = -0.1L;
6977 int main() {
6978   unsigned const char* b = (unsigned const char*)(&d);
6979 #if DOUBLESIZE == LONGDBLSIZE
6980   printf("0\n"); /* if it floats like double */
6981   exit(0);
6982 #endif
6983 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6984   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6985     /* IEEE 754 128-bit little-endian */
6986     printf("1\n");
6987     exit(0);
6988   }
6989   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6990     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6991     printf("2\n");
6992     exit(0);
6993   }
6994 #endif
6995 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6996  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6997  * cannot be trusted. */
6998 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6999   if (b[0] == 0xCD && b[9] == 0xBF) {
7000     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7001      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7002      * Also known as "extended precision". */
7003     printf("3\n");
7004     exit(0);
7005   }
7006   if (b[0] == 0xBF && b[9] == 0xCD) {
7007     /* Is there ever big-endian 80-bit, really?
7008      *
7009      * The Motorola 68881 had another "extended precision" format:
7010      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7011      * for total of 96 bits of bytes.  The zero bits were unused.
7012      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7013      * If it ever becomes relevant, this format should be allocated
7014      * a new doublekind code since it's quite different from the Intel x87.
7015      */
7016     printf("4\n");
7017     exit(0);
7018   }
7019 #endif
7020 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7021   /* software "double double", the 106 is 53+53.
7022    * but irix thinks it is 107. */
7023   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7024     /* double double 128-bit fully little-endian,
7025      * little-endian doubles in little-endian order,
7026      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7027     printf("5\n");
7028     exit(0);
7029   }
7030   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7031     /* double double 128-bit fully big-endian,
7032      * big-endian doubles in big-endian order,
7033      * e.g. PPC/Power and MIPS:
7034      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7035     printf("6\n");
7036     exit(0);
7037   }
7038   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7039     /* double double 128-bit mixed endian.
7040      * little-endian doubles in big-endian order,
7041      * e.g. ppc64el,
7042      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7043     printf("7\n");
7044     exit(0);
7045   }
7046   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7047     /* double double 128-bit mixed endian,
7048      * big-endian doubles in little-endian order,
7049      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7050     printf("8\n");
7051     exit(0);
7052   }
7053 #endif
7054 /* We are largely making this up because it may well be
7055  * that the VAX format H was never made available to C,
7056  * only to Fortran. */
7057 #if LONGDBLSIZE == 16 && defined(__vax__)
7058   if (b[0] == 0xFD && b[15] == 0x99) {
7059     /* VAX format H, PDP-11 mixed endian. */
7060     printf("9\n");
7061     exit(0);
7062   }
7063 #endif
7064   printf("-1\n"); /* unknown */
7065   exit(0);
7066 }
7067 EOP
7068 set try
7069 if eval $compile; then
7070     longdblkind=`$run ./try`
7071 else
7072     longdblkind=-1
7073 fi
7074 ;;
7075 *) longdblkind=0 ;;
7076 esac
7077 case "$longdblkind" in
7078 0) echo "Your long doubles are doubles." >&4 ;;
7079 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7080 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7081 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7082 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7083 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7084 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7085 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7086 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7087 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7088 *) echo "Cannot figure out your long double." >&4 ;;
7089 esac
7090 d_long_double_style_ieee=$undef
7091 d_long_double_style_ieee_std=$undef
7092 d_long_double_style_ieee_extended=$undef
7093 d_long_double_style_ieee_doubledouble=$undef
7094 d_long_double_style_vax=$undef
7095 case "$longdblkind" in
7096 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7097 esac
7098 case "$longdblkind" in
7099 1|2) d_long_double_style_ieee_std=$define ;;
7100 esac
7101 case "$longdblkind" in
7102 3|4) d_long_double_style_ieee_extended=$define ;;
7103 esac
7104 case "$longdblkind" in
7105 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7106 esac
7107 case "$longdblkind" in
7108 9) d_long_double_style_vax=$define ;;
7109 esac
7110 $rm_try
7111
7112 : determine the architecture name
7113 echo " "
7114 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7115         tarch=`arch`"-$osname"
7116 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7117         if uname -m > tmparch 2>&1 ; then
7118                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7119                         -e 's/$/'"-$osname/" tmparch`
7120         else
7121                 tarch="$osname"
7122         fi
7123         $rm -f tmparch
7124 else
7125         tarch="$osname"
7126 fi
7127 case "$myarchname" in
7128 ''|"$tarch") ;;
7129 *)
7130         echo "(Your architecture name used to be $myarchname.)"
7131         archname=''
7132         ;;
7133 esac
7134 case "$targetarch" in
7135 '') ;;
7136 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7137 esac
7138 myarchname="$tarch"
7139 case "$archname" in
7140 '') dflt="$tarch";;
7141 *) dflt="$archname";;
7142 esac
7143 rp='What is your architecture name'
7144 . ./myread
7145 archname="$ans"
7146
7147 : optionally add API version to the architecture for versioned archlibs
7148 case "$useversionedarchname" in
7149 $define|true|[yY]*) dflt='y';;
7150 *)                  dflt='n';;
7151 esac
7152 rp='Add the Perl API version to your archname?'
7153 . ./myread
7154 case "$ans" in
7155 y|Y)    useversionedarchname="$define" ;;
7156 *)      useversionedarchname="$undef" ;;
7157 esac
7158 case "$useversionedarchname" in
7159 $define)
7160         case "$archname" in
7161         *-$api_versionstring)
7162                 echo "...and architecture name already has -$api_versionstring" >&4
7163                 ;;
7164         *)
7165                 archname="$archname-$api_versionstring"
7166                 echo "...setting architecture name to $archname." >&4
7167                 ;;
7168         esac
7169         ;;
7170 esac
7171
7172 case "$usethreads" in
7173 $define)
7174         echo "Threads selected." >&4
7175         case "$archname" in
7176         *-thread*) echo "...and architecture name already has -thread." >&4
7177                 ;;
7178         *)      archname="$archname-thread"
7179                 echo "...setting architecture name to $archname." >&4
7180                 ;;
7181         esac
7182         ;;
7183 esac
7184 case "$usemultiplicity" in
7185 $define)
7186         echo "Multiplicity selected." >&4
7187         case "$archname" in
7188         *-multi*) echo "...and architecture name already has -multi." >&4
7189                 ;;
7190         *)      archname="$archname-multi"
7191                 echo "...setting architecture name to $archname." >&4
7192                 ;;
7193         esac
7194         ;;
7195 esac
7196 case "$use64bitint$use64bitall" in
7197 *"$define"*)
7198         case "$archname64" in
7199         '')
7200                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7201                 ;;
7202         *)
7203                 case "$use64bitint" in
7204                 "$define") echo "64 bit integers selected." >&4 ;;
7205                 esac
7206                 case "$use64bitall" in
7207                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7208                 esac
7209                 case "$archname" in
7210                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7211                         ;;
7212                 *)      archname="$archname-$archname64"
7213                         echo "...setting architecture name to $archname." >&4
7214                         ;;
7215                 esac
7216                 ;;
7217         esac
7218 esac
7219 case "$uselongdouble" in
7220 $define)
7221         echo "Long doubles selected." >&4
7222         case "$longdblsize" in
7223         $doublesize)
7224                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7225                 ;;
7226         *)
7227                 case "$archname" in
7228                 *-ld*) echo "...and architecture name already has -ld." >&4
7229                         ;;
7230                 *)      archname="$archname-ld"
7231                         echo "...setting architecture name to $archname." >&4
7232                         ;;
7233                 esac
7234                 ;;
7235         esac
7236         ;;
7237 esac
7238 case "$usequadmath" in
7239 $define)
7240         echo "quadmath selected." >&4
7241         case "$archname" in
7242         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7243                 ;;
7244         *)      archname="$archname-quadmath"
7245                 echo "...setting architecture name to $archname." >&4
7246                 ;;
7247         esac
7248         ;;
7249 esac
7250 if $test -f archname.cbu; then
7251         echo "Your platform has some specific hints for architecture name, using them..."
7252         . ./archname.cbu
7253 fi
7254
7255 : set the prefixit variable, to compute a suitable default value
7256 prefixit='case "$3" in
7257 ""|none)
7258         case "$oldprefix" in
7259         "") eval "$1=\"\$$2\"";;
7260         *)
7261                 case "$3" in
7262                 "") eval "$1=";;
7263                 none)
7264                         eval "tp=\"\$$2\"";
7265                         case "$tp" in
7266                         ""|" "|none) eval "$1=\"\$$2\"";;
7267                         *) eval "$1=";;
7268                         esac;;
7269                 esac;;
7270         esac;;
7271 *)
7272         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7273         case "$tp" in
7274         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7275         /*-$oldprefix/*|\~*-$oldprefix/*)
7276                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7277         *) eval "$1=\"\$$2\"";;
7278         esac;;
7279 esac'
7280
7281 : determine installation style
7282 : For now, try to deduce it from prefix unless it is already set.
7283 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7284 case "$installstyle" in
7285 '')     case "$prefix" in
7286                 *perl*) dflt='lib';;
7287                 *) dflt='lib/perl5' ;;
7288         esac
7289         ;;
7290 *)      dflt="$installstyle" ;;
7291 esac
7292 : Probably not worth prompting for this since we prompt for all
7293 : the directories individually, and the prompt would be too long and
7294 : confusing anyway.
7295 installstyle=$dflt
7296
7297 : determine where public executables go
7298 echo " "
7299 set dflt bin bin
7300 eval $prefixit
7301 fn=d~
7302 rp='Pathname where the public executables will reside?'
7303 . ./getfile
7304 if $test "X$ansexp" != "X$binexp"; then
7305         installbin=''
7306 fi
7307 prefixvar=bin
7308 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7309 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7310 :     this via initialinstalllocation
7311 . ./setprefixvar
7312
7313 case "$userelocatableinc" in
7314 $define|true|[yY]*)     dflt='y' ;;
7315 *)                      dflt='n' ;;
7316 esac
7317 cat <<EOM
7318
7319 Would you like to build Perl so that the installation is relocatable, so that
7320 library paths in @INC are determined relative to the path of the perl binary?
7321 This is not advised for system Perl installs, or if you need to run setid
7322 scripts or scripts under taint mode.
7323
7324 If this doesn't make any sense to you, just accept the default '$dflt'.
7325 EOM
7326 rp='Use relocatable @INC?'
7327 . ./myread
7328 case "$ans" in
7329 y|Y)    val="$define" ;;
7330 *)      val="$undef"  ;;
7331 esac
7332 set userelocatableinc
7333 eval $setvar
7334
7335 initialinstalllocation="$binexp"
7336 : Default prefix is now "up one level from where the binaries are"
7337 case "$userelocatableinc" in
7338 $define|true|[yY]*)
7339     bin=".../"
7340     binexp=".../"
7341     prefix=".../.."
7342     prefixexp=".../.."
7343     installprefixexp=".../.."
7344     ;;
7345 esac
7346
7347 : determine where private library files go
7348 : Usual default is /usr/local/lib/perl5/$version.
7349 : Also allow things like /opt/perl/lib/$version, since
7350 : /opt/perl/lib/perl5... would be redundant.
7351 : The default "style" setting is made in installstyle.U
7352 case "$installstyle" in
7353 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7354 *)       set dflt privlib lib/$version ;;
7355 esac
7356 eval $prefixit
7357 $cat <<EOM
7358
7359 There are some auxiliary files for $package that need to be put into a
7360 private library directory that is accessible by everyone.
7361
7362 EOM
7363 fn=$binexp
7364 fn=d~+
7365 rp='Pathname where the private library files will reside?'
7366 . ./getfile
7367 prefixvar=privlib
7368 . ./setprefixvar
7369
7370 : set the prefixup variable, to restore leading tilda escape
7371 prefixup='case "$prefixexp" in
7372 "$prefix") ;;
7373 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7374 esac'
7375
7376 : determine where public architecture dependent libraries go
7377 set archlib archlib
7378 eval $prefixit
7379 : privlib default is /usr/local/lib/$package/$version
7380 : archlib default is /usr/local/lib/$package/$version/$archname
7381 : privlib may have an optional trailing /share.
7382 tdflt=`echo $privlib | $sed 's,/share$,,'`
7383 tdflt=$tdflt/$archname
7384 case "$archlib" in
7385 '')     dflt=$tdflt
7386         ;;
7387 *)      dflt="$archlib"
7388     ;;
7389 esac
7390 $cat <<EOM
7391
7392 $spackage contains architecture-dependent library files.  If you are
7393 sharing libraries in a heterogeneous environment, you might store
7394 these files in a separate location.  Otherwise, you can just include
7395 them with the rest of the public library files.
7396
7397 EOM
7398 fn=$binexp
7399 fn=d+~
7400 rp='Where do you want to put the public architecture-dependent libraries?'
7401 . ./getfile
7402 prefixvar=archlib
7403 . ./setprefixvar
7404 if $test X"$archlib" = X"$privlib"; then
7405         d_archlib="$undef"
7406 else
7407         d_archlib="$define"
7408 fi
7409
7410 : see if setuid scripts can be secure
7411 $cat <<EOM
7412
7413 Some kernels have a bug that prevents setuid #! scripts from being
7414 secure.  Some sites have disabled setuid #! scripts because of this.
7415
7416 First let's decide if your kernel supports secure setuid #! scripts.
7417 (If setuid #! scripts would be secure but have been disabled anyway,
7418 don't say that they are secure if asked.)
7419
7420 EOM
7421
7422 val="$undef"
7423 if $test -d /dev/fd; then
7424         echo "#!$ls" >reflect
7425         chmod +x,u+s reflect
7426         ./reflect >flect 2>&1
7427         if $contains "/dev/fd" flect >/dev/null; then
7428                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7429                 val="$define"
7430         else
7431                 $cat <<EOM
7432 If you are not sure if they are secure, I can check but I'll need a
7433 username and password different from the one you are using right now.
7434 If you don't have such a username or don't want me to test, simply
7435 enter 'none'.
7436
7437 EOM
7438                 rp='Other username to test security of setuid scripts with?'
7439                 dflt='none'
7440                 . ./myread
7441                 case "$ans" in
7442                 n|none)
7443                         case "$d_suidsafe" in
7444                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7445                                 dflt=n;;
7446                         "$undef")
7447                                 echo "Well, the $hint value is *not* secure." >&4
7448                                 dflt=n;;
7449                         *)      echo "Well, the $hint value *is* secure." >&4
7450                                 dflt=y;;
7451                         esac
7452                         ;;
7453                 *)
7454                         $rm -f reflect flect
7455                         echo "#!$ls" >reflect
7456                         chmod +x,u+s reflect
7457                         echo >flect
7458                         chmod a+w flect
7459                         echo '"su" will (probably) prompt you for '"$ans's password."
7460                         su $ans -c './reflect >flect'
7461                         if $contains "/dev/fd" flect >/dev/null; then
7462                                 echo "Okay, it looks like setuid scripts are secure." >&4
7463                                 dflt=y
7464                         else
7465                                 echo "I don't think setuid scripts are secure." >&4
7466                                 dflt=n
7467                         fi
7468                         ;;
7469                 esac
7470                 rp='Does your kernel have *secure* setuid scripts?'
7471                 . ./myread
7472                 case "$ans" in
7473                 [yY]*)  val="$define";;
7474                 *)      val="$undef";;
7475                 esac
7476         fi
7477 else
7478         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7479         echo "(That's for file descriptors, not floppy disks.)"
7480         val="$undef"
7481 fi
7482 set d_suidsafe
7483 eval $setvar
7484
7485 $rm -f reflect flect
7486
7487 : now see if they want to do setuid emulation
7488 if $test $patchlevel -lt 11; then
7489 echo " "
7490 val="$undef"
7491 case "$d_suidsafe" in
7492 "$define")
7493         val="$undef"
7494         echo "No need to emulate SUID scripts since they are secure here." >&4
7495         ;;
7496 *)
7497         $cat <<EOM
7498 Some systems have disabled setuid scripts, especially systems where
7499 setuid scripts cannot be secure.  On systems where setuid scripts have
7500 been disabled, the setuid/setgid bits on scripts are currently
7501 useless.  It is possible for $package to detect those bits and emulate
7502 setuid/setgid in a secure fashion.  This emulation will only work if
7503 setuid scripts have been disabled in your kernel.
7504
7505 EOM
7506         case "$d_dosuid" in
7507         "$define") dflt=y ;;
7508         *) dflt=n ;;
7509         esac
7510         rp="Do you want to do setuid/setgid emulation?"
7511         . ./myread
7512         case "$ans" in
7513         [yY]*)  val="$define";;
7514         *)      val="$undef";;
7515         esac
7516         ;;
7517 esac
7518 set d_dosuid
7519 eval $setvar
7520 else
7521     case "$d_dosuid" in
7522         "$define")
7523         cat >&4 <<EOH
7524
7525 SUID emulation has been removed for 5.12
7526 Please re-run Configure without -Dd_dosuid
7527
7528 EOH
7529         exit 1;
7530         ;;
7531     esac
7532     d_dosuid=undef
7533 fi
7534
7535 : Find perl5.005 or later.
7536 echo "Looking for a previously installed perl5.005 or later... "
7537 case "$perl5" in
7538 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7539                 : Check if this perl is recent and can load a simple module
7540                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7541                         perl5=$tdir/perl
7542                         break;
7543                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7544                         perl5=$tdir/perl5
7545                         break;
7546                 fi
7547         done
7548         ;;
7549 *)      perl5="$perl5"
7550         ;;
7551 esac
7552 case "$perl5" in
7553 '')     echo "None found.  That's ok.";;
7554 *)      echo "Using $perl5." ;;
7555 esac
7556
7557 : Set the siteprefix variables
7558 $cat <<EOM
7559
7560 After $package is installed, you may wish to install various
7561 add-on modules and utilities.  Typically, these add-ons will
7562 be installed under $prefix with the rest
7563 of this package.  However, you may wish to install such add-ons
7564 elsewhere under a different prefix.
7565
7566 If you do not wish to put everything under a single prefix, that's
7567 ok.  You will be prompted for the individual locations; this siteprefix
7568 is only used to suggest the defaults.
7569
7570 The default should be fine for most people.
7571
7572 EOM
7573 fn=d~+
7574 rp='Installation prefix to use for add-on modules and utilities?'
7575 : XXX Here might be another good place for an installstyle setting.
7576 case "$siteprefix" in
7577 '') dflt=$prefix ;;
7578 *)  dflt=$siteprefix ;;
7579 esac
7580 . ./getfile
7581 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7582 oldsiteprefix=''
7583 case "$siteprefix" in
7584 '') ;;
7585 *)      case "$ans" in
7586         "$prefix") ;;
7587         *) oldsiteprefix="$prefix";;
7588         esac
7589         ;;
7590 esac
7591 siteprefix="$ans"
7592 siteprefixexp="$ansexp"
7593
7594 : determine where site specific libraries go.
7595 : Usual default is /usr/local/lib/perl5/site_perl/$version
7596 : The default "style" setting is made in installstyle.U
7597 : XXX No longer works with Prefixit stuff.
7598 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7599 case "$sitelib" in
7600 '') case "$installstyle" in
7601         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7602         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7603         esac
7604         ;;
7605 *)      dflt="$sitelib"
7606         ;;
7607 esac
7608 $cat <<EOM
7609
7610 The installation process will create a directory for
7611 site-specific extensions and modules.  Most users find it convenient
7612 to place all site-specific files in this directory rather than in the
7613 main distribution directory.
7614
7615 EOM
7616 fn=d~+
7617 rp='Pathname for the site-specific library files?'
7618 . ./getfile
7619 prefixvar=sitelib
7620 . ./setprefixvar
7621 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7622
7623 : Determine list of previous versions to include in @INC
7624 $cat > getverlist <<EOPL
7625 #!$perl5 -w
7626 use File::Basename;
7627 \$api_versionstring = "$api_versionstring";
7628 \$version = "$version";
7629 \$stem = "$sitelib_stem";
7630 \$archname = "$archname";
7631 EOPL
7632         $cat >> getverlist <<'EOPL'
7633 # The list found is store twice for each entry: the original name, and
7634 # the binary broken down version as pack "sss", so sorting is easy and
7635 # unambiguous. This will work for all versions that have a maximum of
7636 # three digit groups, separate by '.'s or '_'s. Names are extended with
7637 # ".0.0" to ensure at least three elements for the pack.
7638 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7639
7640 # Can't have leading @ because metaconfig interprets it as a command!
7641 ;@inc_version_list=();
7642 # XXX Redo to do opendir/readdir?
7643 if (-d $stem) {
7644     chdir($stem);
7645     ;@candidates = map {
7646         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7647     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7648 }
7649 else {
7650     ;@candidates = ();
7651 }
7652
7653 ($pversion, $aversion, $vsn5005) = map {
7654     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7655 foreach $d (@candidates) {
7656     if ($d->[1] lt $pversion) {
7657         if ($d->[1] ge $aversion) {
7658             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7659         }
7660         elsif ($d->[1] ge $vsn5005) {
7661             unshift(@inc_version_list, grep { -d } $d->[0]);
7662         }
7663     }
7664     else {
7665         # Skip newer version.  I.e. don't look in
7666         # 5.7.0 if we're installing 5.6.1.
7667     }
7668 }
7669
7670 if (@inc_version_list) {
7671     print join(' ', @inc_version_list);
7672 }
7673 else {
7674     # Blank space to preserve value for next Configure run.
7675     print " ";
7676 }
7677 EOPL
7678 chmod +x getverlist
7679 case "$inc_version_list" in
7680 '')     if test -x "$perl5$exe_ext"; then
7681                 dflt=`$perl5 getverlist`
7682         else
7683                 dflt='none'
7684         fi
7685         ;;
7686 $undef) dflt='none' ;;
7687 *)  eval dflt=\"$inc_version_list\" ;;
7688 esac
7689 case "$dflt" in
7690 ''|' ') dflt=none ;;
7691 esac
7692 case "$dflt" in
7693 5.005) dflt=none ;;
7694 esac
7695 $cat <<EOM
7696
7697 In order to ease the process of upgrading, this version of perl
7698 can be configured to use modules built and installed with earlier
7699 versions of perl that were installed under $prefix.  Specify here
7700 the list of earlier versions that this version of perl should check.
7701 If Configure detected no earlier versions of perl installed under
7702 $prefix, then the list will be empty.  Answer 'none' to tell perl
7703 to not search earlier versions.
7704
7705 The default should almost always be sensible, so if you're not sure,
7706 just accept the default.
7707 EOM
7708
7709 rp='List of earlier versions to include in @INC?'
7710 . ./myread
7711 case "$ans" in
7712 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7713 *) inc_version_list="$ans" ;;
7714 esac
7715 case "$inc_version_list" in
7716 ''|' ')
7717         inc_version_list_init='0'
7718         d_inc_version_list="$undef"
7719         ;;
7720 *)      inc_version_list_init=`echo $inc_version_list |
7721                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7722         d_inc_version_list="$define"
7723         ;;
7724 esac
7725 $rm -f getverlist
7726
7727 : see if malloc/malloc.h has to be included
7728 set malloc/malloc.h i_mallocmalloc
7729 eval $inhdr
7730
7731 : see if this is a malloc.h system
7732 : we want a real compile instead of Inhdr because some systems have a
7733 : malloc.h that just gives a compile error saying to use stdlib.h instead
7734 echo " "
7735 $cat >try.c <<EOCP
7736 #include <stdlib.h>
7737 #include <malloc.h>
7738 #$i_mallocmalloc I_MALLOCMALLOC
7739 #ifdef I_MALLOCMALLOC
7740 # include <malloc/malloc.h>
7741 #endif
7742
7743 int main () { return 0; }
7744 EOCP
7745 set try
7746 if eval $compile; then
7747     echo "<malloc.h> found." >&4
7748     val="$define"
7749 else
7750     echo "<malloc.h> NOT found." >&4
7751     val="$undef"
7752 fi
7753 $rm_try
7754 set i_malloc
7755 eval $setvar
7756
7757 : check for length of pointer
7758 echo " "
7759 case "$ptrsize" in
7760 '')
7761         echo "Checking to see how big your pointers are..." >&4
7762         $cat >try.c <<EOCP
7763 #include <stdio.h>
7764 #$i_stdlib I_STDLIB
7765 #ifdef I_STDLIB
7766 #include <stdlib.h>
7767 #endif
7768 int main()
7769 {
7770     printf("%d\n", (int)sizeof(void *));
7771     exit(0);
7772 }
7773 EOCP
7774         set try
7775         if eval $compile_ok; then
7776                 ptrsize=`$run ./try`
7777                 echo "Your pointers are $ptrsize bytes long."
7778         else
7779                 dflt='4'
7780                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7781                 rp="What is the size of a pointer (in bytes)?"
7782                 . ./myread
7783                 ptrsize="$ans"
7784         fi
7785         ;;
7786 esac
7787 $rm_try
7788 case "$use64bitall" in
7789 "$define"|true|[yY]*)
7790         case "$ptrsize" in
7791         4)      cat <<EOM >&4
7792
7793 *** You have chosen a maximally 64-bit build,
7794 *** but your pointers are only 4 bytes wide.
7795 *** Please rerun Configure without -Duse64bitall.
7796 EOM
7797                 case "$d_quad" in
7798                 define)
7799                         cat <<EOM >&4
7800 *** Since you have quads, you could possibly try with -Duse64bitint.
7801 EOM
7802                         ;;
7803                 esac
7804                 cat <<EOM >&4
7805 *** Cannot continue, aborting.
7806
7807 EOM
7808
7809                 exit 1
7810                 ;;
7811         esac
7812         ;;
7813 esac
7814
7815 : determine whether to use malloc wrapping
7816 echo " "
7817 case "$usemallocwrap" in
7818 [yY]*|true|$define)     dflt='y' ;;
7819 [nN]*|false|$undef)     dflt='n' ;;
7820 *)      case "$usedevel" in
7821         [yY]*|true|$define)     dflt='y' ;;
7822         *) dflt='n' ;;
7823         esac
7824         ;;
7825 esac
7826 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7827 . ./myread
7828 usemallocwrap="$ans"
7829 case "$ans" in
7830 y*|true)
7831         usemallocwrap="$define" ;;
7832 *)
7833         usemallocwrap="$undef" ;;
7834 esac
7835
7836 : determine which malloc to compile in
7837 echo " "
7838 case "$usemymalloc" in
7839 [yY]*|true|$define)     dflt='y' ;;
7840 [nN]*|false|$undef)     dflt='n' ;;
7841 *)      case "$ptrsize" in
7842         4) dflt='y' ;;
7843         *) dflt='n' ;;
7844         esac
7845         if test "$useithreads" = "$define"; then dflt='n'; fi
7846         ;;
7847 esac
7848 rp="Do you wish to attempt to use the malloc that comes with $package?"
7849 . ./myread
7850 usemymalloc="$ans"
7851 case "$ans" in
7852 y*|true)
7853         usemymalloc='y'
7854         mallocsrc='malloc.c'
7855         mallocobj="malloc$_o"
7856         d_mymalloc="$define"
7857         case "$libs" in
7858         *-lmalloc*)
7859                 : Remove malloc from list of libraries to use
7860                 echo "Removing unneeded -lmalloc from library list" >&4
7861                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7862                 shift
7863                 libs="$*"
7864                 echo "libs = $libs" >&4
7865                 ;;
7866         esac
7867         ;;
7868 *)
7869         usemymalloc='n'
7870         mallocsrc=''
7871         mallocobj=''
7872         d_mymalloc="$undef"
7873         ;;
7874 esac
7875
7876 : compute the return types of malloc and free
7877 echo " "
7878 $cat >malloc.c <<END
7879 #$i_malloc I_MALLOC
7880 #$i_stdlib I_STDLIB
7881 #include <stdio.h>
7882 #include <sys/types.h>
7883 #ifdef I_MALLOC
7884 #include <malloc.h>
7885 #endif
7886 #ifdef I_STDLIB
7887 #include <stdlib.h>
7888 #endif
7889 #ifdef TRY_MALLOC
7890 void *malloc();
7891 #endif
7892 #ifdef TRY_FREE
7893 void free();
7894 #endif
7895 END
7896 case "$malloctype" in
7897 '')
7898         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7899                 malloctype='void *'
7900         else
7901                 malloctype='char *'
7902         fi
7903         ;;
7904 esac
7905 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7906
7907 case "$freetype" in
7908 '')
7909         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7910                 freetype='void'
7911         else
7912                 freetype='int'
7913         fi
7914         ;;
7915 esac
7916 echo "Your system uses $freetype free(), it would seem." >&4
7917 $rm -f malloc.[co]
7918 : determine where site specific architecture-dependent libraries go.
7919 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7920 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7921 : sitelib may have an optional trailing /share.
7922 case "$sitearch" in
7923 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7924         dflt="$dflt/$archname"
7925         ;;
7926 *)      dflt="$sitearch"
7927         ;;
7928 esac
7929 set sitearch sitearch none
7930 eval $prefixit
7931 $cat <<EOM
7932
7933 The installation process will also create a directory for
7934 architecture-dependent site-specific extensions and modules.
7935
7936 EOM
7937 fn=d~+
7938 rp='Pathname for the site-specific architecture-dependent library files?'
7939 . ./getfile
7940 prefixvar=sitearch
7941 . ./setprefixvar
7942 if $test X"$sitearch" = X"$sitelib"; then
7943         d_sitearch="$undef"
7944 else
7945         d_sitearch="$define"
7946 fi
7947
7948 : Set the vendorprefix variables
7949 $cat <<EOM
7950
7951 The installation process will also create a directory for
7952 vendor-supplied add-ons.  Vendors who supply perl with their system
7953 may find it convenient to place all vendor-supplied files in this
7954 directory rather than in the main distribution directory.  This will
7955 ease upgrades between binary-compatible maintenance versions of perl.
7956
7957 Of course you may also use these directories in whatever way you see
7958 fit.  For example, you might use them to access modules shared over a
7959 company-wide network.
7960
7961 The default answer should be fine for most people.
7962 This causes further questions about vendor add-ons to be skipped
7963 and no vendor-specific directories will be configured for perl.
7964
7965 EOM
7966 rp='Do you want to configure vendor-specific add-on directories?'
7967 case "$usevendorprefix" in
7968 define|true|[yY]*) dflt=y ;;
7969 *)      : User may have set vendorprefix directly on Configure command line.
7970         case "$vendorprefix" in
7971         ''|' ') dflt=n ;;
7972         *)      dflt=y ;;
7973         esac
7974         ;;
7975 esac
7976 . ./myread
7977 case "$ans" in
7978 [yY]*)  fn=d~+
7979         rp='Installation prefix to use for vendor-supplied add-ons?'
7980         case "$vendorprefix" in
7981         '') dflt="$prefix" ;;
7982         *)  dflt=$vendorprefix ;;
7983         esac
7984         . ./getfile
7985         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7986         oldvendorprefix=''
7987         case "$vendorprefix" in
7988         '') ;;
7989         *)      case "$ans" in
7990                 "$prefix") ;;
7991                 *) oldvendorprefix="$prefix";;
7992                 esac
7993                 ;;
7994         esac
7995         usevendorprefix="$define"
7996         vendorprefix="$ans"
7997         vendorprefixexp="$ansexp"
7998         ;;
7999 *)      usevendorprefix="$undef"
8000         vendorprefix=''
8001         vendorprefixexp=''
8002         ;;
8003 esac
8004
8005 : Set the vendorlib variables
8006 case "$vendorprefix" in
8007 '')     d_vendorlib="$undef"
8008         vendorlib=''
8009         vendorlibexp=''
8010         ;;
8011 *)      d_vendorlib="$define"
8012         : determine where vendor-supplied modules go.
8013         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8014         case "$vendorlib" in
8015         '')
8016                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8017                 case "$installstyle" in
8018                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8019                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8020                 esac
8021                 ;;
8022         *)      dflt="$vendorlib"
8023                 ;;
8024         esac
8025         fn=d~+
8026         rp='Pathname for the vendor-supplied library files?'
8027         . ./getfile
8028         vendorlib="$ans"
8029         vendorlibexp="$ansexp"
8030         ;;
8031 esac
8032 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8033 prefixvar=vendorlib
8034 . ./installprefix
8035
8036 : Set the vendorarch variables
8037 case "$vendorprefix" in
8038 '')     d_vendorarch="$undef"
8039         vendorarch=''
8040         vendorarchexp=''
8041         ;;
8042 *)      d_vendorarch="$define"
8043         : determine where vendor-supplied architecture-dependent libraries go.
8044         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8045         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8046         : vendorlib may have an optional trailing /share.
8047         case "$vendorarch" in
8048         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8049                 dflt="$dflt/$archname"
8050                 ;;
8051         *)      dflt="$vendorarch" ;;
8052         esac
8053         fn=d~+
8054         rp='Pathname for vendor-supplied architecture-dependent files?'
8055         . ./getfile
8056         vendorarch="$ans"
8057         vendorarchexp="$ansexp"
8058         ;;
8059 esac
8060 prefixvar=vendorarch
8061 . ./installprefix
8062 if $test X"$vendorarch" = X"$vendorlib"; then
8063         d_vendorarch="$undef"
8064 else
8065         d_vendorarch="$define"
8066 fi
8067
8068 : Final catch-all directories to search
8069 $cat <<EOM
8070
8071 Lastly, you can have perl look in other directories for extensions and
8072 modules in addition to those already specified.
8073 These directories will be searched after
8074         $sitearch
8075         $sitelib
8076 EOM
8077 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8078 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8079 echo ' '
8080 case "$otherlibdirs" in
8081 ''|' ') dflt='none' ;;
8082 *)      dflt="$otherlibdirs" ;;
8083 esac
8084 $cat <<EOM
8085 Enter a colon-separated set of extra paths to include in perl's @INC
8086 search path, or enter 'none' for no extra paths.
8087
8088 EOM
8089
8090 rp='Colon-separated list of additional directories for perl to search?'
8091 . ./myread
8092 case "$ans" in
8093 ' '|''|none)    otherlibdirs=' ' ;;
8094 *)      otherlibdirs="$ans" ;;
8095 esac
8096 case "$otherlibdirs" in
8097 ' ') val=$undef ;;
8098 *)      val=$define ;;
8099 esac
8100 set d_perl_otherlibdirs
8101 eval $setvar
8102
8103 : DTrace support
8104 dflt_dtrace='/usr/sbin/dtrace'
8105 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8106
8107 cat <<EOM
8108
8109 Perl can be built to support DTrace on platforms that support it.
8110 DTrace is a diagnosis and performance analysis tool from Sun.
8111
8112 If this doesn't make any sense to you, just accept the default.
8113 EOM
8114
8115 while $test 1 ; do
8116         case "$usedtrace" in
8117         $define|true|[yY]*)
8118                 dflt='y'
8119                 ;;
8120         $undef|false|[nN]*)
8121                 dflt='n'
8122                 dflt_dtrace=""
8123                 ;;
8124         ?*)
8125                 dflt='y'
8126                 dflt_dtrace=$usedtrace
8127                 ;;
8128         *)
8129                 dflt='n'
8130                 ;;
8131         esac
8132
8133         rp='Support DTrace if available?'
8134         . ./myread
8135         case "$ans" in
8136         y|Y)    val="$define" ;;
8137         *)      val="$undef" ;;
8138         esac
8139         set usedtrace
8140         eval $setvar
8141
8142         test "X$usedtrace" != "X$define" && break
8143
8144         echo " "
8145         rp='Where is the dtrace executable?'
8146         dflt=$dflt_dtrace
8147         . ./getfile
8148         val="$ans"
8149         set dtrace
8150         eval $setvar
8151
8152         if $test -f $dtrace
8153         then
8154                 if $dtrace -h -s ../perldtrace.d \
8155                         -o perldtrace.tmp >/dev/null 2>&1 \
8156                         && rm -f perldtrace.tmp
8157                 then
8158                         echo " "
8159                         echo "Good: your $dtrace knows about the -h flag."
8160                 else
8161                         cat >&2 <<EOM
8162
8163 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8164 ***
8165 *** Your installed dtrace doesn't support the -h switch to compile a D
8166 *** program into a C header. Can't continue.
8167
8168 EOM
8169                         exit 1
8170                 fi
8171                 break;
8172         fi
8173
8174         case "$fastread" in
8175         yes)
8176                 cat >&2 <<EOM
8177
8178 *** $me:  Fatal Error:  $dtrace not found.
8179 *** Can't continue.
8180
8181 EOM
8182                 exit 1
8183                 ;;
8184         *)
8185                 echo "*** $dtrace was not found."
8186                 echo " "
8187                 ;;
8188         esac
8189 done
8190
8191 : See if we want extra modules installed
8192 echo " "
8193 case "$extras" in
8194 '') dflt='n';;
8195 *) dflt='y';;
8196 esac
8197 cat <<EOM
8198 Perl can be built with extra modules or bundles of modules which
8199 will be fetched from the CPAN and installed alongside Perl.
8200
8201 Notice that you will need access to the CPAN; either via the Internet,
8202 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8203 be asked later to configure the CPAN.pm module which will in turn do
8204 the installation of the rest of the extra modules or bundles.)
8205
8206 Notice also that if the modules require any external software such as
8207 libraries and headers (the libz library and the zlib.h header for the
8208 Compress::Zlib module, for example) you MUST have any such software
8209 already installed, this configuration process will NOT install such
8210 things for you.
8211
8212 If this doesn't make any sense to you, just accept the default '$dflt'.
8213 EOM
8214 rp='Install any extra modules (y or n)?'
8215 . ./myread
8216 case "$ans" in
8217 y|Y)
8218         cat <<EOM
8219
8220 Please list any extra modules or bundles to be installed from CPAN,
8221 with spaces between the names.  The names can be in any format the
8222 'install' command of CPAN.pm will understand.  (Answer 'none',
8223 without the quotes, to install no extra modules or bundles.)
8224 EOM
8225         rp='Extras?'
8226         dflt="$extras"
8227         . ./myread
8228         extras="$ans"
8229 esac
8230 case "$extras" in
8231 ''|'none')
8232         val=''
8233         $rm -f ../extras.lst
8234         ;;
8235 *)      echo "(Saving the list of extras for later...)"
8236         echo "$extras" > ../extras.lst
8237         val="'$extras'"
8238         ;;
8239 esac
8240 set extras
8241 eval $setvar
8242 echo " "
8243
8244 : determine where html pages for programs go
8245 set html1dir html1dir none
8246 eval $prefixit
8247 $cat <<EOM
8248
8249 If you wish to install html files for programs in $spackage, indicate
8250 the appropriate directory here.  To skip installing html files,
8251 answer "none".
8252 EOM
8253 case "$html1dir" in
8254 ''|none|$undef|' ') dflt=none ;;
8255 *) dflt=$html1dir ;;
8256 esac
8257 fn=dn+~
8258 rp="Directory for the main $spackage html pages?"
8259 . ./getfile
8260 prefixvar=html1dir
8261 . ./setprefixvar
8262 : Use ' ' for none so value is preserved next time through Configure
8263 $test X"$html1dir" = "X" && html1dir=' '
8264
8265 : determine where html pages for libraries and modules go
8266 set html3dir html3dir none
8267 eval $prefixit
8268 $cat <<EOM
8269
8270 If you wish to install html files for modules associated with $spackage,
8271 indicate the appropriate directory here.  To skip installing html files,
8272 answer "none".
8273 EOM
8274 : There is no obvious default.  If they have specified html1dir, then
8275 : try to key off that, possibly changing .../html1 into .../html3.
8276 case "$html3dir" in
8277 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8278 *) dflt=$html3dir ;;
8279 esac
8280 fn=dn+~
8281 rp="Directory for the $spackage module html pages?"
8282 . ./getfile
8283 prefixvar=html3dir
8284 . ./setprefixvar
8285 : Use ' ' for none so value is preserved next time through Configure
8286 $test X"$html3dir" = "X" && html3dir=' '
8287
8288 : determine whether to install perl also as /usr/bin/perl
8289
8290 echo " "
8291 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8292         $cat <<EOM
8293 Many scripts expect perl to be installed as /usr/bin/perl.
8294
8295 If you want to, I can install the perl you are about to compile
8296 as /usr/bin/perl (in addition to $bin/perl).
8297 EOM
8298         if test -f /usr/bin/perl; then
8299             $cat <<EOM
8300
8301 However, please note that because you already have a /usr/bin/perl,
8302 overwriting that with a new Perl would very probably cause problems.
8303 Therefore I'm assuming you don't want to do that (unless you insist).
8304
8305 EOM
8306             case "$installusrbinperl" in
8307             "$define"|[yY]*)    dflt='y';;
8308             *)                  dflt='n';;
8309             esac
8310         else
8311             $cat <<EOM
8312
8313 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8314
8315 EOM
8316             case "$installusrbinperl" in
8317             "$undef"|[nN]*)     dflt='n';;
8318             *)                  dflt='y';;
8319             esac
8320         fi
8321         rp="Do you want to install perl as /usr/bin/perl?"
8322         . ./myread
8323         case "$ans" in
8324         [yY]*)  val="$define";;
8325         *)      val="$undef" ;;
8326         esac
8327 else
8328         val="$undef"
8329 fi
8330 set installusrbinperl
8331 eval $setvar
8332
8333 : see if dlopen exists
8334 xxx_runnm="$runnm"
8335 xxx_ccflags="$ccflags"
8336 runnm=false
8337 : with g++ one needs -shared to get is-in-libc to work for dlopen
8338 case "$gccversion" in
8339 '')     ;;
8340 *Clang*)        ;;
8341 *)      case "$d_cplusplus" in
8342         "$define") ccflags="$ccflags -shared" ;;
8343         esac
8344         ;;
8345 esac
8346 set dlopen d_dlopen
8347 eval $inlibc
8348 runnm="$xxx_runnm"
8349 ccflags="$xxx_ccflags"
8350
8351 : see if this is a unistd.h system
8352 set unistd.h i_unistd
8353 eval $inhdr
8354
8355 : determine which dynamic loading, if any, to compile in
8356 echo " "
8357 dldir="ext/DynaLoader"
8358 case "$usedl" in
8359     $define|y|true)
8360         dflt='y'
8361         usedl="$define"
8362         ;;
8363     $undef|n|false)
8364         dflt='n'
8365         usedl="$undef"
8366         ;;
8367     *)
8368         dflt='n'
8369         case "$d_dlopen" in
8370             $define) dflt='y' ;;
8371         esac
8372         : Does a dl_xxx.xs file exist for this operating system
8373         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8374         ;;
8375 esac
8376 rp="Do you wish to use dynamic loading?"
8377 . ./myread
8378 usedl="$ans"
8379 bin_ELF="$undef"
8380 case "$ans" in
8381     y*) usedl="$define"
8382         case "$dlsrc" in
8383             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8384                     dflt="$dldir/dl_${osname}.xs"
8385                 elif $test "$d_dlopen" = "$define" ; then
8386                     dflt="$dldir/dl_dlopen.xs"
8387                 else
8388                     dflt=''
8389                 fi
8390                 ;;
8391             *)  dflt="$dldir/$dlsrc"
8392                 ;;
8393         esac
8394         echo "The following dynamic loading files are available:"
8395         : Can not go over to $dldir because getfile has path hard-coded in.
8396         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8397         rp="Source file to use for dynamic loading"
8398         fn="fne"
8399         gfpth="$src"
8400         . ./getfile
8401         usedl="$define"
8402         : emulate basename
8403         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8404
8405         $cat << EOM
8406
8407 Some systems may require passing special flags to $cc -c to
8408 compile modules that will be used to create a shared library.
8409 To use no flags, say "none".
8410
8411 EOM
8412         case "$cccdlflags" in
8413             '') case "$gccversion" in
8414                 '') case "$osname" in
8415                         hpux)   dflt='+z' ;;
8416                         irix*)  dflt='-KPIC' ;;
8417                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8418                         sunos)  dflt='-pic' ;;
8419                         *)      dflt='none' ;;
8420                     esac
8421                     ;;
8422                 *)  case "$osname" in
8423                         darwin) dflt='none' ;;
8424                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8425                         *)      dflt='-fpic' ;;
8426                     esac ;;
8427                 esac ;;
8428             ' ') dflt='none' ;;
8429             *)   dflt="$cccdlflags" ;;
8430         esac
8431
8432         case "$dflt" in
8433             none) dflt='' ;;
8434         esac
8435
8436         # If -Dsysroot was specified, now's the time to add it
8437         # to cccdlflags
8438         if test "X$sysroot" != X; then
8439             case "$gccversion" in
8440                 '') ;;
8441                 *)  case "$dflt" in
8442                         *sysroot*) ;;
8443                         'undef'|*)
8444                             dflt="$dflt --sysroot=$sysroot" ;;
8445                     esac
8446                     ;;
8447             esac
8448         fi
8449
8450         case "$dflt" in
8451             '') dflt='none';;
8452         esac
8453
8454         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8455         . ./myread
8456         case "$ans" in
8457             none) cccdlflags=' ' ;;
8458             *)    cccdlflags="$ans" ;;
8459         esac
8460
8461         cat << EOM
8462
8463 Some systems use ld to create libraries that can be dynamically loaded,
8464 while other systems (such as those using ELF) use $cc.
8465
8466 EOM
8467
8468 : Determine if this is ELF
8469         $cat >try.c <<EOM
8470 /* Test for whether ELF binaries are produced */
8471 #include <fcntl.h>
8472 #$i_stdlib I_STDLIB
8473 #ifdef I_STDLIB
8474 #include <stdlib.h>
8475 #endif
8476 #$i_unistd I_UNISTD
8477 #ifdef I_UNISTD
8478 #include <unistd.h>
8479 #endif
8480 int main() {
8481     char b[4];
8482     int i = open("a.out",O_RDONLY);
8483     if(i == -1)
8484         exit(1); /* fail */
8485     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8486         exit(0); /* succeed (yes, it is ELF) */
8487     exit(1); /* fail */
8488 }
8489 EOM
8490         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8491             bin_ELF="$define"
8492         fi
8493         $rm_try
8494
8495         case "$ld" in
8496             '') if $test $bin_ELF = "$define"; then
8497                     cat <<EOM
8498 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8499 EOM
8500                     dflt="$cc"
8501                 else
8502                     echo "I'll use ld to build dynamic libraries."
8503                     dflt='ld'
8504                 fi
8505                 ;;
8506             *)  dflt="$ld"
8507                 ;;
8508         esac
8509
8510         rp="What command should be used to create dynamic libraries?"
8511         . ./myread
8512         ld="$ans"
8513
8514         cat << EOM
8515
8516 Some systems may require passing special flags to $ld to create a
8517 library that can be dynamically loaded.  If your ld flags include
8518 -L/other/path options to locate libraries outside your loader's normal
8519 search path, you may need to specify those -L options here as well.  To
8520 use no flags, say "none".
8521
8522 EOM
8523         case "$lddlflags" in
8524             '') case "$osname" in
8525                     haiku) dflt='-shared' ;;
8526                     hpux) dflt='-b';
8527                           case "$gccversion" in
8528                               '') dflt="$dflt +vnocompatwarnings" ;;
8529                           esac
8530                           ;;
8531                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8532                     solaris) # See [perl #66604].
8533                             # On Solaris 11, gcc -m64 on amd64
8534                             # appears not to understand -G.  gcc versions at
8535                             # least as old as 3.4.3 support -shared, so just
8536                             # use that with Solaris 11 and later, but keep
8537                             # the old behavior for older Solaris versions.
8538                             case "$gccversion" in
8539                                 '') dflt='-G' ;;
8540                                 *)  case "$osvers" in
8541                                         2.?|2.10) dflt='-G' ;;
8542                                         *) dflt='-shared' ;;
8543                                     esac
8544                                     ;;
8545                             esac
8546                             ;;
8547                     sunos) dflt='-assert nodefinitions' ;;
8548                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8549                     *)     dflt='none' ;;
8550                 esac
8551                 ;;
8552             *) dflt="$lddlflags" ;;
8553         esac
8554
8555         : Only do this for gcc, since, for example, qcc has no concept
8556         : of --sysroot.
8557         if $test "X$sysroot" != X; then
8558             case "$gccversion" in
8559                 '') ;;
8560                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8561             esac
8562         fi
8563
8564         : Try to guess additional flags to pick up local libraries.
8565         : Be careful not to append to a plain 'none'
8566         case "$dflt" in
8567             none) dflt='' ;;
8568         esac
8569         for thisflag in $ldflags; do
8570             case "$thisflag" in
8571                 -L*|-R*|-Wl,-R*)
8572                     case " $dflt " in
8573                         *" $thisflag "*) ;;
8574                         *) dflt="$dflt $thisflag" ;;
8575                     esac
8576                     ;;
8577             esac
8578         done
8579
8580         case "$dflt" in
8581             ''|' ') dflt='none' ;;
8582         esac
8583
8584         case "$ldflags" in
8585             *-fstack-protector-strong*)
8586                 case "$dflt" in
8587                     *-fstack-protector-strong*) ;; # Don't add it again
8588                     *) dflt="$dflt -fstack-protector-strong" ;;
8589                 esac
8590                 ;;
8591             *-fstack-protector*)
8592                 case "$dflt" in
8593                     *-fstack-protector*) ;; # Don't add it again
8594                     *) dflt="$dflt -fstack-protector" ;;
8595                 esac
8596                 ;;
8597         esac
8598
8599         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8600         . ./myread
8601         case "$ans" in
8602             none) lddlflags=' ' ;;
8603             *) lddlflags="$ans" ;;
8604         esac
8605
8606         cat <<EOM
8607
8608 Some systems may require passing special flags to $cc to indicate that
8609 the resulting executable will use dynamic linking.  To use no flags,
8610 say "none".
8611
8612 EOM
8613         case "$ccdlflags" in
8614             '') case "$osname" in
8615                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8616                     sunos)             dflt='none'   ;;
8617                     *)                 dflt='none'   ;;
8618                 esac ;;
8619             ' ') dflt='none' ;;
8620             *)   dflt="$ccdlflags" ;;
8621         esac
8622         rp="Any special flags to pass to $cc to use dynamic linking?"
8623         . ./myread
8624         case "$ans" in
8625             none) ccdlflags=' ' ;;
8626             *)    ccdlflags="$ans" ;;
8627         esac
8628         ;;
8629
8630     *)  usedl="$undef"
8631         ld='ld'
8632         dlsrc='dl_none.xs'
8633         lddlflags=''
8634         ccdlflags=''
8635         ;;
8636 esac
8637
8638 ld_can_script="$undef"
8639 case "$bin_ELF$usedl" in
8640     $define$define)
8641         # Abuse try.h and a.out names for neat cleanup
8642         $cat >try.c <<EOM
8643 void foo() {}
8644 void bar() {}
8645 EOM
8646         $cat >try.h <<EOM
8647 LIBTEST_42 {
8648  global:
8649   foo;
8650  local: *;
8651  };
8652 EOM
8653         if $cc $cccdlflags $ccdlflags $ccflags \
8654                $ldflags $lddlflags -o a.out try.c \
8655                -Wl,--version-script=try.h >/dev/null 2>&1 \
8656            &&  $test -s a.out ; then
8657             echo "ld supports scripting" >&4
8658             ld_can_script="$define"
8659         else
8660             echo "ld does not support scripting" >&4
8661         fi
8662         $rm_try
8663         ;;
8664 esac
8665
8666 : Do we want a shared libperl?
8667 also=''
8668 case "$usedl" in
8669 $undef)
8670         # No dynamic loading being used, so don't bother even to prompt.
8671         useshrplib='false'
8672         ;;
8673 *)      case "$useshrplib" in
8674         '')     case "$osname" in
8675                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8676                         dflt=y
8677                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8678                         ;;
8679                 *)      dflt=n
8680                         ;;
8681                 esac
8682                 ;;
8683         $define|true|[Yy]*)
8684                 dflt=y
8685                 ;;
8686         *)      dflt=n
8687                 ;;
8688         esac
8689         $cat << EOM
8690
8691 The perl executable is normally obtained by linking perlmain.c with
8692 libperl${_a}, any static extensions (usually just DynaLoader), and
8693 any other libraries needed on this system (such as -lm, etc.).  Since
8694 your system supports dynamic loading, it is probably possible to build
8695 a shared libperl.$so.  If you will have more than one executable linked
8696 to libperl.$so, this will significantly reduce the size of each
8697 executable, but it may have a noticeable effect on performance.  The
8698 default is probably sensible for your system.
8699 $also
8700
8701 EOM
8702         rp="Build a shared libperl.$so (y/n)"
8703         . ./myread
8704         case "$ans" in
8705         true|$define|[Yy]*)
8706                 useshrplib='true'  ;;
8707         *)      useshrplib='false' ;;
8708         esac
8709         ;;
8710 esac
8711
8712 case "$useshrplib" in
8713 true)
8714         case "$userelocatableinc" in
8715         true|define)
8716                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8717                 echo "See INSTALL for an explanation why that won't work." >&4
8718                 exit 4
8719                 ;;
8720         esac
8721         case "$libperl" in
8722         '')
8723                 # Figure out a good name for libperl.so.  Since it gets stored in
8724                 # a version-specific architecture-dependent library, the version
8725                 # number isn't really that important, except for making cc/ld happy.
8726                 #
8727                 # A name such as libperl.so.10.1
8728                 majmin="libperl.$so.$patchlevel.$subversion"
8729                 # A name such as libperl.so.100
8730                 majonly=`echo $patchlevel $subversion |
8731                         $awk '{printf "%d%02d", $1, $2}'`
8732                 majonly=libperl.$so.$majonly
8733                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8734                 # rely on figuring it out from the naming of libc.
8735                 case "${osname}${osvers}" in
8736                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8737                         dflt=libperl.$so
8738                         ;;
8739                 cygwin*) # ld links now against the dll directly
8740                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8741                         majonly=`echo $patchlevel $subversion |
8742                                 $awk '{printf "%03d%03d", $1, $2}'`
8743                         majonly=cygperl5.$majonly.$so
8744                         dflt=$majmin
8745                         ;;
8746                 *)      # Try to guess based on whether libc has major.minor.
8747                         case "$libc" in
8748                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8749                         *libc.$so.[0-9]*) dflt=$majonly ;;
8750                         *)      dflt=libperl.$so ;;
8751                         esac
8752                         ;;
8753                 esac
8754                 ;;
8755         *)      dflt=$libperl
8756                 ;;
8757         esac
8758         cat << EOM
8759
8760 I need to select a good name for the shared libperl.  If your system uses
8761 library names with major and minor numbers, then you might want something
8762 like $majmin.  Alternatively, if your system uses a single version
8763 number for shared libraries, then you might want to use $majonly.
8764 Or, your system might be quite happy with a simple libperl.$so.
8765
8766 Since the shared libperl will get installed into a version-specific
8767 architecture-dependent directory, the version number of the shared perl
8768 library probably isn't important, so the default should be o.k.
8769
8770 EOM
8771         rp='What name do you want to give to the shared libperl?'
8772         . ./myread
8773         libperl=$ans
8774         echo "Ok, I'll use $libperl"
8775         ;;
8776 *)
8777         libperl="libperl${_a}"
8778         ;;
8779 esac
8780
8781 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8782 case "$shrpdir" in
8783 '') ;;
8784 *)      $cat >&4 <<EOM
8785 WARNING:  Use of the shrpdir variable for the installation location of
8786 the shared $libperl is not supported.  It was never documented and
8787 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8788 know of any problems this may cause.
8789
8790 EOM
8791         case "$shrpdir" in
8792         "$archlibexp/CORE")
8793                 $cat >&4 <<EOM
8794 But your current setting of $shrpdir is
8795 the default anyway, so it's harmless.
8796 EOM
8797                 ;;
8798         *)
8799                 $cat >&4 <<EOM
8800 Further, your current attempted setting of $shrpdir
8801 conflicts with the value of $archlibexp/CORE
8802 that installperl will use.
8803 EOM
8804                 ;;
8805         esac
8806         ;;
8807 esac
8808
8809 # How will the perl executable find the installed shared $libperl?
8810 # Add $xxx to ccdlflags.
8811 # If we can't figure out a command-line option, use $shrpenv to
8812 # set env LD_RUN_PATH.  The main perl makefile uses this.
8813 shrpdir=$archlibexp/CORE
8814 xxx=''
8815 tmp_shrpenv=''
8816 if "$useshrplib"; then
8817     case "$osname" in
8818         aix)
8819                 # We'll set it in Makefile.SH...
8820                 ;;
8821         solaris)
8822                 xxx="-R $shrpdir"
8823                 ;;
8824         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8825                 xxx="-Wl,-R$shrpdir"
8826                 ;;
8827         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8828                 xxx="-Wl,-rpath,$shrpdir"
8829                 ;;
8830         hpux*)
8831                 # hpux doesn't like the default, either.
8832                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8833                 ;;
8834         cygwin)
8835                 # cygwin needs only ldlibpth
8836                 ;;
8837         *)
8838                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8839                 ;;
8840         esac
8841         case "$xxx" in
8842         '') ;;
8843         *)
8844                 # Only add $xxx if it isn't already in ccdlflags.
8845                 case " $ccdlflags " in
8846                 *" $xxx "*)     ;;
8847                 *)      ccdlflags="$ccdlflags $xxx"
8848                         cat <<EOM >&4
8849
8850 Adding $xxx to the flags
8851 passed to $ld so that the perl executable will find the
8852 installed shared $libperl.
8853
8854 EOM
8855                         ;;
8856                 esac
8857                 ;;
8858         esac
8859 fi
8860 # Fix ccdlflags in AIX for building external extensions.
8861 # (For building Perl itself bare -bE:perl.exp is needed,
8862 #  Makefile.SH takes care of this.)
8863 case "$osname" in
8864 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8865 esac
8866 # Respect a hint or command-line value.
8867 case "$shrpenv" in
8868 '') shrpenv="$tmp_shrpenv" ;;
8869 esac
8870 case "$ldlibpthname" in
8871 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8872 none)   ldlibpthname='' ;;
8873 esac
8874
8875 : determine where manual pages are on this system
8876 echo " "
8877 case "$sysman" in
8878 '')
8879         syspath='/usr/share/man/man1 /usr/man/man1'
8880         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8881         syspath="$syspath /usr/man/u_man/man1"
8882         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8883         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8884         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8885         sysman=`./loc . /usr/man/man1 $syspath`
8886         ;;
8887 esac
8888 if $test -d "$sysman"; then
8889         echo "System manual is in $sysman." >&4
8890 else
8891         echo "Could not find manual pages in source form." >&4
8892 fi
8893
8894 : determine where manual pages go
8895 set man1dir man1dir none
8896 eval $prefixit
8897 $cat <<EOM
8898
8899 $spackage has manual pages available in source form.
8900 EOM
8901 case "$nroff" in
8902 nroff)
8903         echo "However, you don't have nroff, so they're probably useless to you."
8904         case "$man1dir" in
8905         '') man1dir="none";;
8906         esac;;
8907 esac
8908 echo "If you don't want the manual sources installed, answer 'none'."
8909 case "$man1dir" in
8910 ' ') dflt=none
8911         ;;
8912 '')
8913         lookpath="$prefixexp/share/man/man1"
8914         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8915         lookpath="$lookpath $prefixexp/man/p_man/man1"
8916         lookpath="$lookpath $prefixexp/man/u_man/man1"
8917         lookpath="$lookpath $prefixexp/man/man.1"
8918         case "$sysman" in
8919         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8920         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8921         esac
8922         set dflt
8923         eval $prefixup
8924         ;;
8925 *)  dflt="$man1dir"
8926         ;;
8927 esac
8928 echo " "
8929 fn=dn+~
8930 rp="Where do the main $spackage manual pages (source) go?"
8931 . ./getfile
8932 if $test "X$man1direxp" != "X$ansexp"; then
8933         installman1dir=''
8934 fi
8935 prefixvar=man1dir
8936 . ./setprefixvar
8937
8938 case "$man1dir" in
8939 '')     man1dir=' '
8940         installman1dir='';;
8941 esac
8942
8943 : What suffix to use on installed man pages
8944
8945 case "$man1dir" in
8946 ' ')
8947         man1ext='0'
8948         ;;
8949 *)
8950         rp="What suffix should be used for the main $spackage man pages?"
8951         case "$man1ext" in
8952         '')     case "$man1dir" in
8953                 *1)  dflt=1 ;;
8954                 *1p) dflt=1p ;;
8955                 *1pm) dflt=1pm ;;
8956                 *l) dflt=l;;
8957                 *n) dflt=n;;
8958                 *o) dflt=o;;
8959                 *p) dflt=p;;
8960                 *C) dflt=C;;
8961                 *L) dflt=L;;
8962                 *L1) dflt=L1;;
8963                 *) dflt=1;;
8964                 esac
8965                 ;;
8966         *)      dflt="$man1ext";;
8967         esac
8968         . ./myread
8969         man1ext="$ans"
8970         ;;
8971 esac
8972
8973 : see if we can have long filenames
8974 echo " "
8975 first=123456789abcdef
8976 $rm -f $first
8977 if (echo hi >$first) 2>/dev/null; then
8978         if $test -f 123456789abcde; then
8979                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8980                 val="$undef"
8981         else
8982                 echo 'You can have filenames longer than 14 characters.'>&4
8983                 val="$define"
8984         fi
8985 else
8986         $cat <<'EOM'
8987 You can't have filenames longer than 14 chars.
8988 You can't even think about them!
8989 EOM
8990         val="$undef"
8991 fi
8992 set d_flexfnam
8993 eval $setvar
8994 $rm -rf 123456789abcde*
8995
8996 : determine where library module manual pages go
8997 set man3dir man3dir none
8998 eval $prefixit
8999 $cat <<EOM
9000
9001 $spackage has manual pages for many of the library modules.
9002 EOM
9003
9004 case "$nroff" in
9005 nroff)
9006         $cat <<'EOM'
9007 However, you don't have nroff, so they're probably useless to you.
9008 EOM
9009         case "$man3dir" in
9010         '') man3dir="none";;
9011         esac;;
9012 esac
9013
9014 case "$d_flexfnam" in
9015 undef)
9016         $cat <<'EOM'
9017 However, your system can't handle the long file names like File::Basename.3.
9018 EOM
9019         case "$man3dir" in
9020         '') man3dir="none";;
9021         esac;;
9022 esac
9023
9024 echo "If you don't want the manual sources installed, answer 'none'."
9025 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9026 case "$man3dir" in
9027 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9028         if $test -d "$privlib/man/man3"; then
9029                 cat <<EOM >&4
9030
9031 WARNING:  Previous versions of perl installed man3 pages into
9032 $privlib/man/man3.  This version will suggest a
9033 new default of $dflt.
9034 EOM
9035                 tdflt=$dflt
9036                 dflt='n'
9037                 rp='Do you wish to preserve the old behavior?(y/n)'
9038                 . ./myread
9039                 case "$ans" in
9040                 y*) dflt="$privlib/man/man3" ;;
9041                 *)  dflt=$tdflt ;;
9042                 esac
9043     fi
9044         ;;
9045 *)      dflt="$man3dir" ;;
9046 esac
9047 case "$dflt" in
9048 ' ') dflt=none ;;
9049 esac
9050 echo " "
9051 fn=dn+~
9052 rp="Where do the $package library man pages (source) go?"
9053 . ./getfile
9054 prefixvar=man3dir
9055 . ./setprefixvar
9056
9057 case "$man3dir" in
9058 '')     man3dir=' '
9059         installman3dir='';;
9060 esac
9061
9062 : What suffix to use on installed man pages
9063 case "$man3dir" in
9064 ' ')
9065         man3ext='0'
9066         ;;
9067 *)
9068         rp="What suffix should be used for the $package library man pages?"
9069         case "$man3ext" in
9070         '')     case "$man3dir" in
9071                 *3)  dflt=3 ;;
9072                 *3p) dflt=3p ;;
9073                 *3pm) dflt=3pm ;;
9074                 *l) dflt=l;;
9075                 *n) dflt=n;;
9076                 *o) dflt=o;;
9077                 *p) dflt=p;;
9078                 *C) dflt=C;;
9079                 *L) dflt=L;;
9080                 *L3) dflt=L3;;
9081                 *) dflt=3;;
9082                 esac
9083                 ;;
9084         *)      dflt="$man3ext";;
9085         esac
9086         . ./myread
9087         man3ext="$ans"
9088         ;;
9089 esac
9090
9091 : see if we have to deal with yellow pages, now NIS.
9092 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9093         case "$hostcat" in
9094         nidump*) ;;
9095         *)
9096                 case "$hostcat" in
9097                 *ypcat*) dflt=y;;
9098                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9099                                 dflt=y
9100                         else
9101                                 dflt=n
9102                         fi;;
9103                 *) dflt=n;;
9104                 esac
9105                 echo " "
9106                 rp='Are you getting the hosts file via yellow pages?'
9107                 . ./myread
9108                 case "$ans" in
9109                 y*) hostcat='ypcat hosts';;
9110                 *) hostcat='cat /etc/hosts';;
9111                 esac
9112                 ;;
9113         esac
9114 fi
9115 case "$hostcat" in
9116 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9117 esac
9118 case "$groupcat" in
9119 '') test -f /etc/group && groupcat='cat /etc/group';;
9120 esac
9121 case "$passcat" in
9122 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9123 esac
9124
9125 : now get the host name
9126 echo " "
9127 echo "Figuring out host name..." >&4
9128 case "$myhostname" in
9129 '') cont=true
9130         echo 'Maybe "hostname" will work...'
9131         if tans=`sh -c hostname 2>&1` ; then
9132                 myhostname=$tans
9133                 phostname=hostname
9134                 cont=''
9135         fi
9136         ;;
9137 *) cont='';;
9138 esac
9139 if $test "$cont"; then
9140         if ./xenix; then
9141                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9142                 if tans=`cat /etc/systemid 2>&1` ; then
9143                         myhostname=$tans
9144                         phostname='cat /etc/systemid'
9145                         echo "Whadyaknow.  Xenix always was a bit strange..."
9146                         cont=''
9147                 fi
9148         elif $test -r /etc/systemid; then
9149                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9150         fi
9151 fi
9152 if $test "$cont"; then
9153         echo 'No, maybe "uuname -l" will work...'
9154         if tans=`sh -c 'uuname -l' 2>&1` ; then
9155                 myhostname=$tans
9156                 phostname='uuname -l'
9157         else
9158                 echo 'Strange.  Maybe "uname -n" will work...'
9159                 if tans=`sh -c 'uname -n' 2>&1` ; then
9160                         myhostname=$tans
9161                         phostname='uname -n'
9162                 else
9163                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9164                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9165                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9166                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9167                         else
9168                                 case "$myhostname" in
9169                                 '') echo "Does this machine have an identity crisis or something?"
9170                                         phostname='';;
9171                                 *)
9172                                         echo "Well, you said $myhostname before..."
9173                                         phostname='echo $myhostname';;
9174                                 esac
9175                         fi
9176                 fi
9177         fi
9178 fi
9179 case "$myhostname" in
9180 '') myhostname=noname ;;
9181 esac
9182 : you do not want to know about this
9183 set $myhostname
9184 myhostname=$1
9185
9186 : verify guess
9187 if $test "$myhostname" ; then
9188         dflt=y
9189         rp='Your host name appears to be "'$myhostname'".'" Right?"
9190         . ./myread
9191         case "$ans" in
9192         y*) ;;
9193         *) myhostname='';;
9194         esac
9195 fi
9196
9197 : bad guess or no guess
9198 while $test "X$myhostname" = X ; do
9199         dflt=''
9200         rp="Please type the (one word) name of your host:"
9201         . ./myread
9202         myhostname="$ans"
9203 done
9204
9205 : translate upper to lower if necessary
9206 case "$myhostname" in
9207 *[A-Z]*)
9208         echo "(Normalizing case in your host name)"
9209         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9210         ;;
9211 esac
9212
9213 case "$myhostname" in
9214 *.*)
9215         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9216         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9217         echo "(Trimming domain name from host name--host name is now $myhostname)"
9218         ;;
9219 *) case "$mydomain" in
9220         '')
9221                 {
9222                         test "X$hostcat" = "Xypcat hosts" &&
9223                         ypmatch "$myhostname" hosts 2>/dev/null |\
9224                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9225                         $test -s hosts
9226                 } || {
9227                         test "X$hostcat" != "X" &&
9228                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9229                                         /[       ]$myhostname[  . ]/p" > hosts
9230                 }
9231                 tmp_re="[       . ]"
9232                 if $test -f hosts; then
9233                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9234                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9235                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9236                                 hosts | $sort | $uniq | \
9237                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9238                         case `$echo X$dflt` in
9239                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9240                                 dflt=.
9241                                 ;;
9242                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9243                                 ;;
9244                         esac
9245                 else
9246                         echo "(I cannot locate a hosts database anywhere)"
9247                         dflt=.
9248                 fi
9249                 case "$dflt" in
9250                 .)
9251                         tans=`./loc resolv.conf X /etc /usr/etc`
9252                         if $test -f "$tans"; then
9253                                 echo "(Attempting domain name extraction from $tans)"
9254                                 dflt=.`$sed -n -e 's/   / /g' \
9255                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9256                                   -e 1q 2>/dev/null`
9257                                 case "$dflt" in
9258                                 .) dflt=.`$sed -n -e 's/        / /g' \
9259                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9260                                      -e 1q 2>/dev/null`
9261                                         ;;
9262                                 esac
9263                         fi
9264                         ;;
9265                 esac
9266                 case "$dflt" in
9267                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9268                         dflt=.`sh -c domainname 2>/dev/null`
9269                         case "$dflt" in
9270                         '') dflt='.';;
9271                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9272                         esac
9273                         ;;
9274                 esac
9275                 case "$dflt$osname" in
9276                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9277                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9278                         ;;
9279                 esac
9280                 case "$dflt" in
9281                 .) echo "(Lost all hope -- silly guess then)"
9282                         dflt='.nonet'
9283                         ;;
9284                 esac
9285                 $rm -f hosts
9286                 ;;
9287         *) dflt="$mydomain";;
9288         esac;;
9289 esac
9290 echo " "
9291 rp="What is your domain name?"
9292 . ./myread
9293 tans="$ans"
9294 case "$ans" in
9295 '') ;;
9296 .*) ;;
9297 *) tans=".$tans";;
9298 esac
9299 mydomain="$tans"
9300
9301 : translate upper to lower if necessary
9302 case "$mydomain" in
9303 *[A-Z]*)
9304         echo "(Normalizing case in your domain name)"
9305         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9306         ;;
9307 esac
9308
9309 : a little sanity check here
9310 case "$phostname" in
9311 '') ;;
9312 *)
9313         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9314         $myhostname$mydomain|$myhostname) ;;
9315         *)
9316                 case "$phostname" in
9317                 sed*)
9318                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9319                         ;;
9320                 *)
9321                         echo "(That doesn't agree with your $phostname command, by the way.)"
9322                         ;;
9323                 esac
9324         ;;
9325         esac
9326         ;;
9327 esac
9328
9329 : determine the e-mail address of the user who is running us
9330 $cat <<EOM
9331
9332 I need to get your e-mail address in Internet format if possible, i.e.
9333 something like user@host.domain. Please answer accurately since I have
9334 no easy means to double check it. The default value provided below
9335 is most probably close to reality but may not be valid from outside
9336 your organization...
9337
9338 EOM
9339 cont=x
9340 while test "$cont"; do
9341         case "$MAILDOMAIN" in
9342         '')
9343                 if $test -s /etc/mailname; then
9344                         maildomain=`$cat /etc/mailname`
9345                 else
9346                         maildomain="$myhostname$mydomain"
9347                 fi
9348                 ;;
9349         *)  maildomain="$MAILDOMAIN";;
9350         esac
9351         case "$cf_email" in
9352         '') dflt="$cf_by@$maildomain";;
9353         *)  dflt="$cf_email";;
9354         esac
9355         rp='What is your e-mail address?'
9356         . ./myread
9357         cf_email="$ans"
9358         case "$cf_email" in
9359         *@*.*) cont='' ;;
9360         *)
9361                 rp='Address does not look like an Internet one.  Use it anyway?'
9362                 case "$fastread" in
9363                 yes) dflt=y ;;
9364                 *) dflt=n ;;
9365                 esac
9366                 . ./myread
9367                 case "$ans" in
9368                 y*) cont='' ;;
9369                 *) echo " " ;;
9370                 esac
9371                 ;;
9372         esac
9373 done
9374
9375 : Ask e-mail of administrator
9376 $cat <<EOM
9377
9378 If you or somebody else will be maintaining perl at your site, please
9379 fill in the correct e-mail address here so that they may be contacted
9380 if necessary. Currently, the "perlbug" program included with perl
9381 will send mail to this address in addition to perlbug@perl.org. You may
9382 enter "none" for no administrator.
9383
9384 EOM
9385 case "$perladmin" in
9386 '') dflt="$cf_email";;
9387 *) dflt="$perladmin";;
9388 esac
9389 rp='Perl administrator e-mail address'
9390 . ./myread
9391 perladmin="$ans"
9392
9393 : determine whether to use a version number suffix for installed binaries
9394 echo " "
9395 $cat <<EOM
9396 Do you want to use a version number suffix for installed binaries? This
9397 will install 'perl$version' instead of 'perl', and likewise for other
9398 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9399 to be installed side-by-side. Unless you are a developer, you probably
9400 do *not* want to do this.
9401 EOM
9402 case "$versiononly" in
9403 "$define"|[Yy]*|true) dflt='y' ;;
9404 *) dflt='n';
9405 esac
9406 rp="Do you want to use a version number suffix for installed binaries?"
9407 . ./myread
9408 case "$ans" in
9409 [yY]*)  val="$define";;
9410 *)      val="$undef" ;;
9411 esac
9412 set versiononly
9413 eval $setvar
9414
9415 case "$versiononly" in
9416 "$define") inc_version_list=''
9417            inc_version_list_init=0
9418            ;;
9419 esac
9420
9421 : figure out how to guarantee perl startup
9422 : XXX Note that this currently takes advantage of the bug that binexp ignores
9423 :     the Configure -Dinstallprefix setting, which in turn means that under
9424 :     relocatable @INC, initialinstalllocation is what binexp started as.
9425 case "$startperl" in
9426 '')
9427         case "$sharpbang" in
9428         *!)
9429                 $cat <<EOH
9430
9431 I can use the #! construct to start perl on your system. This will
9432 make startup of perl scripts faster, but may cause problems if you
9433 want to share those scripts and perl is not in a standard place
9434 ($initialinstalllocation/perl) on all your platforms. The alternative
9435 is to force a shell by starting the script with a single ':' character.
9436
9437 EOH
9438                 case "$versiononly" in
9439                 "$define")      dflt="$initialinstalllocation/perl$version";;
9440                 *)              dflt="$initialinstalllocation/perl";;
9441                 esac
9442                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9443                 . ./myread
9444                 case "$ans" in
9445                 none)   startperl=": # use perl";;
9446                 *)      startperl="#!$ans"
9447                         if $test 30 -lt `echo "$ans" | wc -c`; then
9448                                 $cat >&4 <<EOM
9449
9450 WARNING:  Some systems limit the #! command to 32 characters.
9451 If you experience difficulty running Perl scripts with #!, try
9452 installing Perl in a directory with a shorter pathname.
9453
9454 EOM
9455                         fi ;;
9456                 esac
9457                 ;;
9458         *) startperl=": # use perl"
9459                 ;;
9460         esac
9461         ;;
9462 esac
9463 echo "I'll use $startperl to start perl scripts."
9464
9465 : figure best path for perl in scripts
9466 case "$perlpath" in
9467 '')
9468         case "$versiononly" in
9469         "$define")      perlpath="$initialinstalllocation/perl$version";;
9470         *)              perlpath="$initialinstalllocation/perl";;
9471         esac
9472         case "$startperl" in
9473         *!*) ;;
9474         *)
9475                 $cat <<EOH
9476
9477 I will use the "eval 'exec'" idiom to start Perl on your system.
9478 I can use the full path of your Perl binary for this purpose, but
9479 doing so may cause problems if you want to share those scripts and
9480 Perl is not always in a standard place ($initialinstalllocation/perl).
9481
9482 EOH
9483                 dflt="$initialinstalllocation/perl"
9484                 rp="What path shall I use in \"eval 'exec'\"?"
9485                 . ./myread
9486                 perlpath="$ans"
9487                 ;;
9488         esac
9489         ;;
9490 esac
9491 case "$startperl" in
9492 *!*)    ;;
9493 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9494 esac
9495
9496 : determine where public executable scripts go
9497 set scriptdir scriptdir
9498 eval $prefixit
9499 case "$scriptdir" in
9500 '')
9501         dflt="$bin"
9502         : guess some guesses
9503         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9504         $test -d /usr/share/bin     && dflt=/usr/share/bin
9505         $test -d /usr/local/script  && dflt=/usr/local/script
9506         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9507         $test -d $prefixexp/script  && dflt=$prefixexp/script
9508         set dflt
9509         eval $prefixup
9510         ;;
9511 *)  dflt="$scriptdir"
9512         ;;
9513 esac
9514 $cat <<EOM
9515
9516 Some installations have a separate directory just for executable scripts so
9517 that they can mount it across multiple architectures but keep the scripts in
9518 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9519 Or you might just lump your scripts in with all your other executables.
9520
9521 EOM
9522 fn=d~
9523 rp='Where do you keep publicly executable scripts?'
9524 . ./getfile
9525 if $test "X$ansexp" != "X$scriptdirexp"; then
9526         installscript=''
9527 fi
9528 installscriptdir=''
9529 prefixvar=scriptdir
9530 . ./setprefixvar
9531 : A little fix up for an irregularly named variable.
9532 installscript="$installscriptdir"
9533
9534 : determine where add-on public executables go
9535 case "$sitebin" in
9536 '')     dflt=$siteprefix/bin ;;
9537 *)      dflt=$sitebin ;;
9538 esac
9539 fn=d~
9540 rp='Pathname where the add-on public executables should be installed?'
9541 . ./getfile
9542 prefixvar=sitebin
9543 . ./setprefixvar
9544
9545 : determine where add-on html pages go
9546 : There is no standard location, so try to copy the previously-selected
9547 : directory structure for the core html pages.
9548 case "$sitehtml1dir" in
9549 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9550 *)     dflt=$sitehtml1dir ;;
9551 esac
9552 case "$dflt" in
9553 ''|' ') dflt=none ;;
9554 esac
9555 fn=dn+~
9556 rp='Pathname where the site-specific html pages should be installed?'
9557 . ./getfile
9558 prefixvar=sitehtml1dir
9559 . ./setprefixvar
9560
9561 : determine where add-on library html pages go
9562 : There is no standard location, so try to copy the previously-selected
9563 : directory structure for the core html pages.
9564 case "$sitehtml3dir" in
9565 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9566 *)     dflt=$sitehtml3dir ;;
9567 esac
9568 case "$dflt" in
9569 ''|' ') dflt=none ;;
9570 esac
9571 fn=dn+~
9572 rp='Pathname where the site-specific library html pages should be installed?'
9573 . ./getfile
9574 prefixvar=sitehtml3dir
9575 . ./setprefixvar
9576
9577 : determine where add-on manual pages go
9578 case "$siteman1dir" in
9579 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9580 *)      dflt=$siteman1dir ;;
9581 esac
9582 case "$dflt" in
9583 ''|' ') dflt=none ;;
9584 esac
9585 fn=dn+~
9586 rp='Pathname where the site-specific manual pages should be installed?'
9587 . ./getfile
9588 prefixvar=siteman1dir
9589 . ./setprefixvar
9590
9591 : determine where add-on library man pages go
9592 case "$siteman3dir" in
9593 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9594 *)      dflt=$siteman3dir ;;
9595 esac
9596 case "$dflt" in
9597 ''|' ') dflt=none ;;
9598 esac
9599 fn=dn+~
9600 rp='Pathname where the site-specific library manual pages should be installed?'
9601 . ./getfile
9602 prefixvar=siteman3dir
9603 . ./setprefixvar
9604
9605 : determine where add-on public executable scripts go
9606 case "$sitescript" in
9607 '')     dflt=$siteprefix/script
9608         $test -d $dflt || dflt=$sitebin ;;
9609 *)  dflt="$sitescript" ;;
9610 esac
9611 fn=d~+
9612 rp='Pathname where add-on public executable scripts should be installed?'
9613 . ./getfile
9614 prefixvar=sitescript
9615 . ./setprefixvar
9616
9617 : see if backtrace exists
9618 set backtrace d_backtrace
9619 eval $inlibc
9620
9621 : Check if C backtrace is actually supported.
9622 case "$usecbacktrace" in
9623   "") usecbacktrace=$undef ;;
9624   [yY]*|true|$define)
9625     case "$d_backtrace" in
9626       [yY]*|true|$define)
9627         ;;
9628       *)
9629         echo "This system does not support backtrace" >&4
9630         usecbacktrace=$undef
9631         ;;
9632       esac
9633     ;;
9634   esac
9635
9636 : Check if faststdio is requested and available
9637 case "$usefaststdio" in
9638 $define|true|[yY]*|'')
9639         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9640         case "$xversion" in
9641         [68])   dflt='y' ;;
9642         *)      dflt='n' ;;
9643         esac
9644         ;;
9645 *) dflt='n';;
9646 esac
9647 cat <<EOM
9648
9649 Perl can be built to use 'fast stdio', which means using the stdio
9650 library but also directly manipulating the stdio buffers to enable
9651 faster I/O.  Using stdio is better for backward compatibility (especially
9652 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9653 interface has been preferred instead of stdio.
9654
9655 If this doesn't make any sense to you, just accept the default '$dflt'.
9656 EOM
9657 rp='Use the "fast stdio" if available?'
9658 . ./myread
9659 case "$ans" in
9660 y|Y)    val="$define" ;;
9661 *)      val="$undef" ;;
9662 esac
9663 set usefaststdio
9664 eval $setvar
9665
9666 : define an is-a-typedef? function
9667 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9668 case "$inclist" in
9669 "") inclist="sys/types.h";;
9670 esac;
9671 eval "varval=\$$var";
9672 case "$varval" in
9673 "")
9674         $rm -f temp.c;
9675         for inc in $inclist; do
9676                 echo "#include <$inc>" >>temp.c;
9677         done;
9678         echo "#ifdef $type" >> temp.c;
9679         echo "printf(\"We have $type\");" >> temp.c;
9680         echo "#endif" >> temp.c;
9681         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9682         if $contains $type temp.E >/dev/null 2>&1; then
9683                 eval "$var=\$type";
9684         else
9685                 eval "$var=\$def";
9686         fi;
9687         $rm -f temp.?;;
9688 *) eval "$var=\$varval";;
9689 esac'
9690
9691 : define an is-a-typedef? function that prompts if the type is not available.
9692 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9693 case "$inclist" in
9694 "") inclist="sys/types.h";;
9695 esac;
9696 eval "varval=\$$var";
9697 case "$varval" in
9698 "")
9699         $rm -f temp.c;
9700         for inc in $inclist; do
9701                 echo "#include <$inc>" >>temp.c;
9702         done;
9703         echo "#ifdef $type" >> temp.c;
9704         echo "printf(\"We have $type\");" >> temp.c;
9705         echo "#endif" >> temp.c;
9706         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9707         echo " " ;
9708         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9709         if $contains $type temp.E >/dev/null 2>&1; then
9710                 echo "$type found." >&4;
9711                 eval "$var=\$type";
9712         else
9713                 echo "$type NOT found." >&4;
9714                 dflt="$def";
9715                 . ./myread ;
9716                 eval "$var=\$ans";
9717         fi;
9718         $rm -f temp.?;;
9719 *) eval "$var=\$varval";;
9720 esac'
9721
9722 : see what type lseek is declared as in the kernel
9723 rp="What is the type used for lseek's offset on this system?"
9724 set off_t lseektype long stdio.h sys/types.h
9725 eval $typedef_ask
9726
9727 echo " "
9728 echo "Checking to see how big your file offsets are..." >&4
9729 $cat >try.c <<EOCP
9730 #include <sys/types.h>
9731 #include <stdio.h>
9732 int main()
9733 {
9734     printf("%d\n", (int)sizeof($lseektype));
9735     return(0);
9736 }
9737 EOCP
9738 set try
9739 if eval $compile_ok; then
9740         lseeksize=`$run ./try`
9741         echo "Your file offsets are $lseeksize bytes long."
9742 else
9743         dflt=$longsize
9744         echo " "
9745         echo "(I can't seem to compile the test program.  Guessing...)"
9746         rp="What is the size of your file offsets (in bytes)?"
9747         . ./myread
9748         lseeksize="$ans"
9749 fi
9750 $rm_try
9751
9752 : see what type file positions are declared as in the library
9753 rp="What is the type for file position used by fsetpos()?"
9754 set fpos_t fpostype long stdio.h sys/types.h
9755 eval $typedef_ask
9756
9757 : Check size for Fpos_t
9758 echo " "
9759 case "$fpostype" in
9760 *_t) zzz="$fpostype"    ;;
9761 *)   zzz="fpos_t"       ;;
9762 esac
9763 echo "Checking the size of $zzz..." >&4
9764 cat > try.c <<EOCP
9765 #include <sys/types.h>
9766 #include <stdio.h>
9767 #$i_stdlib I_STDLIB
9768 #ifdef I_STDLIB
9769 #include <stdlib.h>
9770 #endif
9771 int main() {
9772     printf("%d\n", (int)sizeof($fpostype));
9773     exit(0);
9774 }
9775 EOCP
9776 set try
9777 if eval $compile_ok; then
9778         yyy=`$run ./try`
9779         case "$yyy" in
9780         '')     fpossize=4
9781                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9782                 ;;
9783         *)      fpossize=$yyy
9784                 echo "Your $zzz is $fpossize bytes long."
9785                 ;;
9786         esac
9787 else
9788         dflt="$longsize"
9789         echo " " >&4
9790         echo "(I can't compile the test program.  Guessing...)" >&4
9791         rp="What is the size of your file positions (in bytes)?"
9792         . ./myread
9793         fpossize="$ans"
9794 fi
9795
9796 : Check for large file support
9797 # Backward compatibility (uselfs is deprecated).
9798 case "$uselfs" in
9799 "$define"|true|[yY]*)
9800         cat <<EOM >&4
9801
9802 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9803 EOM
9804         uselargefiles="$define"
9805         ;;
9806 esac
9807
9808 case "$lseeksize:$fpossize" in
9809 8:8) cat <<EOM
9810
9811 You can have files larger than 2 gigabytes.
9812 EOM
9813    val="$define" ;;
9814 *)    case "$uselargefiles" in
9815    "$undef"|false|[nN]*) dflt='n' ;;
9816    *)   dflt='y' ;;
9817    esac
9818    cat <<EOM
9819
9820 Perl can be built to understand large files (files larger than 2 gigabytes)
9821 on some systems.  To do so, Configure can be run with -Duselargefiles.
9822
9823 If this doesn't make any sense to you, just accept the default '$dflt'.
9824 EOM
9825    rp='Try to understand large files, if available?'
9826    . ./myread
9827    case "$ans" in
9828    y|Y) val="$define" ;;
9829    *)   val="$undef"  ;;
9830    esac
9831    ;;
9832 esac
9833 set uselargefiles
9834 eval $setvar
9835 : Look for a hint-file generated 'call-back-unit'.  If the
9836 : user has specified that a large files perl is to be built,
9837 : we may need to set or change some other defaults.
9838 if $test -f uselargefiles.cbu; then
9839         echo "Your platform has some specific hints regarding large file builds, using them..."
9840         . ./uselargefiles.cbu
9841 fi
9842 case "$uselargefiles" in
9843 "$define")
9844         if $test -f uselargefiles.cbu; then
9845                 echo " "
9846                 echo "Rechecking to see how big your file offsets are..." >&4
9847                 $cat >try.c <<EOCP
9848 #include <sys/types.h>
9849 #include <stdio.h>
9850 int main()
9851 {
9852     printf("%d\n", (int)sizeof($lseektype));
9853     return(0);
9854 }
9855 EOCP
9856                 set try
9857                 if eval $compile_ok; then
9858                         lseeksize=`$run ./try`
9859                         $echo "Your file offsets are now $lseeksize bytes long."
9860                 else
9861                         dflt="$lseeksize"
9862                         echo " "
9863                         echo "(I can't seem to compile the test program.  Guessing...)"
9864                         rp="What is the size of your file offsets (in bytes)?"
9865                         . ./myread
9866                         lseeksize="$ans"
9867                 fi
9868                 case "$fpostype" in
9869                 *_t) zzz="$fpostype"    ;;
9870                 *)   zzz="fpos_t"       ;;
9871                 esac
9872                 $echo $n "Rechecking the size of $zzz...$c" >&4
9873                 $cat > try.c <<EOCP
9874 #include <sys/types.h>
9875 #include <stdio.h>
9876 #$i_stdlib I_STDLIB
9877 #ifdef I_STDLIB
9878 #include <stdlib.h>
9879 #endif
9880 int main() {
9881     printf("%d\n", (int)sizeof($fpostype));
9882     return(0);
9883 }
9884 EOCP
9885                 set try
9886                 if eval $compile_ok; then
9887                         yyy=`$run ./try`
9888                         dflt="$lseeksize"
9889                         case "$yyy" in
9890                         '')     echo " "
9891                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9892                                 ;;
9893                         *)      fpossize=$yyy
9894                                 echo " $fpossize bytes." >&4
9895                                 ;;
9896                         esac
9897                 else
9898                         dflt="$fpossize"
9899                         echo " "
9900                         echo "(I can't compile the test program.  Guessing...)" >&4
9901                         rp="What is the size of your file positions (in bytes)?"
9902                         . ./myread
9903                         fpossize="$ans"
9904                 fi
9905                 $rm_try
9906         fi
9907         ;;
9908 esac
9909
9910 : Check if we want perlio
9911 useperlio="$define"
9912
9913 : Set the vendorbin variables
9914 case "$vendorprefix" in
9915 '')     d_vendorbin="$undef"
9916         vendorbin=''
9917         vendorbinexp=''
9918         ;;
9919 *)      d_vendorbin="$define"
9920         : determine where vendor-supplied executables go.
9921         case "$vendorbin" in
9922         '') dflt=$vendorprefix/bin ;;
9923         *)      dflt="$vendorbin" ;;
9924         esac
9925         fn=d~+
9926         rp='Pathname for the vendor-supplied executables directory?'
9927         . ./getfile
9928         vendorbin="$ans"
9929         vendorbinexp="$ansexp"
9930         ;;
9931 esac
9932 prefixvar=vendorbin
9933 . ./installprefix
9934
9935 : Set the vendorhtml1dir variables
9936 case "$vendorprefix" in
9937 '')     vendorhtml1dir=''
9938         vendorhtml1direxp=''
9939         ;;
9940 *)      : determine where vendor-supplied html pages go.
9941         : There is no standard location, so try to copy the previously-selected
9942         : directory structure for the core html pages.
9943         : XXX Better default suggestions would be welcome.
9944         case "$vendorhtml1dir" in
9945         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9946         *)      dflt=$vendorhtml1dir ;;
9947         esac
9948         case "$dflt" in
9949         ''|' ') dflt=none ;;
9950         esac
9951         fn=dn+~
9952         rp='Pathname for the vendor-supplied html pages?'
9953         . ./getfile
9954         vendorhtml1dir="$ans"
9955         vendorhtml1direxp="$ansexp"
9956         ;;
9957 esac
9958 : Use ' ' for none so value is preserved next time through Configure
9959 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9960 prefixvar=vendorhtml1dir
9961 . ./installprefix
9962
9963 : Set the vendorhtml3dir variables
9964 case "$vendorprefix" in
9965 '')     vendorhtml3dir=''
9966         vendorhtml3direxp=''
9967         ;;
9968 *)      : determine where vendor-supplied module html pages go.
9969         : There is no standard location, so try to copy the previously-selected
9970         : directory structure for the core html pages.
9971         : XXX Better default suggestions would be welcome.
9972         case "$vendorhtml3dir" in
9973         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9974         *)      dflt=$vendorhtml3dir ;;
9975         esac
9976         case "$dflt" in
9977         ''|' ') dflt=none ;;
9978         esac
9979         fn=dn+~
9980         rp='Pathname for the vendor-supplied html pages?'
9981         . ./getfile
9982         vendorhtml3dir="$ans"
9983         vendorhtml3direxp="$ansexp"
9984         ;;
9985 esac
9986 : Use ' ' for none so value is preserved next time through Configure
9987 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9988 prefixvar=vendorhtml3dir
9989 . ./installprefix
9990
9991 : Set the vendorman1dir variables
9992 case "$vendorprefix" in
9993 '')     vendorman1dir=''
9994         vendorman1direxp=''
9995         ;;
9996 *)      : determine where vendor-supplied manual pages go.
9997         case "$vendorman1dir" in
9998         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9999         *)      dflt=$vendorman1dir ;;
10000         esac
10001         case "$dflt" in
10002         ''|' ') dflt=none ;;
10003         esac
10004         fn=nd~+
10005         rp='Pathname for the vendor-supplied manual section 1 pages?'
10006         . ./getfile
10007         vendorman1dir="$ans"
10008         vendorman1direxp="$ansexp"
10009         ;;
10010 esac
10011 : Use ' ' for none so value is preserved next time through Configure
10012 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10013 prefixvar=vendorman1dir
10014 . ./installprefix
10015
10016 : Set the vendorman3dir variables
10017 case "$vendorprefix" in
10018 '')     vendorman3dir=''
10019         vendorman3direxp=''
10020         ;;
10021 *)      : determine where vendor-supplied module manual pages go.
10022         case "$vendorman3dir" in
10023         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10024         *)      dflt=$vendorman3dir ;;
10025         esac
10026         case "$dflt" in
10027         ''|' ') dflt=none ;;
10028         esac
10029         fn=nd~+
10030         rp='Pathname for the vendor-supplied manual section 3 pages?'
10031         . ./getfile
10032         vendorman3dir="$ans"
10033         vendorman3direxp="$ansexp"
10034         ;;
10035 esac
10036 : Use ' ' for none so value is preserved next time through Configure
10037 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10038 prefixvar=vendorman3dir
10039 . ./installprefix
10040
10041 : Set the vendorscript variables
10042 case "$vendorprefix" in
10043 '')     d_vendorscript="$undef"
10044         vendorscript=''
10045         vendorscriptexp=''
10046         ;;
10047 *)      d_vendorscript="$define"
10048         : determine where vendor-supplied scripts go.
10049         case "$vendorscript" in
10050         '')     dflt=$vendorprefix/script
10051                 $test -d $dflt || dflt=$vendorbin ;;
10052         *)  dflt="$vendorscript" ;;
10053         esac
10054         $cat <<EOM
10055
10056 The installation process will create a directory for
10057 vendor-supplied scripts.
10058
10059 EOM
10060         fn=d~+
10061         rp='Pathname for the vendor-supplied scripts directory?'
10062         . ./getfile
10063         vendorscript="$ans"
10064         vendorscriptexp="$ansexp"
10065         ;;
10066 esac
10067 prefixvar=vendorscript
10068 . ./installprefix
10069
10070 : see if qgcvt exists
10071 set qgcvt d_qgcvt
10072 eval $inlibc
10073
10074 : Check what kind of doubles your system has
10075 $echo "Checking the kind of doubles you have..." >&4
10076 $cat >try.c <<EOP
10077 #$i_stdlib I_STDLIB
10078 #define DOUBLESIZE $doublesize
10079 #ifdef I_STDLIB
10080 #include <stdlib.h>
10081 #endif
10082 #include <stdio.h>
10083 static const double d = -0.1;
10084 int main() {
10085   unsigned const char* b = (unsigned const char*)(&d);
10086 #if DOUBLESIZE == 4
10087   if (b[0] == 0xCD && b[3] == 0xBD) {
10088     /* IEEE 754 32-bit little-endian */
10089     printf("1\n");
10090     exit(0);
10091   }
10092   if (b[0] == 0xBD && b[3] == 0xCD) {
10093     /* IEEE 754 32-bit big-endian */
10094     printf("2\n");
10095     exit(0);
10096   }
10097   if (b[0] == 0xCC && b[3] == 0xCC) {
10098     /* VAX format F, 32-bit PDP-style mixed endian. */
10099     printf("9\n");
10100     exit(0);
10101   }
10102   if (b[0] == 0xC0 && b[3] == 0x9A) {
10103     /* IBM single 32-bit */
10104     printf("12\n");
10105     exit(0);
10106   }
10107 #endif
10108 #if DOUBLESIZE == 8
10109   if (b[0] == 0x9A && b[7] == 0xBF) {
10110     /* IEEE 754 64-bit little-endian */
10111     printf("3\n");
10112     exit(0);
10113   }
10114   if (b[0] == 0xBF && b[7] == 0x9A) {
10115     /* IEEE 754 64-bit big-endian */
10116     printf("4\n");
10117     exit(0);
10118   }
10119   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10120    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10121     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10122     * 99 99 b9 bf 9a 99 99 99 */
10123     printf("7\n");
10124     exit(0);
10125   }
10126   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10127    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10128     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10129     * 99 99 99 9a bf b9 99 99 */
10130     printf("8\n");
10131     exit(0);
10132   }
10133   if (b[0] == 0xCC && b[7] == 0xCC) {
10134    /* VAX format D, 64-bit PDP-style mixed endian. */
10135     printf("10\n");
10136     exit(0);
10137   }
10138   if (b[0] == 0xD9 && b[7] == 0x99) {
10139    /* VAX format G, 64-bit PDP-style mixed endian. */
10140     printf("11\n");
10141     exit(0);
10142   }
10143   if (b[0] == 0xC0 && b[7] == 0x9A) {
10144     /* IBM double 64-bit */
10145     printf("13\n");
10146     exit(0);
10147   }
10148   if (b[0] == 0xBF && b[7] == 0xCD) {
10149     /* CRAY single 64-bit */
10150     printf("14\n");
10151     exit(0);
10152   }
10153 #endif
10154 #if DOUBLESIZE == 16
10155   if (b[0] == 0x9A && b[15] == 0xBF) {
10156     /* IEEE 754 128-bit little-endian */
10157     printf("5\n");
10158     exit(0);
10159   }
10160   if (b[0] == 0xBF && b[15] == 0x9A) {
10161     /* IEEE 754 128-bit big-endian */
10162     printf("6\n");
10163     exit(0);
10164   }
10165 #endif
10166   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10167    * Whether those environments can still build Perl is debatable. */
10168   printf("-1\n"); /* unknown */
10169   exit(0);
10170 }
10171 EOP
10172 set try
10173 if eval $compile; then
10174     doublekind=`$run ./try`
10175 else
10176     doublekind=-1
10177 fi
10178 case "$doublekind" in
10179 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10180 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10181 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10182 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10183 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10184 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10185 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10186 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10187 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10188 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10189 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10190 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10191 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10192 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10193 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10194 esac
10195 d_double_style_ieee=$undef
10196 d_double_style_vax=$undef
10197 d_double_style_ibm=$undef
10198 d_double_style_cray=$undef
10199 case "$doublekind" in
10200 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10201 9|10|11) d_double_style_vax=$define ;;
10202 12|13) d_double_style_ibm=$define ;;
10203 14) d_double_style_cray=$define ;;
10204 esac
10205 case "$d_double_style_ieee" in
10206 $define)
10207     d_double_has_inf=$define
10208     d_double_has_nan=$define
10209     d_double_has_negative_zero=$define
10210     d_double_has_subnormals=$define
10211     ;;
10212 *)
10213     d_double_has_inf=$undef
10214     d_double_has_nan=$undef
10215     d_double_has_negative_zero=$undef
10216     d_double_has_subnormals=$undef
10217     ;;
10218 esac
10219 $rm_try
10220
10221 : Check print/scan long double stuff
10222 echo " "
10223
10224 if $test X"$d_longdbl" = X"$define"; then
10225
10226 echo "Checking how to print long doubles..." >&4
10227
10228 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10229         $cat >try.c <<'EOCP'
10230 #include <sys/types.h>
10231 #include <stdio.h>
10232 int main() {
10233   double d = 123.456;
10234   printf("%.3f\n", d);
10235 }
10236 EOCP
10237         set try
10238         if eval $compile; then
10239                 yyy=`$run ./try`
10240                 case "$yyy" in
10241                 123.456)
10242                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10243                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10244                         echo "We will use %f."
10245                         ;;
10246                 esac
10247         fi
10248 fi
10249
10250 if $test X"$sPRIfldbl" = X; then
10251         $cat >try.c <<'EOCP'
10252 #include <sys/types.h>
10253 #include <stdio.h>
10254 int main() {
10255   long double d = 123.456;
10256   printf("%.3Lf\n", d);
10257 }
10258 EOCP
10259         set try
10260         if eval $compile; then
10261                 yyy=`$run ./try`
10262                 case "$yyy" in
10263                 123.456)
10264                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10265                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10266                         echo "We will use %Lf."
10267                         ;;
10268                 esac
10269         fi
10270 fi
10271
10272 if $test X"$sPRIfldbl" = X; then
10273         $cat >try.c <<'EOCP'
10274 #include <sys/types.h>
10275 #include <stdio.h>
10276 int main() {
10277   long double d = 123.456;
10278   printf("%.3llf\n", d);
10279 }
10280 EOCP
10281         set try
10282         if eval $compile; then
10283                 yyy=`$run ./try`
10284                 case "$yyy" in
10285                 123.456)
10286                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10287                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10288                         echo "We will use %llf."
10289                         ;;
10290                 esac
10291         fi
10292 fi
10293
10294 if $test X"$sPRIfldbl" = X; then
10295         $cat >try.c <<'EOCP'
10296 #include <sys/types.h>
10297 #include <stdio.h>
10298 int main() {
10299   long double d = 123.456;
10300   printf("%.3lf\n", d);
10301 }
10302 EOCP
10303         set try
10304         if eval $compile; then
10305                 yyy=`$run ./try`
10306                 case "$yyy" in
10307                 123.456)
10308                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10309                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10310                         echo "We will use %lf."
10311                         ;;
10312                 esac
10313         fi
10314 fi
10315
10316 if $test X"$sPRIfldbl" = X; then
10317         echo "Cannot figure out how to print long doubles." >&4
10318 else
10319         sSCNfldbl=$sPRIfldbl    # expect consistency
10320 fi
10321
10322 $rm_try
10323
10324 fi # d_longdbl
10325
10326 case "$sPRIfldbl" in
10327 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10328         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10329         d_SCNfldbl="$undef";
10330         ;;
10331 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10332         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10333         d_SCNfldbl="$define";
10334         ;;
10335 esac
10336
10337 : Before committing on uselongdouble, see whether that looks sane.
10338 if $test "$uselongdouble" = "$define"; then
10339     message=""
10340     echo " "
10341     echo "Checking if your long double math functions work right..." >&4
10342     $cat > try.c <<EOF
10343 #include <math.h>
10344 #include <stdio.h>
10345 int main() {
10346   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10347 }
10348 EOF
10349     case "$osname:$gccversion" in
10350     aix:)       saveccflags="$ccflags"
10351                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10352     esac
10353     set try
10354     if eval $compile_ok; then
10355       yyy=`$run ./try`
10356     fi
10357     case "$yyy" in
10358     3) echo "Your long double math functions are working correctly." >&4 ;;
10359     *) echo "Your long double math functions are broken, not using long doubles." >&4
10360        uselongdouble=$undef
10361        ;;
10362     esac
10363     $rm_try
10364     case "$osname:$gccversion" in
10365     aix:)       ccflags="$saveccflags" ;; # restore
10366     esac
10367 fi
10368
10369 : Check how to convert floats to strings.
10370
10371 if test "X$d_Gconvert" = X; then
10372
10373 echo " "
10374 echo "Checking for an efficient way to convert floats to strings."
10375 echo " " > try.c
10376 case "$uselongdouble" in
10377 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10378 esac
10379 case "$d_longdbl" in
10380 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10381 esac
10382 case "$d_PRIgldbl" in
10383 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10384 esac
10385 $cat >>try.c <<EOP
10386 #ifdef TRY_gconvert
10387 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10388 const char *myname = "gconvert";
10389 #endif
10390 #ifdef TRY_gcvt
10391 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10392 const char *myname = "gcvt";
10393 #endif
10394 #ifdef TRY_qgcvt
10395 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10396 const char *myname = "qgcvt";
10397 #define DOUBLETYPE long double
10398 #endif
10399 #ifdef TRY_sprintf
10400 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10401 #ifdef HAS_PRIgldbl
10402 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10403 #else
10404 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10405 #endif
10406 #else
10407 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10408 #endif
10409 const char *myname = "sprintf";
10410 #endif
10411
10412 #ifndef DOUBLETYPE
10413 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10414 #define DOUBLETYPE long double
10415 #else
10416 #define DOUBLETYPE double
10417 #endif
10418 #endif
10419
10420 #include <stdio.h>
10421
10422 #$i_stdlib I_STDLIB
10423 #ifdef I_STDLIB
10424 #include <stdlib.h>
10425 #endif
10426 #include <string.h>
10427
10428 void checkit(const char *expect, char *got)
10429 {
10430     if (strcmp(expect, got)) {
10431                 printf("%s oddity:  Expected %s, got %s\n",
10432                         myname, expect, got);
10433                 exit(1);
10434         }
10435 }
10436
10437 int main()
10438 {
10439         char buf[64];
10440         buf[63] = '\0';
10441
10442         /* This must be 1st test on (which?) platform */
10443         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10444         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10445         checkit("0.1", buf);
10446
10447         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10448         checkit("0.01", buf);
10449
10450         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10451         checkit("0.001", buf);
10452
10453         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10454         checkit("0.0001", buf);
10455
10456         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10457         if (strlen(buf) > 5)
10458             checkit("9e-005", buf); /* for Microsoft ?? */
10459         else
10460             checkit("9e-05", buf);
10461
10462         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10463         checkit("1", buf);
10464
10465         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10466         checkit("1.1", buf);
10467
10468         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10469         checkit("1.01", buf);
10470
10471         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10472         checkit("1.001", buf);
10473
10474         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10475         checkit("1.0001", buf);
10476
10477         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10478         checkit("1.00001", buf);
10479
10480         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10481         checkit("1.000001", buf);
10482
10483         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10484         checkit("0", buf);
10485
10486         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10487         checkit("-1", buf);
10488
10489         /* Some Linux gcvt's give 1.e+5 here. */
10490         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10491         checkit("100000", buf);
10492
10493         /* Some Linux gcvt's give -1.e+5 here. */
10494         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10495         checkit("-100000", buf);
10496
10497         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10498         checkit("123.456", buf);
10499
10500         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10501         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10502         /* 34 should be enough to scare even long double
10503          * places into using the e notation. */
10504         if (strlen(buf) > 5)
10505             checkit("1e+034", buf); /* for Microsoft */
10506         else
10507             checkit("1e+34", buf);
10508
10509         /* For Perl, if you add additional tests here, also add them to
10510          * t/base/num.t for benefit of platforms not using Configure or
10511          * overriding d_Gconvert */
10512
10513         exit(0);
10514 }
10515 EOP
10516 : first add preferred functions to our list
10517 xxx_list=""
10518 for xxx_convert in $gconvert_preference; do
10519     case $xxx_convert in
10520     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10521     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10522     esac
10523 done
10524 : then add any others
10525 for xxx_convert in gconvert gcvt sprintf; do
10526     case "$xxx_list" in
10527     *$xxx_convert*) ;;
10528     *) xxx_list="$xxx_list $xxx_convert" ;;
10529     esac
10530 done
10531
10532 case "$d_longdbl$uselongdouble" in
10533 "$define$define")
10534     : again, add preferred functions to our list first
10535     xxx_ld_list=""
10536     for xxx_convert in $gconvert_ld_preference; do
10537         case $xxx_convert in
10538         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10539         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10540         esac
10541     done
10542     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10543     for xxx_convert in qgcvt sprintf $xxx_list; do
10544         case "$xxx_ld_list" in
10545         $xxx_convert*|*" $xxx_convert"*) ;;
10546         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10547         esac
10548     done
10549     : if sprintf cannot do long doubles, move it to the end
10550     if test "$d_PRIgldbl" != "$define"; then
10551         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10552     fi
10553     : if no qgcvt, remove it
10554     if test "$d_qgcvt" != "$define"; then
10555         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10556     fi
10557     : use the ld_list
10558     xxx_list="$xxx_ld_list"
10559     ;;
10560 esac
10561
10562 for xxx_convert in $xxx_list; do
10563         echo "Trying $xxx_convert..."
10564         $rm -f try try$_o core
10565         set try -DTRY_$xxx_convert
10566         if eval $compile; then
10567                 echo "$xxx_convert() found." >&4
10568                 if $run ./try; then
10569                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10570                         break;
10571                 else
10572                         echo "...But $xxx_convert didn't work as I expected."
10573                         xxx_convert=''
10574                 fi
10575         else
10576                 echo "$xxx_convert NOT found." >&4
10577                 xxx_convert=''
10578         fi
10579 done
10580
10581 if test X$xxx_convert = X; then
10582     echo "*** WHOA THERE!!! ***" >&4
10583     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10584     xxx_convert=sprintf
10585 fi
10586
10587 case "$xxx_convert" in
10588 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10589 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10590 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10591 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10592    "$define$define$define")
10593       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10594    "$define$define$undef")
10595       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10596    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10597    esac
10598    ;;
10599 esac
10600
10601 fi
10602 $rm_try
10603
10604 : see if _fwalk exists
10605 set fwalk d__fwalk
10606 eval $inlibc
10607
10608 : see if accept4 exists
10609 set accept4 d_accept4
10610 eval $inlibc
10611
10612 : Initialize h_fcntl
10613 h_fcntl=false
10614
10615 : Initialize h_sysfile
10616 h_sysfile=false
10617
10618 : access call always available on UNIX
10619 set access d_access
10620 eval $inlibc
10621
10622 : locate the flags for 'access()'
10623 case "$d_access" in
10624 "$define")
10625         echo " "
10626         $cat >access.c <<EOCP
10627 #include <sys/types.h>
10628 #ifdef I_FCNTL
10629 #include <fcntl.h>
10630 #endif
10631 #ifdef I_SYS_FILE
10632 #include <sys/file.h>
10633 #endif
10634 #ifdef I_UNISTD
10635 #include <unistd.h>
10636 #endif
10637 #$i_stdlib I_STDLIB
10638 #ifdef I_STDLIB
10639 #include <stdlib.h>
10640 #endif
10641 int main() {
10642         exit(R_OK);
10643 }
10644 EOCP
10645         : check sys/file.h first, no particular reason here
10646         if $test `./findhdr sys/file.h` && \
10647                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10648                 h_sysfile=true;
10649                 echo "<sys/file.h> defines the *_OK access constants." >&4
10650         elif $test `./findhdr fcntl.h` && \
10651                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10652                 h_fcntl=true;
10653                 echo "<fcntl.h> defines the *_OK access constants." >&4
10654         elif $test `./findhdr unistd.h` && \
10655                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10656                 echo "<unistd.h> defines the *_OK access constants." >&4
10657         else
10658                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10659         fi
10660         ;;
10661 esac
10662 $rm -f access*
10663
10664 : see if accessx exists
10665 set accessx d_accessx
10666 eval $inlibc
10667
10668 : see if acosh exists
10669 set acosh d_acosh
10670 eval $inlibc
10671
10672 : see if aintl exists
10673 set aintl d_aintl
10674 eval $inlibc
10675
10676 : see if alarm exists
10677 set alarm d_alarm
10678 eval $inlibc
10679
10680 : see if 64bit time functions exists
10681
10682 set ctime64 d_ctime64
10683 eval $inlibc
10684
10685 set localtime64 d_localtime64
10686 eval $inlibc
10687
10688 set gmtime64 d_gmtime64
10689 eval $inlibc
10690
10691 set mktime64 d_mktime64
10692 eval $inlibc
10693
10694 set difftime64 d_difftime64
10695 eval $inlibc
10696
10697 set asctime64 d_asctime64
10698 eval $inlibc
10699
10700 : see if POSIX threads are available
10701 set pthread.h i_pthread
10702 eval $inhdr
10703
10704 : define a function to check prototypes
10705 $cat > protochk <<EOSH
10706 $startsh
10707 cc="$cc"
10708 optimize="$optimize"
10709 ccflags="$ccflags"
10710 define="$define"
10711 rm_try="$rm_try"
10712 usethreads=$usethreads
10713 i_pthread=$i_pthread
10714 pthread_h_first=$pthread_h_first
10715 EOSH
10716
10717 $cat >> protochk <<'EOSH'
10718
10719 $rm_try
10720 foo="$1"
10721 shift
10722 while test $# -ge 2; do
10723         case "$1" in
10724                 $define) echo "#include <$2>" >> try.c ;;
10725                 literal) echo "$2" >> try.c ;;
10726         esac
10727     # Extra magic for the benefit of systems that need pthread.h
10728     # to be included early to correctly detect threadsafe functions.
10729     # Such functions must guarantee themselves, though, that the usethreads
10730     # and i_pthread have been defined, before calling protochk.
10731     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10732         echo "#include <pthread.h>" >> try.c
10733         pthread_h_done=yes
10734     fi
10735     shift 2
10736 done
10737 cat >> try.c <<'EOCP'
10738 #define _(args) args
10739 EOCP
10740 echo "$foo" >> try.c
10741 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10742 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10743 status=$?
10744 $rm_try
10745 exit $status
10746 EOSH
10747 chmod +x protochk
10748 $eunicefix protochk
10749
10750 : Define hasproto macro for Configure internal use
10751 hasproto='varname=$1; func=$2; shift; shift;
10752 while $test $# -ge 2; do
10753         case "$1" in
10754         $define) echo "#include <$2>";;
10755         literal) echo "$2" ;;
10756         esac ;
10757     shift 2;
10758 done > try.c;
10759 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10760 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10761         echo "$func() prototype found.";
10762         val="$define";
10763 else
10764         echo "$func() prototype NOT found.";
10765         val="$undef";
10766 fi;
10767 set $varname;
10768 eval $setvar;
10769 $rm_try tryout.c'
10770
10771 : see if sys/types.h has to be included
10772 set sys/types.h i_systypes
10773 eval $inhdr
10774
10775 : see if sys/select.h has to be included
10776 set sys/select.h i_sysselct
10777 eval $inhdr
10778
10779 : Define hasfield macro for Configure internal use
10780 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10781 while $test $# -ge 2; do
10782         case "$1" in
10783         $define) echo "#include <$2>";;
10784         esac ;
10785     shift 2;
10786 done > try.c;
10787 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10788 set try;
10789 if eval $compile; then
10790         val="$define";
10791 else
10792         val="$undef";
10793 fi;
10794 set $varname;
10795 eval $setvar;
10796 $rm_try'
10797
10798 : see if we should include sys/time.h
10799 echo " "
10800 i_time='define'
10801 if test "X$timeincl" = X; then
10802         echo "Testing to see if we should include <sys/time.h>." >&4
10803         $echo $n "I'm now running the test program...$c"
10804         $cat >try.c <<EOCP
10805 #include <sys/types.h>
10806 #include <time.h>
10807 #ifdef I_SYSTIME
10808 #ifdef SYSTIMEKERNEL
10809 #define KERNEL
10810 #endif
10811 #include <sys/time.h>
10812 #endif
10813 #ifdef I_SYSSELECT
10814 #include <sys/select.h>
10815 #endif
10816 #$i_stdlib I_STDLIB
10817 #ifdef I_STDLIB
10818 #include <stdlib.h>
10819 #endif
10820 int main()
10821 {
10822         struct tm foo;
10823 #ifdef S_TIMEVAL
10824         struct timeval bar;
10825 #endif
10826 #ifdef S_TIMEZONE
10827         struct timezone tzp;
10828 #endif
10829         if (foo.tm_sec == foo.tm_sec)
10830                 exit(0);
10831 #ifdef S_TIMEVAL
10832         if (bar.tv_sec == bar.tv_sec)
10833                 exit(0);
10834 #endif
10835         exit(1);
10836 }
10837 EOCP
10838         flags=''
10839         for s_timezone in '-DS_TIMEZONE' ''; do
10840         sysselect=''
10841         for s_timeval in '-DS_TIMEVAL' ''; do
10842         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10843         for i_systime in '-DI_SYSTIME' ''; do
10844                 case "$flags" in
10845                 '') $echo $n ".$c"
10846                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10847                         if eval $compile; then
10848                                 set X $i_systime $i_systimek $sysselect $s_timeval
10849                                 shift
10850                                 flags="$*"
10851                                 echo " "
10852                                 $echo $n "Succeeded with $flags$c"
10853                         fi
10854                         ;;
10855                 esac
10856         done
10857         done
10858         done
10859         done
10860         timeincl=''
10861         echo " "
10862         case "$flags" in
10863         *SYSTIMEKERNEL*) i_systimek="$define"
10864                 timeincl=`./findhdr sys/time.h`
10865                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10866         *) i_systimek="$undef";;
10867         esac
10868         case "$flags" in
10869         *I_SYSTIME*) i_systime="$define"
10870                 timeincl=`./findhdr sys/time.h`" $timeincl"
10871                 echo "We'll include <sys/time.h>." >&4;;
10872         *) i_systime="$undef";;
10873         esac
10874         $rm_try
10875 fi
10876 : see if struct tm knows about tm_zone
10877 case "$i_systime$i_time" in
10878 *$define*)
10879         echo " "
10880         echo "Checking to see if your struct tm has tm_zone field..." >&4
10881         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10882         eval $hasfield
10883         ;;
10884 *)      val="$undef"
10885         set d_tm_tm_zone
10886         eval $setvar
10887         ;;
10888 esac
10889 case "$d_tm_tm_zone" in
10890 "$define")      echo "Yes, it does."   ;;
10891 *)              echo "No, it doesn't." ;;
10892 esac
10893 : see if struct tm knows about tm_gmtoff
10894 case "$i_systime$i_time" in
10895 *$define*)
10896         echo " "
10897         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10898         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10899         eval $hasfield
10900         ;;
10901 *)      val="$undef"
10902         set d_tm_tm_gmtoff
10903         eval $setvar
10904         ;;
10905 esac
10906 case "$d_tm_tm_gmtoff" in
10907 "$define")      echo "Yes, it does."   ;;
10908 *)              echo "No, it doesn't." ;;
10909 esac
10910
10911 : see if asctime_r exists
10912 set asctime_r d_asctime_r
10913 eval $inlibc
10914 case "$d_asctime_r" in
10915 "$define")
10916         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10917         case "$d_asctime_r_proto:$usethreads" in
10918         ":define")      d_asctime_r_proto=define
10919                 set d_asctime_r_proto asctime_r $hdrs
10920                 eval $hasproto ;;
10921         *)      ;;
10922         esac
10923         case "$d_asctime_r_proto" in
10924         define)
10925         case "$asctime_r_proto" in
10926         ''|0) try='char* asctime_r(const struct tm*, char*);'
10927         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10928         esac
10929         case "$asctime_r_proto" in
10930         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10931         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10932         esac
10933         case "$asctime_r_proto" in
10934         ''|0) try='int asctime_r(const struct tm*, char*);'
10935         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10936         esac
10937         case "$asctime_r_proto" in
10938         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10939         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10940         esac
10941         case "$asctime_r_proto" in
10942         ''|0)   d_asctime_r=undef
10943                 asctime_r_proto=0
10944                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10945         * )     case "$asctime_r_proto" in
10946                 REENTRANT_PROTO*) ;;
10947                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10948                 esac
10949                 echo "Prototype: $try" ;;
10950         esac
10951         ;;
10952         *)      case "$usethreads" in
10953                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10954                 esac
10955                 d_asctime_r=undef
10956                 asctime_r_proto=0
10957                 ;;
10958         esac
10959         ;;
10960 *)      asctime_r_proto=0
10961         ;;
10962 esac
10963
10964 : see if asinh exists
10965 set asinh d_asinh
10966 eval $inlibc
10967
10968 : see if atanh exists
10969 set atanh d_atanh
10970 eval $inlibc
10971
10972 : see if atolf exists
10973 set atolf d_atolf
10974 eval $inlibc
10975
10976 : see if atoll exists
10977 set atoll d_atoll
10978 eval $inlibc
10979
10980 : Look for GCC-style attribute format
10981 case "$d_attribute_format" in
10982 '')
10983 echo " "
10984 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10985 $cat >attrib.c <<'EOCP'
10986 #include <stdio.h>
10987 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10988 EOCP
10989 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10990         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10991                 echo "Your C compiler doesn't support __attribute__((format))."
10992                 val="$undef"
10993         else
10994                 echo "Your C compiler supports __attribute__((format))."
10995                 val="$define"
10996         fi
10997 else
10998         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10999         val="$undef"
11000 fi
11001 ;;
11002 *) val="$d_attribute_format" ;;
11003 esac
11004 set d_attribute_format
11005 eval $setvar
11006 $rm -f attrib*
11007
11008 : Look for GCC-style attribute format with null format allowed
11009 case "$d_printf_format_null" in
11010 '') case "$d_attribute_format" in
11011     $define)
11012         echo " "
11013         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11014 $cat >attrib.c <<EOCP
11015 #include <stdio.h>
11016 #$i_stdlib I_STDLIB
11017 #ifdef I_STDLIB
11018 #include <stdlib.h>
11019 #endif
11020 #$i_inttypes I_INTTYPES
11021 #ifdef I_INTTYPES
11022 #include <inttypes.h>
11023 #endif
11024 #ifndef INTPTR_MAX
11025 #define intptr_t int
11026 #endif
11027 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11028 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11029 int main () { exit(null_printf(NULL)); }
11030 EOCP
11031         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11032             : run the executable in case it produces a run-time warning
11033             if $run ./attrib >>attrib.out 2>&1; then
11034                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11035                     echo "Your C compiler doesn't allow __printf__ format to be null."
11036                     val="$undef"
11037                 else
11038                     echo "Your C compiler allows __printf__ format to be null."
11039                     val="$define"
11040                 fi
11041             else
11042             echo "Your C compiler executable failed with __printf__ format null."
11043             val="$undef"
11044         fi
11045     else
11046         echo "Your C compiler fails with __printf__ format null."
11047         val="$undef"
11048     fi
11049     ;;
11050     *)  val="$undef" ;;
11051     esac
11052 ;;
11053 *)  val="$d_printf_format_null" ;;
11054 esac
11055 set d_printf_format_null
11056 eval $setvar
11057 $rm -f attrib*
11058
11059 : Look for GCC-style attribute malloc
11060 case "$d_attribute_malloc" in
11061 '')
11062 echo " "
11063 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11064 $cat >attrib.c <<'EOCP'
11065 #include <stdio.h>
11066 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11067 EOCP
11068 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11069         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11070                 echo "Your C compiler doesn't support __attribute__((malloc))."
11071                 val="$undef"
11072         else
11073                 echo "Your C compiler supports __attribute__((malloc))."
11074                 val="$define"
11075         fi
11076 else
11077         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11078         val="$undef"
11079 fi
11080 ;;
11081 *) val="$d_attribute_malloc" ;;
11082 esac
11083 set d_attribute_malloc
11084 eval $setvar
11085 $rm -f attrib*
11086
11087 : Look for GCC-style attribute nonnull
11088 case "$d_attribute_nonnull" in
11089 '')
11090 echo " "
11091 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11092 $cat >attrib.c <<'EOCP'
11093 #include <stdio.h>
11094 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11095 EOCP
11096 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11097         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11098                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11099                 val="$undef"
11100         else
11101                 echo "Your C compiler supports __attribute__((nonnull))."
11102                 val="$define"
11103         fi
11104 else
11105         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11106         val="$undef"
11107 fi
11108 ;;
11109 *) val="$d_attribute_nonnull" ;;
11110 esac
11111 set d_attribute_nonnull
11112 eval $setvar
11113 $rm -f attrib*
11114
11115 : Look for GCC-style attribute noreturn
11116 case "$d_attribute_noreturn" in
11117 '')
11118 echo " "
11119 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11120 $cat >attrib.c <<'EOCP'
11121 #include <stdio.h>
11122 void fall_over_dead( void ) __attribute__((noreturn));
11123 EOCP
11124 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11125         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11126                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11127                 val="$undef"
11128         else
11129                 echo "Your C compiler supports __attribute__((noreturn))."
11130                 val="$define"
11131         fi
11132 else
11133         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11134         val="$undef"
11135 fi
11136 ;;
11137 *) val="$d_attribute_noreturn" ;;
11138 esac
11139 set d_attribute_noreturn
11140 eval $setvar
11141 $rm -f attrib*
11142
11143 : Look for GCC-style attribute pure
11144 case "$d_attribute_pure" in
11145 '')
11146 echo " "
11147 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11148 $cat >attrib.c <<'EOCP'
11149 #include <stdio.h>
11150 int square( int n ) __attribute__((pure));
11151 EOCP
11152 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11153         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11154                 echo "Your C compiler doesn't support __attribute__((pure))."
11155                 val="$undef"
11156         else
11157                 echo "Your C compiler supports __attribute__((pure))."
11158                 val="$define"
11159         fi
11160 else
11161         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11162         val="$undef"
11163 fi
11164 ;;
11165 *) val="$d_attribute_pure" ;;
11166 esac
11167 set d_attribute_pure
11168 eval $setvar
11169 $rm -f attrib*
11170
11171 : Look for GCC-style attribute unused
11172 case "$d_attribute_unused" in
11173 '')
11174 echo " "
11175 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11176 $cat >attrib.c <<'EOCP'
11177 #include <stdio.h>
11178 int do_something( int dummy __attribute__((unused)), int n );
11179 EOCP
11180 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11181         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11182                 echo "Your C compiler doesn't support __attribute__((unused))."
11183                 val="$undef"
11184         else
11185                 echo "Your C compiler supports __attribute__((unused))."
11186                 val="$define"
11187         fi
11188 else
11189         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11190         val="$undef"
11191 fi
11192 ;;
11193 *) val="$d_attribute_unused" ;;
11194 esac
11195 set d_attribute_unused
11196 eval $setvar
11197 $rm -f attrib*
11198
11199 : Look for GCC-style attribute deprecated
11200 case "$d_attribute_deprecated" in
11201 '')
11202 echo " "
11203 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11204 $cat >attrib.c <<'EOCP'
11205 #include <stdio.h>
11206 int I_am_deprecated(void) __attribute__((deprecated));
11207 EOCP
11208 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11209         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11210                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11211                 val="$undef"
11212         else
11213                 echo "Your C compiler supports __attribute__((deprecated))."
11214                 val="$define"
11215         fi
11216 else
11217         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11218         val="$undef"
11219 fi
11220 ;;
11221 *) val="$d_attribute_deprecated" ;;
11222 esac
11223 set d_attribute_deprecated
11224 eval $setvar
11225 $rm -f attrib*
11226
11227 : Look for GCC-style attribute warn_unused_result
11228 case "$d_attribute_warn_unused_result" in
11229 '')
11230 echo " "
11231 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11232 $cat >attrib.c <<'EOCP'
11233 #include <stdio.h>
11234 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11235 EOCP
11236 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11237         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11238                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11239                 val="$undef"
11240         else
11241                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11242                 val="$define"
11243         fi
11244 else
11245         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11246         val="$undef"
11247 fi
11248 ;;
11249 *) val="$d_attribute_warn_unused_result" ;;
11250 esac
11251 set d_attribute_warn_unused_result
11252 eval $setvar
11253 $rm -f attrib*
11254
11255 : Look for GCC-style attribute always_inline
11256 case "$d_attribute_always_inline" in
11257 '')
11258 echo " "
11259 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11260 $cat >attrib.c <<'EOCP'
11261 #include <stdio.h>
11262 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11263 EOCP
11264 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11265         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11266                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11267                 val="$undef"
11268         else
11269                 echo "Your C compiler supports __attribute__((always_inline))."
11270                 val="$define"
11271         fi
11272 else
11273         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11274         val="$undef"
11275 fi
11276 ;;
11277 *) val="$d_attribute_always_inline" ;;
11278 esac
11279 set d_attribute_always_inline
11280 eval $setvar
11281 $rm -f attrib*
11282
11283 : see if getpgrp exists
11284 set getpgrp d_getpgrp
11285 eval $inlibc
11286
11287 case "$d_getpgrp" in
11288 "$define")
11289         echo " "
11290         echo "Checking to see which flavor of getpgrp is in use..."
11291         $cat >try.c <<EOP
11292 #include <stdio.h>
11293 #$i_unistd I_UNISTD
11294 #include <sys/types.h>
11295 #ifdef I_UNISTD
11296 #  include <unistd.h>
11297 #endif
11298 #$i_stdlib I_STDLIB
11299 #ifdef I_STDLIB
11300 #include <stdlib.h>
11301 #endif
11302 int main()
11303 {
11304         if (getuid() == 0) {
11305                 printf("(I see you are running Configure as super-user...)\n");
11306                 setuid(1);
11307         }
11308 #ifdef TRY_BSD_PGRP
11309         if (getpgrp(1) == 0)
11310                 exit(0);
11311 #else
11312         if (getpgrp() > 0)
11313                 exit(0);
11314 #endif
11315         exit(1);
11316 }
11317 EOP
11318         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11319                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11320                 val="$define"
11321         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11322                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11323                 val="$undef"
11324         else
11325                 echo "I can't seem to compile and run the test program."
11326                 if ./usg; then
11327                         xxx="a USG one, i.e. you use getpgrp()."
11328                 else
11329                         # SVR4 systems can appear rather BSD-ish.
11330                         case "$i_unistd" in
11331                         $undef)
11332                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11333                                 val="$define"
11334                                 ;;
11335                         $define)
11336                                 xxx="probably a USG one, i.e. you use getpgrp()."
11337                                 val="$undef"
11338                                 ;;
11339                         esac
11340                 fi
11341                 echo "Assuming your getpgrp is $xxx" >&4
11342         fi
11343         ;;
11344 *) val="$undef";;
11345 esac
11346 set d_bsdgetpgrp
11347 eval $setvar
11348 $rm_try
11349
11350 : see if setpgrp exists
11351 set setpgrp d_setpgrp
11352 eval $inlibc
11353
11354 case "$d_setpgrp" in
11355 "$define")
11356         echo " "
11357         echo "Checking to see which flavor of setpgrp is in use..."
11358         $cat >try.c <<EOP
11359 #include <stdio.h>
11360 #$i_unistd I_UNISTD
11361 #include <sys/types.h>
11362 #ifdef I_UNISTD
11363 #  include <unistd.h>
11364 #endif
11365 #$i_stdlib I_STDLIB
11366 #ifdef I_STDLIB
11367 #include <stdlib.h>
11368 #endif
11369 int main()
11370 {
11371         if (getuid() == 0) {
11372                 printf("(I see you are running Configure as super-user...)\n");
11373                 setuid(1);
11374         }
11375 #ifdef TRY_BSD_PGRP
11376         if (-1 == setpgrp(1, 1))
11377                 exit(0);
11378 #else
11379         if (setpgrp() != -1)
11380                 exit(0);
11381 #endif
11382         exit(1);
11383 }
11384 EOP
11385         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11386                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11387                 val="$define"
11388         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11389                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11390                 val="$undef"
11391         else
11392                 echo "(I can't seem to compile and run the test program.)"
11393                 if ./usg; then
11394                         xxx="a USG one, i.e. you use setpgrp()."
11395                 else
11396                         # SVR4 systems can appear rather BSD-ish.
11397                         case "$i_unistd" in
11398                         $undef)
11399                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11400                                 val="$define"
11401                                 ;;
11402                         $define)
11403                                 xxx="probably a USG one, i.e. you use setpgrp()."
11404                                 val="$undef"
11405                                 ;;
11406                         esac
11407                 fi
11408                 echo "Assuming your setpgrp is $xxx" >&4
11409         fi
11410         ;;
11411 *) val="$undef";;
11412 esac
11413 set d_bsdsetpgrp
11414 eval $setvar
11415 $rm_try
11416
11417 : Look for GCC-style __builtin_add_overflow
11418 case "$d_builtin_add_overflow" in
11419 '')
11420     echo " "
11421     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11422     $cat >try.c <<'EOCP'
11423 int main(void) {
11424     const unsigned int uint_max = ~0u;
11425     int target_int = 0;
11426     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11427         return 1;
11428     }
11429     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11430         return 1;
11431     }
11432     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11433         return 1;
11434     }
11435     return 0;
11436 }
11437 EOCP
11438     set try
11439     if eval $compile && $run ./try; then
11440         echo "Your C compiler supports __builtin_add_overflow."
11441         val="$define"
11442     else
11443         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11444         val="$undef"
11445     fi
11446     ;;
11447 *) val="$d_builtin_add_overflow" ;;
11448 esac
11449
11450 set d_builtin_add_overflow
11451 eval $setvar
11452 $rm_try
11453
11454 : Look for GCC-style __builtin_sub_overflow
11455 case "$d_builtin_sub_overflow" in
11456 '')
11457     echo " "
11458     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11459     $cat >try.c <<'EOCP'
11460 int main(void) {
11461     const unsigned int uint_max = ~0u;
11462     int target_int = 0;
11463     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11464         return 1;
11465     }
11466     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11467         return 1;
11468     }
11469     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11470         return 1;
11471     }
11472     return 0;
11473 }
11474 EOCP
11475     set try
11476     if eval $compile && $run ./try; then
11477         echo "Your C compiler supports __builtin_sub_overflow."
11478         val="$define"
11479     else
11480         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11481         val="$undef"
11482     fi
11483     ;;
11484 *) val="$d_builtin_sub_overflow" ;;
11485 esac
11486
11487 set d_builtin_sub_overflow
11488 eval $setvar
11489 $rm_try
11490
11491 : Look for GCC-style __builtin_mul_overflow
11492 case "$d_builtin_mul_overflow" in
11493 '')
11494     echo " "
11495     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11496     $cat >try.c <<'EOCP'
11497 int main(void) {
11498     const unsigned int uint_max = ~0u;
11499     int target_int = 0;
11500     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11501         return 1;
11502     }
11503     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11504         return 1;
11505     }
11506     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11507         return 1;
11508     }
11509     return 0;
11510 }
11511 EOCP
11512     set try
11513     if eval $compile && $run ./try; then
11514         echo "Your C compiler supports __builtin_mul_overflow."
11515         val="$define"
11516     else
11517         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11518         val="$undef"
11519     fi
11520     ;;
11521 *) val="$d_builtin_mul_overflow" ;;
11522 esac
11523
11524 set d_builtin_mul_overflow
11525 eval $setvar
11526 $rm_try
11527
11528 : Look for GCC-style __builtin_choose_expr
11529 case "$d_builtin_choose_expr" in
11530 '')
11531     echo " "
11532     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11533     $cat >try.c <<'EOCP'
11534 #include <assert.h>
11535 #include <stdlib.h>
11536 #include <stdio.h>
11537
11538 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11539
11540 int main(void) {
11541     assert( SYRINX(1) == 2112 );
11542     assert( SYRINX(1) != 5150 );
11543     assert( SYRINX(0) == 5150 );
11544     assert( SYRINX(0) != 2112 );
11545     puts( "All good!" );
11546     exit(0);
11547 }
11548
11549 EOCP
11550     set try
11551     if eval $compile && $run ./try; then
11552         echo "Your C compiler supports __builtin_choose_expr."
11553         val="$define"
11554     else
11555         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11556         val="$undef"
11557     fi
11558 ;;
11559 *) val="$d_builtin_choose_expr" ;;
11560 esac
11561
11562 set d_builtin_choose_expr
11563 eval $setvar
11564 $rm_try
11565
11566 : Look for GCC-style __builtin_expect
11567 case "$d_builtin_expect" in
11568 '')
11569     echo " "
11570     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11571     $cat >try.c <<'EOCP'
11572 int main(void) {
11573     int n = 50;
11574     if ( __builtin_expect(n, 0) ) n = 1;
11575     /* Remember shell exit code truth is 0, C truth is non-zero */
11576     return !(n == 1);
11577 }
11578 EOCP
11579     set try
11580     if eval $compile && $run ./try; then
11581         echo "Your C compiler supports __builtin_expect."
11582         val="$define"
11583     else
11584         echo "Your C compiler doesn't seem to understand __builtin_expect."
11585         val="$undef"
11586     fi
11587     ;;
11588 *) val="$d_builtin_expect" ;;
11589 esac
11590
11591 set d_builtin_expect
11592 eval $setvar
11593 $rm_try
11594
11595 : see if the Compiler supports C99 variadic macros
11596 echo "Checking for C99 variadic macros." >&4
11597 $cat >try.c <<EOCP
11598 #include <stdio.h>
11599 #include <stdarg.h>
11600
11601 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11602
11603 int main() {
11604   char buf[20];
11605   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11606   puts(buf);
11607   return 0;
11608 }
11609 EOCP
11610 set try
11611 if eval $compile && $run ./try 2>&1 >/dev/null; then
11612     case "`$run ./try`" in
11613         "123 456 789")
11614         echo "You have C99 variadic macros." >&4
11615         d_c99_variadic_macros="$define"
11616         ;;
11617         *)
11618         echo "You don't have functional C99 variadic macros." >&4
11619         d_c99_variadic_macros="$undef"
11620         ;;
11621     esac
11622 else
11623     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11624     d_c99_variadic_macros="$undef"
11625 fi
11626 $rm_try
11627
11628 : see if signal is declared as pointer to function returning int or void
11629 echo " "
11630 xxx=`./findhdr signal.h`
11631 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11632 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11633         echo "You have int (*signal())() instead of void." >&4
11634         val="$undef"
11635 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11636         echo "You have void (*signal())()." >&4
11637         val="$define"
11638 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11639         echo "You have int (*signal())() instead of void." >&4
11640         val="$undef"
11641 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11642         echo "You have void (*signal())()." >&4
11643         val="$define"
11644 else
11645         case "$d_voidsig" in
11646         '')
11647         echo "I can't determine whether signal handler returns void or int..." >&4
11648                 dflt=void
11649                 rp="What type does your signal handler return?"
11650                 . ./myread
11651                 case "$ans" in
11652                 v*) val="$define";;
11653                 *) val="$undef";;
11654                 esac;;
11655         "$define")
11656                 echo "As you already told me, signal handler returns void." >&4
11657                 val="$define"
11658                 ;;
11659         *)      echo "As you already told me, signal handler returns int." >&4
11660                 val="$undef"
11661                 ;;
11662         esac
11663 fi
11664 set d_voidsig
11665 eval $setvar
11666 case "$d_voidsig" in
11667 "$define") signal_t="void";;
11668 *) signal_t="int";;
11669 esac
11670 $rm -f $$.tmp
11671
11672 : check for ability to cast large floats to 32-bit ints.
11673 echo " "
11674 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11675 if $test "$intsize" -ge 4; then
11676         xxx=int
11677 else
11678         xxx=long
11679 fi
11680 $cat >try.c <<EOCP
11681 #include <stdio.h>
11682 #$i_stdlib I_STDLIB
11683 #ifdef I_STDLIB
11684 #include <stdlib.h>
11685 #endif
11686 #include <sys/types.h>
11687 #include <signal.h>
11688 $signal_t blech(int s) { exit(3); }
11689 int main()
11690 {
11691         $xxx i32;
11692         double f, g;
11693         int result = 0;
11694         char str[16];
11695         signal(SIGFPE, blech);
11696
11697         /* Don't let compiler optimize the test away.  Store the number
11698            in a writable string for gcc to pass to sscanf under HP-UX.
11699         */
11700         sprintf(str, "2147483647");
11701         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11702         g = 10 * f;
11703         i32  = ($xxx) g;
11704
11705         /* x86 processors will probably give 0x8000 0000, which is a
11706            sign change.  We don't want that.  We want to mimic SPARC
11707            behavior here, which is to preserve the sign and give
11708            back 0x7fff ffff.
11709         */
11710         if (i32 != ($xxx) f)
11711                 result |= 1;
11712         exit(result);
11713 }
11714 EOCP
11715 set try
11716 if eval $compile_ok; then
11717         $run ./try 2>/dev/null
11718         yyy=$?
11719 else
11720         echo "(I can't seem to compile the test program--assuming it can't)"
11721         yyy=1
11722 fi
11723 case "$yyy" in
11724 0)      val="$define"
11725         echo "Yup, it can."
11726         ;;
11727 *)      val="$undef"
11728         echo "Nope, it can't."
11729         ;;
11730 esac
11731 set d_casti32
11732 eval $setvar
11733 $rm_try
11734
11735 : check for ability to cast negative floats to unsigned
11736 echo " "
11737 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11738 $cat >try.c <<EOCP
11739 #include <stdio.h>
11740 #$i_stdlib I_STDLIB
11741 #ifdef I_STDLIB
11742 #include <stdlib.h>
11743 #endif
11744 #include <sys/types.h>
11745 #include <signal.h>
11746 $signal_t blech(int s) { exit(7); }
11747 $signal_t blech_in_list(int s) { exit(4); }
11748 unsigned long dummy_long(unsigned long p) { return p; }
11749 unsigned int dummy_int(unsigned int p) { return p; }
11750 unsigned short dummy_short(unsigned short p) { return p; }
11751 int main()
11752 {
11753         double f;
11754         unsigned long along;
11755         unsigned int aint;
11756         unsigned short ashort;
11757         int result = 0;
11758         char str[16];
11759
11760         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11761            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11762            optimized the whole file away
11763         */
11764         /* Store the number in a writable string for gcc to pass to
11765            sscanf under HP-UX.
11766         */
11767         sprintf(str, "-123");
11768         sscanf(str, "%lf", &f);  /* f = -123.; */
11769
11770         signal(SIGFPE, blech);
11771         along = (unsigned long)f;
11772         aint = (unsigned int)f;
11773         ashort = (unsigned short)f;
11774         if (along != (unsigned long)-123)
11775                 result |= 1;
11776         if (aint != (unsigned int)-123)
11777                 result |= 1;
11778         if (ashort != (unsigned short)-123)
11779                 result |= 1;
11780         sprintf(str, "1073741824.");
11781         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11782         f = f + f;
11783         along = 0;
11784         along = (unsigned long)f;
11785         if (along != 0x80000000)
11786                 result |= 2;
11787         f -= 1.;
11788         along = 0;
11789         along = (unsigned long)f;
11790         if (along != 0x7fffffff)
11791                 result |= 1;
11792         f += 2.;
11793         along = 0;
11794         along = (unsigned long)f;
11795         if (along != 0x80000001)
11796                 result |= 2;
11797         if (result)
11798                 exit(result);
11799         signal(SIGFPE, blech_in_list);
11800         sprintf(str, "123.");
11801         sscanf(str, "%lf", &f);  /* f = 123.; */
11802         along = dummy_long((unsigned long)f);
11803         aint = dummy_int((unsigned int)f);
11804         ashort = dummy_short((unsigned short)f);
11805         if (along != (unsigned long)123)
11806                 result |= 4;
11807         if (aint != (unsigned int)123)
11808                 result |= 4;
11809         if (ashort != (unsigned short)123)
11810                 result |= 4;
11811         exit(result);
11812
11813 }
11814 EOCP
11815 set try
11816 if eval $compile_ok; then
11817         $run ./try 2>/dev/null
11818         castflags=$?
11819 else
11820         echo "(I can't seem to compile the test program--assuming it can't)"
11821         castflags=7
11822 fi
11823 case "$castflags" in
11824 0)      val="$define"
11825         echo "Yup, it can."
11826         ;;
11827 *)      val="$undef"
11828         echo "Nope, it can't."
11829         ;;
11830 esac
11831 set d_castneg
11832 eval $setvar
11833 $rm_try
11834
11835 : see if cbrt exists
11836 set cbrt d_cbrt
11837 eval $inlibc
11838
11839 : see if chown exists
11840 set chown d_chown
11841 eval $inlibc
11842
11843 : see if chroot exists
11844 set chroot d_chroot
11845 eval $inlibc
11846
11847 : see if chsize exists
11848 set chsize d_chsize
11849 eval $inlibc
11850
11851 : see if class exists
11852 set class d_class
11853 eval $inlibc
11854
11855 : see if clearenv exists
11856 set clearenv d_clearenv
11857 eval $inlibc
11858
11859 : Define hasstruct macro for Configure internal use
11860 hasstruct='varname=$1; struct=$2; shift; shift;
11861 while $test $# -ge 2; do
11862         case "$1" in
11863         $define) echo "#include <$2>";;
11864         esac ;
11865     shift 2;
11866 done > try.c;
11867 echo "int main () { struct $struct foo; }" >> try.c;
11868 set try;
11869 if eval $compile; then
11870         val="$define";
11871 else
11872         val="$undef";
11873 fi;
11874 set $varname;
11875 eval $setvar;
11876 $rm_try'
11877
11878 : see whether socket exists
11879 socketlib=''
11880 sockethdr=''
11881 echo " "
11882 $echo $n "Hmm... $c" >&4
11883 if set socket val -f d_socket; eval $csym; $val; then
11884     echo "Looks like you have Berkeley networking support." >&4
11885     d_socket="$define"
11886     if set setsockopt val -f; eval $csym; $val; then
11887         d_oldsock="$undef"
11888     else
11889         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11890         d_oldsock="$define"
11891     fi
11892 else
11893     if $contains socklib libc.list >/dev/null 2>&1; then
11894         echo "Looks like you have Berkeley networking support." >&4
11895         d_socket="$define"
11896         : we will have to assume that it supports the 4.2 BSD interface
11897         d_oldsock="$undef"
11898     else
11899         echo "You don't have Berkeley networking in libc$_a..." >&4
11900         if test "X$d_socket" = "X$define"; then
11901             echo "...but you seem to believe that you have sockets." >&4
11902         else
11903             for net in net socket
11904             do
11905                 if test -f $sysroot/usr/lib/lib$net$_a; then
11906                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11907                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11908                     if $contains socket libc.list >/dev/null 2>&1; then
11909                         d_socket="$define"
11910                         socketlib="-l$net"
11911                         case "$net" in
11912                         net)
11913                             echo "...but the Wollongong group seems to have hacked it in." >&4
11914                             sockethdr="-I$sysroot/usr/netinclude"
11915                             ;;
11916                         esac
11917                         echo "Found Berkeley sockets interface in lib$net." >&4
11918                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11919                             d_oldsock="$undef"
11920                         else
11921                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11922                             d_oldsock="$define"
11923                         fi
11924                         break
11925                     fi
11926                 fi
11927             done
11928             if test "X$d_socket" != "X$define"; then
11929                echo "or anywhere else I see." >&4
11930                d_socket="$undef"
11931                d_oldsock="$undef"
11932             fi
11933         fi
11934     fi
11935 fi
11936
11937 : see if socketpair exists
11938 set socketpair d_sockpair
11939 eval $inlibc
11940
11941
11942 echo " "
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 " "
11960 echo "Checking the availability struct sockaddr_in6 ..." >&4
11961 $cat >try.c <<EOF
11962 #include <sys/types.h>
11963 #include <sys/socket.h>
11964 #include <netinet/in.h>
11965 int main() {
11966 struct sockaddr_in6 sin6;
11967 return (sin6.sin6_family);
11968 }
11969 EOF
11970 val="$undef"
11971 set try; if eval $compile; then
11972     val="$define"
11973 fi
11974 set d_sockaddr_in6; eval $setvar
11975 $rm_try
11976
11977 echo " "
11978 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11979 $cat >try.c <<EOF
11980 #include <sys/types.h>
11981 #include <sys/socket.h>
11982 #include <netinet/in.h>
11983 int main() {
11984 struct sockaddr_in6 sin6;
11985 return (sin6.sin6_scope_id);
11986 }
11987 EOF
11988 val="$undef"
11989 set try; if eval $compile; then
11990     val="$define"
11991 fi
11992 set d_sin6_scope_id; eval $setvar
11993 $rm_try
11994
11995 echo " "
11996 echo "Checking the availability struct ip_mreq ..." >&4
11997 $cat >try.c <<EOF
11998 #include <sys/types.h>
11999 #include <sys/socket.h>
12000 #include <netinet/in.h>
12001 int main() {
12002 struct ip_mreq mreq;
12003 return (mreq.imr_multiaddr.s_addr);
12004 }
12005 EOF
12006 val="$undef"
12007 set try; if eval $compile; then
12008        val="$define"
12009 fi
12010 set d_ip_mreq; eval $setvar
12011 $rm_try
12012
12013 echo " "
12014 echo "Checking the availability struct ip_mreq_source ..." >&4
12015 $cat >try.c <<EOF
12016 #include <sys/types.h>
12017 #include <sys/socket.h>
12018 #include <netinet/in.h>
12019 int main() {
12020 struct ip_mreq_source mreq;
12021 return (mreq.imr_multiaddr.s_addr);
12022 }
12023 EOF
12024 val="$undef"
12025 set try; if eval $compile; then
12026        val="$define"
12027 fi
12028 set d_ip_mreq_source; eval $setvar
12029 $rm_try
12030
12031 echo " "
12032 echo "Checking the availability struct ipv6_mreq ..." >&4
12033 $cat >try.c <<EOF
12034 #include <sys/types.h>
12035 #include <sys/socket.h>
12036 #include <netinet/in.h>
12037 int main() {
12038 struct ipv6_mreq mreq;
12039 return (mreq.ipv6mr_interface);
12040 }
12041 EOF
12042 val="$undef"
12043 set try; if eval $compile; then
12044     val="$define"
12045 fi
12046 set d_ipv6_mreq; eval $setvar
12047 $rm_try
12048
12049 echo " "
12050 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12051 $cat >try.c <<EOF
12052 #include <sys/types.h>
12053 #include <sys/socket.h>
12054 #include <netinet/in.h>
12055 int main() {
12056 struct ipv6_mreq_source mreq;
12057 return (mreq.imr_multiaddr.s_addr);
12058 }
12059 EOF
12060 val="$undef"
12061 set try; if eval $compile; then
12062        val="$define"
12063 fi
12064 set d_ipv6_mreq_source; eval $setvar
12065 $rm_try
12066
12067 echo " "
12068 echo "Checking the availability of certain socket constants..." >&4
12069 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12070     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12071     $cat >try.c <<EOF
12072 #include <sys/types.h>
12073 #include <sys/socket.h>
12074 int main() {
12075     int i = $ENUM;
12076 }
12077 EOF
12078     val="$undef"
12079     set try; if eval $compile; then
12080         val="$define"
12081     fi
12082     set d_${enum}; eval $setvar
12083     $rm_try
12084 done
12085
12086 : see if this is a sys/uio.h system
12087 set sys/uio.h i_sysuio
12088 eval $inhdr
12089
12090 : Check for cmsghdr support
12091 echo " "
12092 echo "Checking to see if your system supports struct cmsghdr..." >&4
12093 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12094 eval $hasstruct
12095 case "$d_cmsghdr_s" in
12096 "$define")      echo "Yes, it does."   ;;
12097 *)              echo "No, it doesn't." ;;
12098 esac
12099
12100 : see if copysign exists
12101 set copysign d_copysign
12102 eval $inlibc
12103
12104 : see if copysignl exists
12105 set copysignl d_copysignl
12106 eval $inlibc
12107
12108 : see if crypt exists
12109 echo " "
12110 set crypt d_crypt
12111 eval $inlibc
12112 case "$d_crypt" in
12113 $define) cryptlib='' ;;
12114 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12115                 echo 'crypt() found.' >&4
12116                 val="$define"
12117                 cryptlib=''
12118         else
12119                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12120                 if $test -z "$cryptlib"; then
12121                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12122                 else
12123                         cryptlib=-lcrypt
12124                 fi
12125                 if $test -z "$cryptlib"; then
12126                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12127                 else
12128                         cryptlib=-lcrypt
12129                 fi
12130                 if $test -z "$cryptlib"; then
12131                         cryptlib=`./loc libcrypt$_a "" $libpth`
12132                 else
12133                         cryptlib=-lcrypt
12134                 fi
12135                 if $test -z "$cryptlib"; then
12136                         echo 'crypt() NOT found.' >&4
12137                         val="$undef"
12138                 else
12139                         val="$define"
12140                 fi
12141         fi
12142         set d_crypt
12143         eval $setvar
12144         ;;
12145 esac
12146
12147 : see if this is a crypt.h system
12148 set crypt.h i_crypt
12149 eval $inhdr
12150
12151 : see if crypt_r exists
12152 set crypt_r d_crypt_r
12153 eval $inlibc
12154 case "$d_crypt_r" in
12155 "$define")
12156         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12157         case "$d_crypt_r_proto:$usethreads" in
12158         ":define")      d_crypt_r_proto=define
12159                 set d_crypt_r_proto crypt_r $hdrs
12160                 eval $hasproto ;;
12161         *)      ;;
12162         esac
12163         case "$d_crypt_r_proto" in
12164         define)
12165         case "$crypt_r_proto" in
12166         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12167         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12168         esac
12169         case "$crypt_r_proto" in
12170         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12171         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12172         esac
12173         case "$crypt_r_proto" in
12174         ''|0)   d_crypt_r=undef
12175                 crypt_r_proto=0
12176                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12177         * )     case "$crypt_r_proto" in
12178                 REENTRANT_PROTO*) ;;
12179                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12180                 esac
12181                 echo "Prototype: $try" ;;
12182         esac
12183         ;;
12184         *)      case "$usethreads" in
12185                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12186                 esac
12187                 d_crypt_r=undef
12188                 crypt_r_proto=0
12189                 ;;
12190         esac
12191         ;;
12192 *)      crypt_r_proto=0
12193         ;;
12194 esac
12195
12196 : get csh whereabouts
12197 case "$csh" in
12198 'csh') val="$undef" ;;
12199 *) val="$define" ;;
12200 esac
12201 set d_csh
12202 eval $setvar
12203 : Respect a hint or command line value for full_csh.
12204 case "$full_csh" in
12205 '') full_csh=$csh ;;
12206 esac
12207
12208 : see if ctermid exists
12209 set ctermid d_ctermid
12210 eval $inlibc
12211
12212 : see if ctermid_r exists
12213 set ctermid_r d_ctermid_r
12214 eval $inlibc
12215 case "$d_ctermid_r" in
12216 "$define")
12217         hdrs="$i_systypes sys/types.h define stdio.h "
12218         case "$d_ctermid_r_proto:$usethreads" in
12219         ":define")      d_ctermid_r_proto=define
12220                 set d_ctermid_r_proto ctermid_r $hdrs
12221                 eval $hasproto ;;
12222         *)      ;;
12223         esac
12224         case "$d_ctermid_r_proto" in
12225         define)
12226         case "$ctermid_r_proto" in
12227         ''|0) try='char* ctermid_r(char*);'
12228         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12229         esac
12230         case "$ctermid_r_proto" in
12231         ''|0)   d_ctermid_r=undef
12232                 ctermid_r_proto=0
12233                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12234         * )     case "$ctermid_r_proto" in
12235                 REENTRANT_PROTO*) ;;
12236                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12237                 esac
12238                 echo "Prototype: $try" ;;
12239         esac
12240         ;;
12241         *)      case "$usethreads" in
12242                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12243                 esac
12244                 d_ctermid_r=undef
12245                 ctermid_r_proto=0
12246                 ;;
12247         esac
12248         ;;
12249 *)      ctermid_r_proto=0
12250         ;;
12251 esac
12252
12253 : see if ctime_r exists
12254 set ctime_r d_ctime_r
12255 eval $inlibc
12256 case "$d_ctime_r" in
12257 "$define")
12258         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12259         case "$d_ctime_r_proto:$usethreads" in
12260         ":define")      d_ctime_r_proto=define
12261                 set d_ctime_r_proto ctime_r $hdrs
12262                 eval $hasproto ;;
12263         *)      ;;
12264         esac
12265         case "$d_ctime_r_proto" in
12266         define)
12267         case "$ctime_r_proto" in
12268         ''|0) try='char* ctime_r(const time_t*, char*);'
12269         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12270         esac
12271         case "$ctime_r_proto" in
12272         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12273         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12274         esac
12275         case "$ctime_r_proto" in
12276         ''|0) try='int ctime_r(const time_t*, char*);'
12277         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12278         esac
12279         case "$ctime_r_proto" in
12280         ''|0) try='int ctime_r(const time_t*, char*, int);'
12281         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12282         esac
12283         case "$ctime_r_proto" in
12284         ''|0)   d_ctime_r=undef
12285                 ctime_r_proto=0
12286                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12287         * )     case "$ctime_r_proto" in
12288                 REENTRANT_PROTO*) ;;
12289                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12290                 esac
12291                 echo "Prototype: $try" ;;
12292         esac
12293         ;;
12294         *)      case "$usethreads" in
12295                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12296                 esac
12297                 d_ctime_r=undef
12298                 ctime_r_proto=0
12299                 ;;
12300         esac
12301         ;;
12302 *)      ctime_r_proto=0
12303         ;;
12304 esac
12305
12306 : see if cuserid exists
12307 set cuserid d_cuserid
12308 eval $inlibc
12309
12310 : see if dbm.h is available
12311 : see if dbmclose exists
12312 set dbmclose d_dbmclose
12313 eval $inlibc
12314
12315 case "$d_dbmclose" in
12316 $define)
12317         set dbm.h i_dbm
12318         eval $inhdr
12319         case "$i_dbm" in
12320         $define)
12321                 val="$undef"
12322                 set i_rpcsvcdbm
12323                 eval $setvar
12324                 ;;
12325         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12326                 eval $inhdr
12327                 ;;
12328         esac
12329         ;;
12330 *)      echo "We won't be including <dbm.h>"
12331         val="$undef"
12332         set i_dbm
12333         eval $setvar
12334         val="$undef"
12335         set i_rpcsvcdbm
12336         eval $setvar
12337         ;;
12338 esac
12339
12340 : see if prototype for dbminit is available
12341 echo " "
12342 set d_dbminitproto dbminit $i_dbm dbm.h
12343 eval $hasproto
12344
12345 : see if difftime exists
12346 set difftime d_difftime
12347 eval $inlibc
12348
12349 : see if this is a dirent system
12350 echo " "
12351 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12352         val="$define"
12353         echo "<dirent.h> found." >&4
12354 else
12355         val="$undef"
12356         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12357                 echo "<sys/dir.h> found." >&4
12358                 echo " "
12359         else
12360                 xinc=`./findhdr sys/ndir.h`
12361         fi
12362         echo "<dirent.h> NOT found." >&4
12363 fi
12364 set i_dirent
12365 eval $setvar
12366
12367 : Look for type of directory structure.
12368 echo " "
12369 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12370
12371 case "$direntrytype" in
12372 ''|' ')
12373         case "$i_dirent" in
12374         $define) guess1='struct dirent' ;;
12375         *) guess1='struct direct'  ;;
12376         esac
12377         ;;
12378 *)      guess1="$direntrytype"
12379         ;;
12380 esac
12381
12382 case "$guess1" in
12383 'struct dirent') guess2='struct direct' ;;
12384 *) guess2='struct dirent' ;;
12385 esac
12386
12387 if $contains "$guess1" try.c >/dev/null 2>&1; then
12388         direntrytype="$guess1"
12389         echo "Your directory entries are $direntrytype." >&4
12390 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12391         direntrytype="$guess2"
12392         echo "Your directory entries seem to be $direntrytype." >&4
12393 else
12394         echo "I don't recognize your system's directory entries." >&4
12395         rp="What type is used for directory entries on this system?"
12396         dflt="$guess1"
12397         . ./myread
12398         direntrytype="$ans"
12399 fi
12400 $rm_try
12401
12402 : see if the directory entry stores field length
12403 echo " "
12404 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12405 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12406         echo "Good, your directory entry keeps length information in d_namlen." >&4
12407         val="$define"
12408 else
12409         echo "Your directory entry does not know about the d_namlen field." >&4
12410         val="$undef"
12411 fi
12412 set d_dirnamlen
12413 eval $setvar
12414 $rm_try
12415
12416 : Look for DIR.dd_fd
12417 case "$i_dirent" in
12418 "$define")
12419     echo "Checking to see if DIR has a dd_fd member variable" >&4
12420     $cat >try.c <<EOCP
12421 #$i_stdlib I_STDLIB
12422 #ifdef I_STDLIB
12423 #include <stdlib.h>
12424 #endif
12425 #include <dirent.h>
12426
12427 int main() {
12428     DIR dir;
12429     dir.dd_fd = 1;
12430     return 0;
12431 }
12432 EOCP
12433     val=$undef
12434     set try
12435     if eval $compile; then
12436         echo "Yes, it does."
12437         val="$define"
12438     else
12439         echo "No, it does not."
12440         val="$undef"
12441     fi
12442     ;;
12443 *)
12444     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12445     val="$undef"
12446     ;;
12447 esac
12448 set d_dir_dd_fd
12449 eval $setvar
12450 $rm_try
12451
12452 : see if this is an sysdir system
12453 set sys/dir.h i_sysdir
12454 eval $inhdr
12455
12456 : see if this is an sysndir system
12457 set sys/ndir.h i_sysndir
12458 eval $inhdr
12459
12460 : Look for dirfd
12461 echo " "
12462 $cat >dirfd.c <<EOM
12463 #include <stdio.h>
12464 #$i_stdlib I_STDLIB
12465 #ifdef I_STDLIB
12466 #include <stdlib.h>
12467 #endif
12468 #$i_dirent I_DIRENT             /**/
12469 #$i_sysdir I_SYS_DIR            /**/
12470 #$i_sysndir I_SYS_NDIR          /**/
12471 #$i_systypes I_SYS_TYPES        /**/
12472 #if defined(I_SYS_TYPES)
12473 #include <sys/types.h>
12474 #endif
12475 #if defined(I_DIRENT)
12476 #include <dirent.h>
12477 #else
12478 #ifdef I_SYS_NDIR
12479 #include <sys/ndir.h>
12480 #else
12481 #ifdef I_SYS_DIR
12482 #include <sys/dir.h>
12483 #endif
12484 #endif
12485 #endif
12486 int main() {
12487         DIR *dirp = opendir(".");
12488         if (dirfd(dirp) >= 0)
12489                 exit(0);
12490         else
12491                 exit(1);
12492 }
12493 EOM
12494 val=$undef
12495 set dirfd
12496 if eval $compile; then
12497         val="$define"
12498 fi
12499 case "$val" in
12500 $define)        echo "dirfd() found." >&4       ;;
12501 *)              echo "dirfd() NOT found." >&4   ;;
12502 esac
12503 set d_dirfd
12504 eval $setvar
12505 $rm -f dirfd*
12506
12507 : see if dladdr exists
12508 set dladdr d_dladdr
12509 eval $inlibc
12510
12511 : see if dlerror exists
12512 xxx_runnm="$runnm"
12513 runnm=false
12514 set dlerror d_dlerror
12515 eval $inlibc
12516 runnm="$xxx_runnm"
12517
12518 : see if dlfcn is available
12519 set dlfcn.h i_dlfcn
12520 eval $inhdr
12521
12522 : Check what extension to use for shared libs
12523 case "$usedl" in
12524 $define|y|true)
12525         $cat << EOM
12526
12527 On a few systems, the dynamically loaded modules that perl generates and uses
12528 will need a different extension than shared libs. The default will probably
12529 be appropriate.
12530
12531 EOM
12532         case "$dlext" in
12533         '')     dflt="$so" ;;
12534         *)      dflt="$dlext" ;;
12535         esac
12536         rp='What is the extension of dynamically loaded modules'
12537         . ./myread
12538         dlext="$ans"
12539         ;;
12540 *)
12541         dlext="none"
12542         ;;
12543 esac
12544
12545 : Check if dlsym need a leading underscore
12546 echo " "
12547 val="$undef"
12548
12549 case "$dlsrc" in
12550 dl_dlopen.xs)
12551         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12552         $cat >dyna.c <<'EOM'
12553 fred () { }
12554 EOM
12555
12556 $cat >fred.c<<EOM
12557
12558 #include <stdio.h>
12559 #$i_stdlib I_STDLIB
12560 #ifdef I_STDLIB
12561 #include <stdlib.h>
12562 #endif
12563 #$i_dlfcn I_DLFCN
12564 #ifdef I_DLFCN
12565 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12566 #else
12567 #include <sys/types.h>
12568 #include <nlist.h>
12569 #include <link.h>
12570 #endif
12571
12572 extern int fred() ;
12573
12574 int main()
12575 {
12576     void * handle ;
12577     void * symbol ;
12578 #ifndef RTLD_LAZY
12579     int mode = 1 ;
12580 #else
12581     int mode = RTLD_LAZY ;
12582 #endif
12583     handle = dlopen("./dyna.$dlext", mode) ;
12584     if (handle == NULL) {
12585         printf ("1\n") ;
12586         fflush (stdout) ;
12587         exit(0);
12588     }
12589     symbol = dlsym(handle, "fred") ;
12590     if (symbol == NULL) {
12591         /* try putting a leading underscore */
12592         symbol = dlsym(handle, "_fred") ;
12593         if (symbol == NULL) {
12594             printf ("2\n") ;
12595             fflush (stdout) ;
12596             exit(0);
12597         }
12598         printf ("3\n") ;
12599     }
12600     else
12601         printf ("4\n") ;
12602     fflush (stdout) ;
12603     exit(0);
12604 }
12605 EOM
12606         : Call the object file tmp-dyna.o in case dlext=o.
12607         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12608                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12609                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12610                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12611                 xxx=`$run ./fred`
12612                 case $xxx in
12613                 1)      echo "Test program failed using dlopen." >&4
12614                         echo "Perhaps you should not use dynamic loading." >&4;;
12615                 2)      echo "Test program failed using dlsym." >&4
12616                         echo "Perhaps you should not use dynamic loading." >&4;;
12617                 3)      echo "dlsym needs a leading underscore" >&4
12618                         val="$define" ;;
12619                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12620                 esac
12621         else
12622                 echo "I can't compile and run the test program." >&4
12623                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12624         fi
12625         ;;
12626 esac
12627
12628 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12629
12630 set d_dlsymun
12631 eval $setvar
12632
12633 : see if drand48_r exists
12634 set drand48_r d_drand48_r
12635 eval $inlibc
12636 case "$d_drand48_r" in
12637 "$define")
12638         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12639         case "$d_drand48_r_proto:$usethreads" in
12640         ":define")      d_drand48_r_proto=define
12641                 set d_drand48_r_proto drand48_r $hdrs
12642                 eval $hasproto ;;
12643         *)      ;;
12644         esac
12645         case "$d_drand48_r_proto" in
12646         define)
12647         case "$drand48_r_proto" in
12648         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12649         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12650         esac
12651         case "$drand48_r_proto" in
12652         ''|0)   d_drand48_r=undef
12653                 drand48_r_proto=0
12654                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12655         * )     case "$drand48_r_proto" in
12656                 REENTRANT_PROTO*) ;;
12657                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12658                 esac
12659                 echo "Prototype: $try" ;;
12660         esac
12661         ;;
12662         *)      case "$usethreads" in
12663                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12664                 esac
12665                 d_drand48_r=undef
12666                 drand48_r_proto=0
12667                 ;;
12668         esac
12669         ;;
12670 *)      drand48_r_proto=0
12671         ;;
12672 esac
12673
12674 : see if prototype for drand48 is available
12675 echo " "
12676 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12677 eval $hasproto
12678
12679 : see if dup2 exists
12680 set dup2 d_dup2
12681 eval $inlibc
12682
12683 : see if dup3 exists
12684 set dup3 d_dup3
12685 eval $inlibc
12686
12687 : see if this is an xlocale.h system
12688 set xlocale.h i_xlocale
12689 eval $inhdr
12690
12691 : see if newlocale exists
12692 set newlocale d_newlocale
12693 eval $inlibc
12694
12695 : see if freelocale exists
12696 set freelocale d_freelocale
12697 eval $inlibc
12698
12699 : see if uselocale exists
12700 set uselocale d_uselocale
12701 eval $inlibc
12702
12703 : see if duplocale exists
12704 set duplocale d_duplocale
12705 eval $inlibc
12706
12707 : see if querylocale exists
12708 set querylocale d_querylocale
12709 eval $inlibc
12710
12711 : see if eaccess exists
12712 set eaccess d_eaccess
12713 eval $inlibc
12714
12715 : see if endgrent exists
12716 set endgrent d_endgrent
12717 eval $inlibc
12718
12719 : see if this is an grp system
12720 set grp.h i_grp
12721 eval $inhdr
12722
12723 case "$i_grp" in
12724 $define)
12725         xxx=`./findhdr grp.h`
12726         $cppstdin $cppflags $cppminus < $xxx >$$.h
12727
12728         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12729                 val="$define"
12730         else
12731                 val="$undef"
12732         fi
12733         set d_grpasswd
12734         eval $setvar
12735
12736         $rm -f $$.h
12737         ;;
12738 *)
12739         val="$undef";
12740         set d_grpasswd; eval $setvar
12741         ;;
12742 esac
12743
12744 : see if endgrent_r exists
12745 set endgrent_r d_endgrent_r
12746 eval $inlibc
12747 case "$d_endgrent_r" in
12748 "$define")
12749         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12750         case "$d_endgrent_r_proto:$usethreads" in
12751         ":define")      d_endgrent_r_proto=define
12752                 set d_endgrent_r_proto endgrent_r $hdrs
12753                 eval $hasproto ;;
12754         *)      ;;
12755         esac
12756         case "$d_endgrent_r_proto" in
12757         define)
12758         case "$endgrent_r_proto" in
12759         ''|0) try='int endgrent_r(FILE**);'
12760         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12761         esac
12762         case "$endgrent_r_proto" in
12763         ''|0) try='void endgrent_r(FILE**);'
12764         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12765         esac
12766         case "$endgrent_r_proto" in
12767         ''|0)   d_endgrent_r=undef
12768                 endgrent_r_proto=0
12769                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12770         * )     case "$endgrent_r_proto" in
12771                 REENTRANT_PROTO*) ;;
12772                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12773                 esac
12774                 echo "Prototype: $try" ;;
12775         esac
12776         ;;
12777         *)      case "$usethreads" in
12778                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12779                 esac
12780                 d_endgrent_r=undef
12781                 endgrent_r_proto=0
12782                 ;;
12783         esac
12784         ;;
12785 *)      endgrent_r_proto=0
12786         ;;
12787 esac
12788
12789 : see if endhostent exists
12790 set endhostent d_endhent
12791 eval $inlibc
12792
12793 : see if this is a netdb.h system
12794 set netdb.h i_netdb
12795 eval $inhdr
12796
12797 : see if endhostent_r exists
12798 set endhostent_r d_endhostent_r
12799 eval $inlibc
12800 case "$d_endhostent_r" in
12801 "$define")
12802         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12803         case "$d_endhostent_r_proto:$usethreads" in
12804         ":define")      d_endhostent_r_proto=define
12805                 set d_endhostent_r_proto endhostent_r $hdrs
12806                 eval $hasproto ;;
12807         *)      ;;
12808         esac
12809         case "$d_endhostent_r_proto" in
12810         define)
12811         case "$endhostent_r_proto" in
12812         ''|0) try='int endhostent_r(struct hostent_data*);'
12813         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12814         esac
12815         case "$endhostent_r_proto" in
12816         ''|0) try='void endhostent_r(struct hostent_data*);'
12817         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12818         esac
12819         case "$endhostent_r_proto" in
12820         ''|0)   d_endhostent_r=undef
12821                 endhostent_r_proto=0
12822                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12823         * )     case "$endhostent_r_proto" in
12824                 REENTRANT_PROTO*) ;;
12825                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12826                 esac
12827                 echo "Prototype: $try" ;;
12828         esac
12829         ;;
12830         *)      case "$usethreads" in
12831                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12832                 esac
12833                 d_endhostent_r=undef
12834                 endhostent_r_proto=0
12835                 ;;
12836         esac
12837         ;;
12838 *)      endhostent_r_proto=0
12839         ;;
12840 esac
12841
12842 : see if endnetent exists
12843 set endnetent d_endnent
12844 eval $inlibc
12845
12846 : see if endnetent_r exists
12847 set endnetent_r d_endnetent_r
12848 eval $inlibc
12849 case "$d_endnetent_r" in
12850 "$define")
12851         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12852         case "$d_endnetent_r_proto:$usethreads" in
12853         ":define")      d_endnetent_r_proto=define
12854                 set d_endnetent_r_proto endnetent_r $hdrs
12855                 eval $hasproto ;;
12856         *)      ;;
12857         esac
12858         case "$d_endnetent_r_proto" in
12859         define)
12860         case "$endnetent_r_proto" in
12861         ''|0) try='int endnetent_r(struct netent_data*);'
12862         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12863         esac
12864         case "$endnetent_r_proto" in
12865         ''|0) try='void endnetent_r(struct netent_data*);'
12866         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12867         esac
12868         case "$endnetent_r_proto" in
12869         ''|0)   d_endnetent_r=undef
12870                 endnetent_r_proto=0
12871                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12872         * )     case "$endnetent_r_proto" in
12873                 REENTRANT_PROTO*) ;;
12874                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12875                 esac
12876                 echo "Prototype: $try" ;;
12877         esac
12878         ;;
12879         *)      case "$usethreads" in
12880                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12881                 esac
12882                 d_endnetent_r=undef
12883                 endnetent_r_proto=0
12884                 ;;
12885         esac
12886         ;;
12887 *)      endnetent_r_proto=0
12888         ;;
12889 esac
12890
12891 : see if endprotoent exists
12892 set endprotoent d_endpent
12893 eval $inlibc
12894
12895 : see if endprotoent_r exists
12896 set endprotoent_r d_endprotoent_r
12897 eval $inlibc
12898 case "$d_endprotoent_r" in
12899 "$define")
12900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12901         case "$d_endprotoent_r_proto:$usethreads" in
12902         ":define")      d_endprotoent_r_proto=define
12903                 set d_endprotoent_r_proto endprotoent_r $hdrs
12904                 eval $hasproto ;;
12905         *)      ;;
12906         esac
12907         case "$d_endprotoent_r_proto" in
12908         define)
12909         case "$endprotoent_r_proto" in
12910         ''|0) try='int endprotoent_r(struct protoent_data*);'
12911         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12912         esac
12913         case "$endprotoent_r_proto" in
12914         ''|0) try='void endprotoent_r(struct protoent_data*);'
12915         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12916         esac
12917         case "$endprotoent_r_proto" in
12918         ''|0)   d_endprotoent_r=undef
12919                 endprotoent_r_proto=0
12920                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12921         * )     case "$endprotoent_r_proto" in
12922                 REENTRANT_PROTO*) ;;
12923                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12924                 esac
12925                 echo "Prototype: $try" ;;
12926         esac
12927         ;;
12928         *)      case "$usethreads" in
12929                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12930                 esac
12931                 d_endprotoent_r=undef
12932                 endprotoent_r_proto=0
12933                 ;;
12934         esac
12935         ;;
12936 *)      endprotoent_r_proto=0
12937         ;;
12938 esac
12939
12940 : see if endpwent exists
12941 set endpwent d_endpwent
12942 eval $inlibc
12943
12944 : see if this is a pwd.h system
12945 set pwd.h i_pwd
12946 eval $inhdr
12947
12948 case "$i_pwd" in
12949 $define)
12950         xxx=`./findhdr pwd.h`
12951         $cppstdin $cppflags $cppminus < $xxx >$$.h
12952
12953         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12954                 val="$define"
12955         else
12956                 val="$undef"
12957         fi
12958         set d_pwquota
12959         eval $setvar
12960
12961         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12962                 val="$define"
12963         else
12964                 val="$undef"
12965         fi
12966         set d_pwage
12967         eval $setvar
12968
12969         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12970                 val="$define"
12971         else
12972                 val="$undef"
12973         fi
12974         set d_pwchange
12975         eval $setvar
12976
12977         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12978                 val="$define"
12979         else
12980                 val="$undef"
12981         fi
12982         set d_pwclass
12983         eval $setvar
12984
12985         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12986                 val="$define"
12987         else
12988                 val="$undef"
12989         fi
12990         set d_pwexpire
12991         eval $setvar
12992
12993         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12994                 val="$define"
12995         else
12996                 val="$undef"
12997         fi
12998         set d_pwcomment
12999         eval $setvar
13000
13001         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13002                 val="$define"
13003         else
13004                 val="$undef"
13005         fi
13006         set d_pwgecos
13007         eval $setvar
13008
13009         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13010                 val="$define"
13011         else
13012                 val="$undef"
13013         fi
13014         set d_pwpasswd
13015         eval $setvar
13016
13017         $rm -f $$.h
13018         ;;
13019 *)
13020         val="$undef";
13021         set d_pwquota; eval $setvar
13022         set d_pwage; eval $setvar
13023         set d_pwchange; eval $setvar
13024         set d_pwclass; eval $setvar
13025         set d_pwexpire; eval $setvar
13026         set d_pwcomment; eval $setvar
13027         set d_pwgecos; eval $setvar
13028         set d_pwpasswd; eval $setvar
13029         ;;
13030 esac
13031
13032 : see if endpwent_r exists
13033 set endpwent_r d_endpwent_r
13034 eval $inlibc
13035 case "$d_endpwent_r" in
13036 "$define")
13037         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13038         case "$d_endpwent_r_proto:$usethreads" in
13039         ":define")      d_endpwent_r_proto=define
13040                 set d_endpwent_r_proto endpwent_r $hdrs
13041                 eval $hasproto ;;
13042         *)      ;;
13043         esac
13044         case "$d_endpwent_r_proto" in
13045         define)
13046         case "$endpwent_r_proto" in
13047         ''|0) try='int endpwent_r(FILE**);'
13048         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13049         esac
13050         case "$endpwent_r_proto" in
13051         ''|0) try='void endpwent_r(FILE**);'
13052         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13053         esac
13054         case "$endpwent_r_proto" in
13055         ''|0)   d_endpwent_r=undef
13056                 endpwent_r_proto=0
13057                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13058         * )     case "$endpwent_r_proto" in
13059                 REENTRANT_PROTO*) ;;
13060                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13061                 esac
13062                 echo "Prototype: $try" ;;
13063         esac
13064         ;;
13065         *)      case "$usethreads" in
13066                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13067                 esac
13068                 d_endpwent_r=undef
13069                 endpwent_r_proto=0
13070                 ;;
13071         esac
13072         ;;
13073 *)      endpwent_r_proto=0
13074         ;;
13075 esac
13076
13077 : see if endservent exists
13078 set endservent d_endsent
13079 eval $inlibc
13080
13081 : see if endservent_r exists
13082 set endservent_r d_endservent_r
13083 eval $inlibc
13084 case "$d_endservent_r" in
13085 "$define")
13086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13087         case "$d_endservent_r_proto:$usethreads" in
13088         ":define")      d_endservent_r_proto=define
13089                 set d_endservent_r_proto endservent_r $hdrs
13090                 eval $hasproto ;;
13091         *)      ;;
13092         esac
13093         case "$d_endservent_r_proto" in
13094         define)
13095         case "$endservent_r_proto" in
13096         ''|0) try='int endservent_r(struct servent_data*);'
13097         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13098         esac
13099         case "$endservent_r_proto" in
13100         ''|0) try='void endservent_r(struct servent_data*);'
13101         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13102         esac
13103         case "$endservent_r_proto" in
13104         ''|0)   d_endservent_r=undef
13105                 endservent_r_proto=0
13106                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13107         * )     case "$endservent_r_proto" in
13108                 REENTRANT_PROTO*) ;;
13109                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13110                 esac
13111                 echo "Prototype: $try" ;;
13112         esac
13113         ;;
13114         *)      case "$usethreads" in
13115                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13116                 esac
13117                 d_endservent_r=undef
13118                 endservent_r_proto=0
13119                 ;;
13120         esac
13121         ;;
13122 *)      endservent_r_proto=0
13123         ;;
13124 esac
13125
13126 : Locate the flags for 'open()'
13127 echo " "
13128 $cat >try.c <<EOCP
13129 #include <sys/types.h>
13130 #ifdef I_FCNTL
13131 #include <fcntl.h>
13132 #endif
13133 #ifdef I_SYS_FILE
13134 #include <sys/file.h>
13135 #endif
13136 #$i_stdlib I_STDLIB
13137 #ifdef I_STDLIB
13138 #include <stdlib.h>
13139 #endif
13140 int main() {
13141         if(O_RDONLY);
13142 #ifdef O_TRUNC
13143         exit(0);
13144 #else
13145         exit(1);
13146 #endif
13147 }
13148 EOCP
13149 : check sys/file.h first to get FREAD on Sun
13150 if $test `./findhdr sys/file.h` && \
13151                 set try -DI_SYS_FILE && eval $compile; then
13152         h_sysfile=true;
13153         echo "<sys/file.h> defines the O_* constants..." >&4
13154         if $run ./try; then
13155                 echo "and you have the 3 argument form of open()." >&4
13156                 val="$define"
13157         else
13158                 echo "but not the 3 argument form of open().  Oh, well." >&4
13159                 val="$undef"
13160         fi
13161 elif $test `./findhdr fcntl.h` && \
13162                 set try -DI_FCNTL && eval $compile; then
13163         h_fcntl=true;
13164         echo "<fcntl.h> defines the O_* constants..." >&4
13165         if $run ./try; then
13166                 echo "and you have the 3 argument form of open()." >&4
13167                 val="$define"
13168         else
13169                 echo "but not the 3 argument form of open().  Oh, well." >&4
13170                 val="$undef"
13171         fi
13172 else
13173         val="$undef"
13174         echo "I can't find the O_* constant definitions!  You got problems." >&4
13175 fi
13176 set d_open3
13177 eval $setvar
13178 $rm_try
13179
13180 : see if this is a sys/file.h system
13181 val=''
13182 set sys/file.h val
13183 eval $inhdr
13184
13185 : do we need to include sys/file.h ?
13186 case "$val" in
13187 "$define")
13188         echo " "
13189         if $h_sysfile; then
13190                 val="$define"
13191                 echo "We'll be including <sys/file.h>." >&4
13192         else
13193                 val="$undef"
13194                 echo "We won't be including <sys/file.h>." >&4
13195         fi
13196         ;;
13197 *)
13198         h_sysfile=false
13199         ;;
13200 esac
13201 set i_sysfile
13202 eval $setvar
13203
13204 : see if fcntl.h is there
13205 val=''
13206 set fcntl.h val
13207 eval $inhdr
13208
13209 : see if we can include fcntl.h
13210 case "$val" in
13211 "$define")
13212         echo " "
13213         if $h_fcntl; then
13214                 val="$define"
13215                 echo "We'll be including <fcntl.h>." >&4
13216         else
13217                 val="$undef"
13218                 if $h_sysfile; then
13219         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13220                 else
13221                         echo "We won't be including <fcntl.h>." >&4
13222                 fi
13223         fi
13224         ;;
13225 *)
13226         h_fcntl=false
13227         val="$undef"
13228         ;;
13229 esac
13230 set i_fcntl
13231 eval $setvar
13232
13233 : see if fork exists
13234 set fork d_fork
13235 eval $inlibc
13236
13237 : see if pipe exists
13238 set pipe d_pipe
13239 eval $inlibc
13240
13241 : check for non-blocking I/O stuff
13242 case "$h_sysfile" in
13243 true) echo "#include <sys/file.h>" > head.c;;
13244 *)
13245        case "$h_fcntl" in
13246        true) echo "#include <fcntl.h>" > head.c;;
13247        *) echo "#include <sys/fcntl.h>" > head.c;;
13248        esac
13249        ;;
13250 esac
13251 echo " "
13252 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13253 case "$o_nonblock" in
13254 '')
13255         $cat head.c > try.c
13256         $cat >>try.c <<EOCP
13257 #include <stdio.h>
13258 #$i_stdlib I_STDLIB
13259 #ifdef I_STDLIB
13260 #include <stdlib.h>
13261 #endif
13262 #$i_fcntl I_FCNTL
13263 #ifdef I_FCNTL
13264 #include <fcntl.h>
13265 #endif
13266 int main() {
13267 #ifdef O_NONBLOCK
13268         printf("O_NONBLOCK\n");
13269         exit(0);
13270 #endif
13271 #ifdef O_NDELAY
13272         printf("O_NDELAY\n");
13273         exit(0);
13274 #endif
13275 #ifdef FNDELAY
13276         printf("FNDELAY\n");
13277         exit(0);
13278 #endif
13279         exit(0);
13280 }
13281 EOCP
13282         set try
13283         if eval $compile_ok; then
13284                 o_nonblock=`$run ./try`
13285                 case "$o_nonblock" in
13286                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13287                 *) echo "Seems like we can use $o_nonblock.";;
13288                 esac
13289         else
13290                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13291         fi
13292         ;;
13293 *) echo "Using $hint value $o_nonblock.";;
13294 esac
13295 $rm_try
13296
13297 echo " "
13298 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13299 case "$eagain" in
13300 '')
13301         case "$d_fork:$d_pipe:$d_alarm" in
13302         define:define:define)
13303         $cat head.c > try.c
13304         $cat >>try.c <<EOCP
13305 #include <errno.h>
13306 #include <sys/types.h>
13307 #include <signal.h>
13308 #include <stdio.h>
13309 #$i_stdlib I_STDLIB
13310 #ifdef I_STDLIB
13311 #include <stdlib.h>
13312 #endif
13313 #$i_fcntl I_FCNTL
13314 #ifdef I_FCNTL
13315 #include <fcntl.h>
13316 #endif
13317 #define MY_O_NONBLOCK $o_nonblock
13318 #ifndef errno  /* XXX need better Configure test */
13319 extern int errno;
13320 #endif
13321 #$i_unistd I_UNISTD
13322 #ifdef I_UNISTD
13323 #include <unistd.h>
13324 #endif
13325 #include <string.h>
13326 $signal_t blech(int x) { exit(3); }
13327 EOCP
13328         $cat >> try.c <<'EOCP'
13329 int main()
13330 {
13331         int pd[2];
13332         int pu[2];
13333         char buf[1];
13334         char string[100];
13335         int ret;
13336
13337         ret = pipe(pd); /* Down: child -> parent */
13338         if (ret != 0)
13339                 exit(3);
13340         ret = pipe(pu); /* Up: parent -> child */
13341         if (ret != 0)
13342                 exit(3);
13343         if (0 != fork()) {
13344                 close(pd[1]);   /* Parent reads from pd[0] */
13345                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13346 #ifdef F_SETFL
13347                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13348                         exit(1);
13349 #else
13350                 exit(4);
13351 #endif
13352                 signal(SIGALRM, blech);
13353                 alarm(5);
13354                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13355                         exit(2);
13356                 sprintf(string, "%d\n", ret);
13357                 ret = write(2, string, strlen(string));
13358                 if (ret != strlen(string))
13359                         exit(3);
13360                 alarm(0);
13361 #ifdef EAGAIN
13362                 if (errno == EAGAIN) {
13363                         printf("EAGAIN\n");
13364                         goto ok;
13365                 }
13366 #endif
13367 #ifdef EWOULDBLOCK
13368                 if (errno == EWOULDBLOCK)
13369                         printf("EWOULDBLOCK\n");
13370 #endif
13371         ok:
13372                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13373                 if (ret != 1)
13374                         exit(3);
13375                 sleep(2);                               /* Give it time to close our pipe */
13376                 alarm(5);
13377                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13378                 alarm(0);
13379                 sprintf(string, "%d\n", ret);
13380                 ret = write(4, string, strlen(string));
13381                 if (ret != strlen(string))
13382                         exit(3);
13383                 exit(0);
13384         }
13385
13386         close(pd[0]);                   /* We write to pd[1] */
13387         close(pu[1]);                   /* We read from pu[0] */
13388         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13389         if (ret != 1)
13390                 exit(3);
13391         close(pd[1]);                   /* Pipe pd is now fully closed! */
13392         exit(0);                                /* Bye bye, thank you for playing! */
13393 }
13394 EOCP
13395         set try
13396         if eval $compile_ok; then
13397                 echo "$startsh" >mtry
13398                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13399                 chmod +x mtry
13400                 $run ./mtry >/dev/null 2>&1
13401                 case $? in
13402                 0) eagain=`$cat try.out`;;
13403                 1) echo "Could not perform non-blocking setting!";;
13404                 2) echo "I did a successful read() for something that was not there!";;
13405                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13406                 4) echo "Could not find F_SETFL!";;
13407                 *) echo "Something terribly wrong happened during testing.";;
13408                 esac
13409                 rd_nodata=`$cat try.ret`
13410                 echo "A read() system call with no data present returns $rd_nodata."
13411                 case "$rd_nodata" in
13412                 0|-1) ;;
13413                 *)
13414                         echo "(That's peculiar, fixing that to be -1.)"
13415                         rd_nodata=-1
13416                         ;;
13417                 esac
13418                 case "$eagain" in
13419                 '')
13420                         echo "Forcing errno EAGAIN on read() with no data available."
13421                         eagain=EAGAIN
13422                         ;;
13423                 *)
13424                         echo "Your read() sets errno to $eagain when no data is available."
13425                         ;;
13426                 esac
13427                 status=`$cat try.err`
13428                 case "$status" in
13429                 0) echo "And it correctly returns 0 to signal EOF.";;
13430                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13431                 *) echo "However, your read() returns '$status' on EOF??";;
13432                 esac
13433                 val="$define"
13434                 if test "$status" = "$rd_nodata"; then
13435                         echo "WARNING: you can't distinguish between EOF and no data!"
13436                         val="$undef"
13437                 fi
13438         else
13439                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13440                 eagain=EAGAIN
13441         fi
13442         ;;
13443         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13444                 eagain=EAGAIN
13445                 val="$define"
13446                 ;;
13447         esac
13448         set d_eofnblk
13449         eval $setvar
13450         ;;
13451 *)
13452         echo "Using $hint value $eagain."
13453         echo "Your read() returns $rd_nodata when no data is present."
13454         case "$d_eofnblk" in
13455         "$define") echo "And you can see EOF because read() returns 0.";;
13456         "$undef") echo "But you can't see EOF status from read() returned value.";;
13457         *)
13458                 echo "(Assuming you can't see EOF status from read anyway.)"
13459                 d_eofnblk=$undef
13460                 ;;
13461         esac
13462         ;;
13463 esac
13464 $rm_try head.c mtry
13465
13466 : see if erf exists
13467 set erf d_erf
13468 eval $inlibc
13469
13470 : see if erfc exists
13471 set erfc d_erfc
13472 eval $inlibc
13473
13474 : see if exp2 exists
13475 set exp2 d_exp2
13476 eval $inlibc
13477
13478 : see if expm1 exists
13479 set expm1 d_expm1
13480 eval $inlibc
13481
13482 : see if _ptr and _cnt from stdio act std
13483 echo " "
13484
13485 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13486         echo "(Looks like you have stdio.h from BSD.)"
13487         case "$stdio_ptr" in
13488         '') stdio_ptr='((fp)->_p)'
13489                 ptr_lval=$define
13490                 ;;
13491         *)      ptr_lval=$d_stdio_ptr_lval;;
13492         esac
13493         case "$stdio_cnt" in
13494         '') stdio_cnt='((fp)->_r)'
13495                 cnt_lval=$define
13496                 ;;
13497         *)      cnt_lval=$d_stdio_cnt_lval;;
13498         esac
13499         case "$stdio_base" in
13500         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13501         esac
13502         case "$stdio_bufsiz" in
13503         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13504         esac
13505 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13506         echo "(Looks like you have stdio.h from Linux.)"
13507         case "$stdio_ptr" in
13508         '') stdio_ptr='((fp)->_IO_read_ptr)'
13509                 ptr_lval=$define
13510                 ;;
13511         *)      ptr_lval=$d_stdio_ptr_lval;;
13512         esac
13513         case "$stdio_cnt" in
13514         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13515                 cnt_lval=$undef
13516                 ;;
13517         *)      cnt_lval=$d_stdio_cnt_lval;;
13518         esac
13519         case "$stdio_base" in
13520         '') stdio_base='((fp)->_IO_read_base)';;
13521         esac
13522         case "$stdio_bufsiz" in
13523         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13524         esac
13525 else
13526         case "$stdio_ptr" in
13527         '') stdio_ptr='((fp)->_ptr)'
13528                 ptr_lval=$define
13529                 ;;
13530         *)      ptr_lval=$d_stdio_ptr_lval;;
13531         esac
13532         case "$stdio_cnt" in
13533         '') stdio_cnt='((fp)->_cnt)'
13534                 cnt_lval=$define
13535                 ;;
13536         *)      cnt_lval=$d_stdio_cnt_lval;;
13537         esac
13538         case "$stdio_base" in
13539         '') stdio_base='((fp)->_base)';;
13540         esac
13541         case "$stdio_bufsiz" in
13542         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13543         esac
13544 fi
13545
13546 : test whether _ptr and _cnt really work
13547 echo "Checking how std your stdio is..." >&4
13548 $cat >try.c <<EOP
13549 #include <stdio.h>
13550 #$i_stdlib I_STDLIB
13551 #ifdef I_STDLIB
13552 #include <stdlib.h>
13553 #endif
13554 #define FILE_ptr(fp)    $stdio_ptr
13555 #define FILE_cnt(fp)    $stdio_cnt
13556 int main() {
13557         FILE *fp = fopen("try.c", "r");
13558         char c = getc(fp);
13559         if (
13560                 18 <= FILE_cnt(fp) &&
13561                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13562         )
13563                 exit(0);
13564         exit(1);
13565 }
13566 EOP
13567 val="$undef"
13568 set try
13569 if eval $compile && $to try.c; then
13570         if $run ./try; then
13571                 echo "Your stdio acts pretty std."
13572                 val="$define"
13573         else
13574                 echo "Your stdio isn't very std."
13575         fi
13576 else
13577         echo "Your stdio doesn't appear very std."
13578 fi
13579 $rm_try
13580
13581 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13582 # direct buffer manipulation no longer works.  The Configure tests
13583 # should be changed to correctly detect this, but until then,
13584 # the following check should at least let perl compile and run.
13585 # (This quick fix should be updated before 5.8.1.)
13586 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13587 # A. Dougherty, June 3, 2002.
13588 case "$d_gnulibc" in
13589 $define)
13590         case "$gnulibc_version" in
13591         2.[01]*)  ;;
13592         2.2) ;;
13593         2.2.[0-9]) ;;
13594         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13595                 val="$undef"
13596                 ;;
13597         esac
13598         ;;
13599 esac
13600 set d_stdstdio
13601 eval $setvar
13602
13603 : Can _ptr be used as an lvalue?
13604 case "$d_stdstdio$ptr_lval" in
13605 $define$define) val=$define ;;
13606 *) val=$undef ;;
13607 esac
13608 set d_stdio_ptr_lval
13609 eval $setvar
13610
13611 : Can _cnt be used as an lvalue?
13612 case "$d_stdstdio$cnt_lval" in
13613 $define$define) val=$define ;;
13614 *) val=$undef ;;
13615 esac
13616 set d_stdio_cnt_lval
13617 eval $setvar
13618
13619
13620 : test whether setting _ptr sets _cnt as a side effect
13621 d_stdio_ptr_lval_sets_cnt="$undef"
13622 d_stdio_ptr_lval_nochange_cnt="$undef"
13623 case "$d_stdio_ptr_lval$d_stdstdio" in
13624 $define$define)
13625         echo "Checking to see what happens if we set the stdio ptr..." >&4
13626 $cat >try.c <<EOP
13627 #include <stdio.h>
13628 /* Can we scream? */
13629 /* Eat dust sed :-) */
13630 /* In the buffer space, no one can hear you scream. */
13631 #$i_stdlib I_STDLIB
13632 #ifdef I_STDLIB
13633 #include <stdlib.h>
13634 #endif
13635 #define FILE_ptr(fp)    $stdio_ptr
13636 #define FILE_cnt(fp)    $stdio_cnt
13637 #include <sys/types.h>
13638 int main() {
13639         FILE *fp = fopen("try.c", "r");
13640         int c;
13641         char *ptr;
13642         size_t cnt;
13643         if (!fp) {
13644             puts("Fail even to read");
13645             exit(1);
13646         }
13647         c = getc(fp); /* Read away the first # */
13648         if (c == EOF) {
13649             puts("Fail even to read");
13650             exit(1);
13651         }
13652         if (!(
13653                 18 <= FILE_cnt(fp) &&
13654                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13655         )) {
13656                 puts("Fail even to read");
13657                 exit (1);
13658         }
13659         ptr = (char*) FILE_ptr(fp);
13660         cnt = (size_t)FILE_cnt(fp);
13661
13662         FILE_ptr(fp) += 42;
13663
13664         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13665                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13666                 exit (1);
13667         }
13668         if (FILE_cnt(fp) <= 20) {
13669                 printf ("Fail (<20 chars to test)");
13670                 exit (1);
13671         }
13672         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13673                 puts("Fail compare");
13674                 exit (1);
13675         }
13676         if (cnt == FILE_cnt(fp)) {
13677                 puts("Pass_unchanged");
13678                 exit (0);
13679         }
13680         if (FILE_cnt(fp) == (cnt - 42)) {
13681                 puts("Pass_changed");
13682                 exit (0);
13683         }
13684         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13685         return 1;
13686
13687 }
13688 EOP
13689         set try
13690         if eval $compile && $to try.c; then
13691                 case `$run ./try` in
13692                 Pass_changed)
13693                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13694                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13695                 Pass_unchanged)
13696                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13697                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13698                 Fail*)
13699                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13700                 *)
13701                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13702         esac
13703         else
13704                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13705         fi
13706         $rm_try
13707         ;;
13708 esac
13709
13710 : see if _base is also standard
13711 val="$undef"
13712 case "$d_stdstdio" in
13713 $define)
13714         $cat >try.c <<EOP
13715 #include <stdio.h>
13716 #$i_stdlib I_STDLIB
13717 #ifdef I_STDLIB
13718 #include <stdlib.h>
13719 #endif
13720 #define FILE_base(fp)   $stdio_base
13721 #define FILE_bufsiz(fp) $stdio_bufsiz
13722 int main() {
13723         FILE *fp = fopen("try.c", "r");
13724         char c = getc(fp);
13725         if (
13726                 19 <= FILE_bufsiz(fp) &&
13727                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13728         )
13729                 exit(0);
13730         exit(1);
13731 }
13732 EOP
13733         set try
13734         if eval $compile && $to try.c; then
13735                 if $run ./try; then
13736                         echo "And its _base field acts std."
13737                         val="$define"
13738                 else
13739                         echo "But its _base field isn't std."
13740                 fi
13741         else
13742                 echo "However, it seems to be lacking the _base field."
13743         fi
13744         $rm_try
13745         ;;
13746 esac
13747 set d_stdiobase
13748 eval $setvar
13749
13750 : see if fast_stdio exists
13751 val="$undef"
13752 case "$d_stdstdio:$d_stdio_ptr_lval" in
13753 "$define:$define")
13754         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13755         *$define*)
13756                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13757                 val="$define"
13758                 ;;
13759         esac
13760         ;;
13761 esac
13762 set d_faststdio
13763 eval $setvar
13764
13765 : see if fchdir exists
13766 set fchdir d_fchdir
13767 eval $inlibc
13768
13769 : see if fchmod exists
13770 set fchmod d_fchmod
13771 eval $inlibc
13772
13773 : check for openat, unlinkat, renameat, linkat, fchmodat
13774 set openat d_openat
13775 eval $inlibc
13776
13777 set unlinkat d_unlinkat
13778 eval $inlibc
13779
13780 set renameat d_renameat
13781 eval $inlibc
13782
13783 set linkat d_linkat
13784 eval $inlibc
13785
13786 set fchmodat d_fchmodat
13787 eval $inlibc
13788
13789 : see if fchown exists
13790 set fchown d_fchown
13791 eval $inlibc
13792
13793 : see if this is an fcntl system
13794 set fcntl d_fcntl
13795 eval $inlibc
13796
13797 : See if fcntl-based locking works.
13798 echo " "
13799 $cat >try.c <<EOCP
13800 #$i_stdlib I_STDLIB
13801 #ifdef I_STDLIB
13802 #include <stdlib.h>
13803 #endif
13804 #include <unistd.h>
13805 #include <fcntl.h>
13806 #include <signal.h>
13807 $signal_t blech(int x) { exit(3); }
13808 int main() {
13809 #if defined(F_SETLK) && defined(F_SETLKW)
13810      struct flock flock;
13811      int retval, fd;
13812      fd = open("try.c", O_RDONLY);
13813      flock.l_type = F_RDLCK;
13814      flock.l_whence = SEEK_SET;
13815      flock.l_start = flock.l_len = 0;
13816      signal(SIGALRM, blech);
13817      alarm(10);
13818      retval = fcntl(fd, F_SETLK, &flock);
13819      close(fd);
13820      (retval < 0 ? exit(2) : exit(0));
13821 #else
13822      exit(2);
13823 #endif
13824 }
13825 EOCP
13826 echo "Checking if fcntl-based file locking works... "
13827 case "$d_fcntl" in
13828 "$define")
13829         set try
13830         if eval $compile_ok; then
13831                 if $run ./try; then
13832                         echo "Yes, it seems to work."
13833                         val="$define"
13834                 else
13835                         echo "Nope, it didn't work."
13836                         val="$undef"
13837                         case "$?" in
13838                         3) $cat >&4 <<EOM
13839 ***
13840 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13841 *** This is (almost) impossible.
13842 *** If your NFS lock daemons are not feeling well, something like
13843 *** this may happen, please investigate.  Cannot continue, aborting.
13844 ***
13845 EOM
13846                                 exit 1
13847                                 ;;
13848                         esac
13849                 fi
13850         else
13851                 echo "I'm unable to compile the test program, so I'll assume not."
13852                 val="$undef"
13853         fi
13854         ;;
13855 *) val="$undef";
13856         echo "Nope, since you don't even have fcntl()."
13857         ;;
13858 esac
13859 set d_fcntl_can_lock
13860 eval $setvar
13861 $rm_try
13862
13863 : check for fd_set items
13864 $cat <<EOM
13865
13866 Checking to see how well your C compiler handles fd_set and friends ...
13867 EOM
13868 $cat >try.c <<EOCP
13869 #$i_stdlib I_STDLIB
13870 #ifdef I_STDLIB
13871 #include <stdlib.h>
13872 #endif
13873 #$i_systime I_SYS_TIME
13874 #$i_sysselct I_SYS_SELECT
13875 #$d_socket HAS_SOCKET
13876 #include <sys/types.h>
13877 #ifdef HAS_SOCKET
13878 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13879 #endif
13880 #ifdef I_SYS_TIME
13881 #include <sys/time.h>
13882 #endif
13883 #ifdef I_SYS_SELECT
13884 #include <sys/select.h>
13885 #endif
13886 int main() {
13887         fd_set fds;
13888
13889 #ifdef TRYBITS
13890         if(fds.fds_bits);
13891 #endif
13892
13893 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13894         exit(0);
13895 #else
13896         exit(1);
13897 #endif
13898 }
13899 EOCP
13900 set try -DTRYBITS
13901 if eval $compile; then
13902         d_fds_bits="$define"
13903         d_fd_set="$define"
13904         echo "Well, your system knows about the normal fd_set typedef..." >&4
13905         if $run ./try; then
13906                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13907                 d_fd_macros="$define"
13908         else
13909                 $cat >&4 <<'EOM'
13910 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13911 EOM
13912                 d_fd_macros="$undef"
13913         fi
13914 else
13915         $cat <<'EOM'
13916 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13917 EOM
13918         set try
13919         if eval $compile; then
13920                 d_fds_bits="$undef"
13921                 d_fd_set="$define"
13922                 echo "Well, your system has some sort of fd_set available..." >&4
13923                 if $run ./try; then
13924                         echo "and you have the normal fd_set macros." >&4
13925                         d_fd_macros="$define"
13926                 else
13927                         $cat <<'EOM'
13928 but not the normal fd_set macros!  Gross!  More work for me...
13929 EOM
13930                         d_fd_macros="$undef"
13931                 fi
13932         else
13933         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13934                 d_fd_set="$undef"
13935                 d_fds_bits="$undef"
13936                 d_fd_macros="$undef"
13937         fi
13938 fi
13939 $rm_try
13940
13941 : see if fdclose exists
13942 set fdclose d_fdclose
13943 eval $inlibc
13944
13945 : see if fdim exists
13946 set fdim d_fdim
13947 eval $inlibc
13948
13949 : see if fegetround exists
13950 set fegetround d_fegetround
13951 eval $inlibc
13952
13953 : see if fgetpos exists
13954 set fgetpos d_fgetpos
13955 eval $inlibc
13956
13957 : see if finite exists
13958 set finite d_finite
13959 eval $inlibc
13960
13961 : see if finitel exists
13962 set finitel d_finitel
13963 eval $inlibc
13964
13965 : see if flock exists
13966 set flock d_flock
13967 eval $inlibc
13968
13969 : see if prototype for flock is available
13970 echo " "
13971 set d_flockproto flock $i_sysfile sys/file.h
13972 eval $hasproto
13973
13974 : see if fma exists
13975 set fma d_fma
13976 eval $inlibc
13977
13978 : see if fmax exists
13979 set fmax d_fmax
13980 eval $inlibc
13981
13982 : see if fmin exists
13983 set fmin d_fmin
13984 eval $inlibc
13985
13986 : see if fp_class exists
13987 set fp_class d_fp_class
13988 eval $inlibc
13989
13990 : check for fpclassify
13991 echo "Checking to see if you have fpclassify..." >&4
13992 $cat >try.c <<EOCP
13993 #include <math.h>
13994 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13995 EOCP
13996 set try
13997 if eval $compile; then
13998         val="$define"
13999         echo "You have fpclassify."
14000 else
14001         val="$undef"
14002         echo "You do not have fpclassify."
14003 fi
14004 $rm_try
14005 set d_fpclassify
14006 eval $setvar
14007
14008 : see if fp_classify exists
14009 set fp_classify d_fp_classify
14010 eval $inlibc
14011
14012 : see if fp_classl exists
14013 set fp_classl d_fp_classl
14014 eval $inlibc
14015
14016 : see if pathconf exists
14017 set pathconf d_pathconf
14018 eval $inlibc
14019
14020 : see if fpathconf exists
14021 set fpathconf d_fpathconf
14022 eval $inlibc
14023
14024 : see if fpclass exists
14025 set fpclass d_fpclass
14026 eval $inlibc
14027
14028 : see if fpclassl exists
14029 set fpclassl d_fpclassl
14030 eval $inlibc
14031
14032 : see if fpgetround exists
14033 set fpgetround d_fpgetround
14034 eval $inlibc
14035
14036 : check for fpos64_t
14037 echo " "
14038 echo "Checking to see if you have fpos64_t..." >&4
14039 $cat >try.c <<EOCP
14040 #include <stdio.h>
14041 int main() { fpos64_t x = 7; }
14042 EOCP
14043 set try
14044 if eval $compile; then
14045         val="$define"
14046         echo "You have fpos64_t."
14047 else
14048         val="$undef"
14049         echo "You do not have fpos64_t."
14050         case "$fpossize" in
14051         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14052         esac
14053 fi
14054 $rm_try
14055 set d_fpos64_t
14056 eval $setvar
14057
14058 : see if frexpl exists
14059 set frexpl d_frexpl
14060 eval $inlibc
14061
14062 : see if this is a sys/param system
14063 set sys/param.h i_sysparam
14064 eval $inhdr
14065
14066 : see if this is a sys/mount.h system
14067 set sys/mount.h i_sysmount
14068 eval $inhdr
14069
14070 : Check for fs_data_s
14071 echo " "
14072 echo "Checking to see if your system supports struct fs_data..." >&4
14073 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14074 eval $hasstruct
14075 case "$d_fs_data_s" in
14076 "$define")      echo "Yes, it does."   ;;
14077 *)              echo "No, it doesn't." ;;
14078 esac
14079
14080 : see if fseeko exists
14081 set fseeko d_fseeko
14082 eval $inlibc
14083 case "$longsize" in
14084 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14085 esac
14086
14087 : see if fsetpos exists
14088 set fsetpos d_fsetpos
14089 eval $inlibc
14090
14091 : see if fstatfs exists
14092 set fstatfs d_fstatfs
14093 eval $inlibc
14094
14095 : see if statvfs exists
14096 set statvfs d_statvfs
14097 eval $inlibc
14098
14099 : see if fstatvfs exists
14100 set fstatvfs d_fstatvfs
14101 eval $inlibc
14102
14103 : see if fsync exists
14104 set fsync d_fsync
14105 eval $inlibc
14106
14107 : see if ftello exists
14108 set ftello d_ftello
14109 eval $inlibc
14110 case "$longsize" in
14111 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14112 esac
14113
14114 : check for a working futimes
14115 d_futimes="$undef"
14116 echo " "
14117 echo "Checking if you have a working futimes()" >&4
14118 $cat >try.c <<EOCP
14119 #include <stdio.h>
14120 #include <stdlib.h>
14121 #include <sys/time.h>
14122 #include <errno.h>
14123 #include <fcntl.h>
14124 #include <stdlib.h>
14125
14126 int main ()
14127 {
14128     int fd, rv;
14129     fd = open ("try.c", O_RDWR);
14130     if (-1 == fd) exit (1);
14131     rv = futimes (fd, NULL);
14132     exit (rv == -1 ? errno : 0);
14133 }
14134 EOCP
14135 set try
14136 if eval $compile; then
14137     `$run ./try`
14138     rc=$?
14139     case "$rc" in
14140         0)  echo "Yes, you have" >&4
14141             d_futimes="$define"
14142             ;;
14143         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14144             ;;
14145     esac
14146 else
14147     echo "No, it does not (probably harmless)" >&4
14148 fi
14149 $rm_try
14150
14151 : look for gai_strerror
14152 echo " "
14153 $cat >try.c <<'EOCP'
14154 #include <sys/types.h>
14155 #include <sys/socket.h>
14156 #include <netdb.h>
14157 int main ()
14158 {
14159     return (gai_strerror (0) ? 0 : 1);
14160     }
14161 EOCP
14162 set try
14163 val="$undef"
14164 if eval $compile; then
14165     `$run ./try`
14166     case "$?" in
14167         0)  echo "A working gai_strerror() found." >&4
14168             val="$define" ;;
14169         *)  echo "gai_strerror() found, but it doesn't work" >&4
14170             ;;
14171         esac
14172 else
14173     echo "gai_strerror() NOT found." >&4
14174     fi
14175 set d_gai_strerror
14176 eval $setvar
14177 $rm_try
14178
14179 : see if ndbm.h is available
14180 set ndbm.h i_ndbm
14181 eval $inhdr
14182 : Compatibility location for RedHat 7.1
14183 set gdbm/ndbm.h i_gdbmndbm
14184 eval $inhdr
14185 : Compatibility location for Debian 4.0
14186 set gdbm-ndbm.h i_gdbm_ndbm
14187 eval $inhdr
14188
14189 val="$undef"
14190 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14191         : see if dbm_open exists
14192         set dbm_open d_dbm_open
14193         eval $inlibc
14194         case "$d_dbm_open" in
14195         $undef)
14196                 i_ndbm="$undef"
14197                 i_gdbmndbm="$undef"
14198                 i_gdbm_ndbm="$undef"
14199                 echo "We won't be including <ndbm.h>"
14200                 val="$undef"
14201                 ;;
14202         *) val="$define"
14203            ;;
14204         esac
14205 fi
14206 set d_ndbm
14207 eval $setvar
14208
14209 ndbm_hdr_protochk='name=$1; hdr=$2;
14210 eval "ihdr=\$""i_$name";
14211 val="$undef";
14212 if $test "$ihdr" = "$define"; then
14213         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14214         case "$d_cplusplus" in
14215         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14216         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14217         esac;
14218         case "$val" in
14219         $define) $echo "Your <$hdr> seems to have prototypes";;
14220         *) $echo "Your <$hdr> does not seem to have prototypes";;
14221         esac;
14222 fi;
14223 set "d_${name}_h_uses_prototypes";
14224 eval $setvar'
14225
14226 set ndbm ndbm.h
14227 eval $ndbm_hdr_protochk
14228 set gdbmndbm gdbm/ndbm.h
14229 eval $ndbm_hdr_protochk
14230 set gdbm_ndbm gdbm-ndbm.h
14231 eval $ndbm_hdr_protochk
14232
14233 : see if getaddrinfo exists
14234 set getaddrinfo d_getaddrinfo
14235 eval $inlibc
14236
14237 : see if getcwd exists
14238 set getcwd d_getcwd
14239 eval $inlibc
14240
14241 : see if getespwnam exists
14242 set getespwnam d_getespwnam
14243 eval $inlibc
14244
14245 : see if getfsstat exists
14246 set getfsstat d_getfsstat
14247 eval $inlibc
14248
14249 : see if getgrent exists
14250 set getgrent d_getgrent
14251 eval $inlibc
14252
14253 : see if getgrent_r exists
14254 set getgrent_r d_getgrent_r
14255 eval $inlibc
14256 case "$d_getgrent_r" in
14257 "$define")
14258         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14259         case "$d_getgrent_r_proto:$usethreads" in
14260         ":define")      d_getgrent_r_proto=define
14261                 set d_getgrent_r_proto getgrent_r $hdrs
14262                 eval $hasproto ;;
14263         *)      ;;
14264         esac
14265         case "$d_getgrent_r_proto" in
14266         define)
14267         case "$getgrent_r_proto" in
14268         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14269         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14270         esac
14271         case "$getgrent_r_proto" in
14272         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14273         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14274         esac
14275         case "$getgrent_r_proto" in
14276         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14277         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14278         esac
14279         case "$getgrent_r_proto" in
14280         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14281         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14282         esac
14283         case "$getgrent_r_proto" in
14284         ''|0) try='int getgrent_r(struct group*, char*, int);'
14285         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14286         esac
14287         case "$getgrent_r_proto" in
14288         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14289         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14290         esac
14291         case "$getgrent_r_proto" in
14292         ''|0)   d_getgrent_r=undef
14293                 getgrent_r_proto=0
14294                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14295         * )     case "$getgrent_r_proto" in
14296                 REENTRANT_PROTO*) ;;
14297                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14298                 esac
14299                 echo "Prototype: $try" ;;
14300         esac
14301         ;;
14302         *)      case "$usethreads" in
14303                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14304                 esac
14305                 d_getgrent_r=undef
14306                 getgrent_r_proto=0
14307                 ;;
14308         esac
14309         ;;
14310 *)      getgrent_r_proto=0
14311         ;;
14312 esac
14313
14314 : see if getgrgid_r exists
14315 set getgrgid_r d_getgrgid_r
14316 eval $inlibc
14317 case "$d_getgrgid_r" in
14318 "$define")
14319         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14320         case "$d_getgrgid_r_proto:$usethreads" in
14321         ":define")      d_getgrgid_r_proto=define
14322                 set d_getgrgid_r_proto getgrgid_r $hdrs
14323                 eval $hasproto ;;
14324         *)      ;;
14325         esac
14326         case "$d_getgrgid_r_proto" in
14327         define)
14328         case "$getgrgid_r_proto" in
14329         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14330         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14331         esac
14332         case "$getgrgid_r_proto" in
14333         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14334         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14335         esac
14336         case "$getgrgid_r_proto" in
14337         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14338         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14339         esac
14340         case "$getgrgid_r_proto" in
14341         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14342         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14343         esac
14344         case "$getgrgid_r_proto" in
14345         ''|0)   d_getgrgid_r=undef
14346                 getgrgid_r_proto=0
14347                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14348         * )     case "$getgrgid_r_proto" in
14349                 REENTRANT_PROTO*) ;;
14350                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14351                 esac
14352                 echo "Prototype: $try" ;;
14353         esac
14354         ;;
14355         *)      case "$usethreads" in
14356                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14357                 esac
14358                 d_getgrgid_r=undef
14359                 getgrgid_r_proto=0
14360                 ;;
14361         esac
14362         ;;
14363 *)      getgrgid_r_proto=0
14364         ;;
14365 esac
14366
14367 : see if getgrnam_r exists
14368 set getgrnam_r d_getgrnam_r
14369 eval $inlibc
14370 case "$d_getgrnam_r" in
14371 "$define")
14372         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14373         case "$d_getgrnam_r_proto:$usethreads" in
14374         ":define")      d_getgrnam_r_proto=define
14375                 set d_getgrnam_r_proto getgrnam_r $hdrs
14376                 eval $hasproto ;;
14377         *)      ;;
14378         esac
14379         case "$d_getgrnam_r_proto" in
14380         define)
14381         case "$getgrnam_r_proto" in
14382         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14383         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14384         esac
14385         case "$getgrnam_r_proto" in
14386         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14387         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14388         esac
14389         case "$getgrnam_r_proto" in
14390         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14391         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14392         esac
14393         case "$getgrnam_r_proto" in
14394         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14395         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14396         esac
14397         case "$getgrnam_r_proto" in
14398         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14399         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14400         esac
14401         case "$getgrnam_r_proto" in
14402         ''|0)   d_getgrnam_r=undef
14403                 getgrnam_r_proto=0
14404                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14405         * )     case "$getgrnam_r_proto" in
14406                 REENTRANT_PROTO*) ;;
14407                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14408                 esac
14409                 echo "Prototype: $try" ;;
14410         esac
14411         ;;
14412         *)      case "$usethreads" in
14413                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14414                 esac
14415                 d_getgrnam_r=undef
14416                 getgrnam_r_proto=0
14417                 ;;
14418         esac
14419         ;;
14420 *)      getgrnam_r_proto=0
14421         ;;
14422 esac
14423
14424 : see if gethostbyaddr exists
14425 set gethostbyaddr d_gethbyaddr
14426 eval $inlibc
14427
14428 : see if gethostbyname exists
14429 set gethostbyname d_gethbyname
14430 eval $inlibc
14431
14432 : see if gethostent exists
14433 set gethostent d_gethent
14434 eval $inlibc
14435
14436 : see how we will look up host name
14437 echo " "
14438 call=''
14439 if set gethostname val -f d_gethname; eval $csym; $val; then
14440         echo 'gethostname() found.' >&4
14441         d_gethname="$define"
14442         call=gethostname
14443 fi
14444 if set uname val -f d_uname; eval $csym; $val; then
14445         if ./xenix; then
14446                 $cat <<'EOM'
14447 uname() was found, but you're running xenix, and older versions of xenix
14448 have a broken uname(). If you don't really know whether your xenix is old
14449 enough to have a broken system call, use the default answer.
14450
14451 EOM
14452                 dflt=y
14453                 case "$d_uname" in
14454                 "$define") dflt=n;;
14455                 esac
14456                 rp='Is your uname() broken?'
14457                 . ./myread
14458                 case "$ans" in
14459                 n*) d_uname="$define"; call=uname;;
14460                 esac
14461         else
14462                 echo 'uname() found.' >&4
14463                 d_uname="$define"
14464                 case "$call" in
14465                 '') call=uname ;;
14466                 esac
14467         fi
14468 fi
14469 case "$d_gethname" in
14470 '') d_gethname="$undef";;
14471 esac
14472 case "$d_uname" in
14473 '') d_uname="$undef";;
14474 esac
14475 case "$d_uname$d_gethname" in
14476 *define*)
14477         dflt=n
14478         cat <<EOM
14479
14480 Every now and then someone has a $call() that lies about the hostname
14481 but can't be fixed for political or economic reasons.  If you wish, I can
14482 pretend $call() isn't there and maybe compute hostname at run-time
14483 thanks to the '$phostname' command.
14484
14485 EOM
14486         rp="Shall I ignore $call() from now on?"
14487         . ./myread
14488         case "$ans" in
14489         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14490         esac;;
14491 esac
14492 case "$phostname" in
14493 '') aphostname='';;
14494 *) case "$aphostname" in
14495         /*) ;;
14496         *) set X $phostname
14497                 shift
14498                 file=$1
14499                 shift
14500                 file=`./loc $file $file $pth`
14501                 aphostname=`echo $file $*`
14502                 ;;
14503         esac
14504         ;;
14505 esac
14506 case "$d_uname$d_gethname" in
14507 *define*) ;;
14508 *)
14509         case "$phostname" in
14510         '')
14511                 echo "There will be no way for $package to get your hostname." >&4;;
14512         *)
14513         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14514                 ;;
14515         esac;;
14516 esac
14517 case "$d_phostname" in
14518 '') d_phostname="$undef";;
14519 esac
14520
14521 : see if gethostbyaddr_r exists
14522 set gethostbyaddr_r d_gethostbyaddr_r
14523 eval $inlibc
14524 case "$d_gethostbyaddr_r" in
14525 "$define")
14526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14527         case "$d_gethostbyaddr_r_proto:$usethreads" in
14528         ":define")      d_gethostbyaddr_r_proto=define
14529                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14530                 eval $hasproto ;;
14531         *)      ;;
14532         esac
14533         case "$d_gethostbyaddr_r_proto" in
14534         define)
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14541         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14542         esac
14543         case "$gethostbyaddr_r_proto" in
14544         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14545         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14546         esac
14547         case "$gethostbyaddr_r_proto" in
14548         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14549         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14550         esac
14551         case "$gethostbyaddr_r_proto" in
14552         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14553         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14554         esac
14555         case "$gethostbyaddr_r_proto" in
14556         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14557         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14558         esac
14559         case "$gethostbyaddr_r_proto" in
14560         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14561         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14562         esac
14563         case "$gethostbyaddr_r_proto" in
14564         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14565         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14566         esac
14567         case "$gethostbyaddr_r_proto" in
14568         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14569         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14570         esac
14571         case "$gethostbyaddr_r_proto" in
14572         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14573         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14574         esac
14575         case "$gethostbyaddr_r_proto" in
14576         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14577         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14578         esac
14579         case "$gethostbyaddr_r_proto" in
14580         ''|0)   d_gethostbyaddr_r=undef
14581                 gethostbyaddr_r_proto=0
14582                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14583         * )     case "$gethostbyaddr_r_proto" in
14584                 REENTRANT_PROTO*) ;;
14585                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14586                 esac
14587                 echo "Prototype: $try" ;;
14588         esac
14589         ;;
14590         *)      case "$usethreads" in
14591                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14592                 esac
14593                 d_gethostbyaddr_r=undef
14594                 gethostbyaddr_r_proto=0
14595                 ;;
14596         esac
14597         ;;
14598 *)      gethostbyaddr_r_proto=0
14599         ;;
14600 esac
14601
14602 : see if gethostbyname_r exists
14603 set gethostbyname_r d_gethostbyname_r
14604 eval $inlibc
14605 case "$d_gethostbyname_r" in
14606 "$define")
14607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14608         case "$d_gethostbyname_r_proto:$usethreads" in
14609         ":define")      d_gethostbyname_r_proto=define
14610                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14611                 eval $hasproto ;;
14612         *)      ;;
14613         esac
14614         case "$d_gethostbyname_r_proto" in
14615         define)
14616         case "$gethostbyname_r_proto" in
14617         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14618         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14619         esac
14620         case "$gethostbyname_r_proto" in
14621         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14622         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14623         esac
14624         case "$gethostbyname_r_proto" in
14625         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14626         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14627         esac
14628         case "$gethostbyname_r_proto" in
14629         ''|0)   d_gethostbyname_r=undef
14630                 gethostbyname_r_proto=0
14631                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14632         * )     case "$gethostbyname_r_proto" in
14633                 REENTRANT_PROTO*) ;;
14634                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14635                 esac
14636                 echo "Prototype: $try" ;;
14637         esac
14638         ;;
14639         *)      case "$usethreads" in
14640                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14641                 esac
14642                 d_gethostbyname_r=undef
14643                 gethostbyname_r_proto=0
14644                 ;;
14645         esac
14646         ;;
14647 *)      gethostbyname_r_proto=0
14648         ;;
14649 esac
14650
14651 : see if gethostent_r exists
14652 set gethostent_r d_gethostent_r
14653 eval $inlibc
14654 case "$d_gethostent_r" in
14655 "$define")
14656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14657         case "$d_gethostent_r_proto:$usethreads" in
14658         ":define")      d_gethostent_r_proto=define
14659                 set d_gethostent_r_proto gethostent_r $hdrs
14660                 eval $hasproto ;;
14661         *)      ;;
14662         esac
14663         case "$d_gethostent_r_proto" in
14664         define)
14665         case "$gethostent_r_proto" in
14666         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14667         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14668         esac
14669         case "$gethostent_r_proto" in
14670         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14671         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14672         esac
14673         case "$gethostent_r_proto" in
14674         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14675         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14676         esac
14677         case "$gethostent_r_proto" in
14678         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14679         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14680         esac
14681         case "$gethostent_r_proto" in
14682         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14683         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14684         esac
14685         case "$gethostent_r_proto" in
14686         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14687         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14688         esac
14689         case "$gethostent_r_proto" in
14690         ''|0)   d_gethostent_r=undef
14691                 gethostent_r_proto=0
14692                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14693         * )     case "$gethostent_r_proto" in
14694                 REENTRANT_PROTO*) ;;
14695                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14696                 esac
14697                 echo "Prototype: $try" ;;
14698         esac
14699         ;;
14700         *)      case "$usethreads" in
14701                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14702                 esac
14703                 d_gethostent_r=undef
14704                 gethostent_r_proto=0
14705                 ;;
14706         esac
14707         ;;
14708 *)      gethostent_r_proto=0
14709         ;;
14710 esac
14711
14712 : see if prototypes for various gethostxxx netdb.h functions are available
14713 echo " "
14714 set d_gethostprotos gethostent $i_netdb netdb.h
14715 eval $hasproto
14716
14717 : see if getitimer exists
14718 set getitimer d_getitimer
14719 eval $inlibc
14720
14721 : see if getlogin exists
14722 set getlogin d_getlogin
14723 eval $inlibc
14724
14725 : see if getlogin_r exists
14726 set getlogin_r d_getlogin_r
14727 eval $inlibc
14728 case "$d_getlogin_r" in
14729 "$define")
14730         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14731         case "$d_getlogin_r_proto:$usethreads" in
14732         ":define")      d_getlogin_r_proto=define
14733                 set d_getlogin_r_proto getlogin_r $hdrs
14734                 eval $hasproto ;;
14735         *)      ;;
14736         esac
14737         case "$d_getlogin_r_proto" in
14738         define)
14739         case "$getlogin_r_proto" in
14740         ''|0) try='int getlogin_r(char*, size_t);'
14741         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14742         esac
14743         case "$getlogin_r_proto" in
14744         ''|0) try='int getlogin_r(char*, int);'
14745         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14746         esac
14747         case "$getlogin_r_proto" in
14748         ''|0) try='char* getlogin_r(char*, size_t);'
14749         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14750         esac
14751         case "$getlogin_r_proto" in
14752         ''|0) try='char* getlogin_r(char*, int);'
14753         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14754         esac
14755         case "$getlogin_r_proto" in
14756         ''|0)   d_getlogin_r=undef
14757                 getlogin_r_proto=0
14758                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14759         * )     case "$getlogin_r_proto" in
14760                 REENTRANT_PROTO*) ;;
14761                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14762                 esac
14763                 echo "Prototype: $try" ;;
14764         esac
14765         ;;
14766         *)      case "$usethreads" in
14767                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14768                 esac
14769                 d_getlogin_r=undef
14770                 getlogin_r_proto=0
14771                 ;;
14772         esac
14773         ;;
14774 *)      getlogin_r_proto=0
14775         ;;
14776 esac
14777
14778 : see if getmnt exists
14779 set getmnt d_getmnt
14780 eval $inlibc
14781
14782 : see if getmntent exists
14783 set getmntent d_getmntent
14784 eval $inlibc
14785
14786 : see if getnameinfo exists
14787 set getnameinfo d_getnameinfo
14788 eval $inlibc
14789
14790 : see if getnetbyaddr exists
14791 set getnetbyaddr d_getnbyaddr
14792 eval $inlibc
14793
14794 : see if getnetbyname exists
14795 set getnetbyname d_getnbyname
14796 eval $inlibc
14797
14798 : see if getnetent exists
14799 set getnetent d_getnent
14800 eval $inlibc
14801
14802 : see if getnetbyaddr_r exists
14803 set getnetbyaddr_r d_getnetbyaddr_r
14804 eval $inlibc
14805 case "$d_getnetbyaddr_r" in
14806 "$define")
14807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14808         case "$d_getnetbyaddr_r_proto:$usethreads" in
14809         ":define")      d_getnetbyaddr_r_proto=define
14810                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14811                 eval $hasproto ;;
14812         *)      ;;
14813         esac
14814         case "$d_getnetbyaddr_r_proto" in
14815         define)
14816         case "$getnetbyaddr_r_proto" in
14817         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14818         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14819         esac
14820         case "$getnetbyaddr_r_proto" in
14821         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14822         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14823         esac
14824         case "$getnetbyaddr_r_proto" in
14825         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14826         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14827         esac
14828         case "$getnetbyaddr_r_proto" in
14829         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14830         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14831         esac
14832         case "$getnetbyaddr_r_proto" in
14833         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14834         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14835         esac
14836         case "$getnetbyaddr_r_proto" in
14837         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14838         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14839         esac
14840         case "$getnetbyaddr_r_proto" in
14841         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14842         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14843         esac
14844         case "$getnetbyaddr_r_proto" in
14845         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14846         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14847         esac
14848         case "$getnetbyaddr_r_proto" in
14849         ''|0)   d_getnetbyaddr_r=undef
14850                 getnetbyaddr_r_proto=0
14851                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14852         * )     case "$getnetbyaddr_r_proto" in
14853                 REENTRANT_PROTO*) ;;
14854                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14855                 esac
14856                 echo "Prototype: $try" ;;
14857         esac
14858         ;;
14859         *)      case "$usethreads" in
14860                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14861                 esac
14862                 d_getnetbyaddr_r=undef
14863                 getnetbyaddr_r_proto=0
14864                 ;;
14865         esac
14866         ;;
14867 *)      getnetbyaddr_r_proto=0
14868         ;;
14869 esac
14870
14871 : see if getnetbyname_r exists
14872 set getnetbyname_r d_getnetbyname_r
14873 eval $inlibc
14874 case "$d_getnetbyname_r" in
14875 "$define")
14876         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14877         case "$d_getnetbyname_r_proto:$usethreads" in
14878         ":define")      d_getnetbyname_r_proto=define
14879                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14880                 eval $hasproto ;;
14881         *)      ;;
14882         esac
14883         case "$d_getnetbyname_r_proto" in
14884         define)
14885         case "$getnetbyname_r_proto" in
14886         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14887         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14888         esac
14889         case "$getnetbyname_r_proto" in
14890         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14891         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14892         esac
14893         case "$getnetbyname_r_proto" in
14894         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14895         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14896         esac
14897         case "$getnetbyname_r_proto" in
14898         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14899         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14900         esac
14901         case "$getnetbyname_r_proto" in
14902         ''|0)   d_getnetbyname_r=undef
14903                 getnetbyname_r_proto=0
14904                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14905         * )     case "$getnetbyname_r_proto" in
14906                 REENTRANT_PROTO*) ;;
14907                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14908                 esac
14909                 echo "Prototype: $try" ;;
14910         esac
14911         ;;
14912         *)      case "$usethreads" in
14913                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14914                 esac
14915                 d_getnetbyname_r=undef
14916                 getnetbyname_r_proto=0
14917                 ;;
14918         esac
14919         ;;
14920 *)      getnetbyname_r_proto=0
14921         ;;
14922 esac
14923
14924 : see if getnetent_r exists
14925 set getnetent_r d_getnetent_r
14926 eval $inlibc
14927 case "$d_getnetent_r" in
14928 "$define")
14929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14930         case "$d_getnetent_r_proto:$usethreads" in
14931         ":define")      d_getnetent_r_proto=define
14932                 set d_getnetent_r_proto getnetent_r $hdrs
14933                 eval $hasproto ;;
14934         *)      ;;
14935         esac
14936         case "$d_getnetent_r_proto" in
14937         define)
14938         case "$getnetent_r_proto" in
14939         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14940         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14941         esac
14942         case "$getnetent_r_proto" in
14943         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14944         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14945         esac
14946         case "$getnetent_r_proto" in
14947         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14948         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14949         esac
14950         case "$getnetent_r_proto" in
14951         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14952         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14953         esac
14954         case "$getnetent_r_proto" in
14955         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14956         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14957         esac
14958         case "$getnetent_r_proto" in
14959         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14960         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14961         esac
14962         case "$getnetent_r_proto" in
14963         ''|0)   d_getnetent_r=undef
14964                 getnetent_r_proto=0
14965                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14966         * )     case "$getnetent_r_proto" in
14967                 REENTRANT_PROTO*) ;;
14968                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14969                 esac
14970                 echo "Prototype: $try" ;;
14971         esac
14972         ;;
14973         *)      case "$usethreads" in
14974                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14975                 esac
14976                 d_getnetent_r=undef
14977                 getnetent_r_proto=0
14978                 ;;
14979         esac
14980         ;;
14981 *)      getnetent_r_proto=0
14982         ;;
14983 esac
14984
14985 : see if prototypes for various getnetxxx netdb.h functions are available
14986 echo " "
14987 set d_getnetprotos getnetent $i_netdb netdb.h
14988 eval $hasproto
14989
14990 : see if getpagesize exists
14991 set getpagesize d_getpagsz
14992 eval $inlibc
14993
14994 : Optional checks for getprotobyname and getprotobynumber
14995
14996 : see if getprotobyname exists
14997 set getprotobyname d_getpbyname
14998 eval $inlibc
14999
15000 : see if getprotobynumber exists
15001 set getprotobynumber d_getpbynumber
15002 eval $inlibc
15003
15004 : see if getprotoent exists
15005 set getprotoent d_getpent
15006 eval $inlibc
15007
15008 : see if getpgid exists
15009 set getpgid d_getpgid
15010 eval $inlibc
15011
15012 : see if getpgrp2 exists
15013 set getpgrp2 d_getpgrp2
15014 eval $inlibc
15015
15016 : see if getppid exists
15017 set getppid d_getppid
15018 eval $inlibc
15019
15020 : see if getpriority exists
15021 set getpriority d_getprior
15022 eval $inlibc
15023
15024 : see if getprotobyname_r exists
15025 set getprotobyname_r d_getprotobyname_r
15026 eval $inlibc
15027 case "$d_getprotobyname_r" in
15028 "$define")
15029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15030         case "$d_getprotobyname_r_proto:$usethreads" in
15031         ":define")      d_getprotobyname_r_proto=define
15032                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15033                 eval $hasproto ;;
15034         *)      ;;
15035         esac
15036         case "$d_getprotobyname_r_proto" in
15037         define)
15038         case "$getprotobyname_r_proto" in
15039         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15040         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15041         esac
15042         case "$getprotobyname_r_proto" in
15043         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15044         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15045         esac
15046         case "$getprotobyname_r_proto" in
15047         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15048         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15049         esac
15050         case "$getprotobyname_r_proto" in
15051         ''|0)   d_getprotobyname_r=undef
15052                 getprotobyname_r_proto=0
15053                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15054         * )     case "$getprotobyname_r_proto" in
15055                 REENTRANT_PROTO*) ;;
15056                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15057                 esac
15058                 echo "Prototype: $try" ;;
15059         esac
15060         ;;
15061         *)      case "$usethreads" in
15062                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15063                 esac
15064                 d_getprotobyname_r=undef
15065                 getprotobyname_r_proto=0
15066                 ;;
15067         esac
15068         ;;
15069 *)      getprotobyname_r_proto=0
15070         ;;
15071 esac
15072
15073 : see if getprotobynumber_r exists
15074 set getprotobynumber_r d_getprotobynumber_r
15075 eval $inlibc
15076 case "$d_getprotobynumber_r" in
15077 "$define")
15078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15079         case "$d_getprotobynumber_r_proto:$usethreads" in
15080         ":define")      d_getprotobynumber_r_proto=define
15081                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15082                 eval $hasproto ;;
15083         *)      ;;
15084         esac
15085         case "$d_getprotobynumber_r_proto" in
15086         define)
15087         case "$getprotobynumber_r_proto" in
15088         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15089         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15090         esac
15091         case "$getprotobynumber_r_proto" in
15092         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15093         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15094         esac
15095         case "$getprotobynumber_r_proto" in
15096         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15097         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15098         esac
15099         case "$getprotobynumber_r_proto" in
15100         ''|0)   d_getprotobynumber_r=undef
15101                 getprotobynumber_r_proto=0
15102                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15103         * )     case "$getprotobynumber_r_proto" in
15104                 REENTRANT_PROTO*) ;;
15105                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15106                 esac
15107                 echo "Prototype: $try" ;;
15108         esac
15109         ;;
15110         *)      case "$usethreads" in
15111                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15112                 esac
15113                 d_getprotobynumber_r=undef
15114                 getprotobynumber_r_proto=0
15115                 ;;
15116         esac
15117         ;;
15118 *)      getprotobynumber_r_proto=0
15119         ;;
15120 esac
15121
15122 : see if getprotoent_r exists
15123 set getprotoent_r d_getprotoent_r
15124 eval $inlibc
15125 case "$d_getprotoent_r" in
15126 "$define")
15127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15128         case "$d_getprotoent_r_proto:$usethreads" in
15129         ":define")      d_getprotoent_r_proto=define
15130                 set d_getprotoent_r_proto getprotoent_r $hdrs
15131                 eval $hasproto ;;
15132         *)      ;;
15133         esac
15134         case "$d_getprotoent_r_proto" in
15135         define)
15136         case "$getprotoent_r_proto" in
15137         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15138         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15139         esac
15140         case "$getprotoent_r_proto" in
15141         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15142         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15143         esac
15144         case "$getprotoent_r_proto" in
15145         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15146         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15147         esac
15148         case "$getprotoent_r_proto" in
15149         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15150         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15151         esac
15152         case "$getprotoent_r_proto" in
15153         ''|0)   d_getprotoent_r=undef
15154                 getprotoent_r_proto=0
15155                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15156         * )     case "$getprotoent_r_proto" in
15157                 REENTRANT_PROTO*) ;;
15158                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15159                 esac
15160                 echo "Prototype: $try" ;;
15161         esac
15162         ;;
15163         *)      case "$usethreads" in
15164                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15165                 esac
15166                 d_getprotoent_r=undef
15167                 getprotoent_r_proto=0
15168                 ;;
15169         esac
15170         ;;
15171 *)      getprotoent_r_proto=0
15172         ;;
15173 esac
15174
15175 : see if prototypes for various getprotoxxx netdb.h functions are available
15176 echo " "
15177 set d_getprotoprotos getprotoent $i_netdb netdb.h
15178 eval $hasproto
15179
15180 : see if getprpwnam exists
15181 set getprpwnam d_getprpwnam
15182 eval $inlibc
15183
15184 : see if getpwent exists
15185 set getpwent d_getpwent
15186 eval $inlibc
15187
15188 : see if getpwent_r exists
15189 set getpwent_r d_getpwent_r
15190 eval $inlibc
15191 case "$d_getpwent_r" in
15192 "$define")
15193         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15194         case "$d_getpwent_r_proto:$usethreads" in
15195         ":define")      d_getpwent_r_proto=define
15196                 set d_getpwent_r_proto getpwent_r $hdrs
15197                 eval $hasproto ;;
15198         *)      ;;
15199         esac
15200         case "$d_getpwent_r_proto" in
15201         define)
15202         case "$getpwent_r_proto" in
15203         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15204         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15205         esac
15206         case "$getpwent_r_proto" in
15207         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15208         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15209         esac
15210         case "$getpwent_r_proto" in
15211         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15212         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15213         esac
15214         case "$getpwent_r_proto" in
15215         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15216         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15217         esac
15218         case "$getpwent_r_proto" in
15219         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15220         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15221         esac
15222         case "$getpwent_r_proto" in
15223         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15224         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15225         esac
15226         case "$getpwent_r_proto" in
15227         ''|0)   d_getpwent_r=undef
15228                 getpwent_r_proto=0
15229                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15230         * )     case "$getpwent_r_proto" in
15231                 REENTRANT_PROTO*) ;;
15232                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15233                 esac
15234                 echo "Prototype: $try" ;;
15235         esac
15236         ;;
15237         *)      case "$usethreads" in
15238                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15239                 esac
15240                 d_getpwent_r=undef
15241                 getpwent_r_proto=0
15242                 ;;
15243         esac
15244         ;;
15245 *)      getpwent_r_proto=0
15246         ;;
15247 esac
15248
15249 : see if getpwnam_r exists
15250 set getpwnam_r d_getpwnam_r
15251 eval $inlibc
15252 case "$d_getpwnam_r" in
15253 "$define")
15254         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15255         case "$d_getpwnam_r_proto:$usethreads" in
15256         ":define")      d_getpwnam_r_proto=define
15257                 set d_getpwnam_r_proto getpwnam_r $hdrs
15258                 eval $hasproto ;;
15259         *)      ;;
15260         esac
15261         case "$d_getpwnam_r_proto" in
15262         define)
15263         case "$getpwnam_r_proto" in
15264         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15265         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15266         esac
15267         case "$getpwnam_r_proto" in
15268         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15269         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15270         esac
15271         case "$getpwnam_r_proto" in
15272         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15273         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15274         esac
15275         case "$getpwnam_r_proto" in
15276         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15277         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15278         esac
15279         case "$getpwnam_r_proto" in
15280         ''|0)   d_getpwnam_r=undef
15281                 getpwnam_r_proto=0
15282                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15283         * )     case "$getpwnam_r_proto" in
15284                 REENTRANT_PROTO*) ;;
15285                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15286                 esac
15287                 echo "Prototype: $try" ;;
15288         esac
15289         ;;
15290         *)      case "$usethreads" in
15291                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15292                 esac
15293                 d_getpwnam_r=undef
15294                 getpwnam_r_proto=0
15295                 ;;
15296         esac
15297         ;;
15298 *)      getpwnam_r_proto=0
15299         ;;
15300 esac
15301
15302 : see if getpwuid_r exists
15303 set getpwuid_r d_getpwuid_r
15304 eval $inlibc
15305 case "$d_getpwuid_r" in
15306 "$define")
15307         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15308         case "$d_getpwuid_r_proto:$usethreads" in
15309         ":define")      d_getpwuid_r_proto=define
15310                 set d_getpwuid_r_proto getpwuid_r $hdrs
15311                 eval $hasproto ;;
15312         *)      ;;
15313         esac
15314         case "$d_getpwuid_r_proto" in
15315         define)
15316         case "$getpwuid_r_proto" in
15317         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15318         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15319         esac
15320         case "$getpwuid_r_proto" in
15321         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15322         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15323         esac
15324         case "$getpwuid_r_proto" in
15325         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15326         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15327         esac
15328         case "$getpwuid_r_proto" in
15329         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15330         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15331         esac
15332         case "$getpwuid_r_proto" in
15333         ''|0)   d_getpwuid_r=undef
15334                 getpwuid_r_proto=0
15335                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15336         * )     case "$getpwuid_r_proto" in
15337                 REENTRANT_PROTO*) ;;
15338                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15339                 esac
15340                 echo "Prototype: $try" ;;
15341         esac
15342         ;;
15343         *)      case "$usethreads" in
15344                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15345                 esac
15346                 d_getpwuid_r=undef
15347                 getpwuid_r_proto=0
15348                 ;;
15349         esac
15350         ;;
15351 *)      getpwuid_r_proto=0
15352         ;;
15353 esac
15354
15355 : Optional checks for getsbyname and getsbyport
15356
15357 : see if getservbyname exists
15358 set getservbyname d_getsbyname
15359 eval $inlibc
15360
15361 : see if getservbyport exists
15362 set getservbyport d_getsbyport
15363 eval $inlibc
15364
15365 : see if getservent exists
15366 set getservent d_getsent
15367 eval $inlibc
15368
15369 : see if getservbyname_r exists
15370 set getservbyname_r d_getservbyname_r
15371 eval $inlibc
15372 case "$d_getservbyname_r" in
15373 "$define")
15374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15375         case "$d_getservbyname_r_proto:$usethreads" in
15376         ":define")      d_getservbyname_r_proto=define
15377                 set d_getservbyname_r_proto getservbyname_r $hdrs
15378                 eval $hasproto ;;
15379         *)      ;;
15380         esac
15381         case "$d_getservbyname_r_proto" in
15382         define)
15383         case "$getservbyname_r_proto" in
15384         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15385         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15386         esac
15387         case "$getservbyname_r_proto" in
15388         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15389         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15390         esac
15391         case "$getservbyname_r_proto" in
15392         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15393         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15394         esac
15395         case "$getservbyname_r_proto" in
15396         ''|0)   d_getservbyname_r=undef
15397                 getservbyname_r_proto=0
15398                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15399         * )     case "$getservbyname_r_proto" in
15400                 REENTRANT_PROTO*) ;;
15401                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15402                 esac
15403                 echo "Prototype: $try" ;;
15404         esac
15405         ;;
15406         *)      case "$usethreads" in
15407                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15408                 esac
15409                 d_getservbyname_r=undef
15410                 getservbyname_r_proto=0
15411                 ;;
15412         esac
15413         ;;
15414 *)      getservbyname_r_proto=0
15415         ;;
15416 esac
15417
15418 : see if getservbyport_r exists
15419 set getservbyport_r d_getservbyport_r
15420 eval $inlibc
15421 case "$d_getservbyport_r" in
15422 "$define")
15423         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15424         case "$d_getservbyport_r_proto:$usethreads" in
15425         ":define")      d_getservbyport_r_proto=define
15426                 set d_getservbyport_r_proto getservbyport_r $hdrs
15427                 eval $hasproto ;;
15428         *)      ;;
15429         esac
15430         case "$d_getservbyport_r_proto" in
15431         define)
15432         case "$getservbyport_r_proto" in
15433         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15434         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15435         esac
15436         case "$getservbyport_r_proto" in
15437         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15438         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15439         esac
15440         case "$getservbyport_r_proto" in
15441         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15442         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15443         esac
15444         case "$getservbyport_r_proto" in
15445         ''|0)   d_getservbyport_r=undef
15446                 getservbyport_r_proto=0
15447                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15448         * )     case "$getservbyport_r_proto" in
15449                 REENTRANT_PROTO*) ;;
15450                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15451                 esac
15452                 echo "Prototype: $try" ;;
15453         esac
15454         ;;
15455         *)      case "$usethreads" in
15456                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15457                 esac
15458                 d_getservbyport_r=undef
15459                 getservbyport_r_proto=0
15460                 ;;
15461         esac
15462         ;;
15463 *)      getservbyport_r_proto=0
15464         ;;
15465 esac
15466
15467 : see if getservent_r exists
15468 set getservent_r d_getservent_r
15469 eval $inlibc
15470 case "$d_getservent_r" in
15471 "$define")
15472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15473         case "$d_getservent_r_proto:$usethreads" in
15474         ":define")      d_getservent_r_proto=define
15475                 set d_getservent_r_proto getservent_r $hdrs
15476                 eval $hasproto ;;
15477         *)      ;;
15478         esac
15479         case "$d_getservent_r_proto" in
15480         define)
15481         case "$getservent_r_proto" in
15482         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15483         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15484         esac
15485         case "$getservent_r_proto" in
15486         ''|0) try='int getservent_r(struct servent*, char*, int);'
15487         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15488         esac
15489         case "$getservent_r_proto" in
15490         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15491         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15492         esac
15493         case "$getservent_r_proto" in
15494         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15495         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15496         esac
15497         case "$getservent_r_proto" in
15498         ''|0)   d_getservent_r=undef
15499                 getservent_r_proto=0
15500                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15501         * )     case "$getservent_r_proto" in
15502                 REENTRANT_PROTO*) ;;
15503                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15504                 esac
15505                 echo "Prototype: $try" ;;
15506         esac
15507         ;;
15508         *)      case "$usethreads" in
15509                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15510                 esac
15511                 d_getservent_r=undef
15512                 getservent_r_proto=0
15513                 ;;
15514         esac
15515         ;;
15516 *)      getservent_r_proto=0
15517         ;;
15518 esac
15519
15520 : see if prototypes for various getservxxx netdb.h functions are available
15521 echo " "
15522 set d_getservprotos getservent $i_netdb netdb.h
15523 eval $hasproto
15524
15525 : see if getspnam exists
15526 set getspnam d_getspnam
15527 eval $inlibc
15528
15529 : see if this is a shadow.h system
15530 set shadow.h i_shadow
15531 eval $inhdr
15532
15533 : see if getspnam_r exists
15534 set getspnam_r d_getspnam_r
15535 eval $inlibc
15536 case "$d_getspnam_r" in
15537 "$define")
15538         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15539         case "$d_getspnam_r_proto:$usethreads" in
15540         ":define")      d_getspnam_r_proto=define
15541                 set d_getspnam_r_proto getspnam_r $hdrs
15542                 eval $hasproto ;;
15543         *)      ;;
15544         esac
15545         case "$d_getspnam_r_proto" in
15546         define)
15547         case "$getspnam_r_proto" in
15548         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15549         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15550         esac
15551         case "$getspnam_r_proto" in
15552         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15553         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15554         esac
15555         case "$getspnam_r_proto" in
15556         ''|0)   d_getspnam_r=undef
15557                 getspnam_r_proto=0
15558                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15559         * )     case "$getspnam_r_proto" in
15560                 REENTRANT_PROTO*) ;;
15561                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15562                 esac
15563                 echo "Prototype: $try" ;;
15564         esac
15565         ;;
15566         *)      case "$usethreads" in
15567                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15568                 esac
15569                 d_getspnam_r=undef
15570                 getspnam_r_proto=0
15571                 ;;
15572         esac
15573         ;;
15574 *)      getspnam_r_proto=0
15575         ;;
15576 esac
15577
15578 : see if gettimeofday or ftime exists
15579 set gettimeofday d_gettimeod
15580 eval $inlibc
15581 case "$d_gettimeod" in
15582 "$undef")
15583         set ftime d_ftime 
15584         eval $inlibc
15585         ;;
15586 *)
15587         val="$undef"; set d_ftime; eval $setvar
15588         ;;
15589 esac
15590 case "$d_gettimeod$d_ftime" in
15591 "$undef$undef")
15592         echo " "
15593         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15594         ;;
15595 esac
15596
15597 : see if gmtime_r exists
15598 set gmtime_r d_gmtime_r
15599 eval $inlibc
15600 case "$d_gmtime_r" in
15601 "$define")
15602         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15603         case "$d_gmtime_r_proto:$usethreads" in
15604         ":define")      d_gmtime_r_proto=define
15605                 set d_gmtime_r_proto gmtime_r $hdrs
15606                 eval $hasproto ;;
15607         *)      ;;
15608         esac
15609         case "$d_gmtime_r_proto" in
15610         define)
15611         case "$gmtime_r_proto" in
15612         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15613         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15614         esac
15615         case "$gmtime_r_proto" in
15616         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15617         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15618         esac
15619         case "$gmtime_r_proto" in
15620         ''|0)   d_gmtime_r=undef
15621                 gmtime_r_proto=0
15622                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15623         * )     case "$gmtime_r_proto" in
15624                 REENTRANT_PROTO*) ;;
15625                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15626                 esac
15627                 echo "Prototype: $try" ;;
15628         esac
15629         ;;
15630         *)      case "$usethreads" in
15631                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15632                 esac
15633                 d_gmtime_r=undef
15634                 gmtime_r_proto=0
15635                 ;;
15636         esac
15637         ;;
15638 *)      gmtime_r_proto=0
15639         ;;
15640 esac
15641
15642 : see if hasmntopt exists
15643 set hasmntopt d_hasmntopt
15644 eval $inlibc
15645
15646 : see if this is a netinet/in.h or sys/in.h system
15647 set netinet/in.h i_niin sys/in.h i_sysin
15648 eval $inhdr
15649
15650 : see if arpa/inet.h has to be included
15651 set arpa/inet.h i_arpainet
15652 eval $inhdr
15653
15654 : see if htonl --and friends-- exists
15655 val=''
15656 set htonl val
15657 eval $inlibc
15658
15659 : Maybe they are macros.
15660 case "$val" in
15661 $undef)
15662         $cat >htonl.c <<EOM
15663 #include <stdio.h>
15664 #include <sys/types.h>
15665 #$i_niin I_NETINET_IN
15666 #$i_sysin I_SYS_IN
15667 #$i_arpainet I_ARPA_INET
15668 #ifdef I_NETINET_IN
15669 #include <netinet/in.h>
15670 #endif
15671 #ifdef I_SYS_IN
15672 #include <sys/in.h>
15673 #endif
15674 #ifdef I_ARPA_INET
15675 #include <arpa/inet.h>
15676 #endif
15677 #ifdef htonl
15678 printf("Defined as a macro.");
15679 #endif
15680 EOM
15681         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15682         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15683                 val="$define"
15684                 echo "But it seems to be defined as a macro." >&4
15685         fi
15686         $rm -f htonl.?
15687         ;;
15688 esac
15689 set d_htonl
15690 eval $setvar
15691
15692 : see if hypot exists
15693 set hypot d_hypot
15694 eval $inlibc
15695
15696 : see if ilogb exists
15697 set ilogb d_ilogb
15698 eval $inlibc
15699
15700 : see if ilogbl exists
15701 set ilogbl d_ilogbl
15702 eval $inlibc
15703
15704 : check whether inet_aton exists
15705 set inet_aton d_inetaton
15706 eval $inlibc
15707
15708 : see if inet_ntop exists
15709 set inet_ntop d_inetntop
15710 eval $inlibc
15711
15712 : see if inet_pton exists
15713 set inet_pton d_inetpton
15714 eval $inlibc
15715
15716 : Look for isascii
15717 echo " "
15718 $cat >isascii.c <<EOCP
15719 #include <stdio.h>
15720 #include <ctype.h>
15721 #$i_stdlib I_STDLIB
15722 #ifdef I_STDLIB
15723 #include <stdlib.h>
15724 #endif
15725 int main() {
15726         int c = 'A';
15727         if (isascii(c))
15728                 exit(0);
15729         else
15730                 exit(1);
15731 }
15732 EOCP
15733 set isascii
15734 if eval $compile; then
15735         echo "isascii() found." >&4
15736         val="$define"
15737 else
15738         echo "isascii() NOT found." >&4
15739         val="$undef"
15740 fi
15741 set d_isascii
15742 eval $setvar
15743 $rm -f isascii*
15744
15745 : Look for isblank
15746 echo " "
15747 $cat >isblank.c <<'EOCP'
15748 #include <stdio.h>
15749 #include <ctype.h>
15750 int main() {
15751         int c = ' ';
15752         if (isblank(c))
15753                 return 0 ;
15754         else
15755                 return 1 ;
15756 }
15757 EOCP
15758 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15759         echo "isblank() found." >&4
15760         val="$define"
15761 else
15762         echo "isblank() NOT found." >&4
15763         val="$undef"
15764 fi
15765 set d_isblank
15766 eval $setvar
15767 $rm -f isblank*
15768
15769 : check for isfinite
15770 echo "Checking to see if you have isfinite..." >&4
15771 $cat >try.c <<EOCP
15772 #include <math.h>
15773 int main() { return isfinite(0.0); }
15774 EOCP
15775 set try
15776 if eval $compile; then
15777         val="$define"
15778         echo "You have isfinite."
15779 else
15780         val="$undef"
15781         echo "You do not have isfinite."
15782 fi
15783 $rm_try
15784 set d_isfinite
15785 eval $setvar
15786
15787 : see if isfinitel exists
15788 set isfinitel d_isfinitel
15789 eval $inlibc
15790
15791 : check for isinf
15792 echo "Checking to see if you have isinf..." >&4
15793 $cat >try.c <<EOCP
15794 #include <math.h>
15795 int main() { return isinf(0.0); }
15796 EOCP
15797 set try
15798 if eval $compile; then
15799         val="$define"
15800         echo "You have isinf."
15801 else
15802         val="$undef"
15803         echo "You do not have isinf."
15804 fi
15805 $rm_try
15806 set d_isinf
15807 eval $setvar
15808
15809 : see if isinfl exists
15810 set isinfl d_isinfl
15811 eval $inlibc
15812
15813 : check for isless
15814 echo "Checking to see if you have isless..." >&4
15815 $cat >try.c <<EOCP
15816 #include <math.h>
15817 int main() { return isless(2.0, 1.0); }
15818 EOCP
15819 set try
15820 if eval $compile; then
15821         val="$define"
15822         echo "You have isless."
15823 else
15824         val="$undef"
15825         echo "You do not have isless."
15826 fi
15827 $rm_try
15828 set d_isless
15829 eval $setvar
15830
15831 : check for isnan
15832 echo "Checking to see if you have isnan..." >&4
15833 $cat >try.c <<EOCP
15834 #include <math.h>
15835 int main() { return isnan(0.0); }
15836 EOCP
15837 set try
15838 if eval $compile; then
15839         val="$define"
15840         echo "You have isnan."
15841 else
15842         val="$undef"
15843         echo "You do not have isnan."
15844 fi
15845 $rm_try
15846 set d_isnan
15847 eval $setvar
15848
15849 : see if isnanl exists
15850 set isnanl d_isnanl
15851 eval $inlibc
15852
15853 : check for isnormal
15854 echo "Checking to see if you have isnormal..." >&4
15855 $cat >try.c <<EOCP
15856 #include <math.h>
15857 int main() { return isnormal(0.0); }
15858 EOCP
15859 set try
15860 if eval $compile; then
15861         val="$define"
15862         echo "You have isnormal."
15863 else
15864         val="$undef"
15865         echo "You do not have isnormal."
15866 fi
15867 $rm_try
15868 set d_isnormal
15869 eval $setvar
15870
15871 : see if j0 exists
15872 set j0 d_j0
15873 eval $inlibc
15874
15875 : see if j0l exists
15876 set j0l d_j0l
15877 eval $inlibc
15878
15879 : see if killpg exists
15880 set killpg d_killpg
15881 eval $inlibc
15882
15883 : see if localeconv exists
15884 set localeconv d_locconv
15885 eval $inlibc
15886
15887 : see if libc has the POSIX.1-2008 currency locale rules
15888 case "$d_locconv:$d_lc_monetary_2008" in
15889 $define:)
15890         $cat >try.c <<EOCP
15891 #include <locale.h>
15892 int main() {
15893         struct lconv *lc = localeconv();
15894         char int_p_cs_precedes = lc->int_p_cs_precedes;
15895         return 0;
15896 }
15897 EOCP
15898         set try
15899         if eval $compile; then
15900                 d_lc_monetary_2008="$define"
15901         else
15902                 d_lc_monetary_2008="$undef"
15903         fi;
15904         $rm_try
15905         ;;
15906 esac
15907
15908 : see if lchown exists
15909 echo " "
15910 $cat > try.c <<EOCP
15911 #include <pwd.h>
15912 #include <stdio.h>
15913 #include <stdlib.h>
15914 #$i_unistd      I_UNISTD
15915 #ifdef I_UNISTD
15916 #  include <unistd.h>
15917 #endif
15918 int main(int argc, char *argv[])
15919 {
15920    if (lchown("./try.c", -1, getgid()) == -1) {
15921        exit(EXIT_FAILURE);
15922    }
15923    exit(EXIT_SUCCESS);
15924 }
15925 EOCP
15926 set try
15927 if eval $compile && ./try; then
15928     $echo "lchown() found." >&4
15929     val="$define"
15930 else
15931     $echo "lchown() NOT found." >&4
15932     val="$undef"
15933 fi
15934 set d_lchown
15935 eval $setvar
15936 $rm_try
15937
15938 : See if number of significant digits in a double precision number is known
15939 echo " "
15940 $cat >ldbl_dig.c <<EOM
15941 #include <limits.h>
15942 #include <float.h>
15943 #ifdef LDBL_DIG
15944 printf("Contains LDBL_DIG");
15945 #endif
15946 EOM
15947 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15948 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15949         echo "LDBL_DIG found." >&4
15950         val="$define"
15951 else
15952         echo "LDBL_DIG NOT found." >&4
15953         val="$undef"
15954 fi
15955 $rm -f ldbl_dig.?
15956 set d_ldbl_dig
15957 eval $setvar
15958
15959 : see if lgamma exists
15960 set lgamma d_lgamma
15961 eval $inlibc
15962
15963 : see if lgamma_r exists
15964 set lgamma_r d_lgamma_r
15965 eval $inlibc
15966
15967 : check to see if math.h defines _LIB_VERSION
15968 d_libm_lib_version="$undef"
15969 echo " "
15970 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15971 $cat >try.c <<EOCP
15972 #include <unistd.h>
15973 #include <math.h>
15974 int main (int argc, char *argv[])
15975 {
15976     printf ("%d\n", _LIB_VERSION);
15977     return (0);
15978     } /* main */
15979 EOCP
15980 set try
15981 if eval $compile; then
15982     foo=`$run ./try`
15983     echo "Yes, it does ($foo)" >&4
15984     d_libm_lib_version="$define"
15985 else
15986     echo "No, it does not (probably harmless)" >&4
15987     fi
15988 $rm_try
15989
15990 : see if link exists
15991 set link d_link
15992 eval $inlibc
15993
15994 : see if llrint exists
15995 set llrint d_llrint
15996 eval $inlibc
15997
15998 : see if llrintl exists
15999 set llrintl d_llrintl
16000 eval $inlibc
16001
16002 : see if llround exists
16003 set llround d_llround
16004 eval $inlibc
16005
16006 : see if llroundl exists
16007 set llroundl d_llroundl
16008 eval $inlibc
16009
16010 : see if localeconv_l exists
16011 set localeconv_l d_localeconv_l
16012 eval $inlibc
16013
16014 : see if localtime_r exists
16015 set localtime_r d_localtime_r
16016 eval $inlibc
16017 case "$d_localtime_r" in
16018 "$define")
16019         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16020         case "$d_localtime_r_proto:$usethreads" in
16021         ":define")      d_localtime_r_proto=define
16022                 set d_localtime_r_proto localtime_r $hdrs
16023                 eval $hasproto ;;
16024         *)      ;;
16025         esac
16026         case "$d_localtime_r_proto" in
16027         define)
16028         case "$localtime_r_proto" in
16029         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16030         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16031         esac
16032         case "$localtime_r_proto" in
16033         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16034         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16035         esac
16036         case "$localtime_r_proto" in
16037         ''|0)   d_localtime_r=undef
16038                 localtime_r_proto=0
16039                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16040         * )     case "$localtime_r_proto" in
16041                 REENTRANT_PROTO*) ;;
16042                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16043                 esac
16044                 echo "Prototype: $try" ;;
16045         esac
16046         ;;
16047         *)      case "$usethreads" in
16048                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16049                 esac
16050                 d_localtime_r=undef
16051                 localtime_r_proto=0
16052                 ;;
16053         esac
16054         ;;
16055 *)      localtime_r_proto=0
16056         ;;
16057 esac
16058
16059 : see if localtime_r calls tzset
16060 case "$localtime_r_proto" in
16061 REENTRANT_PROTO*)
16062         $cat >try.c <<EOCP
16063 /*  Does our libc's localtime_r call tzset ?
16064  *  return 0 if so, 1 otherwise.
16065  */
16066 #$i_systypes    I_SYS_TYPES
16067 #$i_unistd      I_UNISTD
16068 #$i_time        I_TIME
16069 #$i_stdlib      I_STDLIB
16070 #$i_malloc      I_MALLOC
16071 #ifdef I_SYS_TYPES
16072 #  include <sys/types.h>
16073 #endif
16074 #ifdef I_UNISTD
16075 #  include <unistd.h>
16076 #endif
16077 #ifdef I_TIME
16078 #  include <time.h>
16079 #endif
16080 #ifdef I_STDLIB
16081 #include <stdlib.h>
16082 #endif
16083 #include <string.h>
16084 #ifdef I_MALLOC
16085 #  include <malloc.h>
16086 #endif
16087 int main()
16088 {
16089     time_t t = time(0L);
16090     char w_tz[]="TZ" "=GMT+5",
16091          e_tz[]="TZ" "=GMT-5",
16092         *tz_e = (char*)malloc(16),
16093         *tz_w = (char*)malloc(16);
16094     struct tm tm_e, tm_w;
16095     memset(&tm_e,'\0',sizeof(struct tm));
16096     memset(&tm_w,'\0',sizeof(struct tm));
16097     strcpy(tz_e,e_tz);
16098     strcpy(tz_w,w_tz);
16099
16100     putenv(tz_e);
16101     localtime_r(&t, &tm_e);
16102
16103     putenv(tz_w);
16104     localtime_r(&t, &tm_w);
16105
16106     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16107         return 1;
16108     return 0;
16109 }
16110 EOCP
16111         set try
16112         if eval $compile; then
16113             if $run ./try; then
16114                 d_localtime_r_needs_tzset=undef;
16115             else
16116                 d_localtime_r_needs_tzset=define;
16117             fi;
16118         else
16119             d_localtime_r_needs_tzset=undef;
16120         fi;
16121      ;;
16122   *)
16123      d_localtime_r_needs_tzset=undef;
16124      ;;
16125 esac
16126 $rm_try
16127
16128 : see if lockf exists
16129 set lockf d_lockf
16130 eval $inlibc
16131
16132 : see if log1p exists
16133 set log1p d_log1p
16134 eval $inlibc
16135
16136 : see if log2 exists
16137 set log2 d_log2
16138 eval $inlibc
16139
16140 : see if logb exists
16141 set logb d_logb
16142 eval $inlibc
16143
16144 : see if lrint exists
16145 set lrint d_lrint
16146 eval $inlibc
16147
16148 : see if lrintl exists
16149 set lrintl d_lrintl
16150 eval $inlibc
16151
16152 : see if lround exists
16153 set lround d_lround
16154 eval $inlibc
16155
16156 : see if lroundl exists
16157 set lroundl d_lroundl
16158 eval $inlibc
16159
16160 : see if prototype for lseek is available
16161 echo " "
16162 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16163 eval $hasproto
16164
16165 : see if lstat exists
16166 set lstat d_lstat
16167 eval $inlibc
16168
16169 : see if madvise exists
16170 set madvise d_madvise
16171 eval $inlibc
16172
16173 : see if malloc_size exists
16174 set malloc_size d_malloc_size
16175 eval $inlibc
16176
16177 : see if malloc_size_good exists
16178 set malloc_good_size d_malloc_good_size
16179 eval $inlibc
16180
16181 : see if malloc_usable_size exists
16182 set malloc_usable_size d_malloc_usable_size
16183 eval $inlibc
16184
16185 : see if mblen exists
16186 set mblen d_mblen
16187 eval $inlibc
16188
16189 : see if mbrlen exists
16190 set mbrlen d_mbrlen
16191 eval $inlibc
16192
16193 : see if mbrtowc exists
16194 set mbrtowc d_mbrtowc
16195 eval $inlibc
16196
16197 : see if mbstowcs exists
16198 set mbstowcs d_mbstowcs
16199 eval $inlibc
16200
16201 : see if mbtowc exists
16202 set mbtowc d_mbtowc
16203 eval $inlibc
16204
16205 : see if memmem exists
16206 : We need both a prototype in string.h and the symbol in libc.
16207 echo " "
16208 d_memmem_proto=''
16209 xx1="#$d_gnulibc HAS_GNULIBC"
16210 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16211 xx3='#   define _GNU_SOURCE'
16212 xx4='#endif'
16213 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16214 eval $hasproto
16215 case "$d_memmem_proto" in
16216     define) # see if memmem exists
16217         set memmem d_memmem
16218         eval $inlibc
16219         ;;
16220     *)  val=$undef
16221         set d_memmem
16222         eval $setvar
16223         ;;
16224 esac
16225
16226 : see if memrchr exists
16227 : We need both a prototype in string.h and the symbol in libc.
16228 echo " "
16229 d_memrchr_proto=''
16230 xx1="#$d_gnulibc HAS_GNULIBC"
16231 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16232 xx3='#   define _GNU_SOURCE'
16233 xx4='#endif'
16234 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16235 eval $hasproto
16236 case "$d_memrchr_proto" in
16237     define) # see if memrchr exists
16238         set memrchr d_memrchr
16239         eval $inlibc
16240         ;;
16241     *)  val=$undef
16242         set d_memrchr
16243         eval $setvar
16244         ;;
16245 esac
16246
16247 : see if mkdir exists
16248 set mkdir d_mkdir
16249 eval $inlibc
16250
16251 : see if mkdtemp exists
16252 set mkdtemp d_mkdtemp
16253 eval $inlibc
16254
16255 : see if mkfifo exists
16256 set mkfifo d_mkfifo
16257 eval $inlibc
16258
16259 : see if mkostemp exists
16260 set mkostemp d_mkostemp
16261 eval $inlibc
16262
16263 : see if mkstemp exists
16264 set mkstemp d_mkstemp
16265 eval $inlibc
16266
16267 : see if mkstemps exists
16268 set mkstemps d_mkstemps
16269 eval $inlibc
16270
16271 : see if mktime exists
16272 set mktime d_mktime
16273 eval $inlibc
16274
16275 : see if sys/mman.h has to be included
16276 set sys/mman.h i_sysmman
16277 eval $inhdr
16278
16279 : see if mmap exists
16280 set mmap d_mmap
16281 eval $inlibc
16282 : see what shmat returns
16283 : default to something harmless
16284 mmaptype='void *'
16285 case "$i_sysmman$d_mmap" in
16286 "$define$define")
16287         $cat >mmap.c <<'END'
16288 #include <sys/mman.h>
16289 void *mmap();
16290 END
16291         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16292                 mmaptype='void *'
16293         else
16294                 mmaptype='caddr_t'
16295         fi
16296         echo "and it returns ($mmaptype)." >&4
16297         ;;
16298 esac
16299
16300 : see if sqrtl exists
16301 set sqrtl d_sqrtl
16302 eval $inlibc
16303
16304 : see if scalbnl exists
16305 set scalbnl d_scalbnl
16306 eval $inlibc
16307
16308 : see if truncl exists
16309 set truncl d_truncl
16310 eval $inlibc
16311
16312 : see if modfl exists
16313 set modfl d_modfl
16314 eval $inlibc
16315
16316 : see if prototype for modfl is available
16317 echo " "
16318 set d_modflproto modfl define math.h
16319 eval $hasproto
16320
16321 if $test "$uselongdouble" = "$define"; then
16322     message=""
16323     if $test "$d_sqrtl" != "$define"; then
16324         message="$message sqrtl"
16325     fi
16326     if $test "$d_modfl" != "$define"; then
16327         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16328             echo "You have both truncl and copysignl, so I can emulate modfl."
16329         else
16330             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16331                 echo "You have both aintl and copysignl, so I can emulate modfl."
16332             else
16333                 message="$message modfl"
16334             fi
16335         fi
16336     fi
16337     if $test "$d_frexpl" != "$define"; then
16338         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16339             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16340         else
16341             message="$message frexpl"
16342         fi
16343     fi
16344     if $test "$d_ldexpl" != "$define"; then
16345         message="$message ldexpl"
16346     fi
16347
16348     if $test "$message" != ""; then
16349         $cat <<EOM >&4
16350
16351 *** You requested the use of long doubles but you do not seem to have
16352 *** the following mathematical functions needed for long double support:
16353 ***    $message
16354 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16355 *** Cannot continue, aborting.
16356
16357 EOM
16358
16359         exit 1
16360     fi
16361 fi
16362
16363 : see if mprotect exists
16364 set mprotect d_mprotect
16365 eval $inlibc
16366
16367 : see if msgctl exists
16368 set msgctl d_msgctl
16369 eval $inlibc
16370
16371 : see if msgget exists
16372 set msgget d_msgget
16373 eval $inlibc
16374
16375 : see if msgsnd exists
16376 set msgsnd d_msgsnd
16377 eval $inlibc
16378
16379 : see if msgrcv exists
16380 set msgrcv d_msgrcv
16381 eval $inlibc
16382
16383 : see how much of the 'msg*(2)' library is present.
16384 h_msg=true
16385 echo " "
16386 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16387 *"$undef"*) h_msg=false;;
16388 esac
16389 case "$osname" in
16390 freebsd)
16391     case "`ipcs 2>&1`" in
16392     "SVID messages"*"not configured"*)
16393         echo "Your $osname does not have the msg*(2) configured." >&4
16394         h_msg=false
16395         val="$undef"
16396         set msgctl d_msgctl
16397         eval $setvar
16398         set msgget d_msgget
16399         eval $setvar
16400         set msgsnd d_msgsnd
16401         eval $setvar
16402         set msgrcv d_msgrcv
16403         eval $setvar
16404         ;;
16405     esac
16406     ;;
16407 esac
16408 : we could also check for sys/ipc.h ...
16409 if $h_msg && $test `./findhdr sys/msg.h`; then
16410         echo "You have the full msg*(2) library." >&4
16411         val="$define"
16412 else
16413         echo "You don't have the full msg*(2) library." >&4
16414         val="$undef"
16415 fi
16416 set d_msg
16417 eval $setvar
16418
16419 : Check for msghdr_s
16420 echo " "
16421 echo "Checking to see if your system supports struct msghdr..." >&4
16422 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16423 eval $hasstruct
16424 case "$d_msghdr_s" in
16425 "$define")      echo "Yes, it does."   ;;
16426 *)              echo "No, it doesn't." ;;
16427 esac
16428
16429 : see if msync exists
16430 set msync d_msync
16431 eval $inlibc
16432
16433 : see if munmap exists
16434 set munmap d_munmap
16435 eval $inlibc
16436
16437 : see if nan exists
16438 set nan d_nan
16439 eval $inlibc
16440
16441 : see if nanosleep exists
16442 set nanosleep d_nanosleep
16443 eval $inlibc
16444
16445 : see if nearbyint exists
16446 set nearbyint d_nearbyint
16447 eval $inlibc
16448
16449 : see if nextafter exists
16450 set nextafter d_nextafter
16451 eval $inlibc
16452
16453 : see if nexttoward exists
16454 set nexttoward d_nexttoward
16455 eval $inlibc
16456
16457 : see if nice exists
16458 set nice d_nice
16459 eval $inlibc
16460
16461 : see if this is a langinfo.h system
16462 set langinfo.h i_langinfo
16463 eval $inhdr
16464
16465 : see if nl_langinfo exists
16466 set nl_langinfo d_nl_langinfo
16467 eval $inlibc
16468
16469 : see if this is a quadmath.h system
16470 set quadmath.h i_quadmath
16471 eval $inhdr
16472
16473 : Check basic sizes
16474 echo " "
16475 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16476
16477 case "$use64bitint:$d_quad:$quadtype" in
16478 define:define:?*)
16479         ivtype="$quadtype"
16480         uvtype="$uquadtype"
16481         ivsize=8
16482         uvsize=8
16483         ;;
16484 *)      ivtype="long"
16485         uvtype="unsigned long"
16486         ivsize=$longsize
16487         uvsize=$longsize
16488         ;;
16489 esac
16490
16491 case "$uselongdouble:$d_longdbl" in
16492 define:define)
16493         nvtype="long double"
16494         nvsize=$longdblsize
16495         ;;
16496 *)      nvtype=double
16497         nvsize=$doublesize
16498         ;;
16499 esac
16500
16501 case "$usequadmath:$i_quadmath" in
16502 define:define)
16503   nvtype="__float128"
16504   nvsize=16
16505   case "$libs" in
16506   *quadmath*) ;;
16507   *) $cat <<EOM >&4
16508
16509 *** You requested the use of the quadmath library, but you
16510 *** do not seem to have the quadmath library installed.
16511 *** Cannot continue, aborting.
16512 EOM
16513     exit 1
16514     ;;
16515   esac
16516   ;;
16517 define:*) $cat <<EOM >&4
16518
16519 *** You requested the use of the quadmath library, but you
16520 *** do not seem to have the required header, <quadmath.h>.
16521 EOM
16522   case "$gccversion" in
16523   [23].*|4.[0-5]*)
16524    $cat <<EOM >&4
16525 *** Your gcc looks a bit old:
16526 *** $gccversion
16527 EOM
16528     ;;
16529   '')
16530    $cat <<EOM >&4
16531 *** You are not running a gcc.
16532 EOM
16533     ;;
16534   esac
16535   $cat <<EOM >&4
16536 *** For the quadmath library you need at least gcc 4.6.
16537 *** Cannot continue, aborting.
16538 EOM
16539   exit 1
16540   ;;
16541 esac
16542
16543 $echo "(IV will be "$ivtype", $ivsize bytes)"
16544 $echo "(UV will be "$uvtype", $uvsize bytes)"
16545 $echo "(NV will be "$nvtype", $nvsize bytes)"
16546
16547 $cat >try.c <<EOCP
16548 #$i_inttypes I_INTTYPES
16549 #ifdef I_INTTYPES
16550 #include <inttypes.h>
16551 #endif
16552 #include <stdio.h>
16553 int main() {
16554 #ifdef INT8
16555    int8_t i =  INT8_MAX;
16556   uint8_t u = UINT8_MAX;
16557   printf("int8_t\n");
16558 #endif
16559 #ifdef INT16
16560    int16_t i =  INT16_MAX;
16561   uint16_t u = UINT16_MAX;
16562   printf("int16_t\n");
16563 #endif
16564 #ifdef INT32
16565    int32_t i =  INT32_MAX;
16566   uint32_t u = UINT32_MAX;
16567   printf("int32_t\n");
16568 #endif
16569 }
16570 EOCP
16571
16572 i8type="signed char"
16573 u8type="unsigned char"
16574 i8size=1
16575 u8size=1
16576
16577 case "$i16type" in
16578 '')     case "$shortsize" in
16579         2)      i16type=short
16580                 u16type="unsigned short"
16581                 i16size=$shortsize
16582                 u16size=$shortsize
16583                 ;;
16584         esac
16585         ;;
16586 esac
16587 case "$i16type" in
16588 '')     set try -DINT16
16589         if eval $compile; then
16590                 case "`$run ./try`" in
16591                 int16_t)
16592                         i16type=int16_t
16593                         u16type=uint16_t
16594                         i16size=2
16595                         u16size=2
16596                         ;;
16597                 esac
16598         fi
16599         ;;
16600 esac
16601 case "$i16type" in
16602 '')     if $test $shortsize -ge 2; then
16603                 i16type=short
16604                 u16type="unsigned short"
16605                 i16size=$shortsize
16606                 u16size=$shortsize
16607         fi
16608         ;;
16609 esac
16610
16611 case "$i32type" in
16612 '')     case "$longsize" in
16613         4)      i32type=long
16614                 u32type="unsigned long"
16615                 i32size=$longsize
16616                 u32size=$longsize
16617                 ;;
16618         *)      case "$intsize" in
16619                 4)      i32type=int
16620                         u32type="unsigned int"
16621                         i32size=$intsize
16622                         u32size=$intsize
16623                         ;;
16624                 esac
16625                 ;;
16626         esac
16627         ;;
16628 esac
16629 case "$i32type" in
16630 '')     set try -DINT32
16631         if eval $compile; then
16632                 case "`$run ./try`" in
16633                 int32_t)
16634                         i32type=int32_t
16635                         u32type=uint32_t
16636                         i32size=4
16637                         u32size=4
16638                         ;;
16639                 esac
16640         fi
16641         ;;
16642 esac
16643 case "$i32type" in
16644 '')     if $test $intsize -ge 4; then
16645                 i32type=int
16646                 u32type="unsigned int"
16647                 i32size=$intsize
16648                 u32size=$intsize
16649         fi
16650         ;;
16651 esac
16652
16653 case "$i64type" in
16654 '')     case "$d_quad:$quadtype" in
16655         define:?*)
16656                 i64type="$quadtype"
16657                 u64type="$uquadtype"
16658                 i64size=8
16659                 u64size=8
16660                 ;;
16661         esac
16662         ;;
16663 esac
16664
16665 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16666 $cat <<EOP >try.c
16667 #include <stdio.h>
16668 #$i_stdlib I_STDLIB
16669 #ifdef I_STDLIB
16670 #include <stdlib.h>
16671 #endif
16672 #include <sys/types.h>
16673 #include <signal.h>
16674 #ifdef SIGFPE
16675 /* volatile so that the compiler has to store it out to memory */
16676 volatile int bletched = 0;
16677 $signal_t blech(int s) { bletched = 1; }
16678 #endif
16679 int main() {
16680     $uvtype u = 0;
16681     $nvtype d;
16682     int     n = 8 * $uvsize;
16683     int     i;
16684 #ifdef SIGFPE
16685     signal(SIGFPE, blech);
16686 #endif
16687
16688     for (i = 0; i < n; i++) {
16689       u = u << 1 | ($uvtype)1;
16690       d = ($nvtype)u;
16691       if (($uvtype)d != u)
16692         break;
16693       if (d <= 0)
16694         break;
16695       d = ($nvtype)(u - 1);
16696       if (($uvtype)d != (u - 1))
16697         break;
16698 #ifdef SIGFPE
16699       if (bletched)
16700         break;
16701 #endif
16702     }
16703     printf("%d\n", ((i == n) ? -n : i));
16704     exit(0);
16705 }
16706 EOP
16707 set try
16708
16709 d_nv_preserves_uv="$undef"
16710 if eval $compile; then
16711         nv_preserves_uv_bits="`$run ./try`"
16712 fi
16713 case "$nv_preserves_uv_bits" in
16714 \-[1-9]*)
16715         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16716         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16717         d_nv_preserves_uv="$define"
16718         ;;
16719 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16720         d_nv_preserves_uv="$undef" ;;
16721 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16722         nv_preserves_uv_bits="0" ;;
16723 esac
16724 $rm_try
16725
16726 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16727 $cat <<EOP >try.c
16728 #include <stdio.h>
16729
16730 typedef $nvtype NV;
16731
16732 int
16733 main() {
16734   NV value = 2;
16735   int count = 1;
16736
16737   while(count < 256) {
16738     /* volatile so that the compiler has to store it out to memory */
16739     volatile NV up = value + 1.0;
16740     volatile NV negated = -value;
16741     volatile NV down = negated - 1.0;
16742     volatile NV got_up = up - value;
16743     int up_good = got_up == 1.0;
16744     int got_down = down - negated;
16745     int down_good = got_down == -1.0;
16746
16747     if (down_good != up_good) {
16748       fprintf(stderr,
16749               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16750               up_good, (double) got_up, down_good, (double) got_down,
16751               count, (double) value);
16752       return 1;
16753     }
16754     if (!up_good) {
16755       while (1) {
16756         if (count > 8) {
16757           count -= 8;
16758           fputs("256.0", stdout);
16759         } else {
16760           count--;
16761           fputs("2.0", stdout);
16762         }
16763         if (!count) {
16764           puts("");
16765           return 0;
16766         }
16767         fputs("*", stdout);
16768       }
16769     }
16770     value *= 2;
16771     ++count;
16772   }
16773   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16774           count, (double) value);
16775   return 1;
16776 }
16777 EOP
16778 set try
16779
16780 nv_overflows_integers_at='0'
16781 if eval $compile; then
16782     xxx="`$run ./try`"
16783     case "$?" in
16784         0)
16785             case "$xxx" in
16786                 2*)  cat >&4 <<EOM
16787 The largest integer your NVs can preserve is equal to $xxx
16788 EOM
16789                     nv_overflows_integers_at="$xxx"
16790                     ;;
16791                 *)  cat >&4 <<EOM
16792 Cannot determine the largest integer value your NVs can hold, unexpected output
16793 '$xxx'
16794 EOM
16795                     ;;
16796             esac
16797             ;;
16798         *)  cat >&4 <<EOM
16799 Cannot determine the largest integer value your NVs can hold
16800 EOM
16801             ;;
16802     esac
16803 fi
16804 $rm_try
16805
16806 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16807 $cat <<EOP >try.c
16808 #include <stdio.h>
16809 #$i_stdlib I_STDLIB
16810 #ifdef I_STDLIB
16811 #include <stdlib.h>
16812 #endif
16813 #include <string.h>
16814 #include <sys/types.h>
16815 #include <signal.h>
16816 #ifdef SIGFPE
16817 /* volatile so that the compiler has to store it out to memory */
16818 volatile int bletched = 0;
16819 $signal_t blech(int s) { bletched = 1; }
16820 #endif
16821
16822 int checkit($nvtype d, const char *where) {
16823     void *v = &d;
16824     unsigned char *p = (unsigned char *)v;
16825     unsigned char *end = p + sizeof(d);
16826     int fail = 0;
16827
16828     while (p < end)
16829         fail += *p++;
16830
16831     if (!fail)
16832         return 0;
16833
16834     p = (unsigned char *)v;
16835     printf("No - %s: 0x", where);
16836     while (p < end)
16837         printf ("%02X", *p++);
16838     printf("\n");
16839     return 1;
16840 }
16841
16842 int main(int argc, char **argv) {
16843     $nvtype d = 0.0;
16844     int fail = 0;
16845     fail += checkit(d, "0.0");
16846
16847     /* The compiler shouldn't be assuming that bletched is 0  */
16848     d = bletched;
16849
16850     fail += checkit(d, "bleched");
16851
16852 #ifdef SIGFPE
16853     signal(SIGFPE, blech);
16854 #endif
16855
16856     /* Paranoia - the compiler should have no way of knowing that ANSI says
16857        that argv[argc] will always be NULL.  Actually, if it did assume this it
16858        would be buggy, as this is C and main() can be called from elsewhere in
16859        the program.  */
16860     d = argv[argc] ? 1 : 0;
16861
16862     if (d) {
16863         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16864     }
16865
16866     fail += checkit(d, "ternary");
16867
16868     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16869
16870     if (d != 0.0) {
16871         printf("No - memset doesn't give 0.0\n");
16872         /* This might just blow up:  */
16873         printf("(gives %g)\n", d);
16874         return 1;
16875     }
16876
16877 #ifdef SIGFPE
16878     if (bletched) {
16879         printf("No - something bleched\n");
16880         return 1;
16881     }
16882 #endif
16883     if (fail) {
16884       printf("No - %d fail(s)\n", fail);
16885       return 1;
16886     }
16887     printf("Yes\n");
16888     return 0;
16889 }
16890 EOP
16891 set try
16892
16893 d_nv_zero_is_allbits_zero="$undef"
16894 if eval $compile; then
16895     xxx="`$run ./try`"
16896     case "$?" in
16897         0)
16898             case "$xxx" in
16899                 Yes)  cat >&4 <<EOM
16900 0.0 is represented as all bits zero in memory
16901 EOM
16902                     d_nv_zero_is_allbits_zero="$define"
16903                     ;;
16904                 *)  cat >&4 <<EOM
16905 0.0 is not represented as all bits zero in memory
16906 EOM
16907                     d_nv_zero_is_allbits_zero="$undef"
16908                     ;;
16909             esac
16910             ;;
16911         *)  cat >&4 <<EOM
16912 0.0 is not represented as all bits zero in memory
16913 EOM
16914             d_nv_zero_is_allbits_zero="$undef"
16915             ;;
16916     esac
16917 fi
16918 $rm_try
16919
16920 : check for off64_t
16921 echo " "
16922 echo "Checking to see if you have off64_t..." >&4
16923 $cat >try.c <<EOCP
16924 #include <sys/types.h>
16925 #include <unistd.h>
16926 int main() { off64_t x = 7; }
16927 EOCP
16928 set try
16929 if eval $compile; then
16930         val="$define"
16931         echo "You have off64_t."
16932 else
16933         val="$undef"
16934         echo "You do not have off64_t."
16935         case "$lseeksize" in
16936         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16937         esac
16938 fi
16939 $rm_try
16940 set d_off64_t
16941 eval $setvar
16942
16943 : how to create joinable pthreads
16944 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16945         echo " "
16946         echo "Checking what constant to use for creating joinable pthreads..." >&4
16947         $cat >try.c <<'EOCP'
16948 #include <pthread.h>
16949 int main() {
16950     int detachstate = JOINABLE;
16951 }
16952 EOCP
16953         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16954         if eval $compile; then
16955                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16956                 val="$undef" # Yes, undef.
16957                 set d_old_pthread_create_joinable
16958                 eval $setvar
16959                 val=""
16960                 set old_pthread_create_joinable
16961                 eval $setvar
16962         else
16963                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16964                 if eval $compile; then
16965                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16966                         val="$define"
16967                         set d_old_pthread_create_joinable
16968                         eval $setvar
16969                         val=PTHREAD_CREATE_UNDETACHED
16970                         set old_pthread_create_joinable
16971                         eval $setvar
16972                 else
16973                         set try -DJOINABLE=__UNDETACHED
16974                         if eval $compile; then
16975                                 echo "You seem to use __UNDETACHED." >&4
16976                                 val="$define"
16977                                 set d_old_pthread_create_joinable
16978                                 eval $setvar
16979                                 val=__UNDETACHED
16980                                 set old_pthread_create_joinable
16981                                 eval $setvar
16982                         else
16983                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16984                                 val="$define"
16985                                 set d_old_pthread_create_joinable
16986                                 eval $setvar
16987                                 val=0
16988                                 set old_pthread_create_joinable
16989                                 eval $setvar
16990                         fi
16991                 fi
16992         fi
16993         $rm_try
16994 else
16995     d_old_pthread_create_joinable="$undef"
16996     old_pthread_create_joinable=""
16997 fi
16998
16999 : see if pause exists
17000 set pause d_pause
17001 eval $inlibc
17002
17003 : see if pipe2 exists
17004 set pipe2 d_pipe2
17005 eval $inlibc
17006
17007 : see if poll exists
17008 set poll d_poll
17009 eval $inlibc
17010
17011 : see if prctl exists
17012 set prctl d_prctl
17013 eval $inlibc
17014
17015 : see if prctl supports PR_SET_NAME
17016 d_prctl_set_name=$undef
17017 case $d_prctl in
17018     $define)
17019         $cat >try.c <<EOM
17020 #ifdef __ANDROID__
17021 #include <unistd.h>
17022 #endif
17023 #include <sys/prctl.h>
17024
17025 int main (int argc, char *argv[])
17026 {
17027     return (prctl (PR_SET_NAME, "Test"));
17028     } /* main */
17029 EOM
17030         set try
17031         if eval $compile_ok && $run ./try; then
17032             echo "Your prctl (PR_SET_NAME, ...) works"
17033             d_prctl_set_name=$define
17034             fi
17035         $rm_try
17036         ;;
17037     esac
17038
17039 : see if readlink exists
17040 set readlink d_readlink
17041 eval $inlibc
17042
17043 : Check if there is a /proc symlink to the abs path of
17044 : the executing program.  We will honor hints of d_procselfexe=$undef
17045 : or procselfexe being non-empty, otherwise will try to determine both
17046 : if we have readlink.
17047 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17048 : referenced, and AmigaOS does not have a proc filesystem anyway.
17049 echo " "
17050 val="$undef"
17051 if $test "X$d_procselfexe" = Xundef; then
17052         procselfexe=''
17053 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17054         val="$define"
17055 elif $test "X$d_readlink" = Xdefine; then
17056         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17057         : and it feels more tidy to avoid an extra level of symlink
17058         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17059         while test $# -gt 0; do
17060             type=$1; try=$2
17061             shift; shift
17062             if $issymlink $try; then
17063                 $ls -l $try > reflect
17064                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17065                     echo "You have $type-like $try."
17066                     procselfexe='"'$try'"'
17067                     val="$define"
17068                     : This will break out of the loop
17069                     set X; shift
17070                 fi
17071             fi
17072         done
17073 fi
17074 $rm -f reflect
17075 set d_procselfexe
17076 eval $setvar
17077
17078 : backward compatibility for d_hvfork
17079 if test X$d_hvfork != X; then
17080         d_vfork="$d_hvfork"
17081         d_hvfork=''
17082 fi
17083 : see if there is a vfork
17084 val=''
17085 set vfork val
17086 eval $inlibc
17087
17088 d_pseudofork=$undef
17089
17090 : Ok, but do we want to use it. vfork is reportedly unreliable in
17091 : perl on Solaris 2.x, and probably elsewhere.
17092 case "$val" in
17093 $define)
17094         echo " "
17095         case "$usevfork" in
17096         false) dflt='n';;
17097         *) dflt='y';;
17098         esac
17099         cat <<'EOM'
17100
17101 Perl can only use a vfork() that doesn't suffer from strict
17102 restrictions on calling functions or modifying global data in
17103 the child.  For example, glibc-2.1 contains such a vfork()
17104 that is unsuitable.  If your system provides a proper fork()
17105 call, chances are that you do NOT want perl to use vfork().
17106
17107 EOM
17108         rp="Do you still want to use vfork()?"
17109         . ./myread
17110         case "$ans" in
17111         y|Y) ;;
17112         *)
17113                 echo "Ok, we won't use vfork()."
17114                 val="$undef"
17115                 ;;
17116         esac
17117         ;;
17118 esac
17119 set d_vfork
17120 eval $setvar
17121 case "$d_vfork" in
17122 $define) usevfork='true';;
17123 *) usevfork='false';;
17124 esac
17125
17126 : see whether the pthread_atfork exists
17127 $cat >try.c <<EOP
17128 #include <pthread.h>
17129 #include <stdio.h>
17130 int main() {
17131 #ifdef  PTHREAD_ATFORK
17132         pthread_atfork(NULL,NULL,NULL);
17133 #endif
17134 }
17135 EOP
17136
17137 : see if pthread_atfork exists
17138 set try -DPTHREAD_ATFORK
17139 if eval $compile; then
17140     val="$define"
17141 else
17142     val="$undef"
17143 fi
17144 case "$usethreads" in
17145 $define)
17146         case "$val" in
17147         $define) echo 'pthread_atfork found.' >&4        ;;
17148         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17149         esac
17150 esac
17151 set d_pthread_atfork
17152 eval $setvar
17153
17154 : see if pthread_attr_setscope exists
17155 set pthread_attr_setscope d_pthread_attr_setscope
17156 eval $inlibc
17157
17158 : see whether the various POSIXish _yields exist
17159 $cat >try.c <<EOP
17160 #include <pthread.h>
17161 #include <stdio.h>
17162 int main() {
17163 #ifdef SCHED_YIELD
17164         sched_yield();
17165 #else
17166 #ifdef PTHREAD_YIELD
17167         pthread_yield();
17168 #else
17169 #ifdef PTHREAD_YIELD_NULL
17170         pthread_yield(NULL);
17171 #endif
17172 #endif
17173 #endif
17174 }
17175 EOP
17176 : see if sched_yield exists
17177 set try -DSCHED_YIELD
17178 if eval $compile; then
17179     val="$define"
17180     sched_yield='sched_yield()'
17181 else
17182     val="$undef"
17183 fi
17184 case "$usethreads" in
17185 $define)
17186         case "$val" in
17187         $define) echo 'sched_yield() found.' >&4        ;;
17188         *)       echo 'sched_yield() NOT found.' >&4    ;;
17189         esac
17190 esac
17191 set d_sched_yield
17192 eval $setvar
17193
17194 : see if pthread_yield exists
17195 set try -DPTHREAD_YIELD
17196 if eval $compile; then
17197     val="$define"
17198     case "$sched_yield" in
17199     '') sched_yield='pthread_yield()' ;;
17200     esac
17201 else
17202     set try -DPTHREAD_YIELD_NULL
17203     if eval $compile; then
17204         val="$define"
17205         case "$sched_yield" in
17206         '') sched_yield='pthread_yield(NULL)' ;;
17207         esac
17208     else
17209         val="$undef"
17210     fi
17211 fi
17212 case "$usethreads" in
17213 $define)
17214         case "$val" in
17215         $define) echo 'pthread_yield() found.' >&4      ;;
17216         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17217         esac
17218         ;;
17219 esac
17220 set d_pthread_yield
17221 eval $setvar
17222 case "$sched_yield" in
17223 '') sched_yield=undef ;;
17224 esac
17225 $rm_try
17226
17227 : check for ptrdiff_t
17228 echo " "
17229 echo "Checking to see if you have ptrdiff_t..." >&4
17230 $cat >try.c <<EOCP
17231 #include <stddef.h>
17232 int main() { ptrdiff_t x = 7; }
17233 EOCP
17234 set try
17235 if eval $compile; then
17236         val="$define"
17237         echo "You have ptrdiff_t."
17238 else
17239         val="$undef"
17240         echo "You do not have ptrdiff_t."
17241 fi
17242 $rm_try
17243 set d_ptrdiff_t
17244 eval $setvar
17245
17246 : see if random_r exists
17247 set random_r d_random_r
17248 eval $inlibc
17249 case "$d_random_r" in
17250 "$define")
17251         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17252         case "$d_random_r_proto:$usethreads" in
17253         ":define")      d_random_r_proto=define
17254                 set d_random_r_proto random_r $hdrs
17255                 eval $hasproto ;;
17256         *)      ;;
17257         esac
17258         case "$d_random_r_proto" in
17259         define)
17260         case "$random_r_proto" in
17261         ''|0) try='int random_r(int*, struct random_data*);'
17262         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17263         esac
17264         case "$random_r_proto" in
17265         ''|0) try='int random_r(long*, struct random_data*);'
17266         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17267         esac
17268         case "$random_r_proto" in
17269         ''|0) try='int random_r(struct random_data*, int32_t*);'
17270         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17271         esac
17272         case "$random_r_proto" in
17273         ''|0)   d_random_r=undef
17274                 random_r_proto=0
17275                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17276         * )     case "$random_r_proto" in
17277                 REENTRANT_PROTO*) ;;
17278                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17279                 esac
17280                 echo "Prototype: $try" ;;
17281         esac
17282         ;;
17283         *)      case "$usethreads" in
17284                 define) echo "random_r has no prototype, not using it." >&4 ;;
17285                 esac
17286                 d_random_r=undef
17287                 random_r_proto=0
17288                 ;;
17289         esac
17290         ;;
17291 *)      random_r_proto=0
17292         ;;
17293 esac
17294
17295 : see if readdir and friends exist
17296 set readdir d_readdir
17297 eval $inlibc
17298 set seekdir d_seekdir
17299 eval $inlibc
17300 set telldir d_telldir
17301 eval $inlibc
17302 set rewinddir d_rewinddir
17303 eval $inlibc
17304
17305 : see if readdir64_r exists
17306 set readdir64_r d_readdir64_r
17307 eval $inlibc
17308 case "$d_readdir64_r" in
17309 "$define")
17310         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17311         case "$d_readdir64_r_proto:$usethreads" in
17312         ":define")      d_readdir64_r_proto=define
17313                 set d_readdir64_r_proto readdir64_r $hdrs
17314                 eval $hasproto ;;
17315         *)      ;;
17316         esac
17317         case "$d_readdir64_r_proto" in
17318         define)
17319         case "$readdir64_r_proto" in
17320         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17321         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17322         esac
17323         case "$readdir64_r_proto" in
17324         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17325         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17326         esac
17327         case "$readdir64_r_proto" in
17328         ''|0)   d_readdir64_r=undef
17329                 readdir64_r_proto=0
17330                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17331         * )     case "$readdir64_r_proto" in
17332                 REENTRANT_PROTO*) ;;
17333                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17334                 esac
17335                 echo "Prototype: $try" ;;
17336         esac
17337         ;;
17338         *)      case "$usethreads" in
17339                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17340                 esac
17341                 d_readdir64_r=undef
17342                 readdir64_r_proto=0
17343                 ;;
17344         esac
17345         ;;
17346 *)      readdir64_r_proto=0
17347         ;;
17348 esac
17349
17350 : see if readdir_r exists
17351 set readdir_r d_readdir_r
17352 eval $inlibc
17353 case "$d_readdir_r" in
17354 "$define")
17355         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17356         case "$d_readdir_r_proto:$usethreads" in
17357         ":define")      d_readdir_r_proto=define
17358                 set d_readdir_r_proto readdir_r $hdrs
17359                 eval $hasproto ;;
17360         *)      ;;
17361         esac
17362         case "$d_readdir_r_proto" in
17363         define)
17364         case "$readdir_r_proto" in
17365         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17366         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17367         esac
17368         case "$readdir_r_proto" in
17369         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17370         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17371         esac
17372         case "$readdir_r_proto" in
17373         ''|0)   d_readdir_r=undef
17374                 readdir_r_proto=0
17375                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17376         * )     case "$readdir_r_proto" in
17377                 REENTRANT_PROTO*) ;;
17378                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17379                 esac
17380                 echo "Prototype: $try" ;;
17381         esac
17382         ;;
17383         *)      case "$usethreads" in
17384                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17385                 esac
17386                 d_readdir_r=undef
17387                 readdir_r_proto=0
17388                 ;;
17389         esac
17390         ;;
17391 *)      readdir_r_proto=0
17392         ;;
17393 esac
17394
17395 : see if readv exists
17396 set readv d_readv
17397 eval $inlibc
17398
17399 : see if recvmsg exists
17400 set recvmsg d_recvmsg
17401 eval $inlibc
17402
17403 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17404 echo " "
17405 if set regcomp val -f d_regcomp; eval $csym; $val; then
17406         echo 'regcomp() found.' >&4
17407         d_regcomp="$define"
17408         d_regcmp="$undef"
17409         d_re_comp="$undef"
17410 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17411         echo 'regcmp() found.' >&4
17412         d_regcmp="$define"
17413         d_regcomp="$undef"
17414         d_re_comp="$undef"
17415 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17416         echo 're_comp() found, assuming re_exec() also exists.' >&4
17417         d_re_comp="$define"
17418         d_regcomp="$undef"
17419         d_regcmp="$undef"
17420 else
17421         $cat >&4 <<EOM
17422 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17423 EOM
17424         d_regcmp="$undef"
17425         d_re_comp="$undef"
17426         d_regcomp="$undef"
17427 fi
17428
17429 : see if remainder exists
17430 set remainder d_remainder
17431 eval $inlibc
17432
17433 : see if remquo exists
17434 set remquo d_remquo
17435 eval $inlibc
17436
17437 : see if rename exists
17438 set rename d_rename
17439 eval $inlibc
17440
17441 : see if rint exists
17442 set rint d_rint
17443 eval $inlibc
17444
17445 : see if rmdir exists
17446 set rmdir d_rmdir
17447 eval $inlibc
17448
17449 : see if round exists
17450 set round d_round
17451 eval $inlibc
17452
17453 : see if prototype for sbrk is available
17454 echo " "
17455 set d_sbrkproto sbrk $i_unistd unistd.h
17456 eval $hasproto
17457
17458 : see if scalbn exists
17459 set scalbn d_scalbn
17460 eval $inlibc
17461
17462 : see if select exists
17463 set select d_select
17464 eval $inlibc
17465
17466 : see if semctl exists
17467 set semctl d_semctl
17468 eval $inlibc
17469
17470 : see if semget exists
17471 set semget d_semget
17472 eval $inlibc
17473
17474 : see if semop exists
17475 set semop d_semop
17476 eval $inlibc
17477
17478 : see how much of the 'sem*(2)' library is present.
17479 h_sem=true
17480 echo " "
17481 case "$d_semctl$d_semget$d_semop" in
17482 *"$undef"*) h_sem=false;;
17483 esac
17484 case "$osname" in
17485 freebsd)
17486     case "`ipcs 2>&1`" in
17487     "SVID messages"*"not configured"*)
17488         echo "Your $osname does not have the sem*(2) configured." >&4
17489         h_sem=false
17490         val="$undef"
17491         set semctl d_semctl
17492         eval $setvar
17493         set semget d_semget
17494         eval $setvar
17495         set semop d_semop
17496         eval $setvar
17497         ;;
17498     esac
17499     ;;
17500 esac
17501 : we could also check for sys/ipc.h ...
17502 if $h_sem && $test `./findhdr sys/sem.h`; then
17503         echo "You have the full sem*(2) library." >&4
17504         val="$define"
17505 else
17506         echo "You don't have the full sem*(2) library." >&4
17507         val="$undef"
17508 fi
17509 set d_sem
17510 eval $setvar
17511
17512 : see whether sys/sem.h defines union semun
17513 echo " "
17514 $cat > try.c <<'END'
17515 #include <sys/types.h>
17516 #include <sys/ipc.h>
17517 #include <sys/sem.h>
17518 int main () { union semun semun; semun.buf = 0; }
17519 END
17520 set try
17521 if eval $compile; then
17522     echo "You have union semun in <sys/sem.h>." >&4
17523     val="$define"
17524 else
17525     echo "You do not have union semun in <sys/sem.h>." >&4
17526     val="$undef"
17527 fi
17528 $rm_try
17529 set d_union_semun
17530 eval $setvar
17531
17532 : see how to do semctl IPC_STAT
17533 case "$d_sem" in
17534 $define)
17535     echo " "
17536     $cat > tryh.h <<END
17537 #ifndef S_IRUSR
17538 #   ifdef S_IREAD
17539 #       define S_IRUSR S_IREAD
17540 #       define S_IWUSR S_IWRITE
17541 #       define S_IXUSR S_IEXEC
17542 #   else
17543 #       define S_IRUSR 0400
17544 #       define S_IWUSR 0200
17545 #       define S_IXUSR 0100
17546 #   endif
17547 #   define S_IRGRP (S_IRUSR>>3)
17548 #   define S_IWGRP (S_IWUSR>>3)
17549 #   define S_IXGRP (S_IXUSR>>3)
17550 #   define S_IROTH (S_IRUSR>>6)
17551 #   define S_IWOTH (S_IWUSR>>6)
17552 #   define S_IXOTH (S_IXUSR>>6)
17553 #endif
17554 #ifndef S_IRWXU
17555 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17556 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17557 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17558 #endif
17559 END
17560     : see whether semctl IPC_STAT can use union semun
17561     case "$d_semctl_semun" in
17562     '')
17563       val="$undef"
17564       $cat > try.c <<END
17565 #include <sys/types.h>
17566 #include <sys/ipc.h>
17567 #include <sys/sem.h>
17568 #include <sys/stat.h>
17569 #include <stdio.h>
17570 #include <errno.h>
17571 #include "tryh.h"
17572 #ifndef errno
17573 extern int errno;
17574 #endif
17575 #$d_union_semun HAS_UNION_SEMUN
17576 int main() {
17577     union semun
17578 #ifndef HAS_UNION_SEMUN
17579     {
17580         int val;
17581         struct semid_ds *buf;
17582         unsigned short *array;
17583     }
17584 #endif
17585     arg;
17586     int sem, st;
17587
17588 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17589     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17590     if (sem > -1) {
17591         struct semid_ds argbuf;
17592         arg.buf = &argbuf;
17593 #       ifdef IPC_STAT
17594         st = semctl(sem, 0, IPC_STAT, arg);
17595         if (st == 0)
17596             printf("semun\n");
17597         else
17598 #       endif /* IPC_STAT */
17599             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17600 #       ifdef IPC_RMID
17601         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17602 #       endif /* IPC_RMID */
17603             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17604     } else
17605 #endif /* IPC_PRIVATE && ... */
17606         printf("semget failed: errno = %d\n", errno);
17607   return 0;
17608 }
17609 END
17610       set try
17611       if eval $compile; then
17612           xxx=`$run ./try`
17613           case "$xxx" in
17614           semun) val="$define" ;;
17615           esac
17616       fi
17617       $rm_try
17618       set d_semctl_semun
17619       eval $setvar
17620       ;;
17621     esac
17622     case "$d_semctl_semun" in
17623     $define)
17624         echo "You can use union semun for semctl IPC_STAT." >&4
17625         also='also'
17626         ;;
17627     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17628         also=''
17629         ;;
17630     esac
17631
17632     : see whether semctl IPC_STAT can use struct semid_ds pointer
17633     case "$d_semctl_semid_ds" in
17634     '')
17635       val="$undef"
17636       $cat > try.c <<'END'
17637 #include <sys/types.h>
17638 #include <sys/ipc.h>
17639 #include <sys/sem.h>
17640 #include <sys/stat.h>
17641 #include "tryh.h"
17642 #include <stdio.h>
17643 #include <errno.h>
17644 #ifndef errno
17645 extern int errno;
17646 #endif
17647 int main() {
17648     union semun
17649 #ifndef HAS_UNION_SEMUN
17650     {
17651         int val;
17652         struct semid_ds *buf;
17653         unsigned short *array;
17654     }
17655 #endif
17656     arg;
17657     struct semid_ds argbuf;
17658     int sem, st;
17659
17660 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17661     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17662     if (sem > -1) {
17663         arg.buf = &argbuf;
17664 #       ifdef IPC_STAT
17665         st = semctl(sem, 0, IPC_STAT, arg);
17666         if (st == 0)
17667             printf("semid_ds\n");
17668         else
17669 #       endif /* IPC_STAT */
17670             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17671 #       ifdef IPC_RMID
17672         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17673 #       endif /* IPC_RMID */
17674             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17675     } else
17676 #endif /* IPC_PRIVATE && ... */
17677         printf("semget failed: errno = %d\n", errno);
17678
17679     return 0;
17680 }
17681 END
17682       set try
17683       if eval $compile; then
17684           xxx=`$run ./try`
17685           case "$xxx" in
17686           semid_ds) val="$define" ;;
17687           esac
17688       fi
17689       $rm_try
17690       set d_semctl_semid_ds
17691       eval $setvar
17692       ;;
17693     esac
17694     case "$d_semctl_semid_ds" in
17695     $define)
17696         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17697         ;;
17698     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17699         ;;
17700     esac
17701     ;;
17702 *)  val="$undef"
17703
17704     # We do not have the full sem*(2) library, so assume we can not
17705     # use either.
17706
17707     set d_semctl_semun
17708     eval $setvar
17709
17710     set d_semctl_semid_ds
17711     eval $setvar
17712     ;;
17713 esac
17714 $rm_try tryh.h
17715
17716 : see if sendmsg exists
17717 set sendmsg d_sendmsg
17718 eval $inlibc
17719
17720 : see if setegid exists
17721 set setegid d_setegid
17722 eval $inlibc
17723
17724 : see if seteuid exists
17725 set seteuid d_seteuid
17726 eval $inlibc
17727
17728 : see if setgrent exists
17729 set setgrent d_setgrent
17730 eval $inlibc
17731
17732 : see if setgrent_r exists
17733 set setgrent_r d_setgrent_r
17734 eval $inlibc
17735 case "$d_setgrent_r" in
17736 "$define")
17737         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17738         case "$d_setgrent_r_proto:$usethreads" in
17739         ":define")      d_setgrent_r_proto=define
17740                 set d_setgrent_r_proto setgrent_r $hdrs
17741                 eval $hasproto ;;
17742         *)      ;;
17743         esac
17744         case "$d_setgrent_r_proto" in
17745         define)
17746         case "$setgrent_r_proto" in
17747         ''|0) try='int setgrent_r(FILE**);'
17748         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17749         esac
17750         case "$setgrent_r_proto" in
17751         ''|0) try='void setgrent_r(FILE**);'
17752         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17753         esac
17754         case "$setgrent_r_proto" in
17755         ''|0)   d_setgrent_r=undef
17756                 setgrent_r_proto=0
17757                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17758         * )     case "$setgrent_r_proto" in
17759                 REENTRANT_PROTO*) ;;
17760                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17761                 esac
17762                 echo "Prototype: $try" ;;
17763         esac
17764         ;;
17765         *)      case "$usethreads" in
17766                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17767                 esac
17768                 d_setgrent_r=undef
17769                 setgrent_r_proto=0
17770                 ;;
17771         esac
17772         ;;
17773 *)      setgrent_r_proto=0
17774         ;;
17775 esac
17776
17777 : see if sethostent exists
17778 set sethostent d_sethent
17779 eval $inlibc
17780
17781 : see if sethostent_r exists
17782 set sethostent_r d_sethostent_r
17783 eval $inlibc
17784 case "$d_sethostent_r" in
17785 "$define")
17786         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17787         case "$d_sethostent_r_proto:$usethreads" in
17788         ":define")      d_sethostent_r_proto=define
17789                 set d_sethostent_r_proto sethostent_r $hdrs
17790                 eval $hasproto ;;
17791         *)      ;;
17792         esac
17793         case "$d_sethostent_r_proto" in
17794         define)
17795         case "$sethostent_r_proto" in
17796         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17797         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17798         esac
17799         case "$sethostent_r_proto" in
17800         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17801         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17802         esac
17803         case "$sethostent_r_proto" in
17804         ''|0)   d_sethostent_r=undef
17805                 sethostent_r_proto=0
17806                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17807         * )     case "$sethostent_r_proto" in
17808                 REENTRANT_PROTO*) ;;
17809                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17810                 esac
17811                 echo "Prototype: $try" ;;
17812         esac
17813         ;;
17814         *)      case "$usethreads" in
17815                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17816                 esac
17817                 d_sethostent_r=undef
17818                 sethostent_r_proto=0
17819                 ;;
17820         esac
17821         ;;
17822 *)      sethostent_r_proto=0
17823         ;;
17824 esac
17825
17826 : see if setitimer exists
17827 set setitimer d_setitimer
17828 eval $inlibc
17829
17830 : see if setlinebuf exists
17831 set setlinebuf d_setlinebuf
17832 eval $inlibc
17833
17834 : see if locale.h is available
17835 set locale.h i_locale
17836 eval $inhdr
17837
17838 : see if this system has wctype.h
17839 set wctype.h i_wctype
17840 eval $inhdr
17841
17842 : see if towupper exists
17843 set towupper d_towupper
17844 eval $inlibc
17845
17846 : check for setlocale function and behavior
17847 $cat <<EOM
17848
17849 Checking to see if you have setlocale() and its behavior
17850 EOM
17851 $cat >try.c <<EOCP
17852 #include <stdlib.h>
17853 #include <string.h>
17854 #$i_locale I_LOCALE
17855 #ifdef I_LOCALE
17856 #  include <locale.h>
17857 #endif
17858 #$i_wctype I_WCTYPE
17859 #ifdef I_WCTYPE
17860 #  include <wctype.h>
17861 #endif
17862
17863 int main() {
17864     const char * invalid_name = "\a";   /* This is really invalid! */
17865     int accepts_any_locale_name = 0;
17866     int has_C_UTF8 = 0;
17867     unsigned char bad_setlocale = 255;
17868
17869     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17870      * disabled.  It's hard to imagine an instance where meaningful locale
17871      * handling could be done without LC_CTYPE */
17872     const char *  name = setlocale(LC_CTYPE, "C");
17873
17874     if (name == NULL || strcmp(name, "C") != 0) {
17875         exit(bad_setlocale);
17876     }
17877
17878     name = setlocale(LC_CTYPE, invalid_name);
17879     if (name != NULL) {
17880
17881         /* Let it pass if it accepts the name but gives back one of the C
17882          * locales */
17883         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17884             accepts_any_locale_name = 1;
17885         }
17886     }
17887
17888     name = setlocale(LC_CTYPE, "C.UTF-8");
17889     if (name != NULL) {
17890         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17891
17892 #$d_towupper HAS_TOWUPPER
17893 #ifdef HAS_TOWUPPER
17894
17895         /* We assume that if the machine doesn't have the C99 towupper, it
17896          * doesn't have C.UTF-8, even if we successfully changed locales to
17897          * include it.  This seems safer even on platforms that didn't accept
17898          * the really invalid name */
17899
17900         if (towupper(y_with_diaeresis) == 0x178) {
17901             has_C_UTF8 = 1;
17902         }
17903
17904 #endif
17905
17906     }
17907
17908 #if 0
17909
17910     /* Currently unused code to determine if LC_ALL with disparate values uses
17911      * category = value pairs or positional, and to determine the separator
17912      * between the categories.  We could add code so that if the separator were
17913      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17914      * every possible ASCII separator would fit in the 5 bits available in the
17915      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17916      * positional, we probably would want to know the order of the categories.
17917      * Using a file between the C program and the shell script would really be
17918      * require to do that */
17919 #ifdef LC_ALL
17920
17921     unsigned char min_separator = ' ' - 1;
17922     unsigned char separator = min_separator;
17923     int uses_name_value_pair_names = 0;
17924
17925     name = setlocale(LC_ALL, "C");
17926     if (name == NULL || strcmp(name, "C") != 0) {
17927         exit(bad_setlocale);
17928     }
17929
17930     if (has_C_UTF8) {
17931         char * pos;
17932
17933         name = setlocale(LC_CTYPE, "C.UTF-8");
17934         if (name == NULL) {
17935             exit(bad_setlocale);
17936         }
17937         name = setlocale(LC_ALL, NULL);
17938         if (name == NULL) {
17939             exit(bad_setlocale);
17940         }
17941
17942         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17943         if (pos != NULL) {
17944             uses_name_value_pair_names = 1;
17945             if (pos == name) {
17946                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17947             }
17948             else {
17949                 separator = *(pos - 1);
17950             }
17951         }
17952         else {
17953             pos = strstr(name, "C.UTF-8");
17954             if (pos == NULL) {
17955                 /* bad */
17956             }
17957             else if (pos == name) {
17958                 separator = name[sizeof("C.UTF-8") - 1];
17959             }
17960             else {
17961                 separator = *(pos - 1);
17962             }
17963         }
17964     }
17965
17966 #endif
17967 #endif
17968
17969     exit( 0 /* (separator - min_separator) << 3
17970         | uses_name_value_pair_names      << 2
17971           */
17972         | has_C_UTF8                      << 1
17973         | accepts_any_locale_name);
17974
17975 }
17976 EOCP
17977 set try
17978 if eval $compile; then
17979     echo "Your system has setlocale()..." >&4
17980     $run ./try
17981     case $? in
17982         0) echo "and it seems sane" >&4
17983            d_setlocale="$define"
17984            d_setlocale_accepts_any_locale_name="$undef"
17985            d_has_C_UTF8="false"
17986            ;;
17987         1) echo "and it seems sane, but accepts any locale name as valid" >&4
17988            d_setlocale="$define"
17989            d_setlocale_accepts_any_locale_name="$define"
17990            d_has_C_UTF8="false"
17991            ;;
17992         2) echo "and it seems sane" >&4
17993            d_setlocale="$define"
17994            d_setlocale_accepts_any_locale_name="$undef"
17995            d_has_C_UTF8="true"
17996            ;;
17997         3) 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="true"
18001            ;;
18002         *) echo "but it doesn't seem to work, so we won't use it." >&4
18003            d_setlocale="$undef"
18004            d_setlocale_accepts_any_locale_name="$undef"
18005            d_has_C_UTF8="false"
18006            ;;
18007     esac
18008 else
18009     echo "your system does not have setlocale()" >&4
18010     d_setlocale="$undef"
18011     d_setlocale_accepts_any_locale_name="$undef"
18012     d_has_C_UTF8="false"
18013 fi
18014 $rm_try
18015
18016 : see if setlocale_r exists
18017 set setlocale_r d_setlocale_r
18018 eval $inlibc
18019 case "$d_setlocale_r" in
18020 "$define")
18021         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18022         case "$d_setlocale_r_proto:$usethreads" in
18023         ":define")      d_setlocale_r_proto=define
18024                 set d_setlocale_r_proto setlocale_r $hdrs
18025                 eval $hasproto ;;
18026         *)      ;;
18027         esac
18028         case "$d_setlocale_r_proto" in
18029         define)
18030         case "$setlocale_r_proto" in
18031         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18032         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18033         esac
18034         case "$setlocale_r_proto" in
18035         ''|0)   d_setlocale_r=undef
18036                 setlocale_r_proto=0
18037                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18038         * )     case "$setlocale_r_proto" in
18039                 REENTRANT_PROTO*) ;;
18040                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18041                 esac
18042                 echo "Prototype: $try" ;;
18043         esac
18044         ;;
18045         *)      case "$usethreads" in
18046                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18047                 esac
18048                 d_setlocale_r=undef
18049                 setlocale_r_proto=0
18050                 ;;
18051         esac
18052         ;;
18053 *)      setlocale_r_proto=0
18054         ;;
18055 esac
18056
18057 : see if setnetent exists
18058 set setnetent d_setnent
18059 eval $inlibc
18060
18061 : see if setnetent_r exists
18062 set setnetent_r d_setnetent_r
18063 eval $inlibc
18064 case "$d_setnetent_r" in
18065 "$define")
18066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18067         case "$d_setnetent_r_proto:$usethreads" in
18068         ":define")      d_setnetent_r_proto=define
18069                 set d_setnetent_r_proto setnetent_r $hdrs
18070                 eval $hasproto ;;
18071         *)      ;;
18072         esac
18073         case "$d_setnetent_r_proto" in
18074         define)
18075         case "$setnetent_r_proto" in
18076         ''|0) try='int setnetent_r(int, struct netent_data*);'
18077         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18078         esac
18079         case "$setnetent_r_proto" in
18080         ''|0) try='void setnetent_r(int, struct netent_data*);'
18081         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18082         esac
18083         case "$setnetent_r_proto" in
18084         ''|0)   d_setnetent_r=undef
18085                 setnetent_r_proto=0
18086                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18087         * )     case "$setnetent_r_proto" in
18088                 REENTRANT_PROTO*) ;;
18089                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18090                 esac
18091                 echo "Prototype: $try" ;;
18092         esac
18093         ;;
18094         *)      case "$usethreads" in
18095                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18096                 esac
18097                 d_setnetent_r=undef
18098                 setnetent_r_proto=0
18099                 ;;
18100         esac
18101         ;;
18102 *)      setnetent_r_proto=0
18103         ;;
18104 esac
18105
18106 : see if setprotoent exists
18107 set setprotoent d_setpent
18108 eval $inlibc
18109
18110 : see if setpgid exists
18111 set setpgid d_setpgid
18112 eval $inlibc
18113
18114 : see if setpgrp2 exists
18115 set setpgrp2 d_setpgrp2
18116 eval $inlibc
18117
18118 : see if setpriority exists
18119 set setpriority d_setprior
18120 eval $inlibc
18121
18122 : see if setproctitle exists
18123 set setproctitle d_setproctitle
18124 eval $inlibc
18125
18126 : see if setprotoent_r exists
18127 set setprotoent_r d_setprotoent_r
18128 eval $inlibc
18129 case "$d_setprotoent_r" in
18130 "$define")
18131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18132         case "$d_setprotoent_r_proto:$usethreads" in
18133         ":define")      d_setprotoent_r_proto=define
18134                 set d_setprotoent_r_proto setprotoent_r $hdrs
18135                 eval $hasproto ;;
18136         *)      ;;
18137         esac
18138         case "$d_setprotoent_r_proto" in
18139         define)
18140         case "$setprotoent_r_proto" in
18141         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18142         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18143         esac
18144         case "$setprotoent_r_proto" in
18145         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18146         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18147         esac
18148         case "$setprotoent_r_proto" in
18149         ''|0)   d_setprotoent_r=undef
18150                 setprotoent_r_proto=0
18151                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18152         * )     case "$setprotoent_r_proto" in
18153                 REENTRANT_PROTO*) ;;
18154                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18155                 esac
18156                 echo "Prototype: $try" ;;
18157         esac
18158         ;;
18159         *)      case "$usethreads" in
18160                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18161                 esac
18162                 d_setprotoent_r=undef
18163                 setprotoent_r_proto=0
18164                 ;;
18165         esac
18166         ;;
18167 *)      setprotoent_r_proto=0
18168         ;;
18169 esac
18170
18171 : see if setpwent exists
18172 set setpwent d_setpwent
18173 eval $inlibc
18174
18175 : see if setpwent_r exists
18176 set setpwent_r d_setpwent_r
18177 eval $inlibc
18178 case "$d_setpwent_r" in
18179 "$define")
18180         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18181         case "$d_setpwent_r_proto:$usethreads" in
18182         ":define")      d_setpwent_r_proto=define
18183                 set d_setpwent_r_proto setpwent_r $hdrs
18184                 eval $hasproto ;;
18185         *)      ;;
18186         esac
18187         case "$d_setpwent_r_proto" in
18188         define)
18189         case "$setpwent_r_proto" in
18190         ''|0) try='int setpwent_r(FILE**);'
18191         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18192         esac
18193         case "$setpwent_r_proto" in
18194         ''|0) try='void setpwent_r(FILE**);'
18195         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18196         esac
18197         case "$setpwent_r_proto" in
18198         ''|0)   d_setpwent_r=undef
18199                 setpwent_r_proto=0
18200                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18201         * )     case "$setpwent_r_proto" in
18202                 REENTRANT_PROTO*) ;;
18203                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18204                 esac
18205                 echo "Prototype: $try" ;;
18206         esac
18207         ;;
18208         *)      case "$usethreads" in
18209                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18210                 esac
18211                 d_setpwent_r=undef
18212                 setpwent_r_proto=0
18213                 ;;
18214         esac
18215         ;;
18216 *)      setpwent_r_proto=0
18217         ;;
18218 esac
18219
18220 : see if setregid exists
18221 set setregid d_setregid
18222 eval $inlibc
18223 set setresgid d_setresgid
18224 eval $inlibc
18225
18226 : see if setreuid exists
18227 set setreuid d_setreuid
18228 eval $inlibc
18229 set setresuid d_setresuid
18230 eval $inlibc
18231
18232 : see if setrgid exists
18233 set setrgid d_setrgid
18234 eval $inlibc
18235
18236 : see if setruid exists
18237 set setruid d_setruid
18238 eval $inlibc
18239
18240 : see if setservent exists
18241 set setservent d_setsent
18242 eval $inlibc
18243
18244 : see if setservent_r exists
18245 set setservent_r d_setservent_r
18246 eval $inlibc
18247 case "$d_setservent_r" in
18248 "$define")
18249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18250         case "$d_setservent_r_proto:$usethreads" in
18251         ":define")      d_setservent_r_proto=define
18252                 set d_setservent_r_proto setservent_r $hdrs
18253                 eval $hasproto ;;
18254         *)      ;;
18255         esac
18256         case "$d_setservent_r_proto" in
18257         define)
18258         case "$setservent_r_proto" in
18259         ''|0) try='int setservent_r(int, struct servent_data*);'
18260         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18261         esac
18262         case "$setservent_r_proto" in
18263         ''|0) try='void setservent_r(int, struct servent_data*);'
18264         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18265         esac
18266         case "$setservent_r_proto" in
18267         ''|0)   d_setservent_r=undef
18268                 setservent_r_proto=0
18269                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18270         * )     case "$setservent_r_proto" in
18271                 REENTRANT_PROTO*) ;;
18272                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18273                 esac
18274                 echo "Prototype: $try" ;;
18275         esac
18276         ;;
18277         *)      case "$usethreads" in
18278                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18279                 esac
18280                 d_setservent_r=undef
18281                 setservent_r_proto=0
18282                 ;;
18283         esac
18284         ;;
18285 *)      setservent_r_proto=0
18286         ;;
18287 esac
18288
18289 : see if setsid exists
18290 set setsid d_setsid
18291 eval $inlibc
18292
18293 : see if setvbuf exists
18294 set setvbuf d_setvbuf
18295 eval $inlibc
18296
18297 : see if shmctl exists
18298 set shmctl d_shmctl
18299 eval $inlibc
18300
18301 : see if shmget exists
18302 set shmget d_shmget
18303 eval $inlibc
18304
18305 : see if shmat exists
18306 set shmat d_shmat
18307 eval $inlibc
18308 : see what shmat returns
18309 case "$d_shmat" in
18310 "$define")
18311         $cat >shmat.c <<'END'
18312 #include <sys/shm.h>
18313 void *shmat();
18314 END
18315         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18316                 shmattype='void *'
18317         else
18318                 shmattype='char *'
18319         fi
18320         echo "and it returns ($shmattype)." >&4
18321         : see if a prototype for shmat is available
18322         xxx=`./findhdr sys/shm.h`
18323         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18324         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18325                 val="$define"
18326         else
18327                 val="$undef"
18328         fi
18329         $rm -f shmat.[co]
18330         ;;
18331 *)
18332         val="$undef"
18333         ;;
18334 esac
18335 set d_shmatprototype
18336 eval $setvar
18337
18338 : see if shmdt exists
18339 set shmdt d_shmdt
18340 eval $inlibc
18341
18342 : see how much of the 'shm*(2)' library is present.
18343 h_shm=true
18344 echo " "
18345 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18346 *"$undef"*) h_shm=false;;
18347 esac
18348 case "$osname" in
18349 freebsd)
18350     case "`ipcs 2>&1`" in
18351     "SVID shared memory"*"not configured"*)
18352         echo "Your $osname does not have the shm*(2) configured." >&4
18353         h_shm=false
18354         val="$undef"
18355         set shmctl d_shmctl
18356         eval $setvar
18357         set shmget d_shmget
18358         eval $setvar
18359         set shmat d_shmat
18360         eval $setvar
18361         set shmdt d_shmdt
18362         eval $setvar
18363         ;;
18364     esac
18365     ;;
18366 esac
18367 : we could also check for sys/ipc.h ...
18368 if $h_shm && $test `./findhdr sys/shm.h`; then
18369         echo "You have the full shm*(2) library." >&4
18370         val="$define"
18371 else
18372         echo "You don't have the full shm*(2) library." >&4
18373         val="$undef"
18374 fi
18375 set d_shm
18376 eval $setvar
18377
18378 : see if we have sigaction
18379 echo " "
18380 if set sigaction val -f d_sigaction; eval $csym; $val; then
18381         echo 'sigaction() found.' >&4
18382         $cat > try.c <<EOP
18383 #include <stdio.h>
18384 #include <sys/types.h>
18385 #include <signal.h>
18386 #$i_stdlib I_STDLIB
18387 #ifdef I_STDLIB
18388 #include <stdlib.h>
18389 #endif
18390 int main()
18391 {
18392     struct sigaction act, oact;
18393     act.sa_flags = 0;
18394     oact.sa_handler = 0;
18395     /* so that act and oact are used */
18396     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18397 }
18398 EOP
18399         set try
18400         if eval $compile_ok; then
18401                 val="$define"
18402         else
18403                 echo "But you don't seem to have a usable struct sigaction." >&4
18404                 val="$undef"
18405         fi
18406 else
18407         echo 'sigaction NOT found.' >&4
18408         val="$undef"
18409 fi
18410 set d_sigaction; eval $setvar
18411 $rm_try
18412
18413 : see what type pids are declared as in the kernel
18414 rp="What is the type of process ids on this system?"
18415 set pid_t pidtype int stdio.h sys/types.h
18416 eval $typedef_ask
18417
18418 : see what type uids are declared as in the kernel
18419 echo " "
18420 echo "Looking for the type for user ids returned by getuid()."
18421 set uid_t uidtype xxx stdio.h sys/types.h
18422 eval $typedef
18423 case "$uidtype" in
18424 xxx)
18425         xxx=`./findhdr sys/user.h`
18426         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18427         case $1 in
18428         unsigned) dflt="$1 $2" ;;
18429         *) dflt="$1" ;;
18430         esac
18431         ;;
18432 *) dflt="$uidtype";;
18433 esac
18434 case "$uidtype" in
18435 uid_t)  echo "uid_t found." ;;
18436 *)      rp="What is the type for user ids returned by getuid()?"
18437         . ./myread
18438         uidtype="$ans"
18439         ;;
18440 esac
18441
18442 : Define hasfield_t macro for Configure internal use
18443 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18444 while $test $# -ge 2; do
18445     case "$1" in
18446         $define) echo "#include <$2>";;
18447     esac ;
18448     shift 2;
18449 done > try.c;
18450 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18451 set try;
18452 if eval $compile; then
18453         val="$define";
18454 else
18455         val="$undef";
18456 fi;
18457 set $varname;
18458 eval $setvar;
18459 $rm_try'
18460
18461 : see what siginfo fields we have
18462 case "$d_sigaction" in
18463 "$define")
18464         echo "Checking if your siginfo_t has si_errno field...">&4
18465         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18466         eval $hasfield_t;
18467
18468         echo "Checking if your siginfo_t has si_pid field...">&4
18469         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18470         eval $hasfield_t;
18471
18472         echo "Checking if your siginfo_t has si_uid field...">&4
18473         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18474         eval $hasfield_t;
18475
18476         echo "Checking if your siginfo_t has si_addr field...">&4
18477         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18478         eval $hasfield_t;
18479
18480         echo "Checking if your siginfo_t has si_status field...">&4
18481         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18482         eval $hasfield_t;
18483
18484         echo "Checking if your siginfo_t has si_band field...">&4
18485         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18486         eval $hasfield_t;
18487
18488         echo "Checking if your siginfo_t has si_value field...">&4
18489         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18490         eval $hasfield_t;
18491
18492         echo "Checking if your siginfo_t has si_fd field...">&4
18493         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18494         eval $hasfield_t;
18495
18496         ;;
18497 *)
18498         d_siginfo_si_errno="$undef"
18499         d_siginfo_si_pid="$undef"
18500         d_siginfo_si_uid="$undef"
18501         d_siginfo_si_addr="$undef"
18502         d_siginfo_si_status="$undef"
18503         d_siginfo_si_band="$undef"
18504         d_siginfo_si_value="$undef"
18505         d_siginfo_si_fd="$undef"
18506         ;;
18507 esac
18508
18509 : see if this is a sunmath.h system
18510 set sunmath.h i_sunmath
18511 eval $inhdr
18512
18513 : see if signbit exists
18514 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18515 $cat >try.c <<EOCP
18516 #$i_sunmath I_SUNMATH
18517 #include <math.h>
18518 #ifdef I_SUNMATH  /* Solaris special math library */
18519 #  include <sunmath.h>
18520 #endif
18521 #define NV $nvtype
18522 int main(int argc, char **argv)
18523 {
18524     NV x = 0.0;
18525     NV y = -1.0;
18526     if ((signbit(x) == 0) && (signbit(y) != 0))
18527         return 0;
18528     else
18529         return 1;
18530 }
18531 EOCP
18532 val="$undef"
18533 set try
18534 if eval $compile; then
18535     if $run ./try; then
18536         $echo "Yes." >&4
18537         val="$define"
18538     else
18539         $echo "Signbit seems to be available, but doesn't work as I expected."
18540         $echo "I won't use it." >&4
18541         val="$undef"
18542     fi
18543 else
18544     $echo "Nope." >&4
18545     dflt="$undef"
18546 fi
18547 set d_signbit
18548 eval $setvar
18549 $rm_try
18550
18551 : see if sigprocmask exists
18552 set sigprocmask d_sigprocmask
18553 eval $inlibc
18554
18555 : see if sigsetjmp exists
18556 echo " "
18557 case "$d_sigsetjmp" in
18558 '')
18559         $cat >try.c <<EOP
18560 #include <setjmp.h>
18561 #$i_stdlib I_STDLIB
18562 #ifdef I_STDLIB
18563 #include <stdlib.h>
18564 #endif
18565 sigjmp_buf env;
18566 int set = 1;
18567 int main()
18568 {
18569         if (sigsetjmp(env,1))
18570                 exit(set);
18571         set = 0;
18572         siglongjmp(env, 1);
18573         exit(1);
18574 }
18575 EOP
18576         set try
18577         if eval $compile; then
18578                 if $run ./try >/dev/null 2>&1; then
18579                         echo "POSIX sigsetjmp found." >&4
18580                         val="$define"
18581                 else
18582                         $cat >&4 <<EOM
18583 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18584 I'll ignore them.
18585 EOM
18586                         val="$undef"
18587                 fi
18588         else
18589                 echo "sigsetjmp not found." >&4
18590                 val="$undef"
18591         fi
18592         ;;
18593 *) val="$d_sigsetjmp"
18594         case "$d_sigsetjmp" in
18595         $define) echo "POSIX sigsetjmp found." >&4;;
18596         $undef) echo "sigsetjmp not found." >&4;;
18597         esac
18598         ;;
18599 esac
18600 set d_sigsetjmp
18601 eval $setvar
18602 $rm_try
18603
18604 : see if snprintf exists
18605 set snprintf d_snprintf
18606 eval $inlibc
18607
18608 : see if vsnprintf exists
18609 set vsnprintf d_vsnprintf
18610 eval $inlibc
18611
18612 case "$d_snprintf-$d_vsnprintf" in
18613 "$define-$define")
18614     $cat <<EOM
18615 Checking whether your snprintf() and vsnprintf() work okay...
18616 EOM
18617     $cat >try.c <<'EOCP'
18618 /* v?snprintf testing logic courtesy of Russ Allbery.
18619  * According to C99:
18620  * - if the buffer is too short it still must be \0-terminated
18621  * - if the buffer is too short the potentially required length
18622  *   must be returned and not -1
18623  * - if the buffer is NULL the potentially required length
18624  *   must be returned and not -1 or core dump
18625  */
18626 #include <stdio.h>
18627 #include <stdarg.h>
18628
18629 char buf[2];
18630
18631 int test (char *format, ...)
18632 {
18633     va_list args;
18634     int count;
18635
18636     va_start (args, format);
18637     count = vsnprintf (buf, sizeof buf, format, args);
18638     va_end (args);
18639     return count;
18640 }
18641
18642 int main ()
18643 {
18644     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18645              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18646 }
18647 EOCP
18648     set try
18649     if eval $compile; then
18650         `$run ./try`
18651         case "$?" in
18652         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18653         *) cat <<EOM >&4
18654 Your snprintf() and snprintf() don't seem to be working okay.
18655 EOM
18656            d_snprintf="$undef"
18657            d_vsnprintf="$undef"
18658            ;;
18659         esac
18660     else
18661         echo "(I can't seem to compile the test program--assuming they don't)"
18662         d_snprintf="$undef"
18663         d_vsnprintf="$undef"
18664     fi
18665     $rm_try
18666     ;;
18667 esac
18668
18669 : see if sockatmark exists
18670 set sockatmark d_sockatmark
18671 eval $inlibc
18672
18673 : see if prototype for sockatmark is available
18674 echo " "
18675 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18676 eval $hasproto
18677
18678 : see if socks5_init exists
18679 set socks5_init d_socks5_init
18680 eval $inlibc
18681
18682 : see if srand48_r exists
18683 set srand48_r d_srand48_r
18684 eval $inlibc
18685 case "$d_srand48_r" in
18686 "$define")
18687         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18688         case "$d_srand48_r_proto:$usethreads" in
18689         ":define")      d_srand48_r_proto=define
18690                 set d_srand48_r_proto srand48_r $hdrs
18691                 eval $hasproto ;;
18692         *)      ;;
18693         esac
18694         case "$d_srand48_r_proto" in
18695         define)
18696         case "$srand48_r_proto" in
18697         ''|0) try='int srand48_r(long, struct drand48_data*);'
18698         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18699         esac
18700         case "$srand48_r_proto" in
18701         ''|0)   d_srand48_r=undef
18702                 srand48_r_proto=0
18703                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18704         * )     case "$srand48_r_proto" in
18705                 REENTRANT_PROTO*) ;;
18706                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18707                 esac
18708                 echo "Prototype: $try" ;;
18709         esac
18710         ;;
18711         *)      case "$usethreads" in
18712                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18713                 esac
18714                 d_srand48_r=undef
18715                 srand48_r_proto=0
18716                 ;;
18717         esac
18718         ;;
18719 *)      srand48_r_proto=0
18720         ;;
18721 esac
18722
18723 : see if srandom_r exists
18724 set srandom_r d_srandom_r
18725 eval $inlibc
18726 case "$d_srandom_r" in
18727 "$define")
18728         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18729         case "$d_srandom_r_proto:$usethreads" in
18730         ":define")      d_srandom_r_proto=define
18731                 set d_srandom_r_proto srandom_r $hdrs
18732                 eval $hasproto ;;
18733         *)      ;;
18734         esac
18735         case "$d_srandom_r_proto" in
18736         define)
18737         case "$srandom_r_proto" in
18738         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18739         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18740         esac
18741         case "$srandom_r_proto" in
18742         ''|0)   d_srandom_r=undef
18743                 srandom_r_proto=0
18744                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18745         * )     case "$srandom_r_proto" in
18746                 REENTRANT_PROTO*) ;;
18747                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18748                 esac
18749                 echo "Prototype: $try" ;;
18750         esac
18751         ;;
18752         *)      case "$usethreads" in
18753                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18754                 esac
18755                 d_srandom_r=undef
18756                 srandom_r_proto=0
18757                 ;;
18758         esac
18759         ;;
18760 *)      srandom_r_proto=0
18761         ;;
18762 esac
18763
18764 : see if prototype for setresgid is available
18765 echo " "
18766 set d_sresgproto setresgid $i_unistd unistd.h
18767 eval $hasproto
18768
18769 : see if prototype for setresuid is available
18770 echo " "
18771 set d_sresuproto setresuid $i_unistd unistd.h
18772 eval $hasproto
18773
18774 : see if stat exists
18775 set stat d_stat
18776 eval $inlibc
18777
18778 : see if sys/stat.h is available
18779 set sys/stat.h i_sysstat
18780 eval $inhdr
18781
18782 : see if stat knows about block sizes
18783 echo " "
18784 echo "Checking to see if your struct stat has st_blocks field..." >&4
18785 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18786 eval $hasfield
18787
18788 : see if this is a sys/vfs.h system
18789 set sys/vfs.h i_sysvfs
18790 eval $inhdr
18791
18792 : see if this is a sys/statfs.h system
18793 set sys/statfs.h i_sysstatfs
18794 eval $inhdr
18795
18796 : Check for statfs_s
18797 echo " "
18798 echo "Checking to see if your system supports struct statfs..." >&4
18799 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
18800 eval $hasstruct
18801 case "$d_statfs_s" in
18802 "$define")      echo "Yes, it does."   ;;
18803 *)              echo "No, it doesn't." ;;
18804 esac
18805
18806 : see if struct statfs knows about f_flags
18807 case "$d_statfs_s" in
18808 define)
18809         echo " "
18810         echo "Checking to see if your struct statfs has f_flags field..." >&4
18811         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
18812         eval $hasfield
18813         ;;
18814 *)      val="$undef"
18815         set d_statfs_f_flags
18816         eval $setvar
18817         ;;
18818 esac
18819 case "$d_statfs_f_flags" in
18820 "$define")      echo "Yes, it does."   ;;
18821 *)              echo "No, it doesn't." ;;
18822 esac
18823
18824 : see what flavor, if any, of static inline is supported
18825 echo " "
18826 echo "Checking to see if your system supports static inline..."
18827 $cat > try.c <<'EOCP'
18828 #include <stdlib.h>
18829 extern int f_via_a(int x);
18830 extern int f_via_b(int x);
18831 int main(int argc, char **argv)
18832 {
18833     int y;
18834
18835     y = f_via_a(0);
18836 #ifdef USE_B
18837     y = f_via_b(0);
18838 #endif
18839     if (y == 42) {
18840         return EXIT_SUCCESS;
18841     }
18842     else {
18843         return EXIT_FAILURE;
18844     }
18845 }
18846 EOCP
18847 $cat > a.c <<'EOCP'
18848 static INLINE int f(int x) {
18849     int y;
18850     y = x + 42;
18851     return y;
18852 }
18853
18854 int f_via_a(int x)
18855 {
18856     return f(x);
18857 }
18858 EOCP
18859 $cat > b.c <<'EOCP'
18860 extern int f(int x);
18861
18862 int f_via_b(int x)
18863 {
18864     return f(x);
18865 }
18866 EOCP
18867
18868 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18869 case "$perl_static_inline" in
18870 '')     # Check the various possibilities, and break out on success.
18871         # For gcc, prefer __inline__, which will still permit
18872         # cflags.SH to add in -ansi.
18873         case "$gccversion" in
18874                 '') xxx="inline __inline__ __inline _inline";;
18875                 *)  xxx="__inline__ inline __inline _inline";;
18876         esac
18877         for inline in $xxx; do
18878                 set try -DINLINE=$inline a.c
18879                 if eval $compile && $run ./try; then
18880                         # Now make sure there is no external linkage of static
18881                         # functions
18882                         set try -DINLINE=$inline -DUSE_B a.c b.c
18883                         if eval $compile && $run ./try; then
18884                                 $echo "Your compiler supports static $inline, " >&4
18885                                 $echo "but it also creates an external definition," >&4
18886                                 $echo "so I won't use it." >&4
18887                                 val=$undef
18888                         else
18889                                 $echo "Your compiler supports static $inline." >&4
18890                                 val=$define
18891                                 perl_static_inline="static $inline";
18892                                 break;
18893                         fi
18894                 else
18895                         $echo "Your compiler does NOT support static $inline." >&4
18896                         val="$undef"
18897                 fi
18898         done
18899         ;;
18900 *inline*) # Some variant of inline exists.
18901         echo "Keeping your $hint value of $perl_static_inline."
18902         val=$define
18903         ;;
18904 static)  # No inline capabilities
18905         echo "Keeping your $hint value of $perl_static_inline."
18906         val=$undef
18907         ;;
18908 *)  # Unrecognized previous value -- blindly trust the supplied
18909         # value and hope it makes sense.  Use old value for
18910         # d_static_inline, if there is one.
18911         echo "Keeping your $hint value of $perl_static_inline."
18912         case "$d_static_inline" in
18913                 '') val=$define ;;
18914                 *)  val=$d_static_inline ;;
18915         esac
18916         ;;
18917 esac
18918 # Fallback to plain 'static' if nothing worked.
18919 case "$perl_static_inline" in
18920 '')
18921         perl_static_inline="static"
18922         val=$undef
18923         ;;
18924 esac
18925 set d_static_inline
18926 eval $setvar
18927 $rm -f a.[co] b.[co]
18928 $rm_try
18929
18930 : Check stream access
18931 $cat >&4 <<EOM
18932 Checking how to access stdio streams by file descriptor number...
18933 EOM
18934 case "$stdio_stream_array" in
18935 '')     $cat >try.c <<EOCP
18936 #include <stdio.h>
18937 int main() {
18938   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18939     printf("yes\n");
18940 }
18941 EOCP
18942         for s in _iob __iob __sF
18943         do
18944                 set try -DSTDIO_STREAM_ARRAY=$s
18945                 if eval $compile; then
18946                         case "`$run ./try`" in
18947                         yes)    stdio_stream_array=$s; break ;;
18948                         esac
18949                 fi
18950         done
18951         $rm_try
18952 esac
18953 case "$stdio_stream_array" in
18954 '')     $cat >&4 <<EOM
18955 I can't figure out how to access stdio streams by file descriptor number.
18956 EOM
18957         d_stdio_stream_array="$undef"
18958         ;;
18959 *)      $cat >&4 <<EOM
18960 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18961 EOM
18962         d_stdio_stream_array="$define"
18963         ;;
18964 esac
18965
18966 : see if strcoll exists
18967 set strcoll d_strcoll
18968 eval $inlibc
18969
18970 : see if strerror_l exists
18971 set strerror_l d_strerror_l
18972 eval $inlibc
18973
18974 : see if strerror_r exists
18975 set strerror_r d_strerror_r
18976 eval $inlibc
18977 case "$d_strerror_r" in
18978 "$define")
18979         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18980         case "$d_strerror_r_proto:$usethreads" in
18981         ":define")      d_strerror_r_proto=define
18982                 set d_strerror_r_proto strerror_r $hdrs
18983                 eval $hasproto ;;
18984         *)      ;;
18985         esac
18986         case "$d_strerror_r_proto" in
18987         define)
18988         case "$strerror_r_proto" in
18989         ''|0) try='int strerror_r(int, char*, size_t);'
18990         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18991         esac
18992         case "$strerror_r_proto" in
18993         ''|0) try='int strerror_r(int, char*, int);'
18994         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18995         esac
18996         case "$strerror_r_proto" in
18997         ''|0) try='char* strerror_r(int, char*, size_t);'
18998         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18999         esac
19000         case "$strerror_r_proto" in
19001         ''|0)   d_strerror_r=undef
19002                 strerror_r_proto=0
19003                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19004         * )     case "$strerror_r_proto" in
19005                 REENTRANT_PROTO*) ;;
19006                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19007                 esac
19008                 echo "Prototype: $try" ;;
19009         esac
19010         ;;
19011         *)      case "$usethreads" in
19012                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19013                 esac
19014                 d_strerror_r=undef
19015                 strerror_r_proto=0
19016                 ;;
19017         esac
19018         ;;
19019 *)      strerror_r_proto=0
19020         ;;
19021 esac
19022
19023 : see if strftime exists
19024 set strftime d_strftime
19025 eval $inlibc
19026
19027 : see if strlcat exists
19028 : We need both a prototype in string.h and the symbol in libc.
19029 echo " "
19030 d_strlcat_proto=''
19031 xx1="#$d_gnulibc HAS_GNULIBC"
19032 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19033 xx3='#   define _GNU_SOURCE'
19034 xx4='#endif'
19035 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19036 eval $hasproto
19037 case "$d_strlcat_proto" in
19038     define) # see if strlcat exists
19039         set strlcat d_strlcat
19040         eval $inlibc
19041         ;;
19042     *)  val=$undef
19043         set d_strlcat
19044         eval $setvar
19045         ;;
19046 esac
19047
19048 : see if strlcpy exists
19049 : We need both a prototype in string.h and the symbol in libc.
19050 echo " "
19051 d_strlcpy_proto=''
19052 xx1="#$d_gnulibc HAS_GNULIBC"
19053 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19054 xx3='#   define _GNU_SOURCE'
19055 xx4='#endif'
19056 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19057 eval $hasproto
19058 case "$d_strlcpy_proto" in
19059     define) # see if strlcpy exists
19060         set strlcpy d_strlcpy
19061         eval $inlibc
19062         ;;
19063     *)  val=$undef
19064         set d_strlcpy
19065         eval $setvar
19066         ;;
19067 esac
19068
19069 : see if strnlen exists
19070 set strnlen d_strnlen
19071 eval $inlibc
19072
19073 : see if strtod exists
19074 set strtod d_strtod
19075 eval $inlibc
19076
19077 : see if strtod_l exists
19078 set strtod_l d_strtod_l
19079 eval $inlibc
19080
19081 : see if strtol exists
19082 set strtol d_strtol
19083 eval $inlibc
19084
19085 : see if strtold exists
19086 set strtold d_strtold
19087 eval $inlibc
19088
19089 : see if strtold_l exists
19090 set strtold_l d_strtold_l
19091 eval $inlibc
19092
19093 : see if strtoll exists
19094 set strtoll d_strtoll
19095 eval $inlibc
19096
19097 case "$d_longlong-$d_strtoll" in
19098 "$define-$define")
19099         $cat <<EOM
19100 Checking whether your strtoll() works okay...
19101 EOM
19102         $cat >try.c <<'EOCP'
19103 #include <errno.h>
19104 #ifdef __hpux
19105 #define strtoll __strtoll
19106 #endif
19107 #ifdef __EMX__
19108 #define strtoll _strtoll
19109 #endif
19110 #include <stdio.h>
19111 #include <stdlib.h>
19112 static int bad = 0;
19113 void check(const char *s, long long ell, int een) {
19114         long long gll;
19115         errno = 0;
19116         gll = strtoll(s, 0, 10);
19117         if (!((gll == ell) && (errno == een)))
19118                 bad++;
19119 }
19120 int main() {
19121         check(" 1",                                      1LL, 0);
19122         check(" 0",                                      0LL, 0);
19123         check("-1",                                     -1LL, 0);
19124         check("-9223372036854775808", -9223372036854775808LL, 0);
19125         check("-9223372036854775808", -9223372036854775808LL, 0);
19126         check(" 9223372036854775807",  9223372036854775807LL, 0);
19127         check("-9223372036854775808", -9223372036854775808LL, 0);
19128         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19129         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19130         if (!bad)
19131                 printf("ok\n");
19132 }
19133 EOCP
19134         set try
19135         if eval $compile; then
19136                 yyy=`$run ./try`
19137                 case "$yyy" in
19138                 ok) echo "Your strtoll() seems to be working okay." ;;
19139                 *) cat <<EOM >&4
19140 Your strtoll() doesn't seem to be working okay.
19141 EOM
19142                    d_strtoll="$undef"
19143                    ;;
19144                 esac
19145         else
19146                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19147                 d_strtoll="$undef"
19148         fi
19149         ;;
19150 esac
19151
19152 : see if strtoq exists
19153 set strtoq d_strtoq
19154 eval $inlibc
19155
19156 : see if strtoul exists
19157 set strtoul d_strtoul
19158 eval $inlibc
19159
19160 case "$d_strtoul" in
19161 "$define")
19162         $cat <<EOM
19163 Checking whether your strtoul() works okay...
19164 EOM
19165         $cat >try.c <<'EOCP'
19166 #include <stdlib.h>
19167 #include <errno.h>
19168 #include <stdio.h>
19169 static int bad = 0;
19170 void check(const char *s, unsigned long eul, int een) {
19171         unsigned long gul;
19172         errno = 0;
19173         gul = strtoul(s, 0, 10);
19174         if (!((gul == eul) && (errno == een)))
19175                 bad++;
19176 }
19177 int main() {
19178         check(" 1", 1L, 0);
19179         check(" 0", 0L, 0);
19180 EOCP
19181         case "$longsize" in
19182         8)
19183             $cat >>try.c <<'EOCP'
19184         check("18446744073709551615", 18446744073709551615UL, 0);
19185         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19186 #if 0 /* strtoul() for /^-/ strings is undefined. */
19187         check("-1", 18446744073709551615UL, 0);
19188         check("-18446744073709551614", 2, 0);
19189         check("-18446744073709551615", 1, 0);
19190         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19191         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19192 #endif
19193 EOCP
19194                 ;;
19195         4)
19196                     $cat >>try.c <<'EOCP'
19197         check("4294967295", 4294967295UL, 0);
19198         check("4294967296", 4294967295UL, ERANGE);
19199 #if 0 /* strtoul() for /^-/ strings is undefined. */
19200         check("-1", 4294967295UL, 0);
19201         check("-4294967294", 2, 0);
19202         check("-4294967295", 1, 0);
19203         check("-4294967296", 4294967295UL, ERANGE);
19204         check("-4294967297", 4294967295UL, ERANGE);
19205 #endif
19206 EOCP
19207                 ;;
19208         *)
19209 : Should we write these tests to be more portable by sprintf-ing
19210 : ~0 and then manipulating that char string as input for strtol?
19211                 ;;
19212         esac
19213         $cat >>try.c <<'EOCP'
19214         if (!bad)
19215                 printf("ok\n");
19216         return 0;
19217 }
19218 EOCP
19219         set try
19220         if eval $compile; then
19221                 case "`$run ./try`" in
19222                 ok) echo "Your strtoul() seems to be working okay." ;;
19223                 *) cat <<EOM >&4
19224 Your strtoul() doesn't seem to be working okay.
19225 EOM
19226                    d_strtoul="$undef"
19227                    ;;
19228                 esac
19229         else
19230                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19231                 d_strtoul="$undef"
19232         fi
19233         ;;
19234 esac
19235
19236 : see if strtoull exists
19237 set strtoull d_strtoull
19238 eval $inlibc
19239
19240 case "$d_longlong-$d_strtoull" in
19241 "$define-$define")
19242         $cat <<EOM
19243 Checking whether your strtoull() works okay...
19244 EOM
19245         $cat >try.c <<'EOCP'
19246 #include <stdlib.h>
19247 #include <errno.h>
19248 #ifdef __hpux
19249 #define strtoull __strtoull
19250 #endif
19251 #include <stdio.h>
19252 static int bad = 0;
19253 void check(const char *s, long long eull, int een) {
19254         long long gull;
19255         errno = 0;
19256         gull = strtoull(s, 0, 10);
19257         if (!((gull == eull) && (errno == een)))
19258                 bad++;
19259 }
19260 int main() {
19261         check(" 1",                                        1LL, 0);
19262         check(" 0",                                        0LL, 0);
19263         check("18446744073709551615",  18446744073709551615ULL, 0);
19264         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19265 #if 0 /* strtoull() for /^-/ strings is undefined. */
19266         check("-1",                    18446744073709551615ULL, 0);
19267         check("-18446744073709551614",                     2LL, 0);
19268         check("-18446744073709551615",                     1LL, 0);
19269         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19270         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19271 #endif
19272         if (!bad)
19273                 printf("ok\n");
19274 }
19275 EOCP
19276         set try
19277         if eval $compile; then
19278                 case "`$run ./try`" in
19279                 ok) echo "Your strtoull() seems to be working okay." ;;
19280                 *) cat <<EOM >&4
19281 Your strtoull() doesn't seem to be working okay.
19282 EOM
19283                    d_strtoull="$undef"
19284                    ;;
19285                 esac
19286         else
19287                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19288                 d_strtoull="$undef"
19289         fi
19290         ;;
19291 esac
19292
19293 : see if strtouq exists
19294 set strtouq d_strtouq
19295 eval $inlibc
19296
19297 case "$d_strtouq" in
19298 "$define")
19299         $cat <<EOM
19300 Checking whether your strtouq() works okay...
19301 EOM
19302         $cat >try.c <<'EOCP'
19303 #include <stdlib.h>
19304 #include <errno.h>
19305 #include <stdio.h>
19306 static int bad = 0;
19307 void check(const char *s, unsigned long long eull, int een) {
19308         unsigned long long gull;
19309         errno = 0;
19310         gull = strtouq(s, 0, 10);
19311         if (!((gull == eull) && (errno == een)))
19312                 bad++;
19313 }
19314 int main() {
19315         check(" 1",                                        1LL, 0);
19316         check(" 0",                                        0LL, 0);
19317         check("18446744073709551615",  18446744073709551615ULL, 0);
19318         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19319 #if 0 /* strtouq() for /^-/ strings is undefined. */
19320         check("-1",                    18446744073709551615ULL, 0);
19321         check("-18446744073709551614",                     2LL, 0);
19322         check("-18446744073709551615",                     1LL, 0);
19323         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19324         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19325 #endif
19326         if (!bad)
19327                 printf("ok\n");
19328         return 0;
19329 }
19330 EOCP
19331         set try
19332         if eval $compile; then
19333                 case "`$run ./try`" in
19334                 ok) echo "Your strtouq() seems to be working okay." ;;
19335                 *) cat <<EOM >&4
19336 Your strtouq() doesn't seem to be working okay.
19337 EOM
19338                    d_strtouq="$undef"
19339                    ;;
19340                 esac
19341         else
19342                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19343                 d_strtouq="$undef"
19344         fi
19345         ;;
19346 esac
19347
19348 : see if strxfrm exists
19349 set strxfrm d_strxfrm
19350 eval $inlibc
19351
19352 : see if symlink exists
19353 set symlink d_symlink
19354 eval $inlibc
19355
19356 : see if syscall exists
19357 set syscall d_syscall
19358 eval $inlibc
19359
19360 : see if prototype for syscall is available
19361 echo " "
19362 set d_syscallproto syscall $i_unistd unistd.h
19363 eval $hasproto
19364
19365 : see if sysconf exists
19366 set sysconf d_sysconf
19367 eval $inlibc
19368
19369 : see if sys_errlist[] exists
19370 echo " "
19371 if test "X$d_syserrlst" = X; then
19372         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19373                 echo "You have sys_errlist[], so we could roll our own strerror."
19374                 d_syserrlst="$define"
19375         else
19376                 echo "You don't have sys_errlist[], so strerror() is welcome."
19377                 d_syserrlst="$undef"
19378         fi
19379 fi
19380
19381 : see if system exists
19382 set system d_system
19383 eval $inlibc
19384
19385 : see if tcgetpgrp exists
19386 set tcgetpgrp d_tcgetpgrp
19387 eval $inlibc
19388
19389 : see if tcsetpgrp exists
19390 set tcsetpgrp d_tcsetpgrp
19391 eval $inlibc
19392
19393 : see if prototype for telldir is available
19394 echo " "
19395 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19396 eval $hasproto
19397
19398 : see if tgamma exists
19399 set tgamma d_tgamma
19400 eval $inlibc
19401
19402 : check for thread_safe_nl_langinfo_l item
19403 $cat <<EOM
19404
19405 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19406 EOM
19407 $cat >try.c <<EOCP
19408 #$i_stdlib I_STDLIB
19409 #ifdef I_STDLIB
19410 #  include <stdlib.h>
19411 #endif
19412 #include <string.h>
19413 #$i_langinfo I_LANGINFO
19414 #ifdef I_LANGINFO
19415 #  include <langinfo.h>
19416 #endif
19417 #$i_pthread I_PTHREAD
19418 #ifdef I_PTHREAD
19419 #  include <pthread.h>
19420 #endif
19421 #$i_locale I_LOCALE
19422 #ifdef I_LOCALE
19423 #  include <locale.h>
19424 #endif
19425
19426 void *
19427 thread_start(void * arg)
19428 {
19429     nl_langinfo(RADIXCHAR);
19430 }
19431
19432 int main() {
19433     char * main_buffer;
19434     char save_main_buffer[1000];
19435     pthread_t subthread;
19436     pthread_attr_t attr;
19437
19438     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19439
19440     /* If too large for our generous allowance, just assume we don't have
19441      * it. */
19442     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19443         exit(1);
19444     }
19445
19446     strcpy(save_main_buffer, main_buffer);
19447
19448     if (pthread_attr_init(&attr) != 0) {
19449         exit(1);
19450     }
19451
19452     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19453         exit(1);
19454     }
19455
19456     if (pthread_join(subthread, NULL) != 0) {
19457         exit(1);
19458     }
19459
19460     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19461 }
19462 EOCP
19463 case "$usethreads" in
19464     define)
19465         set try
19466         if eval $compile; then
19467             echo "Your system has nl_langinfo_l()..." >&4
19468             if $run ./try; then
19469                 echo "and it is thread-safe (just as I'd hoped)." >&4
19470                 d_thread_safe_nl_langinfo_l="$define"
19471                 echo "$d_thread_safe_nl_langinfo_l" >&4
19472             else
19473                 echo "but it isn't thread-safe, so we won't use it." >&4
19474             fi
19475         else
19476             echo "your system does not have nl_langinfo_l()" >&4
19477         fi
19478         ;;
19479     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19480 esac
19481 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19482         d_thread_safe_nl_langinfo_l="$undef"
19483 fi
19484 $rm_try
19485
19486 : see if time exists
19487 echo " "
19488 if test "X$d_time" = X -o X"$timetype" = X; then
19489     if set time val -f d_time; eval $csym; $val; then
19490                 echo 'time() found.' >&4
19491                 val="$define"
19492                 rp="What is the type returned by time() on this system?"
19493                 set time_t timetype long stdio.h sys/types.h
19494                 eval $typedef_ask
19495     else
19496                 echo 'time() not found, hope that will do.' >&4
19497                 val="$undef"
19498                 timetype='int';
19499     fi
19500     set d_time
19501     eval $setvar
19502 fi
19503
19504 : see if timegm exists
19505 set timegm d_timegm
19506 eval $inlibc
19507
19508 : see if this is a sys/times.h system
19509 set sys/times.h i_systimes
19510 eval $inhdr
19511
19512 : see if times exists
19513 echo " "
19514 if set times val -f d_times; eval $csym; $val; then
19515         echo 'times() found.' >&4
19516         d_times="$define"
19517         inc=''
19518         case "$i_systimes" in
19519         "$define") inc='sys/times.h';;
19520         esac
19521         rp="What is the type returned by times() on this system?"
19522         set clock_t clocktype long stdio.h sys/types.h $inc
19523         eval $typedef_ask
19524 else
19525         echo 'times() NOT found, hope that will do.' >&4
19526         d_times="$undef"
19527         clocktype='int'
19528 fi
19529
19530 : see if tmpnam_r exists
19531 set tmpnam_r d_tmpnam_r
19532 eval $inlibc
19533 case "$d_tmpnam_r" in
19534 "$define")
19535         hdrs="$i_systypes sys/types.h define stdio.h "
19536         case "$d_tmpnam_r_proto:$usethreads" in
19537         ":define")      d_tmpnam_r_proto=define
19538                 set d_tmpnam_r_proto tmpnam_r $hdrs
19539                 eval $hasproto ;;
19540         *)      ;;
19541         esac
19542         case "$d_tmpnam_r_proto" in
19543         define)
19544         case "$tmpnam_r_proto" in
19545         ''|0) try='char* tmpnam_r(char*);'
19546         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19547         esac
19548         case "$tmpnam_r_proto" in
19549         ''|0)   d_tmpnam_r=undef
19550                 tmpnam_r_proto=0
19551                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19552         * )     case "$tmpnam_r_proto" in
19553                 REENTRANT_PROTO*) ;;
19554                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19555                 esac
19556                 echo "Prototype: $try" ;;
19557         esac
19558         ;;
19559         *)      case "$usethreads" in
19560                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19561                 esac
19562                 d_tmpnam_r=undef
19563                 tmpnam_r_proto=0
19564                 ;;
19565         esac
19566         ;;
19567 *)      tmpnam_r_proto=0
19568         ;;
19569 esac
19570
19571 : see if towlower exists
19572 set towlower d_towlower
19573 eval $inlibc
19574
19575 : see if trunc exists
19576 set trunc d_trunc
19577 eval $inlibc
19578
19579 : see if truncate exists
19580 set truncate d_truncate
19581 eval $inlibc
19582
19583 : see if ttyname_r exists
19584 set ttyname_r d_ttyname_r
19585 eval $inlibc
19586 case "$d_ttyname_r" in
19587 "$define")
19588         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19589         case "$d_ttyname_r_proto:$usethreads" in
19590         ":define")      d_ttyname_r_proto=define
19591                 set d_ttyname_r_proto ttyname_r $hdrs
19592                 eval $hasproto ;;
19593         *)      ;;
19594         esac
19595         case "$d_ttyname_r_proto" in
19596         define)
19597         case "$ttyname_r_proto" in
19598         ''|0) try='int ttyname_r(int, char*, size_t);'
19599         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19600         esac
19601         case "$ttyname_r_proto" in
19602         ''|0) try='int ttyname_r(int, char*, int);'
19603         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19604         esac
19605         case "$ttyname_r_proto" in
19606         ''|0) try='char* ttyname_r(int, char*, int);'
19607         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19608         esac
19609         case "$ttyname_r_proto" in
19610         ''|0)   d_ttyname_r=undef
19611                 ttyname_r_proto=0
19612                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19613         * )     case "$ttyname_r_proto" in
19614                 REENTRANT_PROTO*) ;;
19615                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19616                 esac
19617                 echo "Prototype: $try" ;;
19618         esac
19619         ;;
19620         *)      case "$usethreads" in
19621                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19622                 esac
19623                 d_ttyname_r=undef
19624                 ttyname_r_proto=0
19625                 ;;
19626         esac
19627         ;;
19628 *)      ttyname_r_proto=0
19629         ;;
19630 esac
19631
19632 : see if tzname[] exists
19633 echo " "
19634 if set tzname val -a d_tzname; eval $csym; $val; then
19635         val="$define"
19636         echo 'tzname[] found.' >&4
19637 else
19638         val="$undef"
19639         echo 'tzname[] NOT found.' >&4
19640 fi
19641 set d_tzname
19642 eval $setvar
19643
19644 : Check if is a multiplatform env
19645 case "$osname" in
19646 darwin) multiarch="$define" ;;
19647 esac
19648 case "$multiarch" in
19649 ''|[nN]*) multiarch="$undef" ;;
19650 esac
19651
19652 : check for ordering of bytes in a UV
19653 echo " "
19654 case "$multiarch" in
19655 *$define*)
19656         $cat <<EOM
19657 You seem to be doing a multiarchitecture build,
19658 skipping the byteorder check.
19659
19660 EOM
19661         byteorder='ffff'
19662         ;;
19663 *)
19664         case "$byteorder" in
19665         '')
19666                 $cat <<'EOM'
19667 In the following, larger digits indicate more significance.  A big-endian
19668 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19669 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19670 machines may have weird orders like 3412.  A Cray will report 87654321,
19671 an Alpha will report 12345678. If the test program works the default is
19672 probably right.
19673 I'm now running the test program...
19674 EOM
19675                 $cat >try.c <<EOCP
19676 #include <stdio.h>
19677 #$i_stdlib I_STDLIB
19678 #ifdef I_STDLIB
19679 #include <stdlib.h>
19680 #endif
19681 #include <sys/types.h>
19682 typedef $uvtype UV;
19683 int main()
19684 {
19685         int i;
19686         union {
19687                 UV l;
19688                 char c[$uvsize];
19689         } u;
19690
19691         if ($uvsize > 4)
19692                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19693         else
19694                 u.l = (UV)0x04030201;
19695         for (i = 0; i < $uvsize; i++)
19696                 printf("%c", u.c[i]+'0');
19697         printf("\n");
19698         exit(0);
19699 }
19700 EOCP
19701                 xxx_prompt=y
19702                 set try
19703                 if eval $compile && $run ./try > /dev/null; then
19704                         dflt=`$run ./try`
19705                         case "$dflt" in
19706                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19707                                 echo "(The test program ran ok.)"
19708                                 echo "byteorder=$dflt"
19709                                 xxx_prompt=n
19710                         ;;
19711                         ????|????????) echo "(The test program ran ok.)" ;;
19712                         *) echo "(The test program didn't run right for some reason.)" ;;
19713                         esac
19714                 else
19715                         dflt='4321'
19716                         cat <<'EOM'
19717 (I can't seem to compile the test program.  Guessing big-endian...)
19718 EOM
19719                 fi
19720                 case "$xxx_prompt" in
19721                 y)
19722                         rp="What is the order of bytes in $uvtype?"
19723                         . ./myread
19724                         byteorder="$ans"
19725                         ;;
19726                 *)      byteorder=$dflt
19727                         ;;
19728                 esac
19729                 ;;
19730         esac
19731         $rm_try
19732         ;;
19733 esac
19734
19735 : Checking 32bit alignedness
19736 $cat <<EOM
19737
19738 Checking to see whether you can access character data unalignedly...
19739 EOM
19740 case "$d_u32align" in
19741 '')   $cat >try.c <<EOCP
19742 #include <stdio.h>
19743 #$i_stdlib I_STDLIB
19744 #ifdef I_STDLIB
19745 #include <stdlib.h>
19746 #endif
19747 #define U32 $u32type
19748 #define BYTEORDER 0x$byteorder
19749 #define U8 $u8type
19750 #include <signal.h>
19751 #ifdef SIGBUS
19752 $signal_t bletch(int s) { exit(4); }
19753 #endif
19754 int main() {
19755 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19756     volatile U8 buf[8];
19757     volatile U32 *up;
19758     int i;
19759
19760     if (sizeof(U32) != 4) {
19761         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19762         exit(1);
19763     }
19764
19765     fflush(stdout);
19766
19767 #ifdef SIGBUS
19768     signal(SIGBUS, bletch);
19769 #endif
19770
19771     buf[0] = 0;
19772     buf[1] = 0;
19773     buf[2] = 0;
19774     buf[3] = 1;
19775     buf[4] = 0;
19776     buf[5] = 0;
19777     buf[6] = 0;
19778     buf[7] = 1;
19779
19780     for (i = 0; i < 4; i++) {
19781         up = (U32*)(buf + i);
19782         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19783                (*up == 1 << (8*(3-i)))  /* little-endian */
19784               )
19785            )
19786         {
19787             printf("read failed (%x)\n", *up);
19788             exit(2);
19789         }
19790     }
19791
19792     /* write test */
19793     for (i = 0; i < 4; i++) {
19794         up = (U32*)(buf + i);
19795         *up = 0xBeef;
19796         if (*up != 0xBeef) {
19797             printf("write failed (%x)\n", *up);
19798             exit(3);
19799         }
19800     }
19801
19802     exit(0);
19803 #else
19804     printf("1\n");
19805     exit(1);
19806 #endif
19807     return 0;
19808 }
19809 EOCP
19810 set try
19811 if eval $compile_ok; then
19812         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19813         $run ./try 2>&1 >/dev/null
19814         case "$?" in
19815         0)      cat >&4 <<EOM
19816 You can access character data pretty unalignedly.
19817 EOM
19818                 d_u32align="$undef"
19819                 ;;
19820         *)      cat >&4 <<EOM
19821 It seems that you must access character data in an aligned manner.
19822 EOM
19823                 d_u32align="$define"
19824                 ;;
19825         esac
19826 else
19827         rp='Can you access character data at unaligned addresses?'
19828         dflt='n'
19829         . ./myread
19830         case "$ans" in
19831         [yY]*)  d_u32align="$undef"  ;;
19832         *)      d_u32align="$define" ;;
19833         esac
19834 fi
19835 $rm_try
19836 ;;
19837 esac
19838
19839 : see if ualarm exists
19840 set ualarm d_ualarm
19841 eval $inlibc
19842
19843 : see if umask exists
19844 set umask d_umask
19845 eval $inlibc
19846
19847 : see if unordered exists
19848 set unordered d_unordered
19849 eval $inlibc
19850
19851 : see if unsetenv exists
19852 set unsetenv d_unsetenv
19853 eval $inlibc
19854
19855 : see if usleep exists
19856 set usleep d_usleep
19857 eval $inlibc
19858
19859 : see if prototype for usleep is available
19860 echo " "
19861 set d_usleepproto usleep $i_unistd unistd.h
19862 eval $hasproto
19863
19864 : see if ustat exists
19865 set ustat d_ustat
19866 eval $inlibc
19867
19868 : see if closedir exists
19869 set closedir d_closedir
19870 eval $inlibc
19871
19872 case "$d_closedir" in
19873 "$define")
19874         echo " "
19875         echo "Checking whether closedir() returns a status..." >&4
19876         cat > try.c <<EOM
19877 #$i_dirent I_DIRENT             /**/
19878 #$i_sysdir I_SYS_DIR            /**/
19879 #$i_sysndir I_SYS_NDIR          /**/
19880 #$i_systypes I_SYS_TYPES        /**/
19881
19882 #if defined(I_SYS_TYPES)
19883 #include <sys/types.h>
19884 #endif
19885 #if defined(I_DIRENT)
19886 #include <dirent.h>
19887 #else
19888 #ifdef I_SYS_NDIR
19889 #include <sys/ndir.h>
19890 #else
19891 #ifdef I_SYS_DIR
19892 #include <sys/dir.h>
19893 #endif
19894 #endif
19895 #endif
19896 int main() { return closedir(opendir(".")); }
19897 EOM
19898         set try
19899         if eval $compile_ok; then
19900                 if $run ./try > /dev/null 2>&1 ; then
19901                         echo "Yes, it does."
19902                         val="$undef"
19903                 else
19904                         echo "No, it doesn't."
19905                         val="$define"
19906                 fi
19907         else
19908                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19909                 val="$define"
19910         fi
19911         ;;
19912 *)
19913         val="$undef";
19914         ;;
19915 esac
19916 set d_void_closedir
19917 eval $setvar
19918 $rm_try
19919
19920 : see if there is a wait4
19921 set wait4 d_wait4
19922 eval $inlibc
19923
19924 : see if waitpid exists
19925 set waitpid d_waitpid
19926 eval $inlibc
19927
19928 : see if wcrtomb exists
19929 set wcrtomb d_wcrtomb
19930 eval $inlibc
19931
19932 : look for wcscmp
19933 echo " "
19934 $cat >try.c <<'EOCP'
19935 #include <stdio.h>
19936 #include <wchar.h>
19937 int main ()
19938 {
19939     wchar_t *s = L" ";
19940     return (wcscmp (s, s) ? 1 : 0);
19941     }
19942 EOCP
19943 set try
19944 val="$undef"
19945 if eval $compile; then
19946     `$run ./try`
19947     case "$?" in
19948         0)  echo "A working wcscmp() found." >&4
19949             val="$define" ;;
19950         *)  echo "wcscmp() found, but it doesn't work" >&4
19951             ;;
19952         esac
19953 else
19954     echo "wcscmp() NOT found." >&4
19955     fi
19956 set d_wcscmp
19957 eval $setvar
19958 $rm_try
19959
19960 : see if wcstombs exists
19961 set wcstombs d_wcstombs
19962 eval $inlibc
19963
19964 : look for wcsxfrm
19965 echo " "
19966 $cat >try.c <<'EOCP'
19967 #include <errno.h>
19968 #include <wchar.h>
19969 int main ()
19970 {
19971     wchar_t dst[4], *src = L" ";
19972     errno = 0;
19973     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19974     }
19975 EOCP
19976 set try
19977 val="$undef"
19978 if eval $compile; then
19979     `$run ./try`
19980     case "$?" in
19981         0)  echo "A working wcsxfrm() found." >&4
19982             val="$define" ;;
19983         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19984             ;;
19985         esac
19986 else
19987     echo "wcsxfrm() NOT found." >&4
19988     fi
19989 set d_wcsxfrm
19990 eval $setvar
19991 $rm_try
19992
19993 : see if wctomb exists
19994 set wctomb d_wctomb
19995 eval $inlibc
19996
19997 : see if writev exists
19998 set writev d_writev
19999 eval $inlibc
20000
20001 : check for alignment requirements
20002 echo " "
20003 case "$alignbytes" in
20004     '') echo "Checking alignment constraints..." >&4
20005         $cat >try.c <<EOCP
20006 #include <stdio.h>
20007 struct foobar {
20008     char foo;
20009     $nvtype bar;
20010 } try_algn;
20011 int main()
20012 {
20013     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20014     return(0);
20015 }
20016 EOCP
20017         set try
20018         if eval $compile_ok; then
20019             dflt=`$run ./try`
20020         else
20021             dflt='8'
20022             echo "(I can't seem to compile the test program...)"
20023         fi
20024         case "$multiarch" in
20025             *$define*)
20026                 : The usual safe value is 8, but Darwin with -Duselongdouble
20027                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20028                 : Configure to pick a larger value if needed.
20029                 if $test "$dflt" -lt 8; then
20030                     dflt='8'
20031                     echo "Setting alignment to 8 for multiarch support.">&4
20032                 fi
20033                 ;;
20034         esac
20035         ;;
20036     *) dflt="$alignbytes"
20037         ;;
20038 esac
20039 rp="Doubles must be aligned on a how-many-byte boundary?"
20040 . ./myread
20041 alignbytes="$ans"
20042 $rm_try
20043
20044 : set the base revision
20045 baserev=5.0
20046
20047 : length of character in bytes. Is always 1, otherwise it is not C
20048 : This used to be a test using sizeof
20049 charsize=1
20050
20051 : Check for the number of bits in a character
20052 case "$charbits" in
20053 '')     echo "Checking how long a character is (in bits)..." >&4
20054         $cat >try.c <<EOCP
20055 #include <stdio.h>
20056 int main ()
20057 {
20058     int n;
20059     unsigned char c;
20060     for (c = 1, n = 0; c; c <<= 1, n++) ;
20061     printf ("%d\n", n);
20062     return (0);
20063     }
20064 EOCP
20065         set try
20066         if eval $compile_ok; then
20067                 dflt=`$run ./try`
20068         else
20069                 dflt='8'
20070                 echo "(I can't seem to compile the test program.  Guessing...)"
20071         fi
20072         ;;
20073 *)
20074         dflt="$charbits"
20075         ;;
20076 esac
20077 rp="What is the length of a character (in bits)?"
20078 . ./myread
20079 charbits="$ans"
20080 $rm_try
20081 case "$charbits" in
20082 8)      ;;
20083 *)      cat >&4 << EOM
20084 Your system has an unsigned character size of $charbits bits, which
20085 is rather unusual (normally it is 8 bits).  Perl likely will not work
20086 correctly on your system, with subtle bugs in various places.
20087 EOM
20088         rp='Do you really want to continue?'
20089         dflt='n'
20090         . ./myread
20091         case "$ans" in
20092                 [yY])   echo >&4 "Okay, continuing."    ;;
20093                 *)      exit 1                          ;;
20094         esac
20095 esac
20096
20097 : how do we concatenate cpp tokens here?
20098 echo " "
20099 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20100 $cat >cpp_stuff.c <<'EOCP'
20101 #define RCAT(a,b)a/**/b
20102 #define ACAT(a,b)a ## b
20103 RCAT(Rei,ser)
20104 ACAT(Cir,cus)
20105 EOCP
20106 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20107 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20108         echo "Oh!  Smells like ANSI's been here." >&4
20109         echo "We can catify or stringify, separately or together!"
20110         cpp_stuff=42
20111 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20112         echo "Ah, yes!  The good old days!" >&4
20113         echo "However, in the good old days we don't know how to stringify and"
20114         echo "catify at the same time."
20115         cpp_stuff=1
20116 else
20117         $cat >&4 <<EOM
20118 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20119 You're going to have to edit the values of CAT[2-5] in config.h...
20120 EOM
20121         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20122 fi
20123 $rm -f cpp_stuff.*
20124
20125 : see if this is a db.h system
20126 set db.h i_db
20127 eval $inhdr
20128
20129 case "$i_db" in
20130 $define)
20131         : Check db version.
20132         echo " "
20133         echo "Checking Berkeley DB version ..." >&4
20134         $cat >try.c <<EOCP
20135 #include <sys/types.h>
20136 #include <stdio.h>
20137 #$i_stdlib I_STDLIB
20138 #ifdef I_STDLIB
20139 #include <stdlib.h>
20140 #endif
20141 #include <db.h>
20142 int main(int argc, char *argv[])
20143 {
20144 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20145     int Major, Minor, Patch ;
20146     unsigned long Version ;
20147     (void)db_version(&Major, &Minor, &Patch) ;
20148     if (argc == 2) {
20149         printf("%d %d %d %d %d %d\n",
20150                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20151                Major, Minor, Patch);
20152         exit(0);
20153     }
20154     printf("You have Berkeley DB Version 2 or greater.\n");
20155
20156     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20157                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20158     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20159                 Major, Minor, Patch) ;
20160
20161     /* check that db.h & libdb are compatible */
20162     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20163         printf("db.h and libdb are incompatible.\n") ;
20164         exit(3);
20165     }
20166
20167     printf("db.h and libdb are compatible.\n") ;
20168
20169     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20170                 + DB_VERSION_PATCH ;
20171
20172     /* needs to be >= 2.3.4 */
20173     if (Version < 2003004) {
20174     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20175         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20176         exit(2);
20177     }
20178
20179     exit(0);
20180 #else
20181 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20182     if (argc == 2) {
20183         printf("1 0 0\n");
20184         exit(0);
20185     }
20186     printf("You have Berkeley DB Version 1.\n");
20187     exit(0);    /* DB version < 2: the coast is clear. */
20188 #else
20189     exit(1);    /* <db.h> not Berkeley DB? */
20190 #endif
20191 #endif
20192 }
20193 EOCP
20194         set try
20195         if eval $compile_ok && $run ./try; then
20196                 echo 'Looks OK.' >&4
20197                 set `$run ./try 1`
20198                 db_version_major=$1
20199                 db_version_minor=$2
20200                 db_version_patch=$3
20201         else
20202                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20203                 i_db=$undef
20204                 case " $libs " in
20205                 *"-ldb "*)
20206                         : Remove db from list of libraries to use
20207                         echo "Removing unusable -ldb from library list" >&4
20208                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20209                         shift
20210                         libs="$*"
20211                         echo "libs = $libs" >&4
20212                         ;;
20213                 esac
20214         fi
20215         $rm_try
20216         ;;
20217 esac
20218
20219 case "$i_db" in
20220 define)
20221         : Check the return type needed for hash
20222         echo " "
20223         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20224         $cat >try.c <<EOCP
20225 #include <sys/types.h>
20226 #include <db.h>
20227
20228 #ifndef DB_VERSION_MAJOR
20229 u_int32_t hash_cb (const void* ptr, size_t size)
20230 {
20231         return 0;
20232 }
20233 HASHINFO info;
20234 int main()
20235 {
20236         info.hash = hash_cb;
20237 }
20238 #endif
20239 EOCP
20240         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20241                 if $contains warning try.out >>/dev/null 2>&1 ; then
20242                         db_hashtype='int'
20243                 else
20244                         db_hashtype='u_int32_t'
20245                 fi
20246         else
20247                 : XXX Maybe we should just give up here.
20248                 db_hashtype=u_int32_t
20249                 $cat try.out >&4
20250                 echo "Help:  I can't seem to compile the db test program." >&4
20251                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20252         fi
20253         $rm_try
20254         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20255         ;;
20256 *)      db_hashtype=u_int32_t
20257         ;;
20258 esac
20259 case "$i_db" in
20260 define)
20261         : Check the return type needed for prefix
20262         echo " "
20263         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20264         cat >try.c <<EOCP
20265 #include <sys/types.h>
20266 #include <db.h>
20267
20268 #ifndef DB_VERSION_MAJOR
20269 size_t prefix_cb (const DBT *key1, const DBT *key2)
20270 {
20271         return 0;
20272 }
20273 BTREEINFO info;
20274 int main()
20275 {
20276         info.prefix = prefix_cb;
20277 }
20278 #endif
20279 EOCP
20280         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20281                 if $contains warning try.out >>/dev/null 2>&1 ; then
20282                         db_prefixtype='int'
20283                 else
20284                         db_prefixtype='size_t'
20285                 fi
20286         else
20287                 db_prefixtype='size_t'
20288                 : XXX Maybe we should just give up here.
20289                 $cat try.out >&4
20290                 echo "Help:  I can't seem to compile the db test program." >&4
20291                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20292         fi
20293         $rm_try
20294         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20295         ;;
20296 *)      db_prefixtype='size_t'
20297         ;;
20298 esac
20299
20300 : Include . in @INC
20301 $cat <<EOM
20302
20303 Historically Perl has provided a final fallback of the current working
20304 directory '.' when searching for a library. This, however, can lead to
20305 problems when a Perl program which loads optional modules is called from
20306 a shared directory. This can lead to executing unexpected code.
20307
20308 EOM
20309
20310 # When changing to exclude by default:
20311 case "$default_inc_excludes_dot" in
20312     $undef|false|[nN]*) dflt="n" ;;
20313     *)                  dflt="y" ;;
20314 esac
20315 # To turn exclude off by default:
20316 #case "$default_inc_excludes_dot" in
20317 #    $define|true|[yY]*) dflt="y" ;;
20318 #    *)                  dflt="n" ;;
20319 #esac
20320
20321 rp='Exclude '.' from @INC by default? '
20322 . ./myread
20323 case "$ans" in
20324     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20325     *)          default_inc_excludes_dot="$define" ;;
20326 esac
20327
20328 : Check what kind of inf/nan your system has
20329 $echo "Checking the kind of infinities and nans you have..." >&4
20330 $echo "(The following tests may crash.  That's okay.)" >&4
20331 $cat >try.c <<EOP
20332 #define DOUBLESIZE $doublesize
20333 #$d_longdbl HAS_LONG_DOUBLE
20334 #ifdef HAS_LONG_DOUBLE
20335 #define LONG_DOUBLESIZE $longdblsize
20336 #define LONG_DOUBLEKIND $longdblkind
20337 #endif
20338 #include <math.h>
20339 #include <string.h>
20340 #include <stdio.h>
20341 /* Note that whether the sign bit is on or off
20342  * for NaN depends on the CPU/FPU, and possibly
20343  * can be affected by the build toolchain.
20344  *
20345  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20346  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20347  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20348  * (respectively) as opposed to the more usual
20349  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20350  *
20351  * Pre-IEEE-754 floating point format do not even have inf/nan support
20352  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20353  * to even mention, causing immediate SIGFPE or equivalent: this is
20354  * the case with VAX floating point, for example.
20355  */
20356 static void bytes(void *v, unsigned int n) {
20357   unsigned char *p = (unsigned char *)v;
20358   int i;
20359   for (i = 0; i < n; i++) {
20360     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20361   }
20362 }
20363 int main(int argc, char *argv[]) {
20364    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20365     * because some compilers are 'smart' and not only warn but refuse to
20366     * compile such 'illegal' values. */
20367    double dinf = exp(1e9);
20368    double dnan = sqrt(-1.0);
20369 #ifdef HAS_LONG_DOUBLE
20370    long double ldinf = (long double)exp(1e9);
20371    long double ldnan = (long double)sqrt(-1.0);
20372 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20373 /* the 80-bit long doubles might have garbage in their excess bytes */
20374     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20375     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20376 # endif
20377   if (argc == 2) {
20378     switch (argv[1][0]) {
20379     case '1': bytes(&dinf, sizeof(dinf)); break;
20380     case '2': bytes(&dnan, sizeof(dnan)); break;
20381     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20382     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20383 #endif
20384     }
20385   }
20386   return 0;
20387 }
20388 EOP
20389 set try
20390 if eval $compile; then
20391     doubleinfbytes=`$run ./try 1`
20392     doublenanbytes=`$run ./try 2`
20393     case "$d_longdbl" in
20394     $define)
20395       longdblinfbytes=`$run ./try 3`
20396       longdblnanbytes=`$run ./try 4`
20397       ;;
20398     esac
20399 else
20400     # Defaults in case the above test program failed.
20401     case "$doublekind" in
20402     1) # IEEE 754 32-bit LE
20403        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20404        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20405        ;;
20406     2) # IEEE 754 32-bit BE
20407        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20408        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20409        ;;
20410     3) # IEEE 754 64-bit LE
20411        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20412        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20413        ;;
20414     4) # IEEE 754 64-bit BE
20415        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20416        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20417        ;;
20418     5) # IEEE 754 128-bit LE
20419        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20420        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20421        ;;
20422     6) # IEEE 754 128-bit BE
20423        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20424        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20425        ;;
20426     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20427        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20428        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20429        ;;
20430     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20431        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20432        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20433        ;;
20434     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20435        doubleinfbytes=$undef
20436        doublenanbytes=$undef
20437        ;;
20438     *) # No idea.
20439        doubleinfbytes=$undef
20440        doublenanbytes=$undef
20441        ;;
20442     esac
20443     case "$longdblkind" in
20444     1) # IEEE 754 128-bit LE
20445        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20446        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20447        ;;
20448     2) # IEEE 754 128-bit BE
20449        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20450        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20451        ;;
20452     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20453        case "$longdblsize" in
20454        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20455            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20456            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20457            ;;
20458        16) # x86_64
20459            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20460            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20461            ;;
20462        *)  # No idea.
20463            longdblinfbytes=$undef
20464            longdblnanbytes=$undef
20465        ;;
20466        esac
20467        ;;
20468     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20469        case "$longdblsize" in
20470        12) # 32-bit system
20471            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20472            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20473            ;;
20474        16) # 64-bit system
20475            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20476            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20477            ;;
20478        *)  # No idea.
20479            longdblinfbytes=$undef
20480            longdblnanbytes=$undef
20481        ;;
20482        esac
20483        ;;
20484     5) # 128-bit LE-LE "double double"
20485        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20486        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20487        ;;
20488     6) # 128-bit BE-BE "double double"
20489        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20490        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20491        ;;
20492     7) # 128-bit LE-BE "double double"
20493        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20494        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20495        ;;
20496     8) # 128-bit BE-LE "double double"
20497        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20498        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20499        ;;
20500     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20501        longdblinfbytes=$undef
20502        longdblnanbytes=$undef
20503        ;;
20504     *) # No idea.
20505        longdblinfbytes=$undef
20506        longdblnanbytes=$undef
20507        ;;
20508     esac
20509 fi
20510 # In case the program crashed the values are empty, turn them undef.
20511 case "$doubleinfbytes" in
20512 '') doubleinfbytes=$undef ;;
20513 esac
20514 case "$doublenanbytes" in
20515 '') doublenanbytes=$undef ;;
20516 esac
20517 case "$longdblinfbytes" in
20518 '') longdblinfbytes=$undef ;;
20519 esac
20520 case "$longdblnanbytes" in
20521 '') longdblnanbytes=$undef ;;
20522 esac
20523 $rm_try
20524
20525 : Check the length of the double mantissa
20526 $echo "Checking how many mantissa bits your doubles have..." >&4
20527 $cat >try.c <<EOP
20528 #$i_sunmath I_SUNMATH
20529 #include <float.h>
20530 #ifdef I_SUNMATH
20531 # include <sunmath.h>
20532 #endif
20533 #ifdef DBL_MANT_DIG
20534 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20535 #endif
20536 #include <stdio.h>
20537 int main(int argc, char *argv[]) {
20538 #ifdef BITS
20539   printf("%d\n", BITS);
20540 #endif
20541   return 0;
20542 }
20543 EOP
20544 set try
20545 if eval $compile; then
20546     doublemantbits=`$run ./try`
20547 else
20548     doublemantbits="$undef"
20549 fi
20550 $rm_try
20551
20552 : Check the length of the longdouble mantissa
20553 $echo "Checking how many mantissa bits your long doubles have..." >&4
20554 $cat >try.c <<EOP
20555 #$i_sunmath I_SUNMATH
20556 #include <float.h>
20557 #ifdef I_SUNMATH
20558 # include <sunmath.h>
20559 #endif
20560 #$d_longdbl HAS_LONG_DOUBLE
20561 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20562 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20563 /* This format has no implicit bit.  Beware, however, that for
20564  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20565  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20566  * and the top bit must have been one since 387, zero is plain invalid.
20567  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20568 #  define BITS LDBL_MANT_DIG
20569 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20570 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20571  * reason e.g. Irix thinks 107.  But in any case, we want only
20572  * the number of real bits, the implicit bits are of no interest.  */
20573 #  define BITS 2 * (DBL_MANT_DIG - 1)
20574 # else
20575 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20576 # endif
20577 #endif
20578 #include <stdio.h>
20579 int main(int argc, char *argv[]) {
20580 #ifdef BITS
20581   printf("%d\n", BITS);
20582 #endif
20583   return 0;
20584 }
20585 EOP
20586 set try
20587 if eval $compile; then
20588     longdblmantbits=`$run ./try`
20589 else
20590     longdblmantbits="$undef"
20591 fi
20592 $rm_try
20593
20594 : Check the length of the NV mantissa
20595 $echo "Checking how many mantissa bits your NVs have..." >&4
20596 if test "X$usequadmath" = "X$define"; then
20597   nvmantbits=112 # 128-1-15
20598 else
20599   if test "X$nvsize" = "X$doublesize"; then
20600     nvmantbits="$doublemantbits"
20601   else
20602      if test "X$nvsize" = "X$longdblsize"; then
20603        nvmantbits="$longdblmantbits"
20604      else
20605        nvmantbits="$undef"
20606      fi
20607   fi
20608 fi
20609
20610 : How can we generate normalized random numbers ?
20611 echo " "
20612 echo "Using our internal random number implementation..." >&4
20613
20614 case "$ccflags" in
20615 *-Dmy_rand=*|*-Dmy_srand=*)
20616         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20617         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20618         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20619         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20620         ;;
20621 esac
20622
20623 randfunc=Perl_drand48
20624 drand01="Perl_drand48()"
20625 seedfunc="Perl_drand48_init"
20626 randbits=48
20627 randseedtype=U32
20628
20629 : Probe whether dtrace builds an object, as newer Illumos requires an input
20630 : object file that uses at least one of the probes defined in the .d file
20631 case "$usedtrace" in
20632 $define)
20633     case "$dtracexnolibs" in
20634     $define|true|[yY]*)
20635         dtracexnolibs=$define
20636         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20637         ;;
20638     ' '|'')
20639         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20640              dtracexnolibs=$define
20641              echo "Your dtrace accepts -xnolibs"
20642         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20643              dtracexnolibs=$undef
20644              echo "Your dtrace doesn't accept -xnolibs"
20645         else
20646              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20647              exit 1
20648         fi
20649         ;;
20650     *)
20651         dtracexnolibs=$undef
20652         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20653         ;;
20654     esac
20655     case $dtracexnolibs in
20656     $define) xnolibs=-xnolibs ;;
20657     *) xnolibs= ;;
20658     esac
20659
20660     case "$dtraceobject" in
20661     $define|true|[yY]*)
20662         dtraceobject=$define
20663         ;;
20664     ' '|'')
20665         $cat >try.c <<EOM
20666 #include "perldtrace.h"
20667 int main(void) {
20668     PERL_LOADED_FILE("dummy");
20669     return 0;
20670 }
20671 EOM
20672         dtraceobject=$undef
20673         if $cc -c -o try.o $optimize $ccflags try.c \
20674                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20675                 dtraceobject=$define
20676             echo "Your dtrace builds an object file"
20677         fi
20678         ;;
20679     *) dtraceobject=$undef ;;
20680     esac
20681     $rm_try perldtrace.o perldtrace.h
20682 esac
20683
20684 : Determine if this is an EBCDIC system
20685 echo " "
20686 echo "Determining whether or not we are on an EBCDIC system..." >&4
20687 $cat >try.c <<'EOM'
20688 int main()
20689 {
20690   if ('M'==0xd4) return 0;
20691   return 1;
20692 }
20693 EOM
20694
20695 val=$undef
20696 set try
20697 if eval $compile_ok; then
20698         if $run ./try; then
20699                 echo "You seem to speak EBCDIC." >&4
20700                 val="$define"
20701         else
20702                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20703         fi
20704 else
20705         echo "I'm unable to compile the test program." >&4
20706         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20707 fi
20708 $rm_try
20709 set ebcdic
20710 eval $setvar
20711
20712 : Check how to flush
20713 echo " "
20714 $cat >&4 <<EOM
20715 Checking how to flush all pending stdio output...
20716 EOM
20717 # I only know how to find the first 32 possibly open files on SunOS.
20718 # See also hints/sunos_4_1.sh and util.c  --AD
20719 case "$osname" in
20720 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20721 esac
20722 $cat >>try.c <<EOCP
20723 #include <stdio.h>
20724 #$i_stdlib I_STDLIB
20725 #ifdef I_STDLIB
20726 #include <stdlib.h>
20727 #endif
20728 #$i_unistd I_UNISTD
20729 #ifdef I_UNISTD
20730 # include <unistd.h>
20731 #endif
20732 #$d_sysconf HAS_SYSCONF
20733 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20734 #ifdef HAS_STDIO_STREAM_ARRAY
20735 # define STDIO_STREAM_ARRAY $stdio_stream_array
20736 #endif
20737 int main() {
20738   FILE* p;
20739   unlink("try.out");
20740   p = fopen("try.out", "w");
20741 #ifdef TRY_FPUTC
20742   fputc('x', p);
20743 #else
20744 # ifdef TRY_FPRINTF
20745   fprintf(p, "x");
20746 # endif
20747 #endif
20748 #ifdef TRY_FFLUSH_NULL
20749   fflush(NULL);
20750 #endif
20751 #ifdef TRY_FFLUSH_ALL
20752   {
20753     long open_max = -1;
20754 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20755     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20756 # else
20757 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20758     open_max = sysconf(_SC_OPEN_MAX);
20759 #  else
20760 #   ifdef FOPEN_MAX
20761     open_max = FOPEN_MAX;
20762 #   else
20763 #    ifdef OPEN_MAX
20764     open_max = OPEN_MAX;
20765 #    else
20766 #     ifdef _NFILE
20767     open_max = _NFILE;
20768 #     endif
20769 #    endif
20770 #   endif
20771 #  endif
20772 # endif
20773 # ifdef HAS_STDIO_STREAM_ARRAY
20774     if (open_max > 0) {
20775       long i;
20776       for (i = 0; i < open_max; i++)
20777             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20778                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20779                 STDIO_STREAM_ARRAY[i]._flag)
20780                 fflush(&STDIO_STREAM_ARRAY[i]);
20781     }
20782   }
20783 # endif
20784 #endif
20785   _exit(42);
20786 }
20787 EOCP
20788 : first we have to find out how _not_ to flush
20789 $to try.c
20790 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20791     output=''
20792     set try -DTRY_FPUTC
20793     if eval $compile; then
20794             $run ./try 2>/dev/null
20795             code="$?"
20796             $from try.out
20797             if $test ! -s try.out -a "X$code" = X42; then
20798                 output=-DTRY_FPUTC
20799             fi
20800     fi
20801     case "$output" in
20802     '')
20803             set try -DTRY_FPRINTF
20804             if eval $compile; then
20805                     $run ./try 2>/dev/null
20806                     code="$?"
20807                     $from try.out
20808                     if $test ! -s try.out -a "X$code" = X42; then
20809                         output=-DTRY_FPRINTF
20810                     fi
20811             fi
20812         ;;
20813     esac
20814 fi
20815 : check for fflush NULL behavior
20816 case "$fflushNULL" in
20817 '')     set try -DTRY_FFLUSH_NULL $output
20818         if eval $compile; then
20819                 $run ./try 2>/dev/null
20820                 code="$?"
20821                 $from try.out
20822                 if $test -s try.out -a "X$code" = X42; then
20823                         fflushNULL="`$cat try.out`"
20824                 else
20825                         if $test "X$code" != X42; then
20826                                 $cat >&4 <<EOM
20827 (If this test failed, don't worry, we'll try another method shortly.)
20828 EOM
20829                         fi
20830                 fi
20831         fi
20832         $rm -f core try.core core.try.*
20833         case "$fflushNULL" in
20834         x)      $cat >&4 <<EOM
20835 Your fflush(NULL) works okay for output streams.
20836 Let's see if it clobbers input pipes...
20837 EOM
20838 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20839 # bug that improperly flushes the input end of pipes.  So we avoid the
20840 # autoflush on fork/system/exec support for now. :-(
20841 $cat >tryp.c <<EOCP
20842 #include <stdio.h>
20843 int
20844 main(int argc, char **argv)
20845 {
20846     char buf[1024];
20847     int i;
20848     char *bp = buf;
20849     while (1) {
20850         while ((i = getc(stdin)) != -1
20851                && (*bp++ = i) != '\n'
20852                && bp < &buf[1024])
20853         /* DO NOTHING */ ;
20854         *bp = '\0';
20855         fprintf(stdout, "%s", buf);
20856         fflush(NULL);
20857         if (i == -1)
20858             return 0;
20859         bp = buf;
20860     }
20861 }
20862 EOCP
20863                 fflushNULL="$define"
20864                 set tryp
20865                 if eval $compile; then
20866                     $rm -f tryp.out
20867                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20868                     if $test "X$targethost" != X; then
20869                         $to tryp.c
20870                         $to tryp
20871                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20872                     else
20873                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20874                     fi
20875                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20876                        $cat >&4 <<EOM
20877 fflush(NULL) seems to behave okay with input streams.
20878 EOM
20879                         fflushNULL="$define"
20880                     else
20881                         $cat >&4 <<EOM
20882 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20883 EOM
20884                         fflushNULL="$undef"
20885                     fi
20886                 fi
20887                 $rm -f core tryp.c tryp.core core.tryp.*
20888                 ;;
20889         '')     $cat >&4 <<EOM
20890 Your fflush(NULL) isn't working (contrary to ANSI C).
20891 EOM
20892                 fflushNULL="$undef"
20893                 ;;
20894         *)      $cat >&4 <<EOM
20895 Cannot figure out whether your fflush(NULL) works or not.
20896 I'm assuming it doesn't (contrary to ANSI C).
20897 EOM
20898                 fflushNULL="$undef"
20899                 ;;
20900         esac
20901         ;;
20902 $define|true|[yY]*)
20903         fflushNULL="$define"
20904         ;;
20905 *)
20906         fflushNULL="$undef"
20907         ;;
20908 esac
20909 : check explicit looping only if NULL did not work, and if the pipe
20910 : bug does not show up on an explicit flush too
20911 case "$fflushNULL" in
20912 "$undef")
20913         $cat >tryp.c <<EOCP
20914 #include <stdio.h>
20915 int
20916 main(int argc, char **argv)
20917 {
20918     char buf[1024];
20919     int i;
20920     char *bp = buf;
20921     while (1) {
20922         while ((i = getc(stdin)) != -1
20923                && (*bp++ = i) != '\n'
20924                && bp < &buf[1024])
20925         /* DO NOTHING */ ;
20926         *bp = '\0';
20927         fprintf(stdout, "%s", buf);
20928         fflush(stdin);
20929         if (i == -1)
20930             return 0;
20931         bp = buf;
20932     }
20933 }
20934 EOCP
20935         set tryp
20936         if eval $compile; then
20937             $rm -f tryp.out
20938             if $test "X$targethost" != X; then
20939                 $to tryp.c
20940                 $to tryp
20941                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20942             else
20943                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20944             fi
20945             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20946                $cat >&4 <<EOM
20947 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20948 EOM
20949                 : now check for fflushall behaviour
20950                 case "$fflushall" in
20951                 '')     set try -DTRY_FFLUSH_ALL $output
20952                         if eval $compile; then
20953                                 $cat >&4 <<EOM
20954 (Now testing the other method--but note that this also may fail.)
20955 EOM
20956                                 $run ./try 2>/dev/null
20957                                 code=$?
20958                                 $from try.out
20959                                 if $test -s try.out -a "X$code" = X42; then
20960                                         fflushall="`$cat try.out`"
20961                                 fi
20962                         fi
20963                         $rm_try
20964                         case "$fflushall" in
20965                         x)      $cat >&4 <<EOM
20966 Whew. Flushing explicitly all the stdio streams works.
20967 EOM
20968                                 fflushall="$define"
20969                                 ;;
20970                         '')     $cat >&4 <<EOM
20971 Sigh. Flushing explicitly all the stdio streams doesn't work.
20972 EOM
20973                                 fflushall="$undef"
20974                                 ;;
20975                         *)      $cat >&4 <<EOM
20976 Cannot figure out whether flushing stdio streams explicitly works or not.
20977 I'm assuming it doesn't.
20978 EOM
20979                                 fflushall="$undef"
20980                                 ;;
20981                         esac
20982                         ;;
20983                 "$define"|true|[yY]*)
20984                         fflushall="$define"
20985                         ;;
20986                 *)
20987                         fflushall="$undef"
20988                         ;;
20989                 esac
20990             else
20991                 $cat >&4 <<EOM
20992 All is futile.  Even fflush(stdin) clobbers input pipes!
20993 EOM
20994                 fflushall="$undef"
20995             fi
20996         else
20997             fflushall="$undef"
20998         fi
20999         $rm -f core tryp.c tryp.core core.tryp.*
21000         ;;
21001 *)      fflushall="$undef"
21002         ;;
21003 esac
21004
21005 case "$fflushNULL$fflushall" in
21006 undefundef)
21007         $cat <<EOM
21008 OK, I give up.  I cannot figure out how to flush pending stdio output.
21009 We won't be flushing handles at all before fork/exec/popen.
21010 EOM
21011         ;;
21012 esac
21013 $rm_try tryp
21014
21015 : Store the full pathname to the ar program for use in the C program
21016 : Respect a hint or command line value for full_ar.
21017 case "$full_ar" in
21018 '') full_ar=$ar ;;
21019 esac
21020
21021 : Store the full pathname to the sed program for use in the C program
21022 full_sed=$sed
21023
21024 : see what type gids are declared as in the kernel
21025 echo " "
21026 echo "Looking for the type for group ids returned by getgid()."
21027 set gid_t gidtype xxx stdio.h sys/types.h
21028 eval $typedef
21029 case "$gidtype" in
21030 xxx)
21031         xxx=`./findhdr sys/user.h`
21032         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21033         case $1 in
21034         unsigned) dflt="$1 $2" ;;
21035         *) dflt="$1" ;;
21036         esac
21037         ;;
21038 *) dflt="$gidtype";;
21039 esac
21040 case "$gidtype" in
21041 gid_t) echo "gid_t found." ;;
21042 *)      rp="What is the type for group ids returned by getgid()?"
21043         . ./myread
21044         gidtype="$ans"
21045         ;;
21046 esac
21047
21048 : Check the size of GID
21049 echo " "
21050 case "$gidtype" in
21051 *_t) zzz="$gidtype"     ;;
21052 *)   zzz="gid"          ;;
21053 esac
21054 echo "Checking the size of $zzz..." >&4
21055 cat > try.c <<EOCP
21056 #include <sys/types.h>
21057 #include <stdio.h>
21058 #$i_stdlib I_STDLIB
21059 #ifdef I_STDLIB
21060 #include <stdlib.h>
21061 #endif
21062 int main() {
21063     printf("%d\n", (int)sizeof($gidtype));
21064     exit(0);
21065 }
21066 EOCP
21067 set try
21068 if eval $compile_ok; then
21069         yyy=`$run ./try`
21070         case "$yyy" in
21071         '')     gidsize=4
21072                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21073                 ;;
21074         *)      gidsize=$yyy
21075                 echo "Your $zzz is $gidsize bytes long."
21076                 ;;
21077         esac
21078 else
21079         gidsize=4
21080         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21081 fi
21082
21083 : Check if GID is signed
21084 echo " "
21085 case "$gidtype" in
21086 *_t) zzz="$gidtype"     ;;
21087 *)   zzz="gid"          ;;
21088 esac
21089 echo "Checking the sign of $zzz..." >&4
21090 cat > try.c <<EOCP
21091 #include <sys/types.h>
21092 #include <stdio.h>
21093 int main() {
21094         $gidtype foo = -1;
21095         if (foo < 0)
21096                 printf("-1\n");
21097         else
21098                 printf("1\n");
21099 }
21100 EOCP
21101 set try
21102 if eval $compile; then
21103         yyy=`$run ./try`
21104         case "$yyy" in
21105         '')     gidsign=1
21106                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21107                 ;;
21108         *)      gidsign=$yyy
21109                 case "$gidsign" in
21110                  1) echo "Your $zzz is unsigned." ;;
21111                 -1) echo "Your $zzz is signed."   ;;
21112                 esac
21113                 ;;
21114         esac
21115 else
21116         gidsign=1
21117         echo "(I can't compile the test program--guessing unsigned.)" >&4
21118 fi
21119
21120 : Check 64bit sizes
21121 echo " "
21122
21123 if $test X"$quadtype" != X; then
21124
21125 echo "Checking how to print 64-bit integers..." >&4
21126
21127 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21128         $cat >try.c <<'EOCP'
21129 #include <sys/types.h>
21130 #include <stdio.h>
21131 int main() {
21132   int q = 12345678901;
21133   printf("%ld\n", q);
21134 }
21135 EOCP
21136         set try
21137         if eval $compile; then
21138                 yyy=`$run ./try`
21139                 case "$yyy" in
21140                 12345678901)
21141                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21142                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21143                         echo "We will use %d."
21144                         ;;
21145                 esac
21146         fi
21147 fi
21148
21149 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21150         $cat >try.c <<'EOCP'
21151 #include <sys/types.h>
21152 #include <stdio.h>
21153 int main() {
21154   long q = 12345678901;
21155   printf("%ld\n", q);
21156 }
21157 EOCP
21158         set try
21159         if eval $compile; then
21160                 yyy=`$run ./try`
21161                 case "$yyy" in
21162                 12345678901)
21163                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21164                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21165                         echo "We will use %ld."
21166                         ;;
21167                 esac
21168         fi
21169 fi
21170
21171 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21172         $cat >try.c <<'EOCP'
21173 #include <sys/types.h>
21174 #include <inttypes.h>
21175 #include <stdio.h>
21176 int main() {
21177   int64_t q = 12345678901;
21178   printf("%" PRId64 "\n", q);
21179 }
21180 EOCP
21181         set try
21182         if eval $compile; then
21183                 yyy=`$run ./try`
21184                 case "$yyy" in
21185                 12345678901)
21186                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21187                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21188                         echo "We will use the C9X style."
21189                         ;;
21190                 esac
21191         fi
21192 fi
21193
21194 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21195         $cat >try.c <<EOCP
21196 #include <sys/types.h>
21197 #include <stdio.h>
21198 int main() {
21199   $quadtype q = 12345678901;
21200   printf("%Ld\n", q);
21201 }
21202 EOCP
21203         set try
21204         if eval $compile; then
21205                 yyy=`$run ./try`
21206                 case "$yyy" in
21207                 12345678901)
21208                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21209                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21210                         echo "We will use %Ld."
21211                         ;;
21212                 esac
21213         fi
21214 fi
21215
21216 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21217         $cat >try.c <<'EOCP'
21218 #include <sys/types.h>
21219 #include <stdio.h>
21220 int main() {
21221   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21222   printf("%lld\n", q);
21223 }
21224 EOCP
21225         set try
21226         if eval $compile; then
21227                 yyy=`$run ./try`
21228                 case "$yyy" in
21229                 12345678901)
21230                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21231                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21232                         echo "We will use the %lld style."
21233                         ;;
21234                 esac
21235         fi
21236 fi
21237
21238 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21239         $cat >try.c <<EOCP
21240 #include <sys/types.h>
21241 #include <stdio.h>
21242 int main() {
21243   $quadtype q = 12345678901;
21244   printf("%qd\n", q);
21245 }
21246 EOCP
21247         set try
21248         if eval $compile; then
21249                 yyy=`$run ./try`
21250                 case "$yyy" in
21251                 12345678901)
21252                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21253                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21254                         echo "We will use %qd."
21255                         ;;
21256                 esac
21257         fi
21258 fi
21259
21260 if $test X"$sPRId64" = X; then
21261         echo "Cannot figure out how to print 64-bit integers." >&4
21262 fi
21263 $rm_try
21264
21265 fi
21266
21267 case "$sPRId64" in
21268 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21269         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21270         ;;
21271 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21272         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21273         ;;
21274 esac
21275
21276 : Check format strings for internal types
21277 echo " "
21278 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21279
21280 if $test X"$ivsize" = X8; then
21281         ivdformat="$sPRId64"
21282         uvuformat="$sPRIu64"
21283         uvoformat="$sPRIo64"
21284         uvxformat="$sPRIx64"
21285         uvXUformat="$sPRIXU64"
21286 else
21287         if $test X"$ivsize" = X"$longsize"; then
21288                 ivdformat='"ld"'
21289                 uvuformat='"lu"'
21290                 uvoformat='"lo"'
21291                 uvxformat='"lx"'
21292                 uvXUformat='"lX"'
21293         else
21294                 if $test X"$ivsize" = X"$intsize"; then
21295                         ivdformat='"d"'
21296                         uvuformat='"u"'
21297                         uvoformat='"o"'
21298                         uvxformat='"x"'
21299                         uvXUformat='"X"'
21300                 else
21301                         : far out
21302                         if $test X"$ivsize" = X"$shortsize"; then
21303                                 ivdformat='"hd"'
21304                                 uvuformat='"hu"'
21305                                 uvoformat='"ho"'
21306                                 uvxformat='"hx"'
21307                                 uvXUformat='"hX"'
21308                         fi
21309                 fi
21310         fi
21311 fi
21312
21313 if $test X"$usequadmath" = X"$define"; then
21314     nveformat='"Qe"'
21315     nvfformat='"Qf"'
21316     nvgformat='"Qg"'
21317     nvEUformat='"QE"'
21318     nvFUformat='"QF"'
21319     nvGUformat='"QG"'
21320 else
21321     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21322         nveformat="$sPRIeldbl"
21323         nvfformat="$sPRIfldbl"
21324         nvgformat="$sPRIgldbl"
21325         nvEUformat="$sPRIEUldbl"
21326         nvFUformat="$sPRIFUldbl"
21327         nvGUformat="$sPRIGUldbl"
21328     else
21329         nveformat='"e"'
21330         nvfformat='"f"'
21331         nvgformat='"g"'
21332         nvEUformat='"E"'
21333         nvFUformat='"F"'
21334         nvGUformat='"G"'
21335     fi
21336 fi
21337
21338 case "$ivdformat" in
21339 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21340     exit 1
21341     ;;
21342 esac
21343
21344 : Check format string for GID
21345
21346 echo " "
21347 $echo "Checking the format string to be used for gids..." >&4
21348
21349 case "$gidsign" in
21350 -1)     if $test X"$gidsize" = X"$ivsize"; then
21351                 gidformat="$ivdformat"
21352         else
21353                 if $test X"$gidsize" = X"$longsize"; then
21354                         gidformat='"ld"'
21355                 else
21356                         if $test X"$gidsize" = X"$intsize"; then
21357                                 gidformat='"d"'
21358                         else
21359                                 if $test X"$gidsize" = X"$shortsize"; then
21360                                         gidformat='"hd"'
21361                                 fi
21362                         fi
21363                 fi
21364         fi
21365         ;;
21366 *)      if $test X"$gidsize" = X"$uvsize"; then
21367                 gidformat="$uvuformat"
21368         else
21369                 if $test X"$gidsize" = X"$longsize"; then
21370                         gidformat='"lu"'
21371                 else
21372                         if $test X"$gidsize" = X"$intsize"; then
21373                                 gidformat='"u"'
21374                         else
21375                                 if $test X"$gidsize" = X"$shortsize"; then
21376                                         gidformat='"hu"'
21377                                 fi
21378                         fi
21379                 fi
21380         fi
21381         ;;
21382 esac
21383
21384 : see if getgroups exists
21385 set getgroups d_getgrps
21386 eval $inlibc
21387
21388 : see if setgroups exists
21389 set setgroups d_setgrps
21390 eval $inlibc
21391
21392 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21393 echo " "
21394 case "$d_getgrps$d_setgrps" in
21395 *define*)
21396         case "$groupstype" in
21397         '') dflt="$gidtype" ;;
21398         *)  dflt="$groupstype" ;;
21399         esac
21400         $cat <<EOM
21401 What type of pointer is the second argument to getgroups() and setgroups()?
21402 Usually this is the same as group ids, $gidtype, but not always.
21403
21404 EOM
21405         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21406         . ./myread
21407         groupstype="$ans"
21408         ;;
21409 *)  groupstype="$gidtype";;
21410 esac
21411
21412 : check whether make sets MAKE
21413 echo " "
21414 echo "Checking if your $make program sets \$(MAKE)..." >&4
21415 case "$make_set_make" in
21416 '')
21417         $sed 's/^X //' > testmake.mak << 'EOF'
21418 Xall:
21419 X       @echo 'maketemp="$(MAKE)"'
21420 EOF
21421         case "`$make -f testmake.mak 2>/dev/null`" in
21422         *maketemp=*) make_set_make='#' ;;
21423         *)      make_set_make="MAKE=$make" ;;
21424         esac
21425         $rm -f testmake.mak
21426         ;;
21427 esac
21428 case "$make_set_make" in
21429 '#') echo "Yup, it does.";;
21430 *) echo "Nope, it doesn't.";;
21431 esac
21432
21433 : see what type is used for mode_t
21434 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21435 set mode_t modetype int stdio.h sys/types.h
21436 eval $typedef_ask
21437
21438 : see if we need va_copy
21439 echo " "
21440 $cat >try.c <<EOCP
21441 #include <stdarg.h>
21442 #include <stdio.h>
21443 #include <stdlib.h>
21444 #include <signal.h>
21445
21446 int
21447 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21448 {
21449   return vfprintf(f, fmt, *valp);
21450 }
21451
21452 int
21453 myvfprintf(FILE *f, const  char *fmt, va_list val)
21454 {
21455   return ivfprintf(f, fmt, &val);
21456 }
21457
21458 int
21459 myprintf(char *fmt, ...)
21460 {
21461   va_list val;
21462   va_start(val, fmt);
21463   return myvfprintf(stdout, fmt, val);
21464 }
21465
21466 int
21467 main(int ac, char **av)
21468 {
21469   signal(SIGSEGV, exit);
21470
21471   myprintf("%s%cs all right, then\n", "that", '\'');
21472   exit(0);
21473 }
21474 EOCP
21475 set try
21476 if eval $compile && $run ./try 2>&1 >/dev/null; then
21477         case "`$run ./try`" in
21478         "that's all right, then")
21479                 okay=yes
21480                 ;;
21481         esac
21482 fi
21483 case "$okay" in
21484 yes)    echo "It seems that you don't need va_copy()." >&4
21485         need_va_copy="$undef"
21486         ;;
21487 *)      echo "It seems that va_copy() or similar will be needed." >&4
21488         need_va_copy="$define"
21489         ;;
21490 esac
21491 $rm_try
21492
21493 : see what type is used for size_t
21494 rp="What is the type used for the length parameter for string functions?"
21495 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21496 eval $typedef_ask
21497
21498 : check for type of arguments to gethostbyaddr.
21499 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21500         case "$d_gethbyaddr" in
21501         $define)
21502                 $cat <<EOM
21503
21504 Checking to see what type of arguments are accepted by gethostbyaddr().
21505 EOM
21506                 hdrs="$define sys/types.h
21507                         $d_socket sys/socket.h
21508                         $i_niin netinet/in.h
21509                         $i_netdb netdb.h
21510                         $i_unistd unistd.h"
21511                 : The first arg can 'char *' or 'void *'
21512                 : The second arg is some of integral type
21513                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21514                         for yyy in size_t long int; do
21515                                 case "$netdb_host_type" in
21516                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21517                                         if ./protochk "$try" $hdrs; then
21518                                                 echo "Your system accepts $xxx for the first arg."
21519                                                 echo "...and $yyy for the second arg."
21520                                                 netdb_host_type="$xxx"
21521                                                 netdb_hlen_type="$yyy"
21522                                         fi
21523                                         ;;
21524                                 esac
21525                         done
21526                 done
21527                 : In case none of those worked, prompt the user.
21528                 case "$netdb_host_type" in
21529                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21530                         dflt='char *'
21531                         . ./myread
21532                         netdb_host_type=$ans
21533                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21534                         dflt="$sizetype"
21535                         . ./myread
21536                         netdb_hlen_type=$ans
21537                         ;;
21538                 esac
21539                 ;;
21540         *)      : no gethostbyaddr, so pick harmless defaults
21541                 netdb_host_type='char *'
21542                 netdb_hlen_type="$sizetype"
21543                 ;;
21544         esac
21545         # Remove the "const" if needed. -- but then we'll have a
21546         # prototype clash!
21547         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21548 fi
21549
21550 : check for type of argument to gethostbyname.
21551 if test "X$netdb_name_type" = X ; then
21552         case "$d_gethbyname" in
21553         $define)
21554                 $cat <<EOM
21555
21556 Checking to see what type of argument is accepted by gethostbyname().
21557 EOM
21558                 hdrs="$define sys/types.h
21559                         $d_socket sys/socket.h
21560                         $i_niin netinet/in.h
21561                         $i_netdb netdb.h
21562                         $i_unistd unistd.h"
21563                 for xxx in "const char *" "char *"; do
21564                         case "$netdb_name_type" in
21565                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21566                                 if ./protochk "$try" $hdrs; then
21567                                         echo "Your system accepts $xxx."
21568                                         netdb_name_type="$xxx"
21569                                 fi
21570                                 ;;
21571                         esac
21572                 done
21573                 : In case none of those worked, prompt the user.
21574                 case "$netdb_name_type" in
21575                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21576                         dflt='char *'
21577                         . ./myread
21578                         netdb_name_type=$ans
21579                         ;;
21580                 esac
21581                 ;;
21582         *)      : no gethostbyname, so pick harmless default
21583                 netdb_name_type='char *'
21584                 ;;
21585         esac
21586 fi
21587
21588 : check for type of 1st argument to getnetbyaddr.
21589 if test "X$netdb_net_type" = X ; then
21590         case "$d_getnbyaddr" in
21591         $define)
21592                 $cat <<EOM
21593
21594 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21595 EOM
21596                 hdrs="$define sys/types.h
21597                         $d_socket sys/socket.h
21598                         $i_niin netinet/in.h
21599                         $i_netdb netdb.h
21600                         $i_unistd unistd.h"
21601                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21602                         case "$netdb_net_type" in
21603                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21604                                 if ./protochk "$try" $hdrs; then
21605                                         echo "Your system accepts $xxx."
21606                                         netdb_net_type="$xxx"
21607                                 fi
21608                                 ;;
21609                         esac
21610                 done
21611                 : In case none of those worked, prompt the user.
21612                 case "$netdb_net_type" in
21613                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21614                         dflt='long'
21615                         . ./myread
21616                         netdb_net_type=$ans
21617                         ;;
21618                 esac
21619                 ;;
21620         *)      : no getnetbyaddr, so pick harmless default
21621                 netdb_net_type='long'
21622                 ;;
21623         esac
21624 fi
21625 : locate the preferred pager for this system
21626 fn=f/
21627 case "$pager" in
21628 '')
21629         dflt=''
21630         case "$pg" in
21631         /*) dflt=$pg;;
21632         [a-zA-Z]:/*) dflt=$pg;;
21633         esac
21634         case "$more" in
21635         /*) dflt=$more;;
21636         [a-zA-Z]:/*) dflt=$more;;
21637         esac
21638         case "$less" in
21639         /*) dflt=$less;;
21640         [a-zA-Z]:/*) dflt=$less;;
21641         esac
21642         case "$dflt" in
21643         '') dflt=/usr/ucb/more;;
21644         esac
21645         ;;
21646 *)      dflt="$pager"
21647         ;;
21648 esac
21649 fn="f/($dflt)"
21650 echo " "
21651 rp='What pager is used on your system?'
21652 . ./getfile
21653 pager="$ans"
21654
21655 : see if ar generates random libraries by itself
21656 echo " "
21657 echo "Checking how to generate random libraries on your machine..." >&4
21658 echo 'int bar1() { return bar2(); }' > bar1.c
21659 echo 'int bar2() { return 2; }' > bar2.c
21660 $cat > foo.c <<EOP
21661 #$i_stdlib I_STDLIB
21662 #ifdef I_STDLIB
21663 #include <stdlib.h>
21664 #endif
21665 int main() { printf("%d\n", bar1()); exit(0); }
21666 EOP
21667 $cc $ccflags -c bar1.c >/dev/null 2>&1
21668 $cc $ccflags -c bar2.c >/dev/null 2>&1
21669 $cc $ccflags -c foo.c >/dev/null 2>&1
21670 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21671 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21672         $run ./foobar >/dev/null 2>&1; then
21673         echo "$ar appears to generate random libraries itself."
21674         orderlib=false
21675         if [ "X$ranlib" = "X" ]; then
21676             ranlib=":"
21677         fi
21678 elif $ar s bar$_a >/dev/null 2>&1 &&
21679         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21680         $run ./foobar >/dev/null 2>&1; then
21681                 echo "a table of contents needs to be added with '$ar s'."
21682                 orderlib=false
21683                 ranlib="$ar s"
21684 elif $ar ts bar$_a >/dev/null 2>&1 &&
21685         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21686         $run ./foobar >/dev/null 2>&1; then
21687                 echo "a table of contents needs to be added with '$ar ts'."
21688                 orderlib=false
21689                 ranlib="$ar ts"
21690 else
21691         case "$ranlib" in
21692         :) ranlib='';;
21693         '')
21694                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21695                 $test -f $ranlib || ranlib=''
21696                 ;;
21697         esac
21698         if $test -n "$ranlib"; then
21699                 echo "your system has '$ranlib'; we'll use that."
21700                 orderlib=false
21701         else
21702                 echo "your system doesn't seem to support random libraries"
21703                 echo "so we'll use lorder and tsort to order the libraries."
21704                 orderlib=true
21705                 ranlib=":"
21706         fi
21707 fi
21708 $rm -f foo* bar*
21709
21710 : Check the max offset that gmtime and localtime accept
21711 echo "Checking max offsets that gmtime () accepts"
21712
21713 case "$sGMTIME_min/$sGMTIME_max" in
21714     0/0|/)
21715         $cat >try.c <<EOCP
21716 #include <sys/types.h>
21717 #include <stdio.h>
21718 #include <time.h>
21719
21720 int i;
21721 struct tm *tmp;
21722 time_t pt;
21723
21724 void gm_check (time_t t, int min_year, int max_year)
21725 {
21726     tmp = gmtime (&t);
21727     if ( tmp == NULL ||
21728         /* Check tm_year overflow */
21729          tmp->tm_year < min_year || tmp->tm_year > max_year)
21730         tmp = NULL;
21731     else
21732         pt = t;
21733     } /* gm_check */
21734
21735 int check_max ()
21736 {
21737     tmp = NULL;
21738     pt  = 0;
21739 #ifdef MAXLONG
21740     gm_check (MAXLONG, 69, 0x7fffffff);
21741 #endif
21742     if (tmp == NULL || tmp->tm_year < 0) {
21743         for (i = 63; i >= 0; i--) {
21744             time_t x = pt | ((time_t)1 << i);
21745             if (x < 0 || x < pt) continue;
21746             gm_check (x, 69, 0x7fffffff);
21747             }
21748         }
21749     printf ("sGMTIME_max=%ld\n", pt);
21750     return (0);
21751     } /* check_max */
21752
21753 int check_min ()
21754 {
21755     tmp = NULL;
21756     pt  = 0;
21757 #ifdef MINLONG
21758     gm_check (MINLONG, -1900, 70);
21759 #endif
21760     if (tmp == NULL) {
21761         for (i = 36; i >= 0; i--) {
21762             time_t x = pt - ((time_t)1 << i);
21763             if (x > 0) continue;
21764             gm_check (x, -1900, 70);
21765             }
21766         }
21767     printf ("sGMTIME_min=%ld\n", pt);
21768     return (0);
21769     } /* check_min */
21770
21771 int main (int argc, char *argv[])
21772 {
21773     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21774     check_max ();
21775     check_min ();
21776     return (0);
21777     } /* main */
21778 EOCP
21779         set try
21780         if eval $compile; then
21781             eval `$run ./try 2>/dev/null`
21782         else
21783             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21784             fi
21785         $rm_try
21786         ;;
21787     esac
21788
21789 echo "Checking max offsets that localtime () accepts"
21790
21791 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21792     0/0|/)
21793         $cat >try.c <<EOCP
21794 #include <sys/types.h>
21795 #include <stdio.h>
21796 #include <time.h>
21797
21798 int i;
21799 struct tm *tmp;
21800 time_t pt;
21801
21802 void local_check (time_t t, int min_year, int max_year)
21803 {
21804     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21805         tmp = NULL;
21806     else
21807         tmp = localtime (&t);
21808     if ( tmp == NULL ||
21809         /* Check tm_year overflow */
21810          tmp->tm_year < min_year || tmp->tm_year > max_year)
21811         tmp = NULL;
21812     else
21813         pt = t;
21814     } /* local_check */
21815
21816 int check_max ()
21817 {
21818     tmp = NULL;
21819     pt  = 0;
21820 #ifdef MAXLONG
21821     local_check (MAXLONG, 69, 0x7fffffff);
21822 #endif
21823     if (tmp == NULL || tmp->tm_year < 0) {
21824         for (i = 63; i >= 0; i--) {
21825             time_t x = pt | ((time_t)1 << i);
21826             if (x < 0 || x < pt) continue;
21827             local_check (x, 69, 0x7fffffff);
21828             }
21829         }
21830     printf ("sLOCALTIME_max=%ld\n", pt);
21831     return (0);
21832    } /* check_max */
21833
21834 int check_min ()
21835 {
21836     tmp = NULL;
21837     pt  = 0;
21838 #ifdef MINLONG
21839     local_check (MINLONG, -1900, 70);
21840 #endif
21841     if (tmp == NULL) {
21842         for (i = 36; i >= 0; i--) {
21843             time_t x = pt - ((time_t)1 << i);
21844             if (x > 0) continue;
21845             local_check (x, -1900, 70);
21846             }
21847         }
21848     printf ("sLOCALTIME_min=%ld\n", pt);
21849     return (0);
21850     } /* check_min */
21851
21852 int main (int argc, char *argv[])
21853 {
21854     check_max ();
21855     check_min ();
21856     return (0);
21857     } /* main */
21858 EOCP
21859         set try
21860         if eval $compile; then
21861             eval `$run ./try 2>/dev/null`
21862         else
21863             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21864             fi
21865         $rm_try
21866         ;;
21867     esac
21868
21869 : check for type of arguments to select.
21870 case "$selecttype" in
21871 '') case "$d_select" in
21872         $define)
21873                 echo " "
21874                 $cat <<EOM
21875 Checking to see what type of arguments are accepted by select().
21876 EOM
21877                 hdrs="$define sys/types.h
21878                         $i_systime sys/time.h
21879                         $i_sysselct sys/select.h
21880                         $d_socket sys/socket.h"
21881                 : The first arg can be int, unsigned, or size_t
21882                 : The last arg may or may not be 'const'
21883                 val=''
21884                 : void pointer has been seen but using that
21885                 : breaks the selectminbits test
21886                 for xxx in 'fd_set *' 'int *'; do
21887                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21888                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21889                                         case "$val" in
21890                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21891                                                 if ./protochk "$try" $hdrs; then
21892                                                         echo "Your system accepts $xxx."
21893                                                         val="$xxx"
21894                                                 fi
21895                                                 ;;
21896                                         esac
21897                                 done
21898                         done
21899                 done
21900                 case "$val" in
21901                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21902                         case "$d_fd_set" in
21903                                 $define) dflt="fd_set *" ;;
21904                                 *)              dflt="int *" ;;
21905                         esac
21906                         . ./myread
21907                         val=$ans
21908                         ;;
21909                 esac
21910                 selecttype="$val"
21911                 ;;
21912         *)      : no select, so pick a harmless default
21913                 selecttype='int *'
21914                 ;;
21915         esac
21916         ;;
21917 esac
21918
21919 : check for the select 'width'
21920 case "$selectminbits" in
21921 '') safebits=`expr $ptrsize \* 8`
21922     case "$d_select" in
21923         $define)
21924                 $cat <<EOM
21925
21926 Checking to see on how many bits at a time your select() operates...
21927 EOM
21928                 $cat >try.c <<EOCP
21929 #include <sys/types.h>
21930 #$i_time I_TIME
21931 #$i_systime I_SYS_TIME
21932 #$i_systimek I_SYS_TIME_KERNEL
21933 #ifdef I_TIME
21934 #   include <time.h>
21935 #endif
21936 #ifdef I_SYS_TIME
21937 #   ifdef I_SYS_TIME_KERNEL
21938 #       define KERNEL
21939 #   endif
21940 #   include <sys/time.h>
21941 #   ifdef I_SYS_TIME_KERNEL
21942 #       undef KERNEL
21943 #   endif
21944 #endif
21945 #$i_sysselct I_SYS_SELECT
21946 #ifdef I_SYS_SELECT
21947 #include <sys/select.h>
21948 #endif
21949 #$d_socket HAS_SOCKET
21950 #ifdef HAS_SOCKET
21951 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21952 #endif
21953 #include <stdio.h>
21954 #$i_stdlib I_STDLIB
21955 #ifdef I_STDLIB
21956 #include <stdlib.h>
21957 #endif
21958 $selecttype b;
21959 #define S sizeof(*(b))
21960 #define MINBITS 64
21961 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21962 #define NBITS  (NBYTES * 8)
21963 int main() {
21964     char *s = (char *)malloc(NBYTES);
21965     struct timeval t;
21966     int i;
21967     FILE* fp;
21968     int fd;
21969
21970     if (!s)
21971         exit(1);
21972     fclose(stdin);
21973     fp = fopen("try.c", "r");
21974     if (fp == 0)
21975       exit(2);
21976     fd = fileno(fp);
21977     if (fd < 0)
21978       exit(3);
21979     b = ($selecttype)s;
21980     for (i = 0; i < NBITS; i++)
21981         FD_SET(i, b);
21982     t.tv_sec  = 0;
21983     t.tv_usec = 0;
21984     select(fd + 1, b, 0, 0, &t);
21985     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21986     free(s);
21987     printf("%d\n", i + 1);
21988     return 0;
21989 }
21990 EOCP
21991                 set try
21992                 if eval $compile_ok; then
21993                         selectminbits=`$run ./try 2>/dev/null`
21994                         case "$selectminbits" in
21995                         '')     cat >&4 <<EOM
21996 Cannot figure out on how many bits at a time your select() operates.
21997 I'll play safe and guess it is $safebits bits.
21998 EOM
21999                                 selectminbits=$safebits
22000                                 bits="$safebits bits"
22001                                 ;;
22002                         1)      bits="1 bit" ;;
22003                         *)      bits="$selectminbits bits" ;;
22004                         esac
22005                         echo "Your select() operates on $bits at a time." >&4
22006                 else
22007                         rp='What is the minimum number of bits your select() operates on?'
22008                         case "$byteorder" in
22009                         12345678)       dflt=64 ;;
22010                         1234)           dflt=32 ;;
22011                         *)              dflt=1  ;;
22012                         esac
22013                         . ./myread
22014                         val=$ans
22015                         selectminbits="$val"
22016                 fi
22017                 $rm_try
22018                 ;;
22019         *)      : no select, so pick a harmless default
22020                 selectminbits=$safebits
22021                 ;;
22022         esac
22023         ;;
22024 esac
22025
22026 : Trace out the files included by signal.h, then look for SIGxxx names.
22027 case "$sig_num_init" in
22028 '')
22029 if [ "X$fieldn" = X ]; then
22030         : Just make some guesses.  We check them later.
22031         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22032 else
22033         xxx=`echo '#include <signal.h>' |
22034         $cppstdin $cppminus $cppflags 2>/dev/null |
22035         $grep '^[       ]*#.*include' |
22036         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22037                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22038 fi
22039 xxxfiles=''
22040 for xx in $xxx /dev/null ; do
22041         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22042 done
22043 case "$xxxfiles" in
22044 '')     xxxfiles=`./findhdr signal.h` ;;
22045 esac
22046 xxx=`awk '
22047 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22048         print substr($2, 4, 20)
22049 }
22050 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22051         print substr($3, 4, 20)
22052 }' $xxxfiles`
22053 : Append some common names just in case the awk scan failed.
22054 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22055 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22056 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22057 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22058 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22059
22060 : generate a few handy files for later
22061 $cat > signal.c <<EOCP
22062 #include <sys/types.h>
22063 #include <signal.h>
22064 #$i_stdlib I_STDLIB
22065 #ifdef I_STDLIB
22066 #include <stdlib.h>
22067 #endif
22068 #include <stdio.h>
22069 int main() {
22070
22071 /* Strange style to avoid deeply-nested #if/#else/#endif */
22072 #ifndef NSIG
22073 #  ifdef _NSIG
22074 #    define NSIG (_NSIG)
22075 #  endif
22076 #endif
22077
22078 #ifndef NSIG
22079 #  ifdef SIGMAX
22080 #    define NSIG (SIGMAX+1)
22081 #  endif
22082 #endif
22083
22084 #ifndef NSIG
22085 #  ifdef SIG_MAX
22086 #    define NSIG (SIG_MAX+1)
22087 #  endif
22088 #endif
22089
22090 #ifndef NSIG
22091 #  ifdef _SIG_MAX
22092 #    define NSIG (_SIG_MAX+1)
22093 #  endif
22094 #endif
22095
22096 #ifndef NSIG
22097 #  ifdef MAXSIG
22098 #    define NSIG (MAXSIG+1)
22099 #  endif
22100 #endif
22101
22102 #ifndef NSIG
22103 #  ifdef MAX_SIG
22104 #    define NSIG (MAX_SIG+1)
22105 #  endif
22106 #endif
22107
22108 #ifndef NSIG
22109 #  ifdef SIGARRAYSIZE
22110 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22111 #  endif
22112 #endif
22113
22114 #ifndef NSIG
22115 #  ifdef _sys_nsig
22116 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22117 #  endif
22118 #endif
22119
22120 /* Default to some arbitrary number that's big enough to get most
22121    of the common signals.
22122 */
22123 #ifndef NSIG
22124 #    define NSIG 50
22125 #endif
22126
22127 printf("NSIG %d\n", NSIG);
22128
22129 #ifndef JUST_NSIG
22130
22131 EOCP
22132
22133 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22134 {
22135         printf "#ifdef SIG"; printf $1; printf "\n"
22136         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22137         printf $1; printf ");\n"
22138         printf "#endif\n"
22139 }
22140 END {
22141         printf "#endif /* JUST_NSIG */\n";
22142         printf "exit(0);\n}\n";
22143 }
22144 ' >>signal.c
22145 $cat >signal.awk <<'EOP'
22146 BEGIN { ndups = 0 }
22147 $1 ~ /^NSIG$/ { nsig = $2 }
22148 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22149     if ($2 > maxsig) { maxsig = $2 }
22150     if (sig_name[$2]) {
22151         dup_name[ndups] = $1
22152         dup_num[ndups] = $2
22153         ndups++
22154     }
22155     else {
22156         sig_name[$2] = $1
22157         sig_num[$2] = $2
22158     }
22159 }
22160 END {
22161     if (nsig == 0) {
22162         nsig = maxsig + 1
22163     }
22164     printf("NSIG %d\n", nsig);
22165     for (n = 1; n < nsig; n++) {
22166         if (sig_name[n]) {
22167             printf("%s %d\n", sig_name[n], sig_num[n])
22168         }
22169         else {
22170             printf("NUM%d %d\n", n, n)
22171         }
22172     }
22173     for (n = 0; n < ndups; n++) {
22174         printf("%s %d\n", dup_name[n], dup_num[n])
22175     }
22176 }
22177 EOP
22178 $cat >signal_cmd <<EOS
22179 $startsh
22180 if $test -s signal.lst; then
22181     echo "Using your existing signal.lst file"
22182         exit 0
22183 fi
22184 xxx="$xxx"
22185 EOS
22186 $cat >>signal_cmd <<'EOS'
22187
22188 set signal
22189 if eval $compile_ok; then
22190         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22191                 $uniq | $awk -f signal.awk >signal.lst
22192 else
22193         echo "(I can't seem be able to compile the whole test program)" >&4
22194         echo "(I'll try it in little pieces.)" >&4
22195         set signal -DJUST_NSIG
22196         if eval $compile_ok; then
22197                 $run ./signal$_exe > signal.nsg
22198                 $cat signal.nsg
22199         else
22200                 echo "I can't seem to figure out how many signals you have." >&4
22201                 echo "Guessing 50." >&4
22202                 echo 'NSIG 50' > signal.nsg
22203         fi
22204         : Now look at all the signal names, one at a time.
22205         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22206                 $cat > signal.c <<EOCP
22207 #include <sys/types.h>
22208 #include <signal.h>
22209 #include <stdio.h>
22210 int main() {
22211 printf("$xx %d\n", SIG${xx});
22212 return 0;
22213 }
22214 EOCP
22215                 set signal
22216                 if eval $compile; then
22217                         echo "SIG${xx} found."
22218                         $run ./signal$_exe  >> signal.ls1
22219                 else
22220                         echo "SIG${xx} NOT found."
22221                 fi
22222         done
22223         if $test -s signal.ls1; then
22224                 $cat signal.nsg signal.ls1 |
22225                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22226         fi
22227
22228 fi
22229 if $test -s signal.lst; then
22230         :
22231 else
22232         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22233         echo 'kill -l' >signal
22234         set X `csh -f <signal`
22235         $rm -f signal
22236         shift
22237         case $# in
22238         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22239         esac
22240         echo $@ | $tr ' ' $trnl | \
22241             $awk '{ printf "%s %d\n", $1, ++s; }
22242                   END { printf "NSIG %d\n", ++s }' >signal.lst
22243 fi
22244 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22245 EOS
22246 chmod a+x signal_cmd
22247 $eunicefix signal_cmd
22248 ;;
22249 esac
22250
22251 : generate list of signal names
22252 case "$sig_num_init" in
22253 '')
22254 echo " "
22255 case "$sig_name_init" in
22256 '') doinit=yes ;;
22257 *)  case "$sig_num_init" in
22258     ''|*,*) doinit=yes ;;
22259     esac ;;
22260 esac
22261 case "$doinit" in
22262 yes)
22263         echo "Generating a list of signal names and numbers..." >&4
22264         . ./signal_cmd
22265         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22266         sig_name=`$awk 'BEGIN { printf "ZERO " }
22267                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22268         sig_num=`$awk  'BEGIN { printf "0 " }
22269                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22270         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22271                              !/^NSIG/   { printf "\"%s\", ", $1 }
22272                              END        { printf "0\n" }' signal.lst`
22273         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22274                              !/^NSIG/   { printf "%d, ", $2}
22275                              END        { printf "0\n"}' signal.lst`
22276         ;;
22277 esac
22278 echo "The following $sig_count signals are available:"
22279 echo " "
22280 echo $sig_name | $awk \
22281 'BEGIN { linelen = 0 }
22282 {
22283         for (i = 1; i <= NF; i++) {
22284                 name = "SIG" $i " "
22285                 linelen = linelen + length(name)
22286                 if (linelen > 70) {
22287                         printf "\n"
22288                         linelen = length(name)
22289                 }
22290                 printf "%s", name
22291         }
22292         printf "\n"
22293 }'
22294 sig_size=`echo $sig_name | awk '{print NF}'`
22295 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22296 ;;
22297 esac
22298
22299 : Check size of size
22300 echo " "
22301 case "$sizetype" in
22302 *_t) zzz="$sizetype"    ;;
22303 *)   zzz="filesize"     ;;
22304 esac
22305 echo "Checking the size of $zzz..." >&4
22306 cat > try.c <<EOCP
22307 #include <sys/types.h>
22308 #include <stdio.h>
22309 #$i_stdlib I_STDLIB
22310 #ifdef I_STDLIB
22311 #include <stdlib.h>
22312 #endif
22313 int main() {
22314     printf("%d\n", (int)sizeof($sizetype));
22315     exit(0);
22316 }
22317 EOCP
22318 set try
22319 if eval $compile_ok; then
22320         yyy=`$run ./try`
22321         case "$yyy" in
22322         '')     sizesize=4
22323                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22324                 ;;
22325         *)      sizesize=$yyy
22326                 echo "Your $zzz size is $sizesize bytes."
22327                 ;;
22328         esac
22329 else
22330         sizesize=4
22331         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22332 fi
22333
22334 : check for socklen_t
22335 echo " "
22336 echo "Checking to see if you have socklen_t..." >&4
22337 $cat >try.c <<EOCP
22338 #include <sys/types.h>
22339 #$d_socket HAS_SOCKET
22340 #ifdef HAS_SOCKET
22341 #include <sys/socket.h>
22342 #endif
22343 int main() { socklen_t x = 16; }
22344 EOCP
22345 set try
22346 if eval $compile; then
22347         val="$define"
22348         echo "You have socklen_t."
22349 else
22350         val="$undef"
22351         echo "You do not have socklen_t."
22352         case "$sizetype" in
22353         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22354         esac
22355 fi
22356 $rm_try
22357 set d_socklen_t
22358 eval $setvar
22359
22360 : see if this is a socks.h system
22361 set socks.h i_socks
22362 eval $inhdr
22363
22364 : check for type of the size argument to socket calls
22365 case "$d_socket" in
22366 "$define")
22367         $cat <<EOM
22368
22369 Checking to see what type is the last argument of accept().
22370 EOM
22371         yyy=''
22372         case "$d_socklen_t" in
22373         "$define") yyy="$yyy socklen_t"
22374         esac
22375         yyy="$yyy $sizetype int long unsigned"
22376         for xxx in $yyy; do
22377                 case "$socksizetype" in
22378                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22379                         case "$usesocks" in
22380                         "$define")
22381                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22382                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22383                                         socksizetype="$xxx"
22384                                 fi
22385                                 ;;
22386                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22387                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22388                                         socksizetype="$xxx"
22389                                 fi
22390                                 ;;
22391                         esac
22392                         ;;
22393                 esac
22394         done
22395 : In case none of those worked, prompt the user.
22396         case "$socksizetype" in
22397         '')     rp='What is the type for socket address structure sizes?'
22398                 dflt='int'
22399                 . ./myread
22400                 socksizetype=$ans
22401                 ;;
22402         esac
22403         ;;
22404 *)      : no sockets, so pick relatively harmless default
22405         socksizetype='int'
22406         ;;
22407 esac
22408
22409 : see what type is used for signed size_t
22410 set ssize_t ssizetype int stdio.h sys/types.h
22411 eval $typedef
22412 dflt="$ssizetype"
22413 $cat > try.c <<EOM
22414 #include <stdio.h>
22415 #$i_stdlib I_STDLIB
22416 #ifdef I_STDLIB
22417 #include <stdlib.h>
22418 #endif
22419 #include <sys/types.h>
22420 #define Size_t $sizetype
22421 #define SSize_t $dflt
22422 int main()
22423 {
22424         if (sizeof(Size_t) == sizeof(SSize_t))
22425                 printf("$dflt\n");
22426         else if (sizeof(Size_t) == sizeof(int))
22427                 printf("int\n");
22428         else
22429                 printf("long\n");
22430         exit(0);
22431 }
22432 EOM
22433 echo " "
22434 set try
22435 if eval $compile_ok && $run ./try > /dev/null; then
22436         ssizetype=`$run ./try`
22437         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22438 else
22439         $cat >&4 <<EOM
22440 Help! I can't compile and run the ssize_t test program: please enlighten me!
22441 (This is probably a misconfiguration in your system or libraries, and
22442 you really ought to fix it.  Still, I'll try anyway.)
22443
22444 I need a type that is the same size as $sizetype, but is guaranteed to
22445 be signed.  Common values are ssize_t, int and long.
22446
22447 EOM
22448         rp="What signed type is the same size as $sizetype?"
22449         . ./myread
22450         ssizetype="$ans"
22451 fi
22452 $rm_try
22453
22454 : Check the size of st_ino
22455 $echo " "
22456 $echo "Checking the size of st_ino..." >&4
22457 $cat > try.c <<EOCP
22458 #include <sys/stat.h>
22459 #include <stdio.h>
22460 #$i_stdlib I_STDLIB
22461 #ifdef I_STDLIB
22462 #include <stdlib.h>
22463 #endif
22464 int main() {
22465     struct stat st;
22466     printf("%d\n", (int)sizeof(st.st_ino));
22467     exit(0);
22468 }
22469 EOCP
22470 set try
22471 if eval $compile_ok; then
22472         val=`$run ./try`
22473         case "$val" in
22474         '')     st_ino_size=4
22475                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22476                 ;;
22477         *)      st_ino_size=$val
22478                 $echo "Your st_ino is $st_ino_size bytes long."
22479                 ;;
22480         esac
22481 else
22482         st_ino_size=4
22483         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22484 fi
22485 $rm_try
22486
22487 : Check if st_ino is signed
22488 $echo " "
22489 $echo "Checking the sign of st_ino..." >&4
22490 $cat > try.c <<EOCP
22491 #include <sys/stat.h>
22492 #include <stdio.h>
22493 int main() {
22494         struct stat foo;
22495         foo.st_ino = -1;
22496         if (foo.st_ino < 0)
22497                 printf("-1\n");
22498         else
22499                 printf("1\n");
22500 }
22501 EOCP
22502 set try
22503 if eval $compile; then
22504         val=`$run ./try`
22505         case "$val" in
22506         '')     st_ino_sign=1
22507                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22508                 ;;
22509         *)      st_ino_sign=$val
22510                 case "$st_ino_sign" in
22511                  1) $echo "Your st_ino is unsigned." ;;
22512                 -1) $echo "Your st_ino is signed."   ;;
22513                 esac
22514                 ;;
22515         esac
22516 else
22517         st_ino_sign=1
22518         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22519 fi
22520 $rm_try
22521
22522 : see what type of char stdio uses.
22523 echo " "
22524 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22525 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22526         echo "Your stdio uses unsigned chars." >&4
22527         stdchar="unsigned char"
22528 else
22529         echo "Your stdio uses signed chars." >&4
22530         stdchar="char"
22531 fi
22532 $rm -f stdioh
22533
22534 : Check size of UID
22535 echo " "
22536 case "$uidtype" in
22537 *_t) zzz="$uidtype"     ;;
22538 *)   zzz="uid"          ;;
22539 esac
22540 echo "Checking the size of $zzz..." >&4
22541 cat > try.c <<EOCP
22542 #include <sys/types.h>
22543 #include <stdio.h>
22544 #$i_stdlib I_STDLIB
22545 #ifdef I_STDLIB
22546 #include <stdlib.h>
22547 #endif
22548 int main() {
22549     printf("%d\n", (int)sizeof($uidtype));
22550     exit(0);
22551 }
22552 EOCP
22553 set try
22554 if eval $compile_ok; then
22555         yyy=`$run ./try`
22556         case "$yyy" in
22557         '')     uidsize=4
22558                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22559                 ;;
22560         *)      uidsize=$yyy
22561                 echo "Your $zzz is $uidsize bytes long."
22562                 ;;
22563         esac
22564 else
22565         uidsize=4
22566         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22567 fi
22568
22569 : Check if UID is signed
22570 echo " "
22571 case "$uidtype" in
22572 *_t) zzz="$uidtype"     ;;
22573 *)   zzz="uid"          ;;
22574 esac
22575 echo "Checking the sign of $zzz..." >&4
22576 cat > try.c <<EOCP
22577 #include <sys/types.h>
22578 #include <stdio.h>
22579 int main() {
22580         $uidtype foo = -1;
22581         if (foo < 0)
22582                 printf("-1\n");
22583         else
22584                 printf("1\n");
22585 }
22586 EOCP
22587 set try
22588 if eval $compile; then
22589         yyy=`$run ./try`
22590         case "$yyy" in
22591         '')     uidsign=1
22592                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22593                 ;;
22594         *)      uidsign=$yyy
22595                 case "$uidsign" in
22596                  1) echo "Your $zzz is unsigned." ;;
22597                 -1) echo "Your $zzz is signed."   ;;
22598                 esac
22599                 ;;
22600         esac
22601 else
22602         uidsign=1
22603         echo "(I can't compile the test program--guessing unsigned.)" >&4
22604 fi
22605
22606 : Check format string for UID
22607 echo " "
22608 $echo "Checking the format string to be used for uids..." >&4
22609
22610 case "$uidsign" in
22611 -1)     if $test X"$uidsize" = X"$ivsize"; then
22612                 uidformat="$ivdformat"
22613         else
22614                 if $test X"$uidsize" = X"$longsize"; then
22615                         uidformat='"ld"'
22616                 else
22617                         if $test X"$uidsize" = X"$intsize"; then
22618                                 uidformat='"d"'
22619                         else
22620                                 if $test X"$uidsize" = X"$shortsize"; then
22621                                         uidformat='"hd"'
22622                                 fi
22623                         fi
22624                 fi
22625         fi
22626         ;;
22627 *)      if $test X"$uidsize" = X"$uvsize"; then
22628                 uidformat="$uvuformat"
22629         else
22630                 if $test X"$uidsize" = X"$longsize"; then
22631                         uidformat='"lu"'
22632                 else
22633                         if $test X"$uidsize" = X"$intsize"; then
22634                                 uidformat='"u"'
22635                         else
22636                                 if $test X"$uidsize" = X"$shortsize"; then
22637                                         uidformat='"hu"'
22638                                 fi
22639                         fi
22640                 fi
22641         fi
22642         ;;
22643 esac
22644
22645 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22646 echo " "
22647 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22648 $cat >try.c <<'EOM'
22649 /* Intentionally a long probe as I'd like to sanity check that the exact
22650    approach is going to work, as thinking it will work, but only having it
22651    part working at runtime is worse than not having it.  */
22652
22653 #include <sys/types.h>
22654 #include <sys/sysctl.h>
22655 #include <sys/param.h>
22656 #include <stdio.h>
22657 #include <string.h>
22658 #include <stdlib.h>
22659 #include <unistd.h>
22660
22661 int
22662 main(int argc, char **argv) {
22663     char *buffer;
22664     char *argv_leaf = strrchr(argv[0], '/');
22665     char *buffer_leaf;
22666     size_t size = 0;
22667     int mib[4];
22668
22669     mib[0] = CTL_KERN;
22670     mib[1] = KERN_PROC;
22671     mib[2] = KERN_PROC_PATHNAME;
22672     mib[3] = -1;
22673
22674     if (!argv_leaf) {
22675         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22676         return 1;
22677     }
22678
22679     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22680         perror("sysctl");
22681         return 2;
22682     }
22683
22684     if (size < strlen(argv_leaf) + 1) {
22685         fprintf(stderr, "size %lu is too short for a path\n",
22686                 (unsigned long) size);
22687         return 3;
22688     }
22689
22690     if (size > MAXPATHLEN * MAXPATHLEN) {
22691         fprintf(stderr, "size %lu is too long for a path\n",
22692                 (unsigned long) size);
22693         return 4;
22694     }
22695
22696     buffer = (char *)malloc(size);
22697     if (!buffer) {
22698         perror("malloc");
22699         return 5;
22700     }
22701
22702     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22703         perror("sysctl");
22704         return 6;
22705     }
22706
22707     if (strlen(buffer) + 1 != size) {
22708         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22709                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22710         return 7;
22711     }
22712
22713
22714     if (*buffer != '/') {
22715         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22716         return 8;
22717     }
22718
22719     if (strstr(buffer, "/./")) {
22720         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22721         return 9;
22722     }
22723
22724     if (strstr(buffer, "/../")) {
22725         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22726         return 10;
22727     }
22728
22729     buffer_leaf = strrchr(buffer, '/');
22730     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22731         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22732         return 11;
22733     }
22734
22735     free(buffer);
22736
22737     return 0;
22738 }
22739 EOM
22740
22741 val=$undef
22742 set try
22743 if eval $compile; then
22744         if $run ./try; then
22745                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22746                 val="$define"
22747         else
22748                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22749                 val="$undef"
22750         fi
22751 else
22752         echo "I'm unable to compile the test program." >&4
22753         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22754         val="$undef"
22755 fi
22756 $rm_try
22757 set usekernprocpathname
22758 eval $setvar
22759
22760 : Determine if we can use _NSGetExecutablePath to find executing program
22761 echo " "
22762 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22763 $cat >try.c <<'EOM'
22764 /* Intentionally a long probe as I'd like to sanity check that the exact
22765    approach is going to work, as thinking it will work, but only having it
22766    part working at runtime is worse than not having it.  */
22767 #include <mach-o/dyld.h>
22768 #include <stdio.h>
22769 #include <stdlib.h>
22770 #include <sys/param.h>
22771 #include <string.h>
22772
22773 int
22774 main(int argc, char **argv) {
22775     char buf[1];
22776     uint32_t size = sizeof(buf);
22777     int result;
22778     char *buffer;
22779     char *tidied;
22780     char *argv_leaf = strrchr(argv[0], '/');
22781     char *tidied_leaf;
22782
22783     if (!argv_leaf) {
22784         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22785         return 1;
22786     }
22787
22788     _NSGetExecutablePath(buf, &size);
22789     if (size > MAXPATHLEN * MAXPATHLEN) {
22790         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22791                 (unsigned int) size);
22792         return 2;
22793     }
22794
22795     buffer = (char *)malloc(size);
22796     if (!buffer) {
22797         perror("malloc");
22798         return 3;
22799     }
22800
22801     result = _NSGetExecutablePath(buffer, &size);
22802     if (result != 0) {
22803         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22804                 result, (unsigned int) size);
22805         return 4;
22806     }
22807
22808     tidied = realpath(buffer, NULL);
22809     if (!tidied) {
22810         perror("realpath");
22811         return 5;
22812     }
22813
22814     free(buffer);
22815
22816     if (*tidied != '/') {
22817         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22818         return 6;
22819     }
22820
22821     if (strstr(tidied, "/./")) {
22822         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22823         return 7;
22824     }
22825
22826     if (strstr(tidied, "/../")) {
22827         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22828         return 8;
22829     }
22830
22831     tidied_leaf = strrchr(tidied, '/');
22832     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22833         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22834         return 9;
22835     }
22836
22837     free(tidied);
22838
22839     return 0;
22840 }
22841 EOM
22842
22843 val=$undef
22844 set try
22845 if eval $compile; then
22846         if $run ./try; then
22847                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22848                 val="$define"
22849         else
22850                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22851         fi
22852 else
22853         echo "I'm unable to compile the test program." >&4
22854         echo "I'll assume no _NSGetExecutablePath here." >&4
22855 fi
22856 $rm_try
22857 set usensgetexecutablepath
22858 eval $setvar
22859
22860 : Check if site customization support was requested
22861 case "$usesitecustomize" in
22862     $define|true|[Yy]*)
22863         usesitecustomize="$define"
22864         ;;
22865     *)
22866         usesitecustomize="$undef"
22867         ;;
22868     esac
22869
22870 : determine compiler compiler
22871 case "$yacc" in
22872 '')
22873         dflt=yacc;;
22874 *)
22875         dflt="$yacc";;
22876 esac
22877 echo " "
22878 comp='yacc'
22879 if $test -f "$byacc$_exe"; then
22880         dflt="$byacc"
22881         comp="byacc or $comp"
22882 fi
22883 if $test -f "$bison$_exe"; then
22884         comp="$comp or bison -y"
22885 fi
22886 rp="Which compiler compiler ($comp) shall I use?"
22887 . ./myread
22888 yacc="$ans"
22889 case "$yacc" in
22890 *bis*)
22891         case "$yacc" in
22892         *-y*) ;;
22893         *)
22894                 yacc="$yacc -y"
22895                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22896                 ;;
22897         esac
22898         ;;
22899 esac
22900
22901 : see if this is a bfd.h system
22902 set bfd.h i_bfd
22903 eval $inhdr
22904
22905 : see if this is an execinfo.h system
22906 set execinfo.h i_execinfo
22907 eval $inhdr
22908
22909 : see if this is a fenv.h system
22910 set fenv.h i_fenv
22911 eval $inhdr
22912
22913 : see if this is a fp.h system
22914 set fp.h i_fp
22915 eval $inhdr
22916
22917 : see if this is a fp_class.h system
22918 set fp_class.h i_fp_class
22919 eval $inhdr
22920
22921 : see if gdbm.h is available
22922 set gdbm.h t_gdbm
22923 eval $inhdr
22924 case "$t_gdbm" in
22925 $define)
22926         : see if gdbm_open exists
22927         set gdbm_open d_gdbm_open
22928         eval $inlibc
22929         case "$d_gdbm_open" in
22930         $undef)
22931                 t_gdbm="$undef"
22932                 echo "We won't be including <gdbm.h>"
22933                 ;;
22934         esac
22935         ;;
22936 esac
22937 val="$t_gdbm"
22938 set i_gdbm
22939 eval $setvar
22940
22941 : see if this is a ieeefp.h system
22942 case "$i_ieeefp" in
22943 '' ) set ieeefp.h i_ieeefp
22944      eval $inhdr
22945      ;;
22946 esac
22947
22948 : see if this is a libutil.h system
22949 set libutil.h i_libutil
22950 eval $inhdr
22951
22952 : see if mach cthreads are available
22953 if test "X$usethreads" = "X$define"; then
22954         set mach/cthreads.h i_machcthr
22955         eval $inhdr
22956 else
22957         i_machcthr="$undef"
22958 fi
22959
22960 : see if this is a mntent.h system
22961 set mntent.h i_mntent
22962 eval $inhdr
22963
22964 : see if net/errno.h is available
22965 val=''
22966 set net/errno.h val
22967 eval $inhdr
22968
22969 : Unfortunately, it causes problems on some systems.  Arrgh.
22970 case "$val" in
22971 $define)
22972         cat > try.c <<'EOM'
22973 #include <stdio.h>
22974 #include <errno.h>
22975 #include <net/errno.h>
22976 int func()
22977 {
22978         return ENOTSOCK;
22979 }
22980 EOM
22981         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22982                 echo "We'll be including <net/errno.h>." >&4
22983         else
22984                 echo "We won't be including <net/errno.h>." >&4
22985                 val="$undef"
22986         fi
22987         $rm_try
22988         ;;
22989 esac
22990 set i_neterrno
22991 eval $setvar
22992
22993 : see if netinet/tcp.h is available
22994 set netinet/tcp.h i_netinettcp
22995 eval $inhdr
22996
22997 : see if this is a poll.h system
22998 set poll.h i_poll
22999 eval $inhdr
23000
23001 : see if this is a prot.h system
23002 set prot.h i_prot
23003 eval $inhdr
23004
23005 : Preprocessor symbols
23006 echo " "
23007 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23008 $cat <<'EOSH' > Cppsym.know
23009 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23010 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23011 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23012 arch_pwr ardent ARM ARM32 atarist att386 att3b
23013 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23014 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23015 byteorder byte_order
23016 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23017 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23018 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23019 ELF encore EPI EXTENSIONS
23020 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23021 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23022 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23023 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23024 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23025 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23026 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23027 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23028 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23029 ksr1
23030 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23031 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23032 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23033 luna88k Lynx
23034 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23035 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23036 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23037 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23038 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23039 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23040 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23041 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23042 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23043 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23044 ns32000 ns32016 ns32332 ns32k nsc32000
23045 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23046 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23047 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23048 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23049 QK_USER QNX
23050 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23051 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23052 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23053 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23054 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23055 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23056 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23057 SYSV4 SYSV5 sysV68 sysV88
23058 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23059 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23060 tower32_800 tower32_850 tss
23061 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23062 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23063 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23064 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23065 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23066 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23067 uxpm uxps
23068 vax venix VMESA vms
23069 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23070 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23071 z8000 zarch
23072 EOSH
23073 # Maybe put other stuff here too.
23074 ./tr '-' '_' <<EOSH >>Cppsym.know
23075 $osname
23076 EOSH
23077 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23078 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23079 $cat Cppsym.know > Cppsym.c
23080 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23081 $rm -f Cppsym.a Cppsym.b Cppsym.c
23082 cat <<EOSH > Cppsym
23083 $startsh
23084 if $test \$# -gt 0; then
23085     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23086     if $test -s Cppsym.got; then
23087         $rm -f Cppsym.got
23088         exit 0
23089     fi
23090     $rm -f Cppsym.got
23091     exit 1
23092 else
23093     $tr " " "$trnl" | ./Cppsym.try
23094     exit 0
23095 fi
23096 EOSH
23097 chmod +x Cppsym
23098 $eunicefix Cppsym
23099 cat <<EOSH > Cppsym.try
23100 $startsh
23101 cat <<'EOCP' > try.c
23102 #include <stdio.h>
23103 #if cpp_stuff == 1
23104 #define STRINGIFY(a)    "a"
23105 #endif
23106 #if cpp_stuff == 42
23107 #define StGiFy(a)  #a
23108 #define STRINGIFY(a)    StGiFy(a)
23109 #endif
23110 #if $cpp_stuff != 1 && $cpp_stuff != 42
23111 #   include "Bletch: How does this C preprocessor stringify macros?"
23112 #endif
23113 int main() {
23114 EOCP
23115 $awk \\
23116 EOSH
23117 cat <<'EOSH' >> Cppsym.try
23118 'length($1) > 0 {
23119     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23120     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23121     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23122     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23123 }' >> try.c
23124 echo 'return 0;}' >> try.c
23125 EOSH
23126 cat <<EOSH >> Cppsym.try
23127 ccflags="$ccflags"
23128 case "$osname-$gccversion" in
23129 irix-) ccflags="\$ccflags -woff 1178" ;;
23130 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23131 esac
23132 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23133 EOSH
23134 chmod +x Cppsym.try
23135 $eunicefix Cppsym.try
23136 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23137 : Add in any Linux cpp "predefined macros":
23138 case "$osname::$gccversion" in
23139   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23140     tHdrH=_tmpHdr
23141     rm -f $tHdrH'.h' $tHdrH
23142     touch $tHdrH'.h'
23143     # Filter out macro arguments, such as Linux's __INT8_C(c)
23144     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23145        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23146        if [ -s $tHdrH'_cppsym.real' ]; then
23147           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23148        fi
23149     fi
23150     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23151   ;;
23152 esac
23153 : now check the C compiler for additional symbols
23154 postprocess_cc_v=''
23155 case "$osname" in
23156 aix) postprocess_cc_v="|$tr , ' '" ;;
23157 esac
23158 $cat >ccsym <<EOS
23159 $startsh
23160 $cat >tmp.c <<EOF
23161 extern int foo;
23162 EOF
23163 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23164 do
23165         case "\$i" in
23166         -D*) echo "\$i" | $sed 's/^-D//';;
23167         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23168         esac
23169 done
23170 $rm_try
23171 EOS
23172 postprocess_cc_v=''
23173 chmod +x ccsym
23174 $eunicefix ccsym
23175 ./ccsym > ccsym1.raw
23176 if $test -s ccsym1.raw; then
23177     $sort ccsym1.raw | $uniq >ccsym.raw
23178 else
23179     mv ccsym1.raw ccsym.raw
23180 fi
23181
23182 $awk '/\=/ { print $0; next }
23183         { print $0"=1" }' ccsym.raw >ccsym.list
23184 $comm -13 Cppsym.true ccsym.list >ccsym.own
23185 $comm -12 Cppsym.true ccsym.list >ccsym.com
23186 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23187 also=''
23188 if $test -z ccsym.raw; then
23189         echo "Your C compiler doesn't seem to define any symbols!" >&4
23190         echo " "
23191         echo "However, your C preprocessor defines the following symbols:"
23192         $cat Cppsym.true
23193         ccsymbols=''
23194         cppsymbols=`$cat Cppsym.true`
23195         cppsymbols=`echo $cppsymbols`
23196         cppccsymbols="$cppsymbols"
23197 else
23198         if $test -s ccsym.com; then
23199                 echo "Your C compiler and pre-processor define these symbols:"
23200                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23201                 also='also '
23202                 symbols='ones'
23203                 cppccsymbols=`$cat ccsym.com`
23204                 cppccsymbols=`echo $cppccsymbols`
23205                 $test "$silent" || sleep 1
23206         fi
23207         if $test -s ccsym.cpp; then
23208                 $test "$also" && echo " "
23209                 echo "Your C pre-processor ${also}defines the following symbols:"
23210                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23211                 also='further '
23212                 cppsymbols=`$cat ccsym.cpp`
23213                 cppsymbols=`echo $cppsymbols`
23214                 $test "$silent" || sleep 1
23215         fi
23216         if $test -s ccsym.own; then
23217                 $test "$also" && echo " "
23218                 echo "Your C compiler ${also}defines the following cpp symbols:"
23219                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23220                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23221                 ccsymbols=`$cat ccsym.own`
23222                 ccsymbols=`echo $ccsymbols`
23223                 $test "$silent" || sleep 1
23224         fi
23225 fi
23226
23227 : add -D_FORTIFY_SOURCE if feasible and not already there
23228 case "$gccversion" in
23229 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23230         *-O*)   case "$ccflags$cppsymbols" in
23231                 *_FORTIFY_SOURCE=*) # Don't add it again.
23232                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23233                         ;;
23234                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23235                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23236                         ;;
23237                 esac
23238                 ;;
23239         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23240                 ;;
23241         esac
23242         ;;
23243 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23244         ;;
23245 esac
23246
23247 : script used to emit important warnings
23248 cat >warn <<EOS
23249 $startsh
23250 if test \$# -gt 0; then
23251         echo "\$@" >msg
23252 else
23253         cat >msg
23254 fi
23255 echo "*** WARNING:" >&4
23256 sed -e 's/^/*** /' <msg >&4
23257 echo "*** " >&4
23258 cat msg >>config.msg
23259 echo " " >>config.msg
23260 rm -f msg
23261 EOS
23262 chmod +x warn
23263 $eunicefix warn
23264
23265 : see if this is a termio system
23266 val="$undef"
23267 val2="$undef"
23268 val3="$undef"
23269 if $test `./findhdr termios.h`; then
23270     set tcsetattr i_termios
23271     eval $inlibc
23272     val3="$i_termios"
23273 fi
23274 echo " "
23275 case "$val3" in
23276     "$define") echo "You have POSIX termios.h... good!" >&4;;
23277     *)  if ./Cppsym pyr; then
23278             case "`$run /bin/universe`" in
23279                 ucb) if $test `./findhdr sgtty.h`; then
23280                         val2="$define"
23281                         echo "<sgtty.h> found." >&4
23282                     else
23283                         echo "System is pyramid with BSD universe."
23284                         ./warn "<sgtty.h> not found--you could have problems."
23285                     fi;;
23286                 *)  if $test `./findhdr termio.h`; then
23287                         val="$define"
23288                         echo "<termio.h> found." >&4
23289                     else
23290                         echo "System is pyramid with USG universe."
23291                         ./warn "<termio.h> not found--you could have problems."
23292                     fi;;
23293             esac
23294         elif ./usg; then
23295             if $test `./findhdr termio.h`; then
23296                 echo "<termio.h> found." >&4
23297                 val="$define"
23298             elif $test `./findhdr sgtty.h`; then
23299                 echo "<sgtty.h> found." >&4
23300                 val2="$define"
23301             else
23302                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23303             fi
23304         else
23305             if $test `./findhdr sgtty.h`; then
23306                 echo "<sgtty.h> found." >&4
23307                 val2="$define"
23308             elif $test `./findhdr termio.h`; then
23309                 echo "<termio.h> found." >&4
23310                 val="$define"
23311             else
23312                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23313             fi
23314         fi;;
23315 esac
23316 set i_termio; eval $setvar
23317 val=$val2; set i_sgtty; eval $setvar
23318 val=$val3; set i_termios; eval $setvar
23319
23320 : see if stdbool is available
23321 : we want a real compile instead of Inhdr because some Solaris systems
23322 : have stdbool.h, but it can only be used if the compiler indicates it
23323 : is sufficiently c99-compliant.
23324 echo " "
23325 $cat >try.c <<EOCP
23326 #include <stdio.h>
23327 #include <stdbool.h>
23328 int func(bool x)
23329 {
23330     return x ? 1 : 0;
23331 }
23332 int main(int argc, char **argv)
23333 {
23334     return func(0);
23335 }
23336 EOCP
23337 set try
23338 if eval $compile; then
23339         echo "<stdbool.h> found." >&4
23340         val="$define"
23341 else
23342         echo "<stdbool.h> NOT found." >&4
23343         val="$undef"
23344 fi
23345 $rm_try
23346 set i_stdbool
23347 eval $setvar
23348
23349 : see if stdint is available
23350 set stdint.h i_stdint
23351 eval $inhdr
23352
23353 : see if sys/access.h is available
23354 set sys/access.h i_sysaccess
23355 eval $inhdr
23356
23357 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23358 set sys/filio.h i_sysfilio
23359 eval $inhdr
23360 echo " "
23361 if $test `./findhdr sys/ioctl.h`; then
23362         val="$define"
23363         echo '<sys/ioctl.h> found.' >&4
23364 else
23365         val="$undef"
23366         if $test $i_sysfilio = "$define"; then
23367             echo '<sys/ioctl.h> NOT found.' >&4
23368         else
23369                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23370                 $test $i_termio = "$define" && xxx="termio.h"
23371                 $test $i_termios = "$define" && xxx="termios.h"
23372 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23373         fi
23374 fi
23375 set i_sysioctl
23376 eval $setvar
23377
23378 : see if socket ioctl defs are in sys/sockio.h
23379 echo " "
23380 xxx=`./findhdr sys/sockio.h`
23381 if $test "$xxx"; then
23382         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23383                 val="$define"
23384                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23385         else
23386                 val="$undef"
23387                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23388         fi
23389 else
23390         val="$undef"
23391         $cat <<EOM
23392 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23393 EOM
23394 fi
23395 set i_syssockio
23396 eval $setvar
23397
23398 : see if this is a syslog.h system
23399 set syslog.h i_syslog
23400 eval $inhdr
23401
23402 : see if this is a sys/mode.h system
23403 set sys/mode.h i_sysmode
23404 eval $inhdr
23405
23406 : see if there is a sys/poll.h file
23407 set sys/poll.h i_syspoll
23408 eval $inhdr
23409
23410 : see if sys/resource.h has to be included
23411 set sys/resource.h i_sysresrc
23412 eval $inhdr
23413
23414 : see if sys/security.h is available
23415 set sys/security.h i_syssecrt
23416 eval $inhdr
23417
23418 : see if this is a sys/statvfs.h system
23419 set sys/statvfs.h i_sysstatvfs
23420 eval $inhdr
23421
23422 : see if this is a sys/un.h system
23423 set sys/un.h i_sysun
23424 eval $inhdr
23425
23426 : see if this is a sys/utsname.h system
23427 set sys/utsname.h i_sysutsname
23428 eval $inhdr
23429
23430 : see if this is a syswait system
23431 set sys/wait.h i_syswait
23432 eval $inhdr
23433
23434 : see if this is a ustat.h system
23435 set ustat.h i_ustat
23436 eval $inhdr
23437
23438 : see if this is an utime system
23439 set utime.h i_utime
23440 eval $inhdr
23441
23442 : see if this is a vfork system
23443 case "$d_vfork" in
23444 "$define")
23445         set vfork.h i_vfork
23446         eval $inhdr
23447         ;;
23448 *)
23449         i_vfork="$undef"
23450         ;;
23451 esac
23452
23453 : see if wchar.h is present
23454 set wchar.h i_wchar
23455 eval $inhdr
23456
23457 : Check extensions
23458 echo " "
23459 echo "Looking for extensions..." >&4
23460 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23461 : contain old or inaccurate or duplicate values.
23462 nonxs_extensions=''
23463 xs_extensions=''
23464 : We do not use find because it might not be available.
23465 : We do not just use MANIFEST because the user may have dropped
23466 : some additional extensions into the source tree and expect them
23467 : to be built.
23468
23469 : Function to recursively find available extensions, ignoring DynaLoader
23470 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23471 : In 5.10.1 and later, extensions are stored in directories
23472 : like File-Glob instead of the older File/Glob/.
23473 find_extensions='
23474     for xxx in *; do
23475         case "$xxx" in
23476             DynaLoader|dynaload) ;;
23477             *)
23478             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23479             case "$this_ext" in
23480                 Scalar/List/Utils) this_ext="List/Util" ;;
23481                 PathTools)         this_ext="Cwd"       ;;
23482             esac;
23483             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23484             if $contains " $this_ext " "$tdir/$$.tmp"; then
23485                 echo >&4;
23486                 echo "Duplicate directories detected for extension $xxx" >&4;
23487                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23488                 case "$knowitall" in
23489                 "") dflt=y;;
23490                 *) dflt=n;;
23491                 esac;
23492                 . ../UU/myread;
23493                 case "$ans" in
23494                 n*|N*) ;;
23495                 *) echo >&4;
23496                     echo "Ok.  Stopping Configure." >&4;
23497                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23498                     exit 1;;
23499                 esac;
23500                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23501             fi;
23502             $ls -1 "$xxx" > "$tdir/$$.tmp";
23503             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23504                 xs_extensions="$xs_extensions $this_ext";
23505             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23506                 xs_extensions="$xs_extensions $this_ext";
23507             elif $test -d "$xxx"; then
23508                 nonxs_extensions="$nonxs_extensions $this_ext";
23509             fi;
23510             $rm -f "$tdir/$$.tmp";
23511             ;;
23512         esac;
23513     done'
23514 tdir=`pwd`
23515 cd "$rsrc/cpan"
23516 set X
23517 shift
23518 eval $find_extensions
23519 cd "$rsrc/dist"
23520 set X
23521 shift
23522 eval $find_extensions
23523 cd "$rsrc/ext"
23524 set X
23525 shift
23526 eval $find_extensions
23527 set X $xs_extensions
23528 shift
23529 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23530 set X $nonxs_extensions
23531 shift
23532 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23533 cd "$tdir"
23534 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23535
23536 : Now see which are supported on this system.
23537 avail_ext=''
23538 for xxx in $xs_extensions ; do
23539         case "$xxx" in
23540         Amiga*)
23541                 case "$osname" in
23542                 amigaos) avail_ext="$avail_ext $xxx" ;;
23543                 esac
23544                 ;;
23545         DB_File|db_file)
23546                 case "$i_db" in
23547                 $define) avail_ext="$avail_ext $xxx" ;;
23548                 esac
23549                 ;;
23550         GDBM_File|gdbm_fil)
23551                 case "$i_gdbm" in
23552                 $define) avail_ext="$avail_ext $xxx" ;;
23553                 esac
23554                 ;;
23555         IPC/SysV|ipc/sysv)
23556                 : XXX Do we need a useipcsysv variable here
23557                 case "${d_msg}${d_sem}${d_shm}" in
23558                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23559                 esac
23560                 ;;
23561         NDBM_File|ndbm_fil)
23562                 case "$d_ndbm" in
23563                 $define)
23564                     case "$osname-$use64bitint" in
23565                     hpux-define)
23566                         case "$libs" in
23567                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23568                         esac
23569                         ;;
23570                     *) avail_ext="$avail_ext $xxx" ;;
23571                     esac
23572                     ;;
23573                 esac
23574                 ;;
23575         ODBM_File|odbm_fil)
23576                 case "${i_dbm}${i_rpcsvcdbm}" in
23577                 *"${define}"*)
23578                     case "$d_cplusplus" in
23579                     define) ;; # delete as a function name will not work
23580                     *)  case "$osname-$use64bitint" in
23581                         hpux-define)
23582                             case "$libs" in
23583                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23584                             esac
23585                             ;;
23586                         *) avail_ext="$avail_ext $xxx" ;;
23587                         esac
23588                         ;;
23589                     esac
23590                     ;;
23591                 esac
23592                 ;;
23593         Opcode|opcode)
23594                 case "$useopcode" in
23595                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23596                 esac
23597                 ;;
23598         POSIX|posix)
23599                 case "$useposix" in
23600                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23601                 esac
23602                 ;;
23603         Socket|socket)
23604                 case "$d_socket" in
23605                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23606                 esac
23607                 ;;
23608         I18N/Langinfo|langinfo)
23609                 case "$uselanginfo" in
23610                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23611                 esac
23612                 ;;
23613         Sys/Syslog|sys/syslog)
23614                 case $osname in
23615                         amigaos) ;; # not really very useful on AmigaOS
23616                         *)
23617                         : XXX syslog requires socket
23618                         case "$d_socket" in
23619                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23620                         esac
23621                         ;;
23622                 esac
23623                 ;;
23624         Thread|thread)
23625                 case "$usethreads" in
23626                 true|$define|y)
23627                         case "$use5005threads" in
23628                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23629                         esac
23630                 esac
23631                 ;;
23632         threads|threads/shared)
23633                 # threads and threads::shared are special cases.
23634                 # To stop people from asking "Perl 5.8.0 was supposed
23635                 # to have this new fancy threads implementation but my
23636                 # perl doesn't have it" and from people trying to
23637                 # (re)install the threads module using CPAN.pm and
23638                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23639                 # the threads.pm and threads/shared.pm will always be
23640                 # there, croaking informatively ("you need to rebuild
23641                 # all of Perl with threads, sorry") when threads haven't
23642                 # been compiled in.
23643                 # --jhi
23644                 avail_ext="$avail_ext $xxx"
23645                 ;;
23646         VMS*)
23647                 ;;
23648         Win32*)
23649                 case "$osname" in
23650                 cygwin) avail_ext="$avail_ext $xxx" ;;
23651                 esac
23652                 ;;
23653         XS/APItest|xs/apitest)
23654                 # This is just for testing.  Skip it unless we have dynamic loading.
23655
23656                 case "$usedl" in
23657                 $define) avail_ext="$avail_ext $xxx" ;;
23658                 esac
23659                 ;;
23660         XS/Typemap|xs/typemap)
23661                 # This is just for testing.  Skip it unless we have dynamic loading.
23662                 case "$usedl" in
23663                 $define) avail_ext="$avail_ext $xxx" ;;
23664                 esac
23665                 ;;
23666         *)      avail_ext="$avail_ext $xxx"
23667                 ;;
23668         esac
23669 done
23670
23671 set X $avail_ext
23672 shift
23673 avail_ext="$*"
23674
23675 case "$onlyextensions" in
23676 '') ;;
23677 *)  keepextensions=''
23678     echo "You have requested that only certain extensions be included..." >&4
23679     for i in $onlyextensions; do
23680         case " $avail_ext " in
23681         *" $i "*)
23682             echo "Keeping extension $i."
23683             keepextensions="$keepextensions $i"
23684             ;;
23685         *) echo "Ignoring extension $i." ;;
23686         esac
23687     done
23688     avail_ext="$keepextensions"
23689     ;;
23690 esac
23691
23692 case "$noextensions" in
23693 '') ;;
23694 *)  keepextensions=''
23695     echo "You have requested that certain extensions be ignored..." >&4
23696     for i in $avail_ext; do
23697         case " $noextensions " in
23698         *" $i "*) echo "Ignoring extension $i." ;;
23699         *) echo "Keeping extension $i.";
23700            keepextensions="$keepextensions $i"
23701            ;;
23702         esac
23703     done
23704     avail_ext="$keepextensions"
23705     ;;
23706 esac
23707
23708 : Now see which nonxs extensions are supported on this system.
23709 : For now assume all are.
23710 nonxs_ext=''
23711 for xxx in $nonxs_extensions ; do
23712         case "$xxx" in
23713         VMS*)
23714                 ;;
23715         *)      nonxs_ext="$nonxs_ext $xxx"
23716                 ;;
23717         esac
23718 done
23719
23720 set X $nonxs_ext
23721 shift
23722 nonxs_ext="$*"
23723
23724 case $usedl in
23725 $define)
23726         $cat <<EOM
23727 A number of extensions are supplied with $package.  You may choose to
23728 compile these extensions for dynamic loading (the default), compile
23729 them into the $package executable (static loading), or not include
23730 them at all.  Answer "none" to include no extensions.
23731 Note that DynaLoader is always built and need not be mentioned here.
23732
23733 EOM
23734         case "$dynamic_ext" in
23735         '')
23736                 : Exclude those listed in static_ext
23737                 dflt=''
23738                 for xxx in $avail_ext; do
23739                         case " $static_ext " in
23740                         *" $xxx "*) ;;
23741                         *) dflt="$dflt $xxx" ;;
23742                         esac
23743                 done
23744                 set X $dflt
23745                 shift
23746                 dflt="$*"
23747                 ;;
23748         *)      dflt="$dynamic_ext"
23749                 # Perhaps we are reusing an old out-of-date config.sh.
23750                 case "$hint" in
23751                 previous)
23752                         if test X"$dynamic_ext" != X"$avail_ext"; then
23753                                 $cat <<EOM
23754 NOTICE:  Your previous config.sh list may be incorrect.
23755 The extensions now available to you are
23756         ${avail_ext}
23757 but the default list from your previous config.sh is
23758         ${dynamic_ext}
23759
23760 EOM
23761                         fi
23762                         ;;
23763                 esac
23764                 ;;
23765         esac
23766         case "$dflt" in
23767         '')     dflt=none;;
23768         esac
23769         rp="What extensions do you wish to load dynamically?"
23770         . ./myread
23771         case "$ans" in
23772         none) dynamic_ext=' ' ;;
23773         *) dynamic_ext="$ans" ;;
23774         esac
23775
23776         case "$static_ext" in
23777         '')
23778                 : Exclude those already listed in dynamic linking
23779                 dflt=''
23780                 for xxx in $avail_ext; do
23781                         case " $dynamic_ext " in
23782                         *" $xxx "*) ;;
23783                         *) dflt="$dflt $xxx" ;;
23784                         esac
23785                 done
23786                 set X $dflt
23787                 shift
23788                 dflt="$*"
23789                 ;;
23790         *)  dflt="$static_ext"
23791                 ;;
23792         esac
23793
23794         case "$dflt" in
23795         '')     dflt=none;;
23796         esac
23797         rp="What extensions do you wish to load statically?"
23798         . ./myread
23799         case "$ans" in
23800         none) static_ext=' ' ;;
23801         *) static_ext="$ans" ;;
23802         esac
23803         ;;
23804 *)
23805         $cat <<EOM
23806 A number of extensions are supplied with $package.  Answer "none"
23807 to include no extensions.
23808 Note that DynaLoader is always built and need not be mentioned here.
23809
23810 EOM
23811         case "$static_ext" in
23812         '') dflt="$avail_ext" ;;
23813         *)      dflt="$static_ext"
23814                 # Perhaps we are reusing an old out-of-date config.sh.
23815                 case "$hint" in
23816                 previous)
23817                         if test X"$static_ext" != X"$avail_ext"; then
23818                                 $cat <<EOM
23819 NOTICE:  Your previous config.sh list may be incorrect.
23820 The extensions now available to you are
23821         ${avail_ext}
23822 but the default list from your previous config.sh is
23823         ${static_ext}
23824
23825 EOM
23826                         fi
23827                         ;;
23828                 esac
23829                 ;;
23830         esac
23831         : Exclude those that are not xs extensions
23832         case "$dflt" in
23833         '')     dflt=none;;
23834         esac
23835         rp="What extensions do you wish to include?"
23836         . ./myread
23837         case "$ans" in
23838         none) static_ext=' ' ;;
23839         *) static_ext="$ans" ;;
23840         esac
23841         ;;
23842 esac
23843 #
23844 # Encode is a special case.  If we are building Encode as a static
23845 # extension, we need to explicitly list its subextensions as well.
23846 # For other nested extensions, this is handled automatically by
23847 # the appropriate Makefile.PL.
23848 case " $static_ext " in
23849         *" Encode "*) # Add the subextensions of Encode
23850         cd "$rsrc/cpan"
23851         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23852                 static_ext="$static_ext Encode/$xxx"
23853                 known_extensions="$known_extensions Encode/$xxx"
23854         done
23855         cd "$tdir"
23856         ;;
23857 esac
23858
23859 set X $dynamic_ext $static_ext $nonxs_ext
23860 shift
23861 extensions="$*"
23862
23863 # Sanity check:  We require an extension suitable for use with
23864 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23865 # should show up as failures in the test suite, but it's helpful to
23866 # catch them now.) The 'extensions' list is normally sorted
23867 # alphabetically, so we need to accept either
23868 #    DB_File ... Fcntl ... IO  ....
23869 # or something like
23870 #    Fcntl ... NDBM_File ... IO  ....
23871 case " $extensions"  in
23872 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23873 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23874 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23875 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23876    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23877    ;;
23878 esac
23879
23880 : Remove libraries needed only for extensions
23881 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23882 : The exception is SunOS 4.x, which needs them.
23883 case "${osname}X${osvers}" in
23884 sunos*X4*)
23885     perllibs="$libs"
23886     ;;
23887 *) case "$usedl" in
23888     $define|true|[yY]*)
23889             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23890             shift
23891             perllibs="$*"
23892             ;;
23893     *)  perllibs="$libs"
23894             ;;
23895     esac
23896     ;;
23897 esac
23898
23899 : Remove build directory name from cppstdin so it can be used from
23900 : either the present location or the final installed location.
23901 echo " "
23902 : Get out of the UU directory to get correct path name.
23903 cd ..
23904 case "$cppstdin" in
23905 `pwd`/cppstdin)
23906         echo "Stripping down cppstdin path name"
23907         cppstdin=cppstdin
23908         ;;
23909 esac
23910 cd UU
23911
23912 : end of configuration questions
23913 echo " "
23914 echo "End of configuration questions."
23915 echo " "
23916
23917 : back to where it started
23918 if test -d ../UU; then
23919         cd ..
23920 fi
23921
23922 : configuration may be unconditionally patched via a 'config.arch' file
23923 if $test -f config.arch; then
23924         echo "I see a config.arch file, loading it." >&4
23925         . ./config.arch
23926 fi
23927
23928 : configuration may be patched via a 'config.over' file
23929 if $test -f config.over; then
23930         echo " "
23931         dflt=y
23932         rp='I see a config.over file.  Do you wish to load it?'
23933         . UU/myread
23934         case "$ans" in
23935         n*) echo "OK, I'll ignore it.";;
23936         *)      . ./config.over
23937                 echo "Configuration override changes have been loaded."
23938                 ;;
23939         esac
23940 fi
23941
23942 : in case they want portability, strip down executable paths
23943 case "$d_portable" in
23944 "$define")
23945         echo " "
23946         echo "Stripping down executable paths..." >&4
23947         for file in $loclist $trylist; do
23948                 eval temp=\$$file
23949                 eval $file=`basename $temp`
23950         done
23951         ;;
23952 esac
23953
23954 : create config.sh file
23955 echo " "
23956 echo "Creating config.sh..." >&4
23957 $spitshell <<EOT >config.sh
23958 $startsh
23959 #
23960 # This file was produced by running the Configure script. It holds all the
23961 # definitions figured out by Configure. Should you modify one of these values,
23962 # do not forget to propagate your changes by running "Configure -der". You may
23963 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23964 #
23965
23966 # Package name      : $package
23967 # Source directory  : $src
23968 # Configuration time: $cf_time
23969 # Configured by     : $cf_by
23970 # Target system     : $myuname
23971
23972 EOT
23973 : Add in command line options if available
23974 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23975
23976 $spitshell <<EOT >>config.sh
23977
23978 Author='$Author'
23979 Date='$Date'
23980 Header='$Header'
23981 Id='$Id'
23982 Locker='$Locker'
23983 Log='$Log'
23984 RCSfile='$RCSfile'
23985 Revision='$Revision'
23986 Source='$Source'
23987 State='$State'
23988 _a='$_a'
23989 _exe='$_exe'
23990 _o='$_o'
23991 afs='$afs'
23992 afsroot='$afsroot'
23993 alignbytes='$alignbytes'
23994 aphostname='$aphostname'
23995 api_revision='$api_revision'
23996 api_subversion='$api_subversion'
23997 api_version='$api_version'
23998 api_versionstring='$api_versionstring'
23999 ar='$ar'
24000 archlib='$archlib'
24001 archlibexp='$archlibexp'
24002 archname64='$archname64'
24003 archname='$archname'
24004 archobjs='$archobjs'
24005 asctime_r_proto='$asctime_r_proto'
24006 awk='$awk'
24007 baserev='$baserev'
24008 bash='$bash'
24009 bin='$bin'
24010 bin_ELF='$bin_ELF'
24011 binexp='$binexp'
24012 bison='$bison'
24013 byacc='$byacc'
24014 byteorder='$byteorder'
24015 c='$c'
24016 castflags='$castflags'
24017 cat='$cat'
24018 cc='$cc'
24019 cccdlflags='$cccdlflags'
24020 ccdlflags='$ccdlflags'
24021 ccflags='$ccflags'
24022 ccflags_uselargefiles='$ccflags_uselargefiles'
24023 ccname='$ccname'
24024 ccsymbols='$ccsymbols'
24025 ccversion='$ccversion'
24026 cf_by='$cf_by'
24027 cf_email='$cf_email'
24028 cf_time='$cf_time'
24029 charbits='$charbits'
24030 charsize='$charsize'
24031 chgrp='$chgrp'
24032 chmod='$chmod'
24033 chown='$chown'
24034 clocktype='$clocktype'
24035 comm='$comm'
24036 compress='$compress'
24037 contains='$contains'
24038 cp='$cp'
24039 cpio='$cpio'
24040 cpp='$cpp'
24041 cpp_stuff='$cpp_stuff'
24042 cppccsymbols='$cppccsymbols'
24043 cppflags='$cppflags'
24044 cpplast='$cpplast'
24045 cppminus='$cppminus'
24046 cpprun='$cpprun'
24047 cppstdin='$cppstdin'
24048 cppsymbols='$cppsymbols'
24049 crypt_r_proto='$crypt_r_proto'
24050 cryptlib='$cryptlib'
24051 csh='$csh'
24052 ctermid_r_proto='$ctermid_r_proto'
24053 ctime_r_proto='$ctime_r_proto'
24054 d_Gconvert='$d_Gconvert'
24055 d_PRIEUldbl='$d_PRIEUldbl'
24056 d_PRIFUldbl='$d_PRIFUldbl'
24057 d_PRIGUldbl='$d_PRIGUldbl'
24058 d_PRIXU64='$d_PRIXU64'
24059 d_PRId64='$d_PRId64'
24060 d_PRIeldbl='$d_PRIeldbl'
24061 d_PRIfldbl='$d_PRIfldbl'
24062 d_PRIgldbl='$d_PRIgldbl'
24063 d_PRIi64='$d_PRIi64'
24064 d_PRIo64='$d_PRIo64'
24065 d_PRIu64='$d_PRIu64'
24066 d_PRIx64='$d_PRIx64'
24067 d_SCNfldbl='$d_SCNfldbl'
24068 d__fwalk='$d__fwalk'
24069 d_accept4='$d_accept4'
24070 d_access='$d_access'
24071 d_accessx='$d_accessx'
24072 d_acosh='$d_acosh'
24073 d_aintl='$d_aintl'
24074 d_alarm='$d_alarm'
24075 d_archlib='$d_archlib'
24076 d_asctime64='$d_asctime64'
24077 d_asctime_r='$d_asctime_r'
24078 d_asinh='$d_asinh'
24079 d_atanh='$d_atanh'
24080 d_atolf='$d_atolf'
24081 d_atoll='$d_atoll'
24082 d_attribute_always_inline='$d_attribute_always_inline'
24083 d_attribute_deprecated='$d_attribute_deprecated'
24084 d_attribute_format='$d_attribute_format'
24085 d_attribute_malloc='$d_attribute_malloc'
24086 d_attribute_nonnull='$d_attribute_nonnull'
24087 d_attribute_noreturn='$d_attribute_noreturn'
24088 d_attribute_pure='$d_attribute_pure'
24089 d_attribute_unused='$d_attribute_unused'
24090 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24091 d_backtrace='$d_backtrace'
24092 d_bsd='$d_bsd'
24093 d_bsdgetpgrp='$d_bsdgetpgrp'
24094 d_bsdsetpgrp='$d_bsdsetpgrp'
24095 d_builtin_add_overflow='$d_builtin_add_overflow'
24096 d_builtin_choose_expr='$d_builtin_choose_expr'
24097 d_builtin_expect='$d_builtin_expect'
24098 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24099 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24100 d_c99_variadic_macros='$d_c99_variadic_macros'
24101 d_casti32='$d_casti32'
24102 d_castneg='$d_castneg'
24103 d_cbrt='$d_cbrt'
24104 d_chown='$d_chown'
24105 d_chroot='$d_chroot'
24106 d_chsize='$d_chsize'
24107 d_class='$d_class'
24108 d_clearenv='$d_clearenv'
24109 d_closedir='$d_closedir'
24110 d_cmsghdr_s='$d_cmsghdr_s'
24111 d_copysign='$d_copysign'
24112 d_copysignl='$d_copysignl'
24113 d_cplusplus='$d_cplusplus'
24114 d_crypt='$d_crypt'
24115 d_crypt_r='$d_crypt_r'
24116 d_csh='$d_csh'
24117 d_ctermid='$d_ctermid'
24118 d_ctermid_r='$d_ctermid_r'
24119 d_ctime64='$d_ctime64'
24120 d_ctime_r='$d_ctime_r'
24121 d_cuserid='$d_cuserid'
24122 d_dbminitproto='$d_dbminitproto'
24123 d_difftime64='$d_difftime64'
24124 d_difftime='$d_difftime'
24125 d_dir_dd_fd='$d_dir_dd_fd'
24126 d_dirfd='$d_dirfd'
24127 d_dirnamlen='$d_dirnamlen'
24128 d_dladdr='$d_dladdr'
24129 d_dlerror='$d_dlerror'
24130 d_dlopen='$d_dlopen'
24131 d_dlsymun='$d_dlsymun'
24132 d_dosuid='$d_dosuid'
24133 d_double_has_inf='$d_double_has_inf'
24134 d_double_has_nan='$d_double_has_nan'
24135 d_double_has_negative_zero='$d_double_has_negative_zero'
24136 d_double_has_subnormals='$d_double_has_subnormals'
24137 d_double_style_cray='$d_double_style_cray'
24138 d_double_style_ibm='$d_double_style_ibm'
24139 d_double_style_ieee='$d_double_style_ieee'
24140 d_double_style_vax='$d_double_style_vax'
24141 d_drand48_r='$d_drand48_r'
24142 d_drand48proto='$d_drand48proto'
24143 d_dup2='$d_dup2'
24144 d_dup3='$d_dup3'
24145 d_duplocale='$d_duplocale'
24146 d_eaccess='$d_eaccess'
24147 d_endgrent='$d_endgrent'
24148 d_endgrent_r='$d_endgrent_r'
24149 d_endhent='$d_endhent'
24150 d_endhostent_r='$d_endhostent_r'
24151 d_endnent='$d_endnent'
24152 d_endnetent_r='$d_endnetent_r'
24153 d_endpent='$d_endpent'
24154 d_endprotoent_r='$d_endprotoent_r'
24155 d_endpwent='$d_endpwent'
24156 d_endpwent_r='$d_endpwent_r'
24157 d_endsent='$d_endsent'
24158 d_endservent_r='$d_endservent_r'
24159 d_eofnblk='$d_eofnblk'
24160 d_erf='$d_erf'
24161 d_erfc='$d_erfc'
24162 d_eunice='$d_eunice'
24163 d_exp2='$d_exp2'
24164 d_expm1='$d_expm1'
24165 d_faststdio='$d_faststdio'
24166 d_fchdir='$d_fchdir'
24167 d_fchmod='$d_fchmod'
24168 d_fchmodat='$d_fchmodat'
24169 d_fchown='$d_fchown'
24170 d_fcntl='$d_fcntl'
24171 d_fcntl_can_lock='$d_fcntl_can_lock'
24172 d_fd_macros='$d_fd_macros'
24173 d_fd_set='$d_fd_set'
24174 d_fdclose='$d_fdclose'
24175 d_fdim='$d_fdim'
24176 d_fds_bits='$d_fds_bits'
24177 d_fegetround='$d_fegetround'
24178 d_fgetpos='$d_fgetpos'
24179 d_finite='$d_finite'
24180 d_finitel='$d_finitel'
24181 d_flexfnam='$d_flexfnam'
24182 d_flock='$d_flock'
24183 d_flockproto='$d_flockproto'
24184 d_fma='$d_fma'
24185 d_fmax='$d_fmax'
24186 d_fmin='$d_fmin'
24187 d_fork='$d_fork'
24188 d_fp_class='$d_fp_class'
24189 d_fp_classify='$d_fp_classify'
24190 d_fp_classl='$d_fp_classl'
24191 d_fpathconf='$d_fpathconf'
24192 d_fpclass='$d_fpclass'
24193 d_fpclassify='$d_fpclassify'
24194 d_fpclassl='$d_fpclassl'
24195 d_fpgetround='$d_fpgetround'
24196 d_fpos64_t='$d_fpos64_t'
24197 d_freelocale='$d_freelocale'
24198 d_frexpl='$d_frexpl'
24199 d_fs_data_s='$d_fs_data_s'
24200 d_fseeko='$d_fseeko'
24201 d_fsetpos='$d_fsetpos'
24202 d_fstatfs='$d_fstatfs'
24203 d_fstatvfs='$d_fstatvfs'
24204 d_fsync='$d_fsync'
24205 d_ftello='$d_ftello'
24206 d_ftime='$d_ftime'
24207 d_futimes='$d_futimes'
24208 d_gai_strerror='$d_gai_strerror'
24209 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24210 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24211 d_getaddrinfo='$d_getaddrinfo'
24212 d_getcwd='$d_getcwd'
24213 d_getespwnam='$d_getespwnam'
24214 d_getfsstat='$d_getfsstat'
24215 d_getgrent='$d_getgrent'
24216 d_getgrent_r='$d_getgrent_r'
24217 d_getgrgid_r='$d_getgrgid_r'
24218 d_getgrnam_r='$d_getgrnam_r'
24219 d_getgrps='$d_getgrps'
24220 d_gethbyaddr='$d_gethbyaddr'
24221 d_gethbyname='$d_gethbyname'
24222 d_gethent='$d_gethent'
24223 d_gethname='$d_gethname'
24224 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24225 d_gethostbyname_r='$d_gethostbyname_r'
24226 d_gethostent_r='$d_gethostent_r'
24227 d_gethostprotos='$d_gethostprotos'
24228 d_getitimer='$d_getitimer'
24229 d_getlogin='$d_getlogin'
24230 d_getlogin_r='$d_getlogin_r'
24231 d_getmnt='$d_getmnt'
24232 d_getmntent='$d_getmntent'
24233 d_getnameinfo='$d_getnameinfo'
24234 d_getnbyaddr='$d_getnbyaddr'
24235 d_getnbyname='$d_getnbyname'
24236 d_getnent='$d_getnent'
24237 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24238 d_getnetbyname_r='$d_getnetbyname_r'
24239 d_getnetent_r='$d_getnetent_r'
24240 d_getnetprotos='$d_getnetprotos'
24241 d_getpagsz='$d_getpagsz'
24242 d_getpbyname='$d_getpbyname'
24243 d_getpbynumber='$d_getpbynumber'
24244 d_getpent='$d_getpent'
24245 d_getpgid='$d_getpgid'
24246 d_getpgrp2='$d_getpgrp2'
24247 d_getpgrp='$d_getpgrp'
24248 d_getppid='$d_getppid'
24249 d_getprior='$d_getprior'
24250 d_getprotobyname_r='$d_getprotobyname_r'
24251 d_getprotobynumber_r='$d_getprotobynumber_r'
24252 d_getprotoent_r='$d_getprotoent_r'
24253 d_getprotoprotos='$d_getprotoprotos'
24254 d_getprpwnam='$d_getprpwnam'
24255 d_getpwent='$d_getpwent'
24256 d_getpwent_r='$d_getpwent_r'
24257 d_getpwnam_r='$d_getpwnam_r'
24258 d_getpwuid_r='$d_getpwuid_r'
24259 d_getsbyname='$d_getsbyname'
24260 d_getsbyport='$d_getsbyport'
24261 d_getsent='$d_getsent'
24262 d_getservbyname_r='$d_getservbyname_r'
24263 d_getservbyport_r='$d_getservbyport_r'
24264 d_getservent_r='$d_getservent_r'
24265 d_getservprotos='$d_getservprotos'
24266 d_getspnam='$d_getspnam'
24267 d_getspnam_r='$d_getspnam_r'
24268 d_gettimeod='$d_gettimeod'
24269 d_gmtime64='$d_gmtime64'
24270 d_gmtime_r='$d_gmtime_r'
24271 d_gnulibc='$d_gnulibc'
24272 d_grpasswd='$d_grpasswd'
24273 d_has_C_UTF8='$d_has_C_UTF8'
24274 d_hasmntopt='$d_hasmntopt'
24275 d_htonl='$d_htonl'
24276 d_hypot='$d_hypot'
24277 d_ilogb='$d_ilogb'
24278 d_ilogbl='$d_ilogbl'
24279 d_inc_version_list='$d_inc_version_list'
24280 d_inetaton='$d_inetaton'
24281 d_inetntop='$d_inetntop'
24282 d_inetpton='$d_inetpton'
24283 d_int64_t='$d_int64_t'
24284 d_ip_mreq='$d_ip_mreq'
24285 d_ip_mreq_source='$d_ip_mreq_source'
24286 d_ipv6_mreq='$d_ipv6_mreq'
24287 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24288 d_isascii='$d_isascii'
24289 d_isblank='$d_isblank'
24290 d_isfinite='$d_isfinite'
24291 d_isfinitel='$d_isfinitel'
24292 d_isinf='$d_isinf'
24293 d_isinfl='$d_isinfl'
24294 d_isless='$d_isless'
24295 d_isnan='$d_isnan'
24296 d_isnanl='$d_isnanl'
24297 d_isnormal='$d_isnormal'
24298 d_j0='$d_j0'
24299 d_j0l='$d_j0l'
24300 d_killpg='$d_killpg'
24301 d_lc_monetary_2008='$d_lc_monetary_2008'
24302 d_lchown='$d_lchown'
24303 d_ldbl_dig='$d_ldbl_dig'
24304 d_ldexpl='$d_ldexpl'
24305 d_lgamma='$d_lgamma'
24306 d_lgamma_r='$d_lgamma_r'
24307 d_libm_lib_version='$d_libm_lib_version'
24308 d_libname_unique='$d_libname_unique'
24309 d_link='$d_link'
24310 d_linkat='$d_linkat'
24311 d_llrint='$d_llrint'
24312 d_llrintl='$d_llrintl'
24313 d_llround='$d_llround'
24314 d_llroundl='$d_llroundl'
24315 d_localeconv_l='$d_localeconv_l'
24316 d_localtime64='$d_localtime64'
24317 d_localtime_r='$d_localtime_r'
24318 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24319 d_locconv='$d_locconv'
24320 d_lockf='$d_lockf'
24321 d_log1p='$d_log1p'
24322 d_log2='$d_log2'
24323 d_logb='$d_logb'
24324 d_long_double_style_ieee='$d_long_double_style_ieee'
24325 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24326 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24327 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24328 d_long_double_style_vax='$d_long_double_style_vax'
24329 d_longdbl='$d_longdbl'
24330 d_longlong='$d_longlong'
24331 d_lrint='$d_lrint'
24332 d_lrintl='$d_lrintl'
24333 d_lround='$d_lround'
24334 d_lroundl='$d_lroundl'
24335 d_lseekproto='$d_lseekproto'
24336 d_lstat='$d_lstat'
24337 d_madvise='$d_madvise'
24338 d_malloc_good_size='$d_malloc_good_size'
24339 d_malloc_size='$d_malloc_size'
24340 d_malloc_usable_size='$d_malloc_usable_size'
24341 d_mblen='$d_mblen'
24342 d_mbrlen='$d_mbrlen'
24343 d_mbrtowc='$d_mbrtowc'
24344 d_mbstowcs='$d_mbstowcs'
24345 d_mbtowc='$d_mbtowc'
24346 d_memmem='$d_memmem'
24347 d_memrchr='$d_memrchr'
24348 d_mkdir='$d_mkdir'
24349 d_mkdtemp='$d_mkdtemp'
24350 d_mkfifo='$d_mkfifo'
24351 d_mkostemp='$d_mkostemp'
24352 d_mkstemp='$d_mkstemp'
24353 d_mkstemps='$d_mkstemps'
24354 d_mktime64='$d_mktime64'
24355 d_mktime='$d_mktime'
24356 d_mmap='$d_mmap'
24357 d_modfl='$d_modfl'
24358 d_modflproto='$d_modflproto'
24359 d_mprotect='$d_mprotect'
24360 d_msg='$d_msg'
24361 d_msg_ctrunc='$d_msg_ctrunc'
24362 d_msg_dontroute='$d_msg_dontroute'
24363 d_msg_oob='$d_msg_oob'
24364 d_msg_peek='$d_msg_peek'
24365 d_msg_proxy='$d_msg_proxy'
24366 d_msgctl='$d_msgctl'
24367 d_msgget='$d_msgget'
24368 d_msghdr_s='$d_msghdr_s'
24369 d_msgrcv='$d_msgrcv'
24370 d_msgsnd='$d_msgsnd'
24371 d_msync='$d_msync'
24372 d_munmap='$d_munmap'
24373 d_mymalloc='$d_mymalloc'
24374 d_nan='$d_nan'
24375 d_nanosleep='$d_nanosleep'
24376 d_ndbm='$d_ndbm'
24377 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24378 d_nearbyint='$d_nearbyint'
24379 d_newlocale='$d_newlocale'
24380 d_nextafter='$d_nextafter'
24381 d_nexttoward='$d_nexttoward'
24382 d_nice='$d_nice'
24383 d_nl_langinfo='$d_nl_langinfo'
24384 d_nv_preserves_uv='$d_nv_preserves_uv'
24385 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24386 d_off64_t='$d_off64_t'
24387 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24388 d_oldpthreads='$d_oldpthreads'
24389 d_oldsock='$d_oldsock'
24390 d_open3='$d_open3'
24391 d_openat='$d_openat'
24392 d_pathconf='$d_pathconf'
24393 d_pause='$d_pause'
24394 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24395 d_phostname='$d_phostname'
24396 d_pipe2='$d_pipe2'
24397 d_pipe='$d_pipe'
24398 d_poll='$d_poll'
24399 d_portable='$d_portable'
24400 d_prctl='$d_prctl'
24401 d_prctl_set_name='$d_prctl_set_name'
24402 d_printf_format_null='$d_printf_format_null'
24403 d_procselfexe='$d_procselfexe'
24404 d_pseudofork='$d_pseudofork'
24405 d_pthread_atfork='$d_pthread_atfork'
24406 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24407 d_pthread_yield='$d_pthread_yield'
24408 d_ptrdiff_t='$d_ptrdiff_t'
24409 d_pwage='$d_pwage'
24410 d_pwchange='$d_pwchange'
24411 d_pwclass='$d_pwclass'
24412 d_pwcomment='$d_pwcomment'
24413 d_pwexpire='$d_pwexpire'
24414 d_pwgecos='$d_pwgecos'
24415 d_pwpasswd='$d_pwpasswd'
24416 d_pwquota='$d_pwquota'
24417 d_qgcvt='$d_qgcvt'
24418 d_quad='$d_quad'
24419 d_querylocale='$d_querylocale'
24420 d_random_r='$d_random_r'
24421 d_re_comp='$d_re_comp'
24422 d_readdir64_r='$d_readdir64_r'
24423 d_readdir='$d_readdir'
24424 d_readdir_r='$d_readdir_r'
24425 d_readlink='$d_readlink'
24426 d_readv='$d_readv'
24427 d_recvmsg='$d_recvmsg'
24428 d_regcmp='$d_regcmp'
24429 d_regcomp='$d_regcomp'
24430 d_remainder='$d_remainder'
24431 d_remquo='$d_remquo'
24432 d_rename='$d_rename'
24433 d_renameat='$d_renameat'
24434 d_rewinddir='$d_rewinddir'
24435 d_rint='$d_rint'
24436 d_rmdir='$d_rmdir'
24437 d_round='$d_round'
24438 d_sbrkproto='$d_sbrkproto'
24439 d_scalbn='$d_scalbn'
24440 d_scalbnl='$d_scalbnl'
24441 d_sched_yield='$d_sched_yield'
24442 d_scm_rights='$d_scm_rights'
24443 d_seekdir='$d_seekdir'
24444 d_select='$d_select'
24445 d_sem='$d_sem'
24446 d_semctl='$d_semctl'
24447 d_semctl_semid_ds='$d_semctl_semid_ds'
24448 d_semctl_semun='$d_semctl_semun'
24449 d_semget='$d_semget'
24450 d_semop='$d_semop'
24451 d_sendmsg='$d_sendmsg'
24452 d_setegid='$d_setegid'
24453 d_seteuid='$d_seteuid'
24454 d_setgrent='$d_setgrent'
24455 d_setgrent_r='$d_setgrent_r'
24456 d_setgrps='$d_setgrps'
24457 d_sethent='$d_sethent'
24458 d_sethostent_r='$d_sethostent_r'
24459 d_setitimer='$d_setitimer'
24460 d_setlinebuf='$d_setlinebuf'
24461 d_setlocale='$d_setlocale'
24462 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24463 d_setlocale_r='$d_setlocale_r'
24464 d_setnent='$d_setnent'
24465 d_setnetent_r='$d_setnetent_r'
24466 d_setpent='$d_setpent'
24467 d_setpgid='$d_setpgid'
24468 d_setpgrp2='$d_setpgrp2'
24469 d_setpgrp='$d_setpgrp'
24470 d_setprior='$d_setprior'
24471 d_setproctitle='$d_setproctitle'
24472 d_setprotoent_r='$d_setprotoent_r'
24473 d_setpwent='$d_setpwent'
24474 d_setpwent_r='$d_setpwent_r'
24475 d_setregid='$d_setregid'
24476 d_setresgid='$d_setresgid'
24477 d_setresuid='$d_setresuid'
24478 d_setreuid='$d_setreuid'
24479 d_setrgid='$d_setrgid'
24480 d_setruid='$d_setruid'
24481 d_setsent='$d_setsent'
24482 d_setservent_r='$d_setservent_r'
24483 d_setsid='$d_setsid'
24484 d_setvbuf='$d_setvbuf'
24485 d_shm='$d_shm'
24486 d_shmat='$d_shmat'
24487 d_shmatprototype='$d_shmatprototype'
24488 d_shmctl='$d_shmctl'
24489 d_shmdt='$d_shmdt'
24490 d_shmget='$d_shmget'
24491 d_sigaction='$d_sigaction'
24492 d_siginfo_si_addr='$d_siginfo_si_addr'
24493 d_siginfo_si_band='$d_siginfo_si_band'
24494 d_siginfo_si_errno='$d_siginfo_si_errno'
24495 d_siginfo_si_fd='$d_siginfo_si_fd'
24496 d_siginfo_si_pid='$d_siginfo_si_pid'
24497 d_siginfo_si_status='$d_siginfo_si_status'
24498 d_siginfo_si_uid='$d_siginfo_si_uid'
24499 d_siginfo_si_value='$d_siginfo_si_value'
24500 d_signbit='$d_signbit'
24501 d_sigprocmask='$d_sigprocmask'
24502 d_sigsetjmp='$d_sigsetjmp'
24503 d_sin6_scope_id='$d_sin6_scope_id'
24504 d_sitearch='$d_sitearch'
24505 d_snprintf='$d_snprintf'
24506 d_sockaddr_in6='$d_sockaddr_in6'
24507 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24508 d_sockatmark='$d_sockatmark'
24509 d_sockatmarkproto='$d_sockatmarkproto'
24510 d_socket='$d_socket'
24511 d_socklen_t='$d_socklen_t'
24512 d_sockpair='$d_sockpair'
24513 d_socks5_init='$d_socks5_init'
24514 d_sqrtl='$d_sqrtl'
24515 d_srand48_r='$d_srand48_r'
24516 d_srandom_r='$d_srandom_r'
24517 d_sresgproto='$d_sresgproto'
24518 d_sresuproto='$d_sresuproto'
24519 d_stat='$d_stat'
24520 d_statblks='$d_statblks'
24521 d_statfs_f_flags='$d_statfs_f_flags'
24522 d_statfs_s='$d_statfs_s'
24523 d_static_inline='$d_static_inline'
24524 d_statvfs='$d_statvfs'
24525 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24526 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24527 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24528 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24529 d_stdio_stream_array='$d_stdio_stream_array'
24530 d_stdiobase='$d_stdiobase'
24531 d_stdstdio='$d_stdstdio'
24532 d_strcoll='$d_strcoll'
24533 d_strerror_l='$d_strerror_l'
24534 d_strerror_r='$d_strerror_r'
24535 d_strftime='$d_strftime'
24536 d_strlcat='$d_strlcat'
24537 d_strlcpy='$d_strlcpy'
24538 d_strnlen='$d_strnlen'
24539 d_strtod='$d_strtod'
24540 d_strtod_l='$d_strtod_l'
24541 d_strtol='$d_strtol'
24542 d_strtold='$d_strtold'
24543 d_strtold_l='$d_strtold_l'
24544 d_strtoll='$d_strtoll'
24545 d_strtoq='$d_strtoq'
24546 d_strtoul='$d_strtoul'
24547 d_strtoull='$d_strtoull'
24548 d_strtouq='$d_strtouq'
24549 d_strxfrm='$d_strxfrm'
24550 d_suidsafe='$d_suidsafe'
24551 d_symlink='$d_symlink'
24552 d_syscall='$d_syscall'
24553 d_syscallproto='$d_syscallproto'
24554 d_sysconf='$d_sysconf'
24555 d_sysernlst='$d_sysernlst'
24556 d_syserrlst='$d_syserrlst'
24557 d_system='$d_system'
24558 d_tcgetpgrp='$d_tcgetpgrp'
24559 d_tcsetpgrp='$d_tcsetpgrp'
24560 d_telldir='$d_telldir'
24561 d_telldirproto='$d_telldirproto'
24562 d_tgamma='$d_tgamma'
24563 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24564 d_time='$d_time'
24565 d_timegm='$d_timegm'
24566 d_times='$d_times'
24567 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24568 d_tm_tm_zone='$d_tm_tm_zone'
24569 d_tmpnam_r='$d_tmpnam_r'
24570 d_towlower='$d_towlower'
24571 d_towupper='$d_towupper'
24572 d_trunc='$d_trunc'
24573 d_truncate='$d_truncate'
24574 d_truncl='$d_truncl'
24575 d_ttyname_r='$d_ttyname_r'
24576 d_tzname='$d_tzname'
24577 d_u32align='$d_u32align'
24578 d_ualarm='$d_ualarm'
24579 d_umask='$d_umask'
24580 d_uname='$d_uname'
24581 d_union_semun='$d_union_semun'
24582 d_unlinkat='$d_unlinkat'
24583 d_unordered='$d_unordered'
24584 d_unsetenv='$d_unsetenv'
24585 d_uselocale='$d_uselocale'
24586 d_usleep='$d_usleep'
24587 d_usleepproto='$d_usleepproto'
24588 d_ustat='$d_ustat'
24589 d_vendorarch='$d_vendorarch'
24590 d_vendorbin='$d_vendorbin'
24591 d_vendorlib='$d_vendorlib'
24592 d_vendorscript='$d_vendorscript'
24593 d_vfork='$d_vfork'
24594 d_void_closedir='$d_void_closedir'
24595 d_voidsig='$d_voidsig'
24596 d_voidtty='$d_voidtty'
24597 d_vsnprintf='$d_vsnprintf'
24598 d_wait4='$d_wait4'
24599 d_waitpid='$d_waitpid'
24600 d_wcrtomb='$d_wcrtomb'
24601 d_wcscmp='$d_wcscmp'
24602 d_wcstombs='$d_wcstombs'
24603 d_wcsxfrm='$d_wcsxfrm'
24604 d_wctomb='$d_wctomb'
24605 d_writev='$d_writev'
24606 d_xenix='$d_xenix'
24607 date='$date'
24608 db_hashtype='$db_hashtype'
24609 db_prefixtype='$db_prefixtype'
24610 db_version_major='$db_version_major'
24611 db_version_minor='$db_version_minor'
24612 db_version_patch='$db_version_patch'
24613 default_inc_excludes_dot='$default_inc_excludes_dot'
24614 direntrytype='$direntrytype'
24615 dlext='$dlext'
24616 dlsrc='$dlsrc'
24617 doubleinfbytes='$doubleinfbytes'
24618 doublekind='$doublekind'
24619 doublemantbits='$doublemantbits'
24620 doublenanbytes='$doublenanbytes'
24621 doublesize='$doublesize'
24622 drand01='$drand01'
24623 drand48_r_proto='$drand48_r_proto'
24624 dtrace='$dtrace'
24625 dtraceobject='$dtraceobject'
24626 dtracexnolibs='$dtracexnolibs'
24627 dynamic_ext='$dynamic_ext'
24628 eagain='$eagain'
24629 ebcdic='$ebcdic'
24630 echo='$echo'
24631 egrep='$egrep'
24632 emacs='$emacs'
24633 endgrent_r_proto='$endgrent_r_proto'
24634 endhostent_r_proto='$endhostent_r_proto'
24635 endnetent_r_proto='$endnetent_r_proto'
24636 endprotoent_r_proto='$endprotoent_r_proto'
24637 endpwent_r_proto='$endpwent_r_proto'
24638 endservent_r_proto='$endservent_r_proto'
24639 eunicefix='$eunicefix'
24640 exe_ext='$exe_ext'
24641 expr='$expr'
24642 extensions='$extensions'
24643 extern_C='$extern_C'
24644 extras='$extras'
24645 fflushNULL='$fflushNULL'
24646 fflushall='$fflushall'
24647 find='$find'
24648 firstmakefile='$firstmakefile'
24649 flex='$flex'
24650 fpossize='$fpossize'
24651 fpostype='$fpostype'
24652 freetype='$freetype'
24653 from='$from'
24654 full_ar='$full_ar'
24655 full_csh='$full_csh'
24656 full_sed='$full_sed'
24657 gccansipedantic='$gccansipedantic'
24658 gccosandvers='$gccosandvers'
24659 gccversion='$gccversion'
24660 getgrent_r_proto='$getgrent_r_proto'
24661 getgrgid_r_proto='$getgrgid_r_proto'
24662 getgrnam_r_proto='$getgrnam_r_proto'
24663 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24664 gethostbyname_r_proto='$gethostbyname_r_proto'
24665 gethostent_r_proto='$gethostent_r_proto'
24666 getlogin_r_proto='$getlogin_r_proto'
24667 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24668 getnetbyname_r_proto='$getnetbyname_r_proto'
24669 getnetent_r_proto='$getnetent_r_proto'
24670 getprotobyname_r_proto='$getprotobyname_r_proto'
24671 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24672 getprotoent_r_proto='$getprotoent_r_proto'
24673 getpwent_r_proto='$getpwent_r_proto'
24674 getpwnam_r_proto='$getpwnam_r_proto'
24675 getpwuid_r_proto='$getpwuid_r_proto'
24676 getservbyname_r_proto='$getservbyname_r_proto'
24677 getservbyport_r_proto='$getservbyport_r_proto'
24678 getservent_r_proto='$getservent_r_proto'
24679 getspnam_r_proto='$getspnam_r_proto'
24680 gidformat='$gidformat'
24681 gidsign='$gidsign'
24682 gidsize='$gidsize'
24683 gidtype='$gidtype'
24684 glibpth='$glibpth'
24685 gmake='$gmake'
24686 gmtime_r_proto='$gmtime_r_proto'
24687 gnulibc_version='$gnulibc_version'
24688 grep='$grep'
24689 groupcat='$groupcat'
24690 groupstype='$groupstype'
24691 gzip='$gzip'
24692 h_fcntl='$h_fcntl'
24693 h_sysfile='$h_sysfile'
24694 hint='$hint'
24695 hostcat='$hostcat'
24696 hostgenerate='$hostgenerate'
24697 hostosname='$hostosname'
24698 hostperl='$hostperl'
24699 html1dir='$html1dir'
24700 html1direxp='$html1direxp'
24701 html3dir='$html3dir'
24702 html3direxp='$html3direxp'
24703 i16size='$i16size'
24704 i16type='$i16type'
24705 i32size='$i32size'
24706 i32type='$i32type'
24707 i64size='$i64size'
24708 i64type='$i64type'
24709 i8size='$i8size'
24710 i8type='$i8type'
24711 i_arpainet='$i_arpainet'
24712 i_bfd='$i_bfd'
24713 i_bsdioctl='$i_bsdioctl'
24714 i_crypt='$i_crypt'
24715 i_db='$i_db'
24716 i_dbm='$i_dbm'
24717 i_dirent='$i_dirent'
24718 i_dlfcn='$i_dlfcn'
24719 i_execinfo='$i_execinfo'
24720 i_fcntl='$i_fcntl'
24721 i_fenv='$i_fenv'
24722 i_fp='$i_fp'
24723 i_fp_class='$i_fp_class'
24724 i_gdbm='$i_gdbm'
24725 i_gdbm_ndbm='$i_gdbm_ndbm'
24726 i_gdbmndbm='$i_gdbmndbm'
24727 i_grp='$i_grp'
24728 i_ieeefp='$i_ieeefp'
24729 i_inttypes='$i_inttypes'
24730 i_langinfo='$i_langinfo'
24731 i_libutil='$i_libutil'
24732 i_locale='$i_locale'
24733 i_machcthr='$i_machcthr'
24734 i_malloc='$i_malloc'
24735 i_mallocmalloc='$i_mallocmalloc'
24736 i_mntent='$i_mntent'
24737 i_ndbm='$i_ndbm'
24738 i_netdb='$i_netdb'
24739 i_neterrno='$i_neterrno'
24740 i_netinettcp='$i_netinettcp'
24741 i_niin='$i_niin'
24742 i_poll='$i_poll'
24743 i_prot='$i_prot'
24744 i_pthread='$i_pthread'
24745 i_pwd='$i_pwd'
24746 i_quadmath='$i_quadmath'
24747 i_rpcsvcdbm='$i_rpcsvcdbm'
24748 i_sgtty='$i_sgtty'
24749 i_shadow='$i_shadow'
24750 i_socks='$i_socks'
24751 i_stdbool='$i_stdbool'
24752 i_stdint='$i_stdint'
24753 i_stdlib='$i_stdlib'
24754 i_sunmath='$i_sunmath'
24755 i_sysaccess='$i_sysaccess'
24756 i_sysdir='$i_sysdir'
24757 i_sysfile='$i_sysfile'
24758 i_sysfilio='$i_sysfilio'
24759 i_sysin='$i_sysin'
24760 i_sysioctl='$i_sysioctl'
24761 i_syslog='$i_syslog'
24762 i_sysmman='$i_sysmman'
24763 i_sysmode='$i_sysmode'
24764 i_sysmount='$i_sysmount'
24765 i_sysndir='$i_sysndir'
24766 i_sysparam='$i_sysparam'
24767 i_syspoll='$i_syspoll'
24768 i_sysresrc='$i_sysresrc'
24769 i_syssecrt='$i_syssecrt'
24770 i_sysselct='$i_sysselct'
24771 i_syssockio='$i_syssockio'
24772 i_sysstat='$i_sysstat'
24773 i_sysstatfs='$i_sysstatfs'
24774 i_sysstatvfs='$i_sysstatvfs'
24775 i_systime='$i_systime'
24776 i_systimek='$i_systimek'
24777 i_systimes='$i_systimes'
24778 i_systypes='$i_systypes'
24779 i_sysuio='$i_sysuio'
24780 i_sysun='$i_sysun'
24781 i_sysutsname='$i_sysutsname'
24782 i_sysvfs='$i_sysvfs'
24783 i_syswait='$i_syswait'
24784 i_termio='$i_termio'
24785 i_termios='$i_termios'
24786 i_time='$i_time'
24787 i_unistd='$i_unistd'
24788 i_ustat='$i_ustat'
24789 i_utime='$i_utime'
24790 i_vfork='$i_vfork'
24791 i_wchar='$i_wchar'
24792 i_wctype='$i_wctype'
24793 i_xlocale='$i_xlocale'
24794 ignore_versioned_solibs='$ignore_versioned_solibs'
24795 inc_version_list='$inc_version_list'
24796 inc_version_list_init='$inc_version_list_init'
24797 incpath='$incpath'
24798 incpth='$incpth'
24799 inews='$inews'
24800 initialinstalllocation='$initialinstalllocation'
24801 installarchlib='$installarchlib'
24802 installbin='$installbin'
24803 installhtml1dir='$installhtml1dir'
24804 installhtml3dir='$installhtml3dir'
24805 installman1dir='$installman1dir'
24806 installman3dir='$installman3dir'
24807 installprefix='$installprefix'
24808 installprefixexp='$installprefixexp'
24809 installprivlib='$installprivlib'
24810 installscript='$installscript'
24811 installsitearch='$installsitearch'
24812 installsitebin='$installsitebin'
24813 installsitehtml1dir='$installsitehtml1dir'
24814 installsitehtml3dir='$installsitehtml3dir'
24815 installsitelib='$installsitelib'
24816 installsiteman1dir='$installsiteman1dir'
24817 installsiteman3dir='$installsiteman3dir'
24818 installsitescript='$installsitescript'
24819 installstyle='$installstyle'
24820 installusrbinperl='$installusrbinperl'
24821 installvendorarch='$installvendorarch'
24822 installvendorbin='$installvendorbin'
24823 installvendorhtml1dir='$installvendorhtml1dir'
24824 installvendorhtml3dir='$installvendorhtml3dir'
24825 installvendorlib='$installvendorlib'
24826 installvendorman1dir='$installvendorman1dir'
24827 installvendorman3dir='$installvendorman3dir'
24828 installvendorscript='$installvendorscript'
24829 intsize='$intsize'
24830 issymlink='$issymlink'
24831 ivdformat='$ivdformat'
24832 ivsize='$ivsize'
24833 ivtype='$ivtype'
24834 known_extensions='$known_extensions'
24835 ksh='$ksh'
24836 ld='$ld'
24837 ld_can_script='$ld_can_script'
24838 lddlflags='$lddlflags'
24839 ldflags='$ldflags'
24840 ldflags_uselargefiles='$ldflags_uselargefiles'
24841 ldlibpthname='$ldlibpthname'
24842 less='$less'
24843 lib_ext='$lib_ext'
24844 libc='$libc'
24845 libperl='$libperl'
24846 libpth='$libpth'
24847 libs='$libs'
24848 libsdirs='$libsdirs'
24849 libsfiles='$libsfiles'
24850 libsfound='$libsfound'
24851 libspath='$libspath'
24852 libswanted='$libswanted'
24853 libswanted_uselargefiles='$libswanted_uselargefiles'
24854 line='$line'
24855 lint='$lint'
24856 lkflags='$lkflags'
24857 ln='$ln'
24858 lns='$lns'
24859 localtime_r_proto='$localtime_r_proto'
24860 locincpth='$locincpth'
24861 loclibpth='$loclibpth'
24862 longdblinfbytes='$longdblinfbytes'
24863 longdblkind='$longdblkind'
24864 longdblmantbits='$longdblmantbits'
24865 longdblnanbytes='$longdblnanbytes'
24866 longdblsize='$longdblsize'
24867 longlongsize='$longlongsize'
24868 longsize='$longsize'
24869 lp='$lp'
24870 lpr='$lpr'
24871 ls='$ls'
24872 lseeksize='$lseeksize'
24873 lseektype='$lseektype'
24874 mail='$mail'
24875 mailx='$mailx'
24876 make='$make'
24877 make_set_make='$make_set_make'
24878 mallocobj='$mallocobj'
24879 mallocsrc='$mallocsrc'
24880 malloctype='$malloctype'
24881 man1dir='$man1dir'
24882 man1direxp='$man1direxp'
24883 man1ext='$man1ext'
24884 man3dir='$man3dir'
24885 man3direxp='$man3direxp'
24886 man3ext='$man3ext'
24887 mips_type='$mips_type'
24888 mistrustnm='$mistrustnm'
24889 mkdir='$mkdir'
24890 mmaptype='$mmaptype'
24891 modetype='$modetype'
24892 more='$more'
24893 multiarch='$multiarch'
24894 mv='$mv'
24895 myarchname='$myarchname'
24896 mydomain='$mydomain'
24897 myhostname='$myhostname'
24898 myuname='$myuname'
24899 n='$n'
24900 need_va_copy='$need_va_copy'
24901 netdb_hlen_type='$netdb_hlen_type'
24902 netdb_host_type='$netdb_host_type'
24903 netdb_name_type='$netdb_name_type'
24904 netdb_net_type='$netdb_net_type'
24905 nm='$nm'
24906 nm_opt='$nm_opt'
24907 nm_so_opt='$nm_so_opt'
24908 nonxs_ext='$nonxs_ext'
24909 nroff='$nroff'
24910 nvEUformat='$nvEUformat'
24911 nvFUformat='$nvFUformat'
24912 nvGUformat='$nvGUformat'
24913 nv_overflows_integers_at='$nv_overflows_integers_at'
24914 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24915 nveformat='$nveformat'
24916 nvfformat='$nvfformat'
24917 nvgformat='$nvgformat'
24918 nvmantbits='$nvmantbits'
24919 nvsize='$nvsize'
24920 nvtype='$nvtype'
24921 o_nonblock='$o_nonblock'
24922 obj_ext='$obj_ext'
24923 old_pthread_create_joinable='$old_pthread_create_joinable'
24924 optimize='$optimize'
24925 orderlib='$orderlib'
24926 osname='$osname'
24927 osvers='$osvers'
24928 otherlibdirs='$otherlibdirs'
24929 package='$package'
24930 pager='$pager'
24931 passcat='$passcat'
24932 patchlevel='$patchlevel'
24933 path_sep='$path_sep'
24934 perl5='$perl5'
24935 perl='$perl'
24936 perl_patchlevel='$perl_patchlevel'
24937 perl_static_inline='$perl_static_inline'
24938 perladmin='$perladmin'
24939 perllibs='$perllibs'
24940 perlpath='$perlpath'
24941 pg='$pg'
24942 phostname='$phostname'
24943 pidtype='$pidtype'
24944 plibpth='$plibpth'
24945 pmake='$pmake'
24946 pr='$pr'
24947 prefix='$prefix'
24948 prefixexp='$prefixexp'
24949 privlib='$privlib'
24950 privlibexp='$privlibexp'
24951 procselfexe='$procselfexe'
24952 ptrsize='$ptrsize'
24953 quadkind='$quadkind'
24954 quadtype='$quadtype'
24955 randbits='$randbits'
24956 randfunc='$randfunc'
24957 random_r_proto='$random_r_proto'
24958 randseedtype='$randseedtype'
24959 ranlib='$ranlib'
24960 rd_nodata='$rd_nodata'
24961 readdir64_r_proto='$readdir64_r_proto'
24962 readdir_r_proto='$readdir_r_proto'
24963 revision='$revision'
24964 rm='$rm'
24965 rm_try='$rm_try'
24966 rmail='$rmail'
24967 run='$run'
24968 runnm='$runnm'
24969 sGMTIME_max='$sGMTIME_max'
24970 sGMTIME_min='$sGMTIME_min'
24971 sLOCALTIME_max='$sLOCALTIME_max'
24972 sLOCALTIME_min='$sLOCALTIME_min'
24973 sPRIEUldbl='$sPRIEUldbl'
24974 sPRIFUldbl='$sPRIFUldbl'
24975 sPRIGUldbl='$sPRIGUldbl'
24976 sPRIXU64='$sPRIXU64'
24977 sPRId64='$sPRId64'
24978 sPRIeldbl='$sPRIeldbl'
24979 sPRIfldbl='$sPRIfldbl'
24980 sPRIgldbl='$sPRIgldbl'
24981 sPRIi64='$sPRIi64'
24982 sPRIo64='$sPRIo64'
24983 sPRIu64='$sPRIu64'
24984 sPRIx64='$sPRIx64'
24985 sSCNfldbl='$sSCNfldbl'
24986 sched_yield='$sched_yield'
24987 scriptdir='$scriptdir'
24988 scriptdirexp='$scriptdirexp'
24989 sed='$sed'
24990 seedfunc='$seedfunc'
24991 selectminbits='$selectminbits'
24992 selecttype='$selecttype'
24993 sendmail='$sendmail'
24994 setgrent_r_proto='$setgrent_r_proto'
24995 sethostent_r_proto='$sethostent_r_proto'
24996 setlocale_r_proto='$setlocale_r_proto'
24997 setnetent_r_proto='$setnetent_r_proto'
24998 setprotoent_r_proto='$setprotoent_r_proto'
24999 setpwent_r_proto='$setpwent_r_proto'
25000 setservent_r_proto='$setservent_r_proto'
25001 sh='$sh'
25002 shar='$shar'
25003 sharpbang='$sharpbang'
25004 shmattype='$shmattype'
25005 shortsize='$shortsize'
25006 shrpenv='$shrpenv'
25007 shsharp='$shsharp'
25008 sig_count='$sig_count'
25009 sig_name='$sig_name'
25010 sig_name_init='$sig_name_init'
25011 sig_num='$sig_num'
25012 sig_num_init='$sig_num_init'
25013 sig_size='$sig_size'
25014 signal_t='$signal_t'
25015 sitearch='$sitearch'
25016 sitearchexp='$sitearchexp'
25017 sitebin='$sitebin'
25018 sitebinexp='$sitebinexp'
25019 sitehtml1dir='$sitehtml1dir'
25020 sitehtml1direxp='$sitehtml1direxp'
25021 sitehtml3dir='$sitehtml3dir'
25022 sitehtml3direxp='$sitehtml3direxp'
25023 sitelib='$sitelib'
25024 sitelib_stem='$sitelib_stem'
25025 sitelibexp='$sitelibexp'
25026 siteman1dir='$siteman1dir'
25027 siteman1direxp='$siteman1direxp'
25028 siteman3dir='$siteman3dir'
25029 siteman3direxp='$siteman3direxp'
25030 siteprefix='$siteprefix'
25031 siteprefixexp='$siteprefixexp'
25032 sitescript='$sitescript'
25033 sitescriptexp='$sitescriptexp'
25034 sizesize='$sizesize'
25035 sizetype='$sizetype'
25036 sleep='$sleep'
25037 smail='$smail'
25038 so='$so'
25039 sockethdr='$sockethdr'
25040 socketlib='$socketlib'
25041 socksizetype='$socksizetype'
25042 sort='$sort'
25043 spackage='$spackage'
25044 spitshell='$spitshell'
25045 srand48_r_proto='$srand48_r_proto'
25046 srandom_r_proto='$srandom_r_proto'
25047 src='$src'
25048 ssizetype='$ssizetype'
25049 st_ino_sign='$st_ino_sign'
25050 st_ino_size='$st_ino_size'
25051 startperl='$startperl'
25052 startsh='$startsh'
25053 static_ext='$static_ext'
25054 stdchar='$stdchar'
25055 stdio_base='$stdio_base'
25056 stdio_bufsiz='$stdio_bufsiz'
25057 stdio_cnt='$stdio_cnt'
25058 stdio_filbuf='$stdio_filbuf'
25059 stdio_ptr='$stdio_ptr'
25060 stdio_stream_array='$stdio_stream_array'
25061 strerror_r_proto='$strerror_r_proto'
25062 submit='$submit'
25063 subversion='$subversion'
25064 sysman='$sysman'
25065 sysroot='$sysroot'
25066 tail='$tail'
25067 tar='$tar'
25068 targetarch='$targetarch'
25069 targetdir='$targetdir'
25070 targetenv='$targetenv'
25071 targethost='$targethost'
25072 targetmkdir='$targetmkdir'
25073 targetport='$targetport'
25074 targetsh='$targetsh'
25075 tbl='$tbl'
25076 tee='$tee'
25077 test='$test'
25078 timeincl='$timeincl'
25079 timetype='$timetype'
25080 tmpnam_r_proto='$tmpnam_r_proto'
25081 to='$to'
25082 touch='$touch'
25083 tr='$tr'
25084 trnl='$trnl'
25085 troff='$troff'
25086 ttyname_r_proto='$ttyname_r_proto'
25087 u16size='$u16size'
25088 u16type='$u16type'
25089 u32size='$u32size'
25090 u32type='$u32type'
25091 u64size='$u64size'
25092 u64type='$u64type'
25093 u8size='$u8size'
25094 u8type='$u8type'
25095 uidformat='$uidformat'
25096 uidsign='$uidsign'
25097 uidsize='$uidsize'
25098 uidtype='$uidtype'
25099 uname='$uname'
25100 uniq='$uniq'
25101 uquadtype='$uquadtype'
25102 use5005threads='$use5005threads'
25103 use64bitall='$use64bitall'
25104 use64bitint='$use64bitint'
25105 usecbacktrace='$usecbacktrace'
25106 usecrosscompile='$usecrosscompile'
25107 usedevel='$usedevel'
25108 usedl='$usedl'
25109 usedtrace='$usedtrace'
25110 usefaststdio='$usefaststdio'
25111 useithreads='$useithreads'
25112 usekernprocpathname='$usekernprocpathname'
25113 uselanginfo='$uselanginfo'
25114 uselargefiles='$uselargefiles'
25115 uselongdouble='$uselongdouble'
25116 usemallocwrap='$usemallocwrap'
25117 usemorebits='$usemorebits'
25118 usemultiplicity='$usemultiplicity'
25119 usemymalloc='$usemymalloc'
25120 usenm='$usenm'
25121 usensgetexecutablepath='$usensgetexecutablepath'
25122 useopcode='$useopcode'
25123 useperlio='$useperlio'
25124 useposix='$useposix'
25125 usequadmath='$usequadmath'
25126 usereentrant='$usereentrant'
25127 userelocatableinc='$userelocatableinc'
25128 useshrplib='$useshrplib'
25129 usesitecustomize='$usesitecustomize'
25130 usesocks='$usesocks'
25131 usethreads='$usethreads'
25132 usevendorprefix='$usevendorprefix'
25133 useversionedarchname='$useversionedarchname'
25134 usevfork='$usevfork'
25135 usrinc='$usrinc'
25136 uuname='$uuname'
25137 uvXUformat='$uvXUformat'
25138 uvoformat='$uvoformat'
25139 uvsize='$uvsize'
25140 uvtype='$uvtype'
25141 uvuformat='$uvuformat'
25142 uvxformat='$uvxformat'
25143 vendorarch='$vendorarch'
25144 vendorarchexp='$vendorarchexp'
25145 vendorbin='$vendorbin'
25146 vendorbinexp='$vendorbinexp'
25147 vendorhtml1dir='$vendorhtml1dir'
25148 vendorhtml1direxp='$vendorhtml1direxp'
25149 vendorhtml3dir='$vendorhtml3dir'
25150 vendorhtml3direxp='$vendorhtml3direxp'
25151 vendorlib='$vendorlib'
25152 vendorlib_stem='$vendorlib_stem'
25153 vendorlibexp='$vendorlibexp'
25154 vendorman1dir='$vendorman1dir'
25155 vendorman1direxp='$vendorman1direxp'
25156 vendorman3dir='$vendorman3dir'
25157 vendorman3direxp='$vendorman3direxp'
25158 vendorprefix='$vendorprefix'
25159 vendorprefixexp='$vendorprefixexp'
25160 vendorscript='$vendorscript'
25161 vendorscriptexp='$vendorscriptexp'
25162 version='$version'
25163 version_patchlevel_string='$version_patchlevel_string'
25164 versiononly='$versiononly'
25165 vi='$vi'
25166 xlibpth='$xlibpth'
25167 yacc='$yacc'
25168 yaccflags='$yaccflags'
25169 zcat='$zcat'
25170 zip='$zip'
25171 EOT
25172
25173 : add special variables
25174 $test -f $src/patchlevel.h && \
25175 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25176 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25177 echo "PERL_CONFIG_SH=true" >>config.sh
25178
25179 : propagate old symbols
25180 if $test -f UU/config.sh; then
25181         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25182         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25183                 config.sh config.sh UU/oldconfig.sh |\
25184                 $sort | $uniq -u >UU/oldsyms
25185         set X `$cat UU/oldsyms`
25186         shift
25187         case $# in
25188         0) ;;
25189         *)
25190                 $cat <<EOM
25191 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25192 EOM
25193                 echo ": Variables propagated from previous config.sh file." >>config.sh
25194                 for sym in `$cat UU/oldsyms`; do
25195                         echo "    Propagating $hint variable "'$'"$sym..."
25196                         eval 'tmp="$'"${sym}"'"'
25197                         echo "$tmp" | \
25198                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25199                 done
25200                 ;;
25201         esac
25202 fi
25203
25204 : preserve RCS keywords in files with variable substitution, grrr
25205 Id='$Id'
25206
25207 : Finish up by extracting the .SH files
25208 case "$alldone" in
25209 exit)
25210         echo "Stopping at your request, leaving temporary files around."
25211         exit 0
25212         ;;
25213 cont)
25214         ;;
25215 '')
25216         dflt=''
25217         nostick=true
25218         $cat <<EOM
25219
25220 If you'd like to make any changes to the config.sh file before I begin
25221 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25222
25223 EOM
25224         rp="Press return or use a shell escape to edit config.sh:"
25225         . UU/myread
25226         nostick=''
25227         case "$ans" in
25228         '') ;;
25229         *) : in case they cannot read
25230                 sh 1>&4 -c "$ans";;
25231         esac
25232         ;;
25233 esac
25234
25235 : if this fails, just run all the .SH files by hand
25236 . ./config.sh
25237
25238 echo " "
25239 exec 1>&4
25240 pwd=`pwd`
25241 . ./UU/extract
25242 cd "$pwd"
25243
25244 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25245         dflt=y
25246         case "$silent" in
25247         true) ;;
25248         *)
25249                 $cat <<EOM
25250
25251 Now you need to generate make dependencies by running "$make depend".
25252 You might prefer to run it in background: "$make depend > makedepend.out &"
25253 It can take a while, so you might not want to run it right now.
25254
25255 EOM
25256                 ;;
25257         esac
25258         rp="Run $make depend now?"
25259         . UU/myread
25260         case "$ans" in
25261         y*)
25262                 $make depend && echo "Now you must run '$make'."
25263                 ;;
25264         *)
25265                 echo "You must run '$make depend' then '$make'."
25266                 ;;
25267         esac
25268 elif test -f [Mm]akefile; then
25269         echo " "
25270         echo "Now you must run a $make."
25271 else
25272         echo "Configure done."
25273 fi
25274
25275 if $test -f Policy.sh; then
25276     $cat <<EOM
25277
25278 If you compile $package on a different machine or from a different object
25279 directory, copy the Policy.sh file from this object directory to the
25280 new one before you run Configure -- this will help you with most of
25281 the policy defaults.
25282
25283 EOM
25284 fi
25285 if $test -f UU/config.msg; then
25286     echo "Hmm.  I also noted the following information while running:"
25287     echo " "
25288     $cat UU/config.msg >&4
25289 fi
25290 $rm -f kit*isdone ark*isdone
25291 $rm -rf UU
25292
25293 : End of Configure
25294